Browse Source

feat: 优化细节

叶静 3 tuần trước cách đây
mục cha
commit
a1afa6a818

+ 12 - 0
src/app/shop/admin/finance/finance.service.js

@@ -148,6 +148,18 @@ const financeUtils = {
     const typeFn = typeMap[bizType];
     return typeFn ? typeFn() : t('modules.finance.unknownType');
   },
+
+  // 格式化金额,保留两位小数
+  formatAmount: (amount) => {
+    if (amount === null || amount === undefined) return '0.00';
+    return Number(amount || 0).toFixed(2);
+  },
+
+  // 格式化金额并添加货币符号
+  formatCurrency: (amount, currency = 'BDT') => {
+    const formattedAmount = financeUtils.formatAmount(amount);
+    return `৳${formattedAmount}`;
+  },
 };
 
 const route = {

+ 7 - 6
src/app/shop/admin/finance/recharge/index.vue

@@ -132,14 +132,15 @@ const searchFields = computed(() => ({
     placeholder: t('modules.recharge.enterOrderNo'),
     width: 180,
   },
-  channel: {
+  methodName: {
     type: 'select',
-    label: t('modules.recharge.channel'),
-    placeholder: t('modules.recharge.selectChannel'),
+    label: t('modules.recharge.method'),
+    placeholder: t('form.pleaseSelect') + t('modules.recharge.method'),
     width: 120,
     options: [
-      { label: 'TKPAY', value: 1 },
-      { label: '3QPAY', value: 2 },
+      { label: 'BKASH', value: 'BKASH' },
+      { label: 'NAGAD', value: 'NAGAD' },
+      { label: 'ROCKET', value: 'ROCKET' },
     ],
   },
   timeType: {
@@ -165,7 +166,7 @@ const defaultSearchValues = reactive({
   userName: '',
   userPhone: '',
   orderNo: '',
-  channel: '',
+  methodName: '',
   timeType: 1, // 默认下单时间
   date_range: [],
 });

+ 13 - 12
src/app/shop/admin/user/list/detail.vue

@@ -104,13 +104,13 @@
             <template #default="{ row }">{{ row.groupNum }}</template>
           </el-table-column>
           <el-table-column :label="t('modules.user.totalCommission')" align="center">
-            <template #default="{ row }">{{ row.totalEarnings }}</template>
+            <template #default="{ row }">{{ formatCurrency(row.totalEarnings) }}</template>
           </el-table-column>
           <el-table-column :label="t('modules.user.settledCommission')" align="center">
-            <template #default="{ row }">{{ row.settledEarnings }}</template>
+            <template #default="{ row }">{{ formatCurrency(row.settledEarnings) }}</template>
           </el-table-column>
           <el-table-column :label="t('modules.user.totalRecharge')" align="center">
-            <template #default="{ row }">{{ row.rechargeAmount }}</template>
+            <template #default="{ row }">{{ formatCurrency(row.rechargeAmount) }}</template>
           </el-table-column>
         </el-table>
 
@@ -120,19 +120,19 @@
             <template #default="{ row }">{{ row.teamNum }}</template>
           </el-table-column>
           <el-table-column :label="t('modules.user.accountBalance')" align="center">
-            <template #default="{ row }">{{ row.walletBalance }}</template>
+            <template #default="{ row }">{{ formatCurrency(row.walletBalance) }}</template>
           </el-table-column>
           <el-table-column :label="t('modules.user.commissionBalance')" align="center">
-            <template #default="{ row }">{{ row.earningsBalance }}</template>
+            <template #default="{ row }">{{ formatCurrency(row.earningsBalance) }}</template>
           </el-table-column>
           <el-table-column :label="t('modules.user.last7DaysCommission')" align="center">
-            <template #default="{ row }">{{ row.l7DEarnings }}</template>
+            <template #default="{ row }">{{ formatCurrency(row.l7DEarnings) }}</template>
           </el-table-column>
           <el-table-column :label="t('modules.user.pendingCommission')" align="center">
-            <template #default="{ row }">{{ row.pendingEarnings }}</template>
+            <template #default="{ row }">{{ formatCurrency(row.pendingEarnings) }}</template>
           </el-table-column>
           <el-table-column :label="t('modules.user.totalWithdraw')" align="center">
-            <template #default="{ row }">{{ row.withdrawAmount }}</template>
+            <template #default="{ row }">{{ formatCurrency(row.withdrawAmount) }}</template>
           </el-table-column>
         </el-table>
       </div>
@@ -180,7 +180,7 @@
               </el-table-column>
               <el-table-column prop="payPrice" :label="t('modules.order.paymentAmount')" min-width="130" align="center">
                 <template #default="{ row }">
-                  <div>৳{{ row.payPrice || 0 }}</div>
+                  <div>{{ formatCurrency(row.payPrice) }}</div>
                 </template>
               </el-table-column>
               <el-table-column :label="t('modules.order.orderStatus')" min-width="100" align="center">
@@ -264,7 +264,7 @@
                 </template>
               </el-table-column>
               <el-table-column :label="t('modules.user.commissionAmount')" align="center">
-                <template #default="{ row }"> ৳{{ row.amount || 0 }} </template>
+                <template #default="{ row }"> {{ formatCurrency(row.amount) }} </template>
               </el-table-column>
               <el-table-column :label="t('modules.user.commissionStatus')" min-width="100" align="center">
                 <template #default="{ row }">
@@ -303,7 +303,7 @@
                 </template>
               </el-table-column>
               <el-table-column :label="t('modules.user.amount')" align="center">
-                <template #default="{ row }"> ৳{{ row.amount || 0 }} </template>
+                <template #default="{ row }"> {{ formatCurrency(row.amount) }} </template>
               </el-table-column>
               <el-table-column :label="t('common.status')" min-width="100" align="center">
                 <template #default="{ row }">
@@ -359,7 +359,7 @@
                 </template>
               </el-table-column>
               <el-table-column :label="t('modules.user.withdrawAmount')" align="center">
-                <template #default="{ row }"> ৳{{ row.amount || 0 }} </template>
+                <template #default="{ row }"> {{ formatCurrency(row.amount) }} </template>
               </el-table-column>
               <el-table-column :label="t('common.status')" min-width="100" align="center">
                 <template #default="{ row }">
@@ -567,6 +567,7 @@ const getChannelType = financeUtils.getChannelType;
 const getCurrencyText = financeUtils.getCurrencyText;
 const getAccountTypeText = financeUtils.getAccountTypeText;
 const getBizTypeText = financeUtils.getBizTypeText;
+const formatCurrency = financeUtils.formatCurrency;
 
 // 获取用户详情
 const loading = ref(false);

+ 1 - 1
src/locales/en-US/index.json

@@ -1025,7 +1025,7 @@
       "vipLevel": "VIP Level",
       "paymentInfo": "Payment Information",
       "noLevel": "No Level",
-      "paymentBank": "Payment Bank",
+      "paymentBank": "Payment Method",
       "accountName": "Account Name",
       "paymentAccount": "Payment Account",
       "newPassword": "New Password",

+ 1 - 1
src/locales/zh-CN/index.json

@@ -1022,7 +1022,7 @@
       "vipLevel": "VIP等级",
       "paymentInfo": "收款信息",
       "noLevel": "暂无等级",
-      "paymentBank": "收款银行",
+      "paymentBank": "收款方式",
       "accountName": "账户名称",
       "paymentAccount": "收款账户",
       "newPassword": "新密码",