From bf9fb3424b4fc4e1cc8e0f729c195b1a824142d4 Mon Sep 17 00:00:00 2001 From: qingyiay <2386314947@qq.com> Date: 星期四, 07 九月 2023 15:16:26 +0800 Subject: [PATCH] 客户我的界面逻辑优化 --- pages/customer-page/customer-my/faYunstatistics/faYunstatistics.vue | 38 ++++++++++++++++++++++++-------------- 1 files changed, 24 insertions(+), 14 deletions(-) diff --git a/pages/customer-page/customer-my/faYunstatistics/faYunstatistics.vue b/pages/customer-page/customer-my/faYunstatistics/faYunstatistics.vue index a7dc442..1434f5f 100644 --- a/pages/customer-page/customer-my/faYunstatistics/faYunstatistics.vue +++ b/pages/customer-page/customer-my/faYunstatistics/faYunstatistics.vue @@ -10,7 +10,7 @@ <view class="content-num">鍙戣繍杞︽暟</view> </view> <view class="content-text"> - <view class="content-container">{{ totalTon.toFixed(2) }}</view> + <view class="content-container">{{ totalTon}}</view> <view class="content-num">鍙戣繍鍚ㄦ暟</view> </view> </view> @@ -42,13 +42,12 @@ <view class="card-top"> <view class="left"><combined-title :title="item.condition"></combined-title></view> <view class="card-top_num"> - {{ item.taskCoalList.length }}杞{ - item.taskCoalList - .reduce((prev, cur) => { - return prev + cur.clean; - }, 0) - .toFixed(2) - }}鍚� + {{ item.taskCoalList.length }}杞� + {{Number(item.taskCoalList + .reduce((prev, cur) => { + cur.clean=cur.clean||0 + return prev + cur.clean; + }, 0)).toFixed(2)}}鍚� </view> </view> <view class="card-main" @@ -279,6 +278,7 @@ </template> <script> + import BigNumber from "bignumber.js" import combinedTitle from '@/components/combined-title/combined-title.vue'; export default { components: { @@ -330,11 +330,11 @@ faYunDetailobj: {}, modalShow: false, coalStatus: ['棰嗗彇', '棰勭害', '绛惧埌', '鍏ュ満', '绉扮毊', '绉版瘺', '绂诲満', '鍏ョ鎴�', '鍑虹鎴�', '鍏ョ叅浠�', '鍑虹叅浠�', '鏀剧┖', '浣滃簾', '鍏ュ満鐢宠', - '杩涘叆鍦洪櫌' + '杩涘叆鍦洪櫌', '寮傚父瀹℃牳涓�' ] }; }, - onShow() { + onLoad() { this.firstDate(); this.lastDate(); this.getShipping(); @@ -431,10 +431,15 @@ this.totalLength = this.filterList.map(v => v.taskCoalList.length).reduce((x, y) => x + y); this.totalTon = this.filterList.map(v => v.taskCoalList.reduce((prev, cur) => { - return cur.clean + prev; + const cleanvalue = cur.clean || 0 + return cleanvalue + prev }, 0) ); - this.totalTon = this.totalTon.reduce((x, y) => x + y); + this.totalTon = this.totalTon.reduce((x, y) => { + let xx = new BigNumber(x) + let yy = new BigNumber(y) + return xx.plus(yy).toNumber().toFixed(2) + }, new BigNumber(0)); } else { this.totalLength = 0; this.totalTon = 0; @@ -507,10 +512,15 @@ this.totalLength = this.filterList.map(v => v.taskCoalList.length).reduce((x, y) => x + y); this.totalTon = this.filterList.map(v => v.taskCoalList.reduce((prev, cur) => { - return cur.clean + prev; + const cleanvalue = cur.clean || 0 + return cleanvalue + prev }, 0) ); - this.totalTon = this.totalTon.reduce((x, y) => x + y); + this.totalTon = this.totalTon.reduce((x, y) => { + let xx = new BigNumber(x) + let yy = new BigNumber(y) + return xx.plus(yy).toNumber().toFixed(2) + }, new BigNumber(0)); } else { this.totalLength = 0; this.totalTon = 0; -- Gitblit v1.9.1