zhb 2 ماه پیش
والد
کامیت
144db892af
1فایلهای تغییر یافته به همراه74 افزوده شده و 77 حذف شده
  1. 74 77
      pages/customer/components/AccountCard.vue

+ 74 - 77
pages/customer/components/AccountCard.vue

@@ -2,11 +2,8 @@
     <view class="account-card">
         <!-- 折叠/展开按钮 -->
         <button class="collapse-btn" @click="toggleExpand">
-            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
-                stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
-                :class="['chevron-icon', { expanded: isExpanded }]">
-                <path d="M6 15l6 -6l6 6" />
-            </svg>
+            <cwg-icon name="chevron-right" :size="20" color="#6c8595"
+                :class="['chevron-icon', { expanded: isExpanded }]" />
         </button>
 
         <!-- 标签区域 -->
@@ -33,36 +30,15 @@
             <!-- 移动端圆形按钮组(≤1100px显示) -->
             <view class="mobile-buttons">
                 <!-- 交易 -->
-                <view class="circle-btn" @click="handleAction('trade')">
-                    <view class="circle-icon">
-                        <cwg-icon name="crm-trade" :size="16" color="#2e3a47" />
-                    </view>
-                    <text class="circle-label" v-t="'Shop.Index.Transaction'" />
-                </view>
-                <!-- 入金(带限制包装,此处简化) -->
-                <view class="circle-btn" @click="toDeposit" v-if="!isDemo">
-                    <view class="circle-icon">
-                        <cwg-icon name="crm-deposit" :size="16" color="#2e3a47" />
-                    </view>
-                    <text class="circle-label" v-t="'Home.page_customer.item2'" />
-                </view>
-
-                <!-- 出金 -->
-                <view class="circle-btn" @click="toWithdraw" v-if="!isDemo">
-                    <view class="circle-icon">
-                        <cwg-icon name="crm-withdraw" :size="16" color="#2e3a47" />
-                    </view>
-                    <text class="circle-label" v-t="'Home.page_customer.item3'" />
-                </view>
-
-                <!-- 转账 -->
-                <view class="circle-btn" @click="toTransfer" v-if="!isDemo">
-                    <view class="circle-icon">
-                        <cwg-icon name="crm-transfer" :size="16" color="#2e3a47" />
+                <template v-for="(item, index) in circleButtons" :key="index">
+                    <view class="circle-btn" :class="{ 'is-disabled': item.disabled }" @click="handleAction1(item)"
+                        v-if="!item.needDemo">
+                        <view class="circle-icon" :class="{ 'primary': item.primary }">
+                            <cwg-icon :name="item.icon" :size="16" :color="item.color" />
+                        </view>
+                        <text class="circle-label" v-t="item.label" />
                     </view>
-                    <text class="circle-label" v-t="'Custom.Index.Transfer'" />
-                </view>
-
+                </template>
                 <!-- 更多(三点) -->
                 <cwg-dropdown @open="onOpen" @close="onClose" :menu-list="customMenuList"
                     @menuClick="handleCustomClick">
@@ -73,42 +49,25 @@
                         <text class="circle-label" v-t="'Latest.More'" />
                     </view>
                 </cwg-dropdown>
-
             </view>
 
             <!-- 桌面端按钮组(>1100px显示) -->
             <view class="desktop-buttons">
