From 92963d3497c43c9bec7d717c966e5c202fc98b53 Mon Sep 17 00:00:00 2001 From: aixianling Date: Thu, 8 Aug 2024 14:24:17 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=98=BE=E7=A4=BA=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=BD=8D=E6=95=B0=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/AppRealtimePanel.vue | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/views/AppRealtimePanel.vue b/src/views/AppRealtimePanel.vue index 93ea764..cba9257 100644 --- a/src/views/AppRealtimePanel.vue +++ b/src/views/AppRealtimePanel.vue @@ -10,14 +10,14 @@ export default { computed: { search: v => v.$storeBoard.search, list: v => [ - {label: "总销售", prop: "saleAmt"}, - {label: "常规销售", prop: "commonSaleAmt"}, - {label: "节令销售", prop: "seasonSaleAmt"}, - {label: "有效订单数", prop: "validOrderNum"}, + {label: "总销售", prop: "saleAmt", decimal: 1}, + {label: "常规销售", prop: "commonSaleAmt", decimal: 1}, + {label: "节令销售", prop: "seasonSaleAmt", decimal: 1}, + {label: "有效订单数", prop: "validOrderNum", decimal: 0}, {label: "常规客单价", prop: "customerUnitPrice"}, {label: "会员有效订单占比", prop: "memOrderPercent", unit: "%"}, {label: "报损率", prop: "lossAmtPercent", unit: "%"}, - {label: "报损金额", prop: "lossAmt"}, + {label: "报损金额", prop: "lossAmt", decimal: 1}, {label: "外卖销售占比", prop: "deliveryAmtPercent", unit: "%"}, ] }, @@ -39,9 +39,10 @@ export default { }, getValue(item) { let result = this.info[item.prop] - if (item.unit == "%") result = (result * 100 || 0).toFixed(2)+ "%" + const decimal = item.decimal > -1 ? item.decimal : 2 + if (item.unit == "%") result = (result * 100 || 0).toFixed(decimal) + "%" if (item.calc) result = item.calc() - if (/^-?\d+(\.\d+)?$/.test(result)) result = Number(result).toFixed(2) + if (/^-?\d+(\.\d+)?$/.test(result)) result = Number(result).toFixed(decimal) return result } }