Commit 9372b332 by 杨明

fixed

1 parent b4a0e5ed
......@@ -3,7 +3,7 @@
<glsx-combi-form class="edit-form-container" :isBlock="true" ref="editFormRef" formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="selectGiftBtn">
<el-radio label="" v-model="giftValue" v-if="!isGhPackage">自定义礼包</el-radio>
<el-radio label="" v-model="giftValue" v-else @change="getModel">自定义续保套餐</el-radio>
<el-radio label="" v-model="giftValue" v-if="isGhPackage && !isCustom" @change="getModel">自定义续保套餐</el-radio>
<div class="gift-container">
<el-radio-group v-model="giftValue" @change="getModel">
<el-radio :label="item.id" v-for="item in giftList" :key="item.id">{{ item.name }}(成本:{{ item.totalEquityPrice || 0 }})</el-radio>
......@@ -105,6 +105,7 @@ export default {
data() {
return {
isInit: this.$route.query.addOrEdit == 'add',
isCustom: false,
isGhPackage: false,
giftValue: '',
editForm: {
......@@ -266,6 +267,9 @@ export default {
}
})
}
if (this.giftList.find(item => item.name == '自定义套餐')) {
this.isCustom = true
}
})
},
calcCarValue(scope) {
......@@ -645,20 +649,33 @@ export default {
this.loading = false
})
},
getCarMoreList() {
var params = {
serviceStatus: 1,
pageNum: 1,
pageSize: 10000
}
this.loading = true
this.$apis.marketing.servicePage(params).then(res => {
this.loading = false
this.selectedCarList = []
this.$refs['carRef'].$refs['listMutiTable'].clearSelection()
this.carList = res.list || []
this.carList.forEach(item => {
item.packageCode = item.serviceCode
getCarMoreList(isChecked) {
return new Promise(resolve => {
var params = {
serviceStatus: 1,
pageNum: 1,
pageSize: 10000
}
this.loading = true
this.$apis.marketing.servicePage(params).then(res => {
this.loading = false
this.selectedCarList = []
this.$refs['carRef'].$refs['listMutiTable'].clearSelection()
this.carList = res.list || []
this.carList.forEach(p => {
p.packageCode = p.serviceCode
if (isChecked) {
this.selectedCarList.forEach(s => {
if (p.packageCode == s.packageCode) {
p.packageAmount = s.packageAmount || 0
}
})
}
})
if (isChecked) {
this.calcCarValue()
}
resolve()
})
})
},
......@@ -669,7 +686,7 @@ export default {
return
}
this.$apis.giftBag.packageDetail({ id: this.giftValue }).then(res => {
this.$nextTick(() => {
this.$nextTick(async () => {
this.selectedCarList = res.serviceMerchantPackageConfigDTOS || []
let activityCoupon = res.couponList || []
......@@ -681,7 +698,20 @@ export default {
this.selectedGoodsList = activityCoupon.filter(i => i.discountType == 8)
this.selectedServiceList = activityCoupon.filter(i => i.discountType != 8)
if (res.name == '自定义套餐') {
this.getCarMoreList()
try {
const serviceItem = Object.entries(JSON.parse(res.serviceItem))
this.selectedCarList = serviceItem.map(item => {
return {
packageCode: item[0],
serviceCode: item[0],
packageAmount: +item[1]
}
})
await this.getCarMoreList(true)
this.selectedPreExisting(this.selectedCarList, this.carList, 'packageCode', this.$refs['carRef'])
} catch (e) {
console.log(e)
}
} else {
this.getList()
}
......@@ -734,6 +764,9 @@ export default {
</style>
<style lang="scss" scoped>
.gift-container {
margin-top: 10px;
}
.choseRow {
display: flex;
height: auto;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!