订单NaN的情况修复

dev_2022-03-03
yujialong 3 years ago
parent 085754efac
commit 43d37d41b4
  1. 3
      src/views/customer/AddCustomer.vue
  2. 14
      src/views/order/AddOrder.vue

@ -169,7 +169,8 @@
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<el-switch v-model="scope.row.isEnable" :active-value="1" :inactive-value="0" :active-text="scope.row.isEnable ? '启用' : '禁用'" :disabled="isDetail" @change="switchOff($event,scope.row,scope.$index)"></el-switch>
<el-switch v-if="scope.row.ship" v-model="scope.row.isEnable" :active-value="1" :inactive-value="0" :active-text="scope.row.isEnable ? '启用' : '禁用'" :disabled="isDetail" @change="switchOff($event,scope.row,scope.$index)"></el-switch>
<span v-else>未发货</span>
</template>
</el-table-column>
</el-table>

@ -1249,6 +1249,10 @@ export default {
this.$post(this.api.ship,row).then(res => {});
}
},
// 0
handleNaN(val) {
return isNaN(val) ? 0 : val
},
//
calculateDiscount(val, row) {
if (row.finalPrice)
@ -1258,7 +1262,7 @@ export default {
userAmount(val, row) {
if (val && row.totalAmount) {
// row.accountNum = Math.floor(row.totalAmount / val);
row.accountNum = Math.round(row.totalAmount / val);
row.accountNum = this.handleNaN(Math.round(row.totalAmount / val))
}
},
//
@ -1289,25 +1293,25 @@ export default {
if (row.totalAmount) {
let all = row.totalAmount;
if (row.accountNum) {//
row.finalPrice = Math.round(all / row.accountNum).toFixed(2);
row.finalPrice = this.handleNaN(Math.round(all / row.accountNum).toFixed(2))
}
if (row.finalPrice) {//
// row.accountNum = Math.floor(all / row.finalPrice);
row.accountNum = Math.round(all / row.finalPrice);
row.accountNum = this.handleNaN(Math.round(all / row.finalPrice))
}
}
},
//
dealComputers(e, row) {
if (row.finalPrice && row.accountNum) {
row.totalAmount = Math.round((row.finalPrice) * (row.accountNum)).toFixed(2);
row.totalAmount = this.handleNaN(Math.round((row.finalPrice) * (row.accountNum)).toFixed(2))
}
this.allAmount();
},
//
dealBargain(e, row) {
if (row.accountNum && row.totalAmount) {
row.finalPrice = Math.round(row.totalAmount / row.accountNum).toFixed(2);
row.finalPrice = this.handleNaN(Math.round(row.totalAmount / row.accountNum).toFixed(2))
}
},
// 使

Loading…
Cancel
Save