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 } }