Commit 228633f7 by 杨明

fixed

1 parent 3df0be34
......@@ -225,13 +225,9 @@ export default {
this.totalPrice = 0
for (let i = 0; i < this.selectedCarList.length; i++) {
if (scope && scope.packageCode == this.selectedCarList[i].packageCode) {
this.selectedCarList[i].packageAmount = scope.packageAmount
this.selectedCarList[i].packageAmount = scope.packageAmount || 0
}
if (!this.selectedCarList[i].packageAmount) {
this.$message.error('输入用车权益价格')
return
}
this.totalPrice = this.totalPrice + parseFloat(this.selectedCarList[i].packageAmount)
this.totalPrice = this.totalPrice + parseFloat(this.selectedCarList[i].packageAmount || 0)
}
},
handleSaveGift() {
......@@ -246,7 +242,7 @@ export default {
}
this.totalPrice = 0
for (let i = 0; i < selectedCarList.length; i++) {
this.totalPrice = this.totalPrice + parseFloat(selectedCarList[i].packageAmount)
this.totalPrice = this.totalPrice + parseFloat(selectedCarList[i].packageAmount || 0)
}
this.setPackage(Object.assign({}, { selectedServiceList: this.$common.utils.deepClone(this.selectedServiceList), selectedCarList: this.$common.utils.deepClone(this.selectedCarList), selectedGoodsList: this.$common.utils.deepClone(this.selectedGoodsList) }))
const selectedGoodsList = [...this.selectedGoodsList, ...this.selectedServiceList].map(item => {
......@@ -270,6 +266,9 @@ export default {
params.activityPrice = (this.editForm.activityPrice * 100).toFixed(0)
params.superMarketingCouponRelRequestList = selectedGoodsList || []
params.giftId = this.giftValue
if (this.giftValue) {
this.handleSave()
}
this.SET_STEP(3)
this.setProcess({
1: {
......@@ -278,10 +277,15 @@ export default {
})
},
handleSave() {
this.giftVisible = true
this.giftName = ''
if (this.giftValue) {
const giftList = this.giftList.find(item => this.giftValue == item.id)
this.handleConfirm(giftList)
} else {
this.giftVisible = true
this.giftName = ''
}
},
handleConfirm() {
handleConfirm(res) {
const { merchantId, selectedServiceList, selectedGoodsList, subscribe, giftName } = this
const selectedCarList = this.selectedCarList.filter(item => item.packageAmount)
const couponIds = [...selectedServiceList, ...selectedGoodsList].map(item => {
......@@ -289,8 +293,9 @@ export default {
})
const equities = {}
this.totalPrice = 0
if (selectedCarList.length == 0) {
this.$message.error('输入用车权益价格')
console.log(selectedCarList.length + selectedServiceList.length + selectedGoodsList.length)
if (selectedCarList.length + selectedServiceList.length + selectedGoodsList.length == 0) {
this.$message.error('权益服务、平台优惠、门店优惠券至少选一项')
return
}
for (let i = 0; i < selectedCarList.length; i++) {
......@@ -305,6 +310,10 @@ export default {
couponIds: JSON.stringify(couponIds),
equities: JSON.stringify(equities)
}
if (res && res.id) {
params.id = res.id
params.name = res.name
}
this.$apis.giftBag.packageAdd(params).then(res => {
if (res) {
this.giftVisible = false
......@@ -462,7 +471,7 @@ export default {
this.isInit = false
this.selectedCarList.forEach(s => {
if (p.packageCode == s.packageCode) {
p.packageAmount = s.packageAmount
p.packageAmount = s.packageAmount || 0
}
})
this.calcCarValue()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!