Răsfoiți Sursa

Merge remote-tracking branch 'origin/development' into development

congxuesong 2 săptămâni în urmă
părinte
comite
68879d6e00

+ 16 - 6
src/views/financialManagement/cashApply.vue

@@ -11,7 +11,7 @@
       <!-- 可提现金额 -->
       <div class="section">
         <div class="section-title">可提现金额</div>
-        <div class="available-amount">¥{{ formatCurrency(availableAmount) }}</div>
+        <div class="available-amount">¥{{ formatNumber(availableAmount) }}</div>
       </div>
 
       <!-- 提现金额输入 -->
@@ -113,6 +113,21 @@ const cashDialogVisible = ref(false);
 const withdrawPassword = ref("");
 // 提现金额
 const withdrawAmount = ref();
+// 格式化数字为千分位
+const formatNumber = (value: any): string => {
+  if (value === null || value === undefined || value === "") {
+    return "0.00";
+  }
+  const num = typeof value === "string" ? parseFloat(value) : Number(value);
+  if (isNaN(num)) {
+    return "0.00";
+  }
+  // 保留两位小数并添加千分位
+  return num.toLocaleString("zh-CN", {
+    minimumFractionDigits: 2,
+    maximumFractionDigits: 2
+  });
+};
 // 密码输入处理(只允许数字)
 const handlePasswordInput = (value: string) => {
   withdrawPassword.value = value.replace(/\D/g, "");
@@ -148,11 +163,6 @@ const goBack = () => {
   router.back();
 };
 
-// 格式化金额
-const formatCurrency = (value: number) => {
-  return value.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
-};
-
 // 全部提现
 const handleWithdrawAll = () => {
   withdrawAmount.value = availableAmount.value.toString();

+ 18 - 2
src/views/financialManagement/index.vue

@@ -18,7 +18,7 @@
           <el-image :src="gold" class="gold" />
           <div class="summary-amount">
             <span class="currency">¥</span>
-            <span class="amount">{{ todayIncome }}</span>
+            <span class="amount">{{ formatNumber(todayIncome) }}</span>
             <span class="unit">元</span>
           </div>
         </div>
@@ -37,7 +37,7 @@
           </el-tooltip>
         </div>
         <div class="stat-amount">
-          {{ stat.amount }}
+          {{ formatNumber(stat.amount) }}
         </div>
         <!----:disabled="stat.key === 'withdraw' && isWithdrawDisabled(stat.amount)"-->
         <el-button type="primary" class="stat-btn" @click="handleAction(stat.key)">
@@ -176,6 +176,22 @@ const fetchGetTodayIncome = async () => {
 //   return numAmount === 0 || isNaN(numAmount);
 // };
 
+// 格式化数字为千分位
+const formatNumber = (value: any): string => {
+  if (value === null || value === undefined || value === "") {
+    return "0.00";
+  }
+  const num = typeof value === "string" ? parseFloat(value) : Number(value);
+  if (isNaN(num)) {
+    return "0.00";
+  }
+  // 保留两位小数并添加千分位
+  return num.toLocaleString("zh-CN", {
+    minimumFractionDigits: 2,
+    maximumFractionDigits: 2
+  });
+};
+
 const handleAction = async (key: string) => {
   if (key == "withdraw") {
     // 获取可提现金额

+ 18 - 3
src/views/financialManagement/reconciled.vue

@@ -25,15 +25,15 @@
           {{ reconciled.couponName }}
         </h3>
         <el-row class="couponRow">
-          <el-col :span="12"> 实际收益: +{{ ((reconciled.money || 0) / 100).toFixed(2) }} </el-col>
+          <el-col :span="12"> 实际收益: &yen;{{ formatNumber(reconciled.money / 100) }} </el-col>
           <el-col :span="12">
             <!-- {{ `技术服务费(${unposted.commission / 100 || 3}%)` }}: 后续后端会变成可控的-->
             {{ `技术服务费(${commissionRate}%):` }}
-            {{ reconciled.commission != null ? (reconciled.commission / 100).toFixed(2) : "--" }}
+            {{ formatNumber(reconciled.commission / 100) }}
           </el-col>
         </el-row>
         <el-row class="couponRow">
-          <el-col :span="12"> 售价: {{ reconciled.orderPrice != null ? reconciled.orderPrice : "--" }} </el-col>
+          <el-col :span="12"> 售价: &yen;{{ formatNumber(reconciled.orderPrice) }} </el-col>
         </el-row>
         <h3 class="orderInfo">订单信息</h3>
         <div>
@@ -67,6 +67,21 @@ const toDetail = (row: any) => {
   dialogVisible.value = true;
   reconciled.value = row;
 };
+// 格式化数字为千分位
+const formatNumber = (value: any): string => {
+  if (value === null || value === undefined || value === "") {
+    return "0.00";
+  }
+  const num = typeof value === "string" ? parseFloat(value) : Number(value);
+  if (isNaN(num)) {
+    return "0.00";
+  }
+  // 保留两位小数并添加千分位
+  return num.toLocaleString("zh-CN", {
+    minimumFractionDigits: 2,
+    maximumFractionDigits: 2
+  });
+};
 // ProTable 实例(需要在使用它的地方之前定义)
 const proTable = ref<ProTableInstance>();
 

+ 21 - 8
src/views/financialManagement/todayIncomeList.vue

@@ -25,16 +25,14 @@
           {{ unposted.storeName }}
         </h2>
         <el-row class="couponRow">
-          <el-col :span="12"> 实际收益: {{ ((unposted.money || 0) / 100).toFixed(2) }} </el-col>
+          <el-col :span="12"> 实际收益: &yen;{{ formatNumber(unposted.money / 100) }} </el-col>
           <el-col :span="12">
             {{ `技术服务费(${commissionRate}%)` }}:
-            {{ unposted.commission != null ? (unposted.commission / 100).toFixed(2) : "--" }}
+            {{ formatNumber(unposted.commission / 100) }}
           </el-col>
         </el-row>
         <el-row class="couponRow">
-          <el-col :span="12">
-            售价: {{ ((Number(unposted.money) + Number(unposted.commission)) / 100).toFixed(2) || "0.00" }}
-          </el-col>
+          <el-col :span="12"> 售价: &yen;{{ formatNumber(unposted.orderPrice) }} </el-col>
         </el-row>
         <h3 class="orderInfo">订单信息</h3>
         <div>
@@ -67,6 +65,21 @@ const toDetail = (row: any) => {
   dialogVisible.value = true;
   unposted.value = row;
 };
+// 格式化数字为千分位
+const formatNumber = (value: any): string => {
+  if (value === null || value === undefined || value === "") {
+    return "0.00";
+  }
+  const num = typeof value === "string" ? parseFloat(value) : Number(value);
+  if (isNaN(num)) {
+    return "0.00";
+  }
+  // 保留两位小数并添加千分位
+  return num.toLocaleString("zh-CN", {
+    minimumFractionDigits: 2,
+    maximumFractionDigits: 2
+  });
+};
 // 返回
 const goBack = () => {
   router.back();
@@ -84,21 +97,21 @@ const columns = reactive<ColumnProps<any>[]>([
     prop: "money",
     label: "实际收益",
     render: scope => {
-      return ((scope.row.money || 0) / 100).toFixed(2) || "0.00";
+      return formatNumber(scope.row.money / 100);
     }
   },
   {
     prop: "price",
     label: "售价",
     render: scope => {
-      return ((Number(scope.row.money) + Number(scope.row.commission)) / 100).toFixed(2) || "0.00";
+      return formatNumber(Number(scope.row.money) + Number(scope.row.commission) / 100);
     }
   },
   {
     prop: "commission",
     label: "技术服务费",
     render: scope => {
-      return (scope.row.commission / 100).toFixed(2) || "0.00";
+      return formatNumber(scope.row.commission / 100);
     }
   },
   { prop: "operation", label: "操作", fixed: "right", width: 330 }

+ 18 - 5
src/views/financialManagement/unposted.vue

@@ -26,17 +26,15 @@
         </h2>
 
         <el-row class="couponRow">
-          <el-col :span="12">
-            实际收益: {{ unposted.incomeMoney || ((unposted?.money || 0) / 100).toFixed(2) || "0.00" }}
-          </el-col>
+          <el-col :span="12"> 实际收益: &yen;{{ formatNumber(unposted.money / 100) }} </el-col>
           <el-col :span="12">
             <!-- {{ `技术服务费(${unposted.commission / 100 || 3}%)` }}: 后续后端会变成可控的-->
             {{ `技术服务费(${commissionRate}%)` }}:
-            {{ unposted.commission != null ? (unposted.commission / 100).toFixed(2) : "--" }}
+            {{ formatNumber(unposted.commission / 100) }}
           </el-col>
         </el-row>
         <el-row class="couponRow">
-          <el-col :span="12"> 售价: {{ unposted.orderPrice || "--" }} </el-col>
+          <el-col :span="12"> 售价: &yen;{{ formatNumber(unposted.orderPrice) }} </el-col>
         </el-row>
 
         <h3 class="orderInfo">订单信息</h3>
@@ -70,6 +68,21 @@ const toDetail = (row: any) => {
   dialogVisible.value = true;
   unposted.value = row;
 };
+// 格式化数字为千分位
+const formatNumber = (value: any): string => {
+  if (value === null || value === undefined || value === "") {
+    return "0.00";
+  }
+  const num = typeof value === "string" ? parseFloat(value) : Number(value);
+  if (isNaN(num)) {
+    return "0.00";
+  }
+  // 保留两位小数并添加千分位
+  return num.toLocaleString("zh-CN", {
+    minimumFractionDigits: 2,
+    maximumFractionDigits: 2
+  });
+};
 // ProTable 实例(需要在使用它的地方之前定义)
 const proTable = ref<ProTableInstance>();
 // 返回