ljc 1 месяц назад
Родитель
Сommit
d1e96e149b
3 измененных файлов с 65 добавлено и 12 удалено
  1. 2 0
      components/cwg-popup.vue
  2. 22 1
      components/cwg-tabel.vue
  3. 41 11
      pages/ib/index.vue

+ 2 - 0
components/cwg-popup.vue

@@ -254,6 +254,8 @@ defineExpose({
 @media screen and (max-width: 768px) {
     :deep(.cwg-dialog) {
         width: px2rpx(600) !important;
+        max-height: 70vh;
+        overflow-y: scroll;
     }
 
     .dialog-content {

+ 22 - 1
components/cwg-tabel.vue

@@ -193,7 +193,7 @@ const props = defineProps({
     // 参数如columns
     mobilePrimaryFields: { type: Array, default: () => [] },
     // API 请求函数
-    api: { type: Function, required: true },
+    api: { type: Function },
     // 查询参数
     queryParams: { type: Object, default: () => ({}) },
     // 是否立即加载
@@ -226,6 +226,8 @@ const props = defineProps({
     showSummary: { type: Boolean, default: false },
     // 自定义总计数据,若不传则尝试使用 api 响应中的 res.sum
     summaryData: { type: Object, default: () => null },
+    // 传入的静态数据,有此数据时则不发起 api 请求
+    data: { type: Array, default: () => null },
     // 自定义的合计计算方法,如果配置了,则使用该方法计算总计数据
     summaryMethod: { type: Function, default: null },
     // 总计行第一列的默认文本
@@ -546,6 +548,13 @@ const setDetailVisible = (visible) => {
 
 // ========== 数据加载 ==========
 const loadData = async () => {
+    if (props.data) {
+        tableData.value = props.data
+        if (props.summaryData) {
+            internalSummaryData.value = props.summaryData
+        }
+        return
+    }
     tableData.value = []
     if (loading.value) return
     loading.value = true
@@ -691,6 +700,18 @@ const handleResize = () => {
 }
 // #endif
 // ========== 监听参数变化 ==========
+watch(() => props.data, (newData) => {
+    if (newData) {
+        tableData.value = newData
+    }
+}, { deep: true, immediate: true })
+
+watch(() => props.summaryData, (newSum) => {
+    if (props.data && newSum) {
+        internalSummaryData.value = newSum
+    }
+}, { deep: true, immediate: true })
+
 watch(() => props.queryParams, () => {
     nextTick(() => {
         // refreshTable()

+ 41 - 11
pages/ib/index.vue

@@ -392,11 +392,34 @@
       </view>
     </cwg-popup>
 
+    <!-- 子账户数量弹窗 -->
+    <cwg-popup 
+      v-model:visible="isSubsDialogVisible" 
+      type="center" 
+      :title="t('blockchain.item1')" 
+      :showFooters="true"
+      @close="isSubsDialogVisible = false"
+      @confirm="isSubsDialogVisible = false"
+    >
+      <view class="dia-content custom-dialog-content" style="padding: 10px 0; max-height: 50vh; overflow-y: auto;">
+        <cwg-tabel
+          :data="agentId_level"
+          :columns="[
+            { label: t('Ib.Index.TradingAccount'), prop: 'login', align: 'center' },
+            { label: t('Ib.Index.Balance'), prop: 'balance', align: 'center' }
+          ]"
+          :showPagination="false"
+          :showOperation="false"
+          style="margin-bottom: 20px"
+        />
+      </view>
+    </cwg-popup>
+
   </cwg-page-wrapper>
 </template>
 
 <script setup>
-  import { ref, computed, watch, onMounted } from 'vue'
+  import { ref, computed, watch, onMounted, nextTick } from 'vue'
   import { useI18n } from 'vue-i18n'
   import useRouter from '@/hooks/useRouter'
   import { ibApi } from '@/service/ib'
@@ -937,17 +960,24 @@
     }
   }
 
-  const toDialogSubs = (row) => {
-    if (row?.type == 3) {
-      router.push({
-        path: '/pages/ib/transfer',
-        query: { tab: 'pammSubs', id: row.id },
-      })
-      return
+  const isSubsDialogVisible = ref(false)
+  const agentId_level = ref([])
+
+  const toDialogSubs = async (row) => {
+
+    agentId_level.value = []
+    try {
+      const res = await ibApi.pammListSubs({ id: row.id })
+      if (res.code === Code.StatusOK) {
+        agentId_level.value = res.data || []
+      } else {
+        uni.showToast({ title: res.msg, icon: 'none' })
+      }
+    } catch (e) {
+      // uni.showToast({ title: t('Msg.Fail'), icon: 'none' })
     }
-    router.push({
-      path: '/pages/ib/transfer',
-      query: { tab: 'mamSubs', id: row.id },
+    nextTick(()=>{
+      isSubsDialogVisible.value = true
     })
   }