task#,工单批次,未开票,统计金额,浮点数相加优化
This commit is contained in:
@ -23,7 +23,8 @@
|
||||
"vue-router": "^3.0.7",
|
||||
"vuex": "^3.6.2",
|
||||
"element-ui": "^2.15.9",
|
||||
"dayjs": "^1.8.14"
|
||||
"dayjs": "^1.8.14",
|
||||
"decimal.js": "^10.4.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.16",
|
||||
|
@ -86,6 +86,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Decimal } from 'decimal.js';
|
||||
import {myMixins} from "@/utils/myMixins"
|
||||
import {notifyInvoiceList} from "@/api/mine"
|
||||
export default {
|
||||
@ -110,12 +111,23 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
totalCount () {
|
||||
/* totalCount () {
|
||||
let total = 0;
|
||||
this.checkList.map(item => {
|
||||
total += item.invoiceMoney
|
||||
})
|
||||
return total
|
||||
},*/
|
||||
totalCount() {
|
||||
// 使用 Decimal 来计算总金额
|
||||
let total = new Decimal(0);
|
||||
|
||||
this.checkList.forEach(item => {
|
||||
total = total.plus(new Decimal(item.invoiceMoney));
|
||||
});
|
||||
|
||||
// 返回总金额,保留两位小数
|
||||
return total.toNumber()
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
|
@ -82,7 +82,7 @@
|
||||
<span class="content">{{orderInfo.bridgeAmountBc + ' 元' }}</span>
|
||||
</div>
|
||||
<div class="item" v-show="bridgeCaState">
|
||||
<span class="titleLeft">va路桥费:</span>
|
||||
<span class="titleLeft">ca路桥费:</span>
|
||||
<span class="content">{{orderInfo.bridgeAmountCa + ' 元' }}</span>
|
||||
</div>
|
||||
<div class="item" v-show="tyreAmountState">
|
||||
|
Reference in New Issue
Block a user