-                <view class="action-btn primary" @click="handleAction('trade')">
-                    <span class="btn-icon">
-                        <cwg-icon name="crm-trade" :size="16" color="#fff" />
-                    </span>
-                    <text v-t="'Shop.Index.Transaction'" />
-                </view>
-                <view class="action-btn" @click="toDeposit" v-if="!isDemo">
-                    <span class="btn-icon">
-                        <cwg-icon name="crm-deposit" :size="16" color="#2e3a47" />
-                    </span>
-                    <text v-t="'Home.page_customer.item2'" />
-                </view>
-                <view class="action-btn" @click="toWithdraw" v-if="!isDemo">
-                    <span class="btn-icon">
-                        <cwg-icon name="crm-withdraw" :size="16" color="#2e3a47" />
-                    </span>
-                    <text v-t="'Home.page_customer.item3'" />
-                </view>
-                <view class="action-btn" @click="toTransfer" v-if="!isDemo">
-                    <span class="btn-icon">
-                        <cwg-icon name="crm-transfer" :size="16" color="#2e3a47" />
-                    </span>
-                    <text v-t="'Custom.Index.Transfer'" />
-                </view>
+                <template v-for="(item, index) in actionButtons" :key="index">
+                    <view class="action-btn" :class="{ 'primary': item.primary, 'is-disabled': item.disabled }"
+                        @click="handleAction1(item)" v-if="!item.needDemo">
+                        <span class="btn-icon">
+                            <cwg-icon :name="item.icon" :size="16" :color="item.color" />
+                        </span>
+                        <text v-t="item.label" />
+                    </view>
+                </template>
                 <cwg-dropdown @open="onOpen" @close="onClose" :menu-list="customMenuList"
                     @menuClick="handleCustomClick">
                     <view class="action-btn icon-only">
                         <cwg-icon name="crm-ellipsis-vertical" :size="16" color="#2e3a47" />
                     </view>
                 </cwg-dropdown>
-
             </view>
         </view>
         <view ref="infoBottomRef" class="info-bottom" :style="{
@@ -152,8 +111,6 @@
         <!-- 通知区域(预留) -->
         <view class="notificators"></view>
         <TerminalDialog v-model:visible="terminalDialogVisible" />
-        <!-- <TerminalNickNameDialog v-model:visible="terminalNickNameDialogVisible" :account="account"
-            @save="saveNickName" /> -->
         <TerminalChangePasswordDialog v-model:visible="terminalChangePasswordDialogVisible" :pwdType="pwdType"
             :account="account" />
         <TerminalInfoDialog v-model:visible="terminalInfoDialogVisible" :accountNumber="accountInfo.login"
@@ -193,7 +150,30 @@ export interface Account {
     balanceWithSymbol: string;              // 余额,如 '85319215'
 }
 const isDemo = computed(() => accountInfo.value.listType == 'demo')
