Commit 6fb70836 by 李长胜

js小数精度问题

1 parent 1a106683
...@@ -150,12 +150,8 @@ export default { ...@@ -150,12 +150,8 @@ export default {
this.merchantName = this.$globalState.session.merchantName this.merchantName = this.$globalState.session.merchantName
} }
// if (this.id) {
this.getSetmealServiceFun() //获取服务套餐,执行完了之后去获取编辑详情
// }else{ this.getSetmealServiceFun() //获取服务套餐,执行完了之后去获取编辑详情
// this.getSetmealServiceFun()
// }
}, },
watch: { watch: {
// allItemList: { // allItemList: {
...@@ -243,7 +239,7 @@ export default { ...@@ -243,7 +239,7 @@ export default {
}, },
//删除该条服务套餐(让item.serviceQuantity==0) //删除该条服务套餐(让item.serviceQuantity==0)
closeChoseItemFun(item, index) { 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 // item.serviceQuantity = 0
// this.allItemList.forEach(ele => { // this.allItemList.forEach(ele => {
// if (ele.id == item.serviceId) { // if (ele.id == item.serviceId) {
...@@ -259,7 +255,7 @@ export default { ...@@ -259,7 +255,7 @@ export default {
this.allItemList.forEach(item => { this.allItemList.forEach(item => {
if (item.serviceQuantity) { if (item.serviceQuantity) {
this.selectNum++ this.selectNum++
this.totalPrice += item.vipPrice * item.serviceQuantity this.totalPrice = (this.totalPrice *100+item.vipPrice * item.serviceQuantity*100)/100
} }
}) })
}, },
...@@ -307,7 +303,6 @@ export default { ...@@ -307,7 +303,6 @@ export default {
type: res.code == '0' ? 'success' : 'error' type: res.code == '0' ? 'success' : 'error'
}) })
if (res.code == '0') { if (res.code == '0') {
// this.$router.go(-1)
this.$router.push("/memberCenter/setmeal") this.$router.push("/memberCenter/setmeal")
} }
}) })
...@@ -351,7 +346,9 @@ export default { ...@@ -351,7 +346,9 @@ export default {
}, },
goBack() { goBack() {
// this.$router.go(-1)
if (JSON.stringify(this.ruleForm) == JSON.stringify(this.copyRuleForm) && this.choseItemList.length == this.copyChoseItemList.length && this.totalPrice == this.copyTotalPrice) { if (JSON.stringify(this.ruleForm) == JSON.stringify(this.copyRuleForm) && this.choseItemList.length == this.copyChoseItemList.length && this.totalPrice == this.copyTotalPrice) {
// this.$router.go(-1)
this.$router.push("/memberCenter/setmeal") this.$router.push("/memberCenter/setmeal")
} else { } else {
this.isTipDialogVisible = true this.isTipDialogVisible = true
...@@ -409,7 +406,7 @@ export default { ...@@ -409,7 +406,7 @@ export default {
this.setmealDialogVisible = false this.setmealDialogVisible = false
this.totalPrice = 0 this.totalPrice = 0
this.choseItemList.forEach(item => { 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) { // 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!