Преглед изворни кода

feat: 筛选,金额$符号,登录更新金额

ljc пре 1 месец
родитељ
комит
bd545a1b9e
4 измењених фајлова са 50 додато и 37 уклоњено
  1. 0 1
      components/cwg-payment.vue
  2. 1 1
      components/cwg-sidebar.vue
  3. 47 35
      pages/ib/report.vue
  4. 2 0
      pages/login/index.vue

+ 0 - 1
components/cwg-payment.vue

@@ -156,7 +156,6 @@ const getWalletList = async () => {
       walletbalance.value = res.data
     }
   } else {
-
     uni.showToast({
       title: res.msg,
       icon: 'none',

+ 1 - 1
components/cwg-sidebar.vue

@@ -34,7 +34,7 @@
               t('Ib.Index.TotalRevenue') }}
             </view>
             <view class="wallet-id-box">
-              {{ mode === 'customer' ? formattedPendingWithdrawAmount : ibTotalBalance }}
+              ${{ mode === 'customer' ? formattedPendingWithdrawAmount : ibTotalBalance }}
             </view>
           </template>
 

+ 47 - 35
pages/ib/report.vue

@@ -20,7 +20,7 @@
 
 <script setup lang="ts">
   // 报告
-  import { ref, computed, onMounted, watch, nextTick } from 'vue'
+  import { ref, computed, onMounted, watch, nextTick, reactive } from 'vue'
   import { useI18n } from 'vue-i18n'
   import { onLoad } from '@dcloudio/uni-app'
   import Config from '@/config/index'
@@ -93,7 +93,7 @@ const defaultDateRange = [`${year}-${month}-01`, `${year}-${month}-${day}`]
 
 const filterFields = ref([])
 
-  const search = ref({
+  const search = reactive({
     detail_type: null as number | null,
     customType: 0,
     platform: 'MT4',
@@ -121,20 +121,32 @@ const agentLevels = ref<Array<{ key: string, options: any[] }>>([
 ])
 
 const handleAgentChange = async (val: any, levelIndex: number) => {
-  console.log(val, 'change1`')
+  console.log(val, 'change1')
+  
   // 截断当前层级之后的所有层级
   agentLevels.value.splice(levelIndex + 1)
 
   // 清理 searchParams 中被移除层级的值
-  for (let key in searchParams.value) {
+  const params = { ...searchParams.value }
+  for (let key in params) {
     if (key.startsWith('agentId_')) {
       const idx = parseInt(key.split('_')[1])
       if (idx > levelIndex) {
-        delete searchParams.value[key]
+        delete params[key]
       }
     }
   }
+  
+  // 更新当前选中的代理ID
+  params[`agentId_${levelIndex}`] = val
+  
+  // 同步更新 searchParams
+  searchParams.value = { ...params }
+  
+  // 确保更新完成后再执行搜索
+  await nextTick()
   handleSearch(searchParams.value)
+  
   if (val === 0 || val === -1 || val === '') {
     return
   }
@@ -176,8 +188,8 @@ const getSummaries = (param: any) => {
       return
     }
 
-    const type = search.value.reportType
-    const detailType = search.value.detail_type
+    const type = reportType.value
+    const detailType = search.detail_type
 
     // 根据不同的列 prop 进行合计数据显示和格式化
     const prop = column.prop
@@ -259,6 +271,7 @@ const getSummaries = (param: any) => {
       break
     }
   }
+    console.log(finalAgentId,'finalAgentId')
   payload.agentId = finalAgentId
   if (payload.date?.length) {
     payload.startDate = payload.date[0]
@@ -273,19 +286,18 @@ const getSummaries = (param: any) => {
   if (type !== 3) payload.detail_type = null
   if (type !== 24) payload.customType = 0
 
-  search.value = {
-    reportType: payload.reportType,
-    detail_type: payload.detail_type,
-    customType: payload.customType,
-    platform: payload.platform,
-    startDate: payload.startDate,
-    endDate: payload.endDate,
-    date: payload.date,
-    agentId: payload.agentId,
-    login: payload.login,
-    cId: payload.cId,
-    isShort: payload.isShort,
-  }
+    Object.assign(search, payload)
+  // search.reportType = payload.reportType
+  // search.detail_type = payload.detail_type
+  // search.customType = payload.customType
+  // search.platform = payload.platform
+  // search.startDate = payload.startDate
+  // search.endDate = payload.endDate
+  // search.date = payload.date
+  // search.agentId = payload.agentId
+  // search.login = payload.login
+  // search.cId = payload.cId
+  // search.isShort = payload.isShort
   nextTick(() => {
     tableRef.value?.refreshTable?.()
   })
@@ -324,8 +336,8 @@ const initIbTree = async () => {
     console.log(reportType.value,'23')
 
     if (reportType.value == 3) {
-      console.log(columnList.value[`3_${search.value.detail_type}`])
-      return columnList.value[`3_${search.value.detail_type}`] || []
+      console.log(columnList.value[`3_${search.detail_type}`])
+      return columnList.value[`3_${search.detail_type}`] || []
     }
     console.log(columnList.value[reportType.value])
     return columnList.value[reportType.value] || []
@@ -334,7 +346,7 @@ const initIbTree = async () => {
   const mobilePrimaryFields = computed(() => {
     let list: any[] = []
     if (reportType.value === 3) {
-      list = mobileList.value[`3_${search.value.detail_type}`] || []
+      list = mobileList.value[`3_${search.detail_type}`] || []
     } else {
       list = mobileList.value[reportType.value] || []
     }
@@ -354,7 +366,7 @@ const initIbTree = async () => {
     return async (params: any) => {
       let apiFn = ibApi.tradeDw
       const type = reportType.value
-      const detailType = search.value.detail_type
+      const detailType = search.detail_type
 
     if (type == 1) apiFn = ibApi.tradeDw
     else if (type == 2) apiFn = ibApi.tradeAgentCommission
@@ -380,41 +392,41 @@ const initIbTree = async () => {
 
 watch(() => searchParams.value.reportType, (val) => {
   const type = Number(val)
-  search.value.reportType = type
+  search.reportType = type
   if (type === 24) {
     searchParams.value.customType = 0
     searchParams.value.detail_type = null
-    search.value.customType = 0
-    search.value.detail_type = null
+    search.customType = 0
+    search.detail_type = null
   } else if (type === 3) {
     if (searchParams.value.detail_type == null) searchParams.value.detail_type = 1
-    if (search.value.detail_type == null) search.value.detail_type = 1
+    if (search.detail_type == null) search.detail_type = 1
   } else {
     searchParams.value.detail_type = null
-    search.value.detail_type = null
+    search.detail_type = null
     searchParams.value.customType = 0
-    search.value.customType = 0
+    search.customType = 0
   }
 }, { immediate: true })
 
 watch(() => searchParams.value.detail_type, (val) => {
-  search.value.detail_type = val == null ? null : Number(val)
+  search.detail_type = val == null ? null : Number(val)
 })
 
 watch(() => searchParams.value.platform, (val) => {
-  search.value.platform = val
+  search.platform = val
 })
 
 watch(() => searchParams.value.customType, (val) => {
-  search.value.customType = val
+  search.customType = val
 })
 
   watch(() => searchParams.value.isShort, (val) => {
-    search.value.isShort = val
+    search.isShort = val
   })
   onLoad((options) => {
     console.log(options?.type,'type')
-    // search.value.reportType = options?.type;
+    // search.reportType = options?.type;
     // searchParams.value.reportType = options?.type;
     reportType.value = options?.type
     nextTick(()=>{

+ 2 - 0
pages/login/index.vue

@@ -678,6 +678,8 @@ async function getCustomLoginInfo() {
     const res = await userApi.getUserInfo()
     userStore.saveUserInfo(res.data)
     uni.removeStorageSync('systemListCache')
+    // 登录更新金额
+    uni.$emit('updatePayment')
     // uni.$emit('updateSystemList', 'login')
     if (res.code === 200) {
       switch (modeStore.value) {