+const closeFunctionOpen = (code) => {
+    console.log(code, 121212);
+    const closeFunctions = accountInfo.value.closeFunctions || ""
 
+    if (closeFunctions == null || closeFunctions === "") {
+        return true;
+    }
+    return String(closeFunctions).indexOf(String(code)) === -1;
+}
+// 圆形按钮数据
+const circleButtons = ref([
+    { key: 'trade', label: 'Shop.Index.Transaction', icon: 'crm-trade', action: 'trade', needDemo: false, primary: true, disabled: false, color: '#fff' },
+    { key: 'deposit', label: 'Home.page_customer.item2', icon: 'crm-deposit', action: 'deposit', needDemo: isDemo.value, disabled: !closeFunctionOpen('1'), color: '#2e3a47' },
+    { key: 'withdraw', label: 'Home.page_customer.item3', icon: 'crm-withdraw', action: 'withdraw', needDemo: isDemo.value, disabled: !closeFunctionOpen('2'), color: '#2e3a47' },
+    { key: 'transfer', label: 'Custom.Index.Transfer', icon: 'crm-transfer', action: 'transfer', needDemo: isDemo.value, disabled: !(closeFunctionOpen('5') && closeFunctionOpen('6') && closeFunctionOpen('3')), color: '#2e3a47' }
+])
+
+// 普通按钮数据
+const actionButtons = computed(() => [
+    { key: 'trade', label: 'Shop.Index.Transaction', icon: 'crm-trade', color: '#fff', primary: true, action: 'trade', needDemo: false, disabled: false },
+    { key: 'deposit', label: 'Home.page_customer.item2', icon: 'crm-deposit', color: '#2e3a47', primary: false, action: 'deposit', needDemo: isDemo.value, disabled: !closeFunctionOpen('1') },
+    { key: 'withdraw', label: 'Home.page_customer.item3', icon: 'crm-withdraw', color: '#2e3a47', primary: false, action: 'withdraw', needDemo: isDemo.value, disabled: !closeFunctionOpen('2') },
+    { key: 'transfer', label: 'Custom.Index.Transfer', icon: 'crm-transfer', color: '#2e3a47', primary: false, action: 'transfer', needDemo: isDemo.value, disabled: !(closeFunctionOpen('5') && closeFunctionOpen('6') && closeFunctionOpen('3')) }
+])
 const fieldList = ref([
     { label: '账户类型', key: 'nickname', copyable: false },
     { label: t('Label.Leverage'), key: 'actualLeverage', copyable: false },
@@ -238,6 +218,16 @@ const terminalDialogVisible = ref(false)
 const terminalChangePasswordDialogVisible = ref(false)
 const terminalInfoDialogVisible = ref(false)
 const pwdType = ref(1)
+const handleAction1 = (item) => {
+    if (item.disabled) {
+        uni.showToast({
+            title: t('news_add_field.Des.item1'),
+            icon: 'none'
+        })
+        return
+    }
+    handleAction(item.action, item)
+}
 // 处理按钮操作
 const handleAction = (type: string) => {
     console.log(type == 'info', type, 'info');
@@ -257,37 +247,35 @@ const handleAction = (type: string) => {
             console.log(type);
             terminalInfoDialogVisible.value = true
             break;
+        case 'deposit':
+            toDeposit()
+            break;
+        case 'withdraw':
+            toWithdraw()
+            break;
+        case 'transfer':
+            toTransfer()
+            break;
         default:
             break;
     }
 };
 
 const customMenuList = computed(() => !isDemo.value ? [{ label: '修改交易密码', type: 'changePassword1' }, { label: '修改投资者密码', type: 'changePassword2' }, { label: '账户信息', type: 'info' }] : [{ label: '账户信息', type: 'info' }])
-
-
 const handleCustomClick = (item, index) => {
-
-
     handleAction(item.value.type)
 }
-
-
 // 复制文本
 const copy = (text: string) => {
     uni.setClipboardData({ data: text });
 };
-
-
-
 // 按钮对应的操作方法
 const toDeposit = () => {
     router.push(`/pages/customer/deposit?login=${accountInfo.value.login}&type=${accountInfo.value.type}&balance=${accountInfo.value.balance}&currency=${accountInfo.value.currency}`)
 }
-
 const toWithdraw = () => {
     router.push(`/pages/customer/withdrawal?login=${accountInfo.value.login}&type=${accountInfo.value.type}&balance=${accountInfo.value.balance}&currency=${accountInfo.value.currency}`)
 }
-
 const toTransfer = () => {
     router.push(`/pages/customer/transfer?login=${accountInfo.value.login}&type=${accountInfo.value.type}&balance=${accountInfo.value.balance}&currency=${accountInfo.value.currency}`)
 }
@@ -345,10 +333,11 @@ onBeforeUnmount(() => {
         justify-content: center;
 
         .chevron-icon {
+            transform: rotate(90deg);
             transition: transform 0.3s;
 
             &.expanded {
-                transform: rotate(180deg);
+                transform: rotate(270deg);
             }
         }
     }
@@ -429,6 +418,10 @@ onBeforeUnmount(() => {
                     justify-content: center;
                     color: #2e3a47;
                     transition: background-color 0.2s;
+                    &.primary {
+                        background-color: var(--color-navy-700);
+                        color: #fff;
+                    }
 
                     &:hover {
                         background-color: #e9ecef;
@@ -473,9 +466,6 @@ onBeforeUnmount(() => {
                     background-color: var(--color-navy-700);
                     color: #fff;
 
-                    svg {
-                        stroke: #fff;
-                    }
 
                     &:hover {
                         background-color: var(--color-navy-600);
@@ -501,6 +491,13 @@ onBeforeUnmount(() => {
                 }
             }
         }
+
+        .is-disabled {
+            cursor: not-allowed;
+            opacity: 0.5;
+        }
+
+
     }
 
     .info-section {