Ver código fonte

feat:修改

ljc 1 mês atrás
pai
commit
9430dee385

+ 84 - 16
components/cwg-payment.vue

@@ -1,12 +1,16 @@
 <template>
 <template>
   <view class="notice-container">
   <view class="notice-container">
     <cwg-dropdown ref="dropdownRef" :menu-list="[]" @menuClick="handleMenuClick">
     <cwg-dropdown ref="dropdownRef" :menu-list="[]" @menuClick="handleMenuClick">
-      <view class="pc-header-btn pc-payment-btn">
-        <cwg-icon name="crm-payment" color="#141d22" @click="openNotice" />
+      <view class="pc-header-btn pc-payment-btn" v-if="mode === 'customer'">
+        <cwg-icon name="crm-payment" color="#141d22" />
         <text class="balance-text">{{ formattedBalance }} USD</text>
         <text class="balance-text">{{ formattedBalance }} USD</text>
       </view>
       </view>
+      <view class="pc-header-btn pc-payment-btn" v-if="mode === 'ib'">
+        <cwg-icon name="crm-payment" color="#141d22" />
+        <text class="balance-text">{{ ibBalance }} USD</text>
+      </view>
       <template #btn>
       <template #btn>
-        <view class="right-drawer custom-payment-drawer">
+        <view class="right-drawer custom-payment-drawer" v-if="mode === 'customer'">
           <view class="drawer-header">
           <view class="drawer-header">
             <text class="drawer-title">隐藏余额</text>
             <text class="drawer-title">隐藏余额</text>
             <switch :checked="!isShow" @change="toggleShow" color="#6c8595" style="transform:scale(0.7)" />
             <switch :checked="!isShow" @change="toggleShow" color="#6c8595" style="transform:scale(0.7)" />
@@ -24,24 +28,47 @@
             <button class="action-btn" @click.stop="goPages(2)" v-t="'wallet.item7'"></button>
             <button class="action-btn" @click.stop="goPages(2)" v-t="'wallet.item7'"></button>
           </view>
           </view>
         </view>
         </view>
+        <view class="right-drawer custom-payment-drawer" v-if="mode === 'ib'">
+          <view class="drawer-header">
+            <text class="drawer-title">隐藏余额</text>
+            <switch :checked="!isShow" @change="toggleShow" color="#6c8595" style="transform:scale(0.7)" />
+          </view>
+          <view class="drawer-content">
+            <view class="balance-amount">{{ ibBalance }} USD</view>
+            <view>
+              <view class="account-number">${{ ibTotalBalance }}</view>
+              <view class="account-type" v-t="'Ib.Index.TotalRevenue'"></view>
+            </view>
+
+          </view>
+          <view class="drawer-actions">
+            <button class="action-btn" @click.stop="goIbPages(1)" v-t="'Custom.Index.Withdrawals'"></button>
+            <button class="action-btn" @click.stop="goIbPages(2)" v-t="'Home.page_ib.item4'"></button>
+            <button class="action-btn" @click.stop="goIbPages(3)" v-t="'Ib.Transfer.CommissionIssue'"></button>
+          </view>
+        </view>
       </template>
       </template>
     </cwg-dropdown>
     </cwg-dropdown>
   </view>
   </view>
 </template>
 </template>
 
 
 <script setup lang="ts">
 <script setup lang="ts">
-  import { computed, ref, onMounted } from 'vue'
+  import { computed, ref, onMounted, watch } from 'vue'
   import { newsApi } from '@/service/news'
   import { newsApi } from '@/service/news'
   import { storeToRefs } from 'pinia'
   import { storeToRefs } from 'pinia'
   import useRouter from '@/hooks/useRouter'
   import useRouter from '@/hooks/useRouter'
   import { drawApi } from '@/service/draw'
   import { drawApi } from '@/service/draw'
   import { useI18n } from 'vue-i18n'
   import { useI18n } from 'vue-i18n'
