Commit 6fb70836 by 李长胜

js小数精度问题

1 parent 1a106683
......@@ -150,12 +150,8 @@ export default {
this.merchantName = this.$globalState.session.merchantName
}
// if (this.id) {
this.getSetmealServiceFun() //获取服务套餐,执行完了之后去获取编辑详情
// }else{
// this.getSetmealServiceFun()
// }
this.getSetmealServiceFun() //获取服务套餐,执行完了之后去获取编辑详情
},
watch: {
// allItemList: {
......@@ -243,7 +239,7 @@ export default {
},
//删除该条服务套餐(让item.serviceQuantity==0)
closeChoseItemFun(item, index) {
this.totalPrice = this.totalPrice - item.vipPrice * item.serviceQuantity
this.totalPrice = (this.totalPrice*100 - item.vipPrice * item.serviceQuantity*100)/100
// item.serviceQuantity = 0
// this.allItemList.forEach(ele => {
// if (ele.id == item.serviceId) {
......@@ -259,7 +255,7 @@ export default {
this.allItemList.forEach(item => {
if (item.serviceQuantity) {
this.selectNum++
this.totalPrice += item.vipPrice * item.serviceQuantity
this.totalPrice = (this.totalPrice *100+item.vipPrice * item.serviceQuantity*100)/100
}
})
},
......@@ -307,8 +303,7 @@ export default {
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
// this.$router.go(-1)
this.$router.push("/memberCenter/setmeal")
this.$router.push("/memberCenter/setmeal")
}
})
} else {
......@@ -351,8 +346,10 @@ export default {
},
goBack() {
// this.$router.go(-1)
if (JSON.stringify(this.ruleForm) == JSON.stringify(this.copyRuleForm) && this.choseItemList.length == this.copyChoseItemList.length && this.totalPrice == this.copyTotalPrice) {
this.$router.push("/memberCenter/setmeal")
// this.$router.go(-1)
this.$router.push("/memberCenter/setmeal")
} else {
this.isTipDialogVisible = true
}
......@@ -409,7 +406,7 @@ export default {
this.setmealDialogVisible = false
this.totalPrice = 0
this.choseItemList.forEach(item => {
this.totalPrice += item.vipPrice * item.serviceQuantity
this.totalPrice = (this.totalPrice*100+ item.vipPrice * item.serviceQuantity*100)/100
})
// this.totalPrice = this.choseItemList.reduce(function(preValue, choseItem) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!