+  import { useMenuSplit } from '@/composables/useMenuSplit'
   import useUserStore from '@/stores/use-user-store'
   import useUserStore from '@/stores/use-user-store'
+  import { userToken } from '@/composables/config'
+  import { onLoad } from '@dcloudio/uni-app'
+  import { ibApi } from '@/service/ib'
+
+  const { mode } = useMenuSplit()
 
 
   const { t, locale } = useI18n()
   const { t, locale } = useI18n()
   const userStore = useUserStore()
   const userStore = useUserStore()
-  import { userToken } from '@/composables/config'
-  import { onLoad } from '@dcloudio/uni-app'
 
 
   const isRed = ref(false)
   const isRed = ref(false)
   const dropdownRef = ref(null)
   const dropdownRef = ref(null)
@@ -50,6 +77,7 @@
   }
   }
   const router = useRouter()
   const router = useRouter()
   const menuList = []
   const menuList = []
+  const ibData = ref({})
 
 
   const handleMenuClick = ({ value }) => {
   const handleMenuClick = ({ value }) => {
     goPages(value)
     goPages(value)
@@ -87,6 +115,16 @@
     const decimalValue = NumberDecimal(value)
     const decimalValue = NumberDecimal(value)
     return isShow.value ? decimalValue : NumberDesensitization(decimalValue)
     return isShow.value ? decimalValue : NumberDesensitization(decimalValue)
   })
   })
+
+  //ib金额
+  const ibBalance = computed(() => {
+    const value = NumberDecimal(ibData.value?.balance || 0)
+    return isShow.value ? value : NumberDesensitization(value)
+  })
+  const ibTotalBalance = computed(() => {
+    const value = NumberDecimal(ibData.value?.all || 0)
+    return isShow.value ? value : NumberDesensitization(value)
+  })
   const getWalletList = async () => {
   const getWalletList = async () => {
     let res = await drawApi.walletbalance({})
     let res = await drawApi.walletbalance({})
     if (res.code == 200) {
     if (res.code == 200) {
@@ -130,19 +168,49 @@
     router.push(path)
     router.push(path)
     close()
     close()
   }
   }
+
+  const goIbPages = (type) => {
+    let path,query
+    if (type == 1) {
+      path = '/pages/ib/withdraw-select'
+    } else if (type == 2) {
+      path = '/pages/ib/transfer'
+    } else if (type == 3) {
+      path = '/pages/ib/transfer'
+      query = { tab: 2 }
+    }
+    router.push({ path,query })
+    close()
+  }
+
+
   const toPaymentHistory = () => {
   const toPaymentHistory = () => {
     router.push({ path: '/pages/customer/payment-history',query:{fromPending: "true"} })
     router.push({ path: '/pages/customer/payment-history',query:{fromPending: "true"} })
   }
   }
-  const goMore = () => {
-    router.push({
-      path: '/pages/common/notice',
-    })
-    close()
+
+  const getIbData = async () => {
+    const res = await ibApi.IbData()
+    if (res.code === 200) {
+      if (res.data != null)
+        ibData.value = res.data
+    } else {
+      uni.showToast({ title: res.msg, icon: 'none' })
+    }
   }
   }
-  onMounted(() => {
+  watch(() => mode.value, (newMode) => {
     if (!userToken.value) return
     if (!userToken.value) return
-    getWalletList()
-    getPendingWithdrawAmount()
+      console.log(newMode,'mode')
+    if (newMode == 'customer') {
+      getWalletList()
+      getPendingWithdrawAmount()
+    }else if (newMode == 'ib') {
+      getIbData()
+    }
+  },
+  { immediate: true })
+  onMounted(() => {
+
+
   })
   })
 </script>
 </script>
 
 
@@ -198,7 +266,7 @@
     }
     }
 
 
     .custom-payment-drawer {
     .custom-payment-drawer {
-      width: px2rpx(260);
+      width: px2rpx(320);
       background-color: var(--color-white);
       background-color: var(--color-white);
       padding: 0;
       padding: 0;
       border-radius: px2rpx(8);
       border-radius: px2rpx(8);
@@ -241,7 +309,7 @@
 
 
       .drawer-actions {
       .drawer-actions {
         display: flex;
         display: flex;
-        gap: px2rpx(12);
+        gap: px2rpx(10);
         padding: 0 px2rpx(16) px2rpx(20);
         padding: 0 px2rpx(16) px2rpx(20);
 
 
         .action-btn {
         .action-btn {

+ 6 - 1
components/cwg-popup.vue

@@ -1,6 +1,6 @@
 <template>
 <template>
     <uni-popup ref="popupRef" type="center" @change="handlePopupChange">
     <uni-popup ref="popupRef" type="center" @change="handlePopupChange">
-        <view class="cwg-dialog">
+        <view class="cwg-dialog" :style="{ width: width }">
             <!-- 弹窗头部 -->
             <!-- 弹窗头部 -->
             <view class="dialog-header" v-if="title">
             <view class="dialog-header" v-if="title">
                 <text class="dialog-title">{{ title || t('Tips.DeleteAccount') }}</text>
                 <text class="dialog-title">{{ title || t('Tips.DeleteAccount') }}</text>
@@ -123,6 +123,11 @@ const props = defineProps({
         type: String,
         type: String,
         default: ''
         default: ''
     },
     },
+    // 内容宽度
+    width: {
+        type: String,
+        default: '600px'
+    },
     // 分页信息(传递给父组件使用)
     // 分页信息(传递给父组件使用)
     pagerInfo: {
     pagerInfo: {
         type: Object,
         type: Object,

+ 101 - 145
pages/ib/components/applyIbDialog.vue

@@ -1,87 +1,76 @@
 <template>
 <template>
-  <cwg-popup :title="t(title)" :visible="visible" @close="closeDia" @confirm="confirmDia">
+  <cwg-popup :title="t(title)" :visible="visible" @close="closeDia" @confirm="confirmDia" :width="'900px'">
     <view class="dia-content">
     <view class="dia-content">
       <uni-forms ref="formRef" labelWidth="200">
       <uni-forms ref="formRef" labelWidth="200">
         <uni-forms-item v-if="isFormApplyIb" :label="t('Ib.Custom.Manage3')+':'" prop="customerId">
         <uni-forms-item v-if="isFormApplyIb" :label="t('Ib.Custom.Manage3')+':'" prop="customerId">
           <cwg-combox v-model:value="addAgentForm.customerId" :options="customerList"
           <cwg-combox v-model:value="addAgentForm.customerId" :options="customerList"
-                      :placeholder="t('placeholder.choose')" filterable @change="changeCustomer" />
+                      :placeholder="t('placeholder.choose')" filterable @change="changeCustomer" style="max-width: 280px" />
         </uni-forms-item>
         </uni-forms-item>
         <uni-loading v-if="laoding"/>
         <uni-loading v-if="laoding"/>
-        <view v-else class="commission-groups">
-          <view v-for="(group, gIndex) in commissionTemplateTableData" :key="gIndex" class="group-card">
-            <!-- 头部开关和标题 -->
-            <view class="group-header" @click="toggleGroup(group)">
-              <view class="group-title">
-                <text class="title-text">{{ group.accountGroup }}</text>
-              </view>
-              <view class="group-switch" @click.stop>
-                <switch :checked="group.isOpen" @change="(e) => onGroupSwitchChange(e, group)" color="#2b5aed"
-                        style="transform:scale(0.8)" />
-              </view>
-            </view>
-
-            <!-- 展开的内容区 -->
-            <view v-show="group.isOpen" class="group-body">
-              <view v-for="(item, iIndex) in group.items" :key="iIndex" class="item-row">
-                <view class="item-title">
-                  <!--                  <text class="type-badge">{{ item.dataType === 'rebates' ? 'Rebates' : 'Commissions' }}</text>-->
-                  <text class="type-text">{{ item.type }}</text>
-                </view>
-
-                <view class="item-fields">
-                  <!-- METAL -->
-                  <view class="field-col">
-                    <text class="field-label">METAL</text>
-                    <cwg-combox
-                      v-model:value="item.energy"
-                      :options="formatOptions(item.energyOptions)"
-                      :placeholder="t('placeholder.choose')"
-                    />
-                  </view>
-
-                  <!-- FX -->
-                  <view class="field-col">
-                    <text class="field-label">FX</text>
-                    <cwg-combox
-                      v-model:value="item.forex"
-                      :options="formatOptions(item.forexOptions)"
-                      :placeholder="t('placeholder.choose')"
-                    />
-                  </view>
-
-                  <!-- ENERGY -->
-                  <view class="field-col">
-                    <text class="field-label">ENERGY</text>
-                    <cwg-combox
-                      v-model:value="item.energy2"
-                      :options="formatOptions(item.energy2Options)"
-                      :placeholder="t('placeholder.choose')"
-                    />
-                  </view>
-
-                  <!-- CFD -->
-                  <view class="field-col">
-                    <text class="field-label">CFD</text>
-                    <cwg-combox
-                      v-model:value="item.index"
-                      :options="formatOptions(item.indexOptions)"
-                      :placeholder="t('placeholder.choose')"
-                    />
-                  </view>
-
-                  <!-- INDEX -->
-                  <view class="field-col">
-                    <text class="field-label">INDEX</text>
-                    <cwg-combox
-                      v-model:value="item.metal"
-                      :options="formatOptions(item.metalOptions)"
-                      :placeholder="t('placeholder.choose')"
-                    />
-                  </view>
-                </view>
-              </view>
-            </view>
-          </view>
+        <view v-else class="commission-table-container">
+          <table class="commission-table">
+            <thead>
+              <tr>
+                <th style="width: 80px;">{{ t('Ib.Custom.Status') }}</th>
+                <th style="width: 100px;"></th>
+                <th style="width: 100px;"></th>
+                <th style="width: 80px;">METAL</th>
+                <th>FX</th>
+                <th>ENERGY</th>
+                <th>CFD</th>
+                <th>INDEX</th>
+              </tr>
+            </thead>
+            <tbody v-for="(group, gIndex) in commissionTemplateTableData" :key="gIndex">
+              <tr v-for="(item, iIndex) in group.items" :key="iIndex">
+                <td v-if="iIndex === 0" :rowspan="group.items.length" class="center-td">
+                  <switch :checked="group.isOpen" @change="(e) => onGroupSwitchChange(e, group)" color="#2b5aed"
+                          style="transform:scale(0.8)" />
+                </td>
+                <td v-if="iIndex === 0" :rowspan="group.items.length" class="center-td group-name-td">
+                  {{ group.accountGroup }}
+                </td>
+                <td class="center-td type-td">
+                  {{ item.type }}
+                </td>
+                <td style="width: 80px;">
+                  <cwg-combox
+                    v-model:value="item.energy"
+                    :options="formatOptions(item.energyOptions)"
+                    :placeholder="t('placeholder.choose')"
+                  />
+                </td>
+                <td>
+                  <cwg-combox
+                    v-model:value="item.forex"
+                    :options="formatOptions(item.forexOptions)"
+                    :placeholder="t('placeholder.choose')"
+                  />
+                </td>
+                <td>
+                  <cwg-combox
+                    v-model:value="item.energy2"
+                    :options="formatOptions(item.energy2Options)"
+                    :placeholder="t('placeholder.choose')"
+                  />
+                </td>
+                <td>
+                  <cwg-combox
+                    v-model:value="item.index"
+                    :options="formatOptions(item.indexOptions)"
+                    :placeholder="t('placeholder.choose')"
+                  />
+                </td>
+                <td>
+                  <cwg-combox
+                    v-model:value="item.metal"
+                    :options="formatOptions(item.metalOptions)"
+                    :placeholder="t('placeholder.choose')"
+                  />
+                </td>
+              </tr>
+            </tbody>
+          </table>
         </view>
         </view>
       </uni-forms>
       </uni-forms>
     </view>
     </view>
@@ -521,90 +510,57 @@
 <style lang="scss" scoped>
 <style lang="scss" scoped>
   @import "@/uni.scss";
   @import "@/uni.scss";
 
 
-  .commission-groups {
+  .commission-table-container {
     margin-top: px2rpx(10);
     margin-top: px2rpx(10);
     padding-bottom: px2rpx(150); /* 预留底部空间,防止最下面的下拉框被截断或遮挡 */
     padding-bottom: px2rpx(150); /* 预留底部空间,防止最下面的下拉框被截断或遮挡 */
+    width: 100%;
+    overflow-x: auto;
   }
   }
 
 
-  .group-card {
-    border: 1px solid #ebeef5;
-    border-radius: px2rpx(6);
-    margin-bottom: px2rpx(15);
-    background-color: #fff;
-    /* overflow: hidden; 移除此属性,防止下拉框被遮挡截断 */
-  }
-
-  .group-header {
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
-    padding: px2rpx(10) px2rpx(15);
-    background-color: #f5f7fa;
-    border-bottom: 1px solid #ebeef5;
-    border-top-left-radius: px2rpx(6);
-    border-top-right-radius: px2rpx(6);
-  }
-
-  .group-title {
+  .commission-table {
+    width: 100%;
+    border-collapse: collapse;
+    border-spacing: 0;
     font-size: px2rpx(14);
     font-size: px2rpx(14);
-    font-weight: bold;
-    color: #303133;
-  }
+    color: #606266;
+    border: 1px solid #ebeef5;
 
 
-  .group-body {
-    padding: px2rpx(15);
-  }
+    thead {
+      background-color: #f5f7fa;
+    }
 
 
-  .item-row {
-    margin-bottom: px2rpx(15);
-    padding-bottom: px2rpx(15);
-    border-bottom: 1px dashed #ebeef5;
+    th {
+      padding: px2rpx(12) px2rpx(10);
+      text-align: center;
+      font-weight: bold;
+      color: #909399;
+      border: 1px solid #ebeef5;
+      font-size: px2rpx(13);
+      white-space: nowrap;
+    }
 
 
-    &:last-child {
-      margin-bottom: 0;
-      padding-bottom: 0;
-      border-bottom: none;
+    td {
+      padding: px2rpx(8) px2rpx(10);
+      border: 1px solid #ebeef5;
+      vertical-align: middle;
     }
     }
-  }
 
 
-  .item-title {
-    margin-bottom: px2rpx(10);
-    display: flex;
-    align-items: center;
+    .center-td {
+      text-align: center;
+    }
 
 
-    .type-badge {
-      background-color: #e1f3d8;
-      color: #67c23a;
-      padding: px2rpx(2) px2rpx(8);
-      border-radius: px2rpx(4);
-      font-size: px2rpx(12);
-      margin-right: px2rpx(8);
+    .group-name-td {
+      color: #303133;
+      font-weight: 500;
     }
     }
 
 
-    .type-text {
-      font-size: px2rpx(13);
+    .type-td {
       color: #606266;
       color: #606266;
     }
     }
-  }
-
-  .item-fields {
-    display: flex;
-    flex-wrap: wrap;
-    gap: px2rpx(10);
-    justify-content: flex-start;
-  }
 
 
-  .field-col {
-    flex: 0 0 calc( 20% - px2rpx(10) );
-    min-width: px2rpx(80);
-    max-width: px2rpx(120);
-    display: flex;
-    flex-direction: column;
-
-    .field-label {
-      font-size: px2rpx(12);
-      color: #909399;
-      margin-bottom: px2rpx(5);
+    :deep(.cwg-combox) {
+      width: 100%;
+      min-width: px2rpx(80);
     }
     }
   }
   }
 
 

+ 28 - 3
pages/ib/index.vue

@@ -2,8 +2,8 @@
   <cwg-page-wrapper class="create-page" :isHeaderFixed="true" :bgColor="'#f8f9f9'">
   <cwg-page-wrapper class="create-page" :isHeaderFixed="true" :bgColor="'#f8f9f9'">
     <cwg-header :title="t('Home.page_ib.item1')" :showBack="false" />
     <cwg-header :title="t('Home.page_ib.item1')" :showBack="false" />
     <uni-loading v-if="loading" />
     <uni-loading v-if="loading" />
-    <uni-row v-else class="demo-uni-row uni-row1">
-      <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
+    <uni-row v-else class="demo-uni-row uni-row1" :gutter="20">
+      <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8" class="uni-col-left">
         <view class="dashboard-container">
         <view class="dashboard-container">
           <!-- 余额卡片 -->
           <!-- 余额卡片 -->
           <view class="card balance-card">
           <view class="card balance-card">
@@ -103,7 +103,7 @@
                     </view>-->
                     </view>-->
         </view>
         </view>
       </uni-col>
       </uni-col>
-      <uni-col :xs="24" :sm="24" :md="16" :lg="16" :xl="16">
+      <uni-col :xs="24" :sm="24" :md="16" :lg="16" :xl="16" class="uni-col-right">
         <view class="dashboard-container">
         <view class="dashboard-container">
           <view class="card mam-card">
           <view class="card mam-card">
             <view class="card-header">
             <view class="card-header">
@@ -964,9 +964,34 @@
 <style lang="scss" scoped>
 <style lang="scss" scoped>
   @import "@/uni.scss";
   @import "@/uni.scss";
 
 
+  .demo-uni-row {
+    display: flex;
+    flex-wrap: wrap;
+    align-items: stretch;
+  }
+
+  .uni-col-left {
+    display: flex;
+    flex-direction: column;
+  }
+
+  .uni-col-right {
+    display: flex;
+    flex-direction: column;
+  }
+
   .dashboard-container {
   .dashboard-container {
     min-height: 10vh;
     min-height: 10vh;
     box-sizing: border-box;
     box-sizing: border-box;
+    display: flex;
+    flex-direction: column;
+    height: 100%;
+  }
+
+  .mam-card {
+    flex: 1;
+    display: flex;
+    flex-direction: column;
   }
   }
 
 
   /* 卡片通用样式 */
   /* 卡片通用样式 */

+ 3 - 3
stores/use-global-store.ts

@@ -20,11 +20,11 @@ const useStore = defineStore("globalStore", () => {
     state.theme = payload;
     state.theme = payload;
   };
   };
   const initMode = () => {
   const initMode = () => {
-    // const encryptedMode = ls.get('mode');
-    state.mode = 'customer';
+    const encryptedMode = ls.get('mode');
+    state.mode = encryptedMode || 'customer';
   };
   };
   const setMode = (payload: 'customer' | 'ib') => {
   const setMode = (payload: 'customer' | 'ib') => {
-    // ls.set('mode', payload)
+    ls.set('mode', payload)
     state.mode = payload;
     state.mode = payload;
   };
   };
   const setBarHeight = (payload: number) => {
   const setBarHeight = (payload: number) => {

+ 3 - 0
utils/request.js

@@ -1,6 +1,8 @@
 // 基础配置
 // 基础配置
 import { showLoading, hideLoading } from '@/hooks/useLoading'
 import { showLoading, hideLoading } from '@/hooks/useLoading'
 import config1 from "@/config";
 import config1 from "@/config";
+import ls from "@/utils/store2";
+
 const baseUrl = config1.Host85;
 const baseUrl = config1.Host85;
 const timeout = 60000;
 const timeout = 60000;
 // 不加loading
 // 不加loading
@@ -100,6 +102,7 @@ const responseInterceptor = (response, options = {}) => {
           uni.reLaunch({
           uni.reLaunch({
             url: LOGIN_PAGE_PATH,
             url: LOGIN_PAGE_PATH,
             success: () => {
             success: () => {
+              ls.set('mode', 'customer');
               isRedirectingToLogin = false;
               isRedirectingToLogin = false;
             },
             },
             fail: () => {
             fail: () => {