Commit 5132e9f2 by 杨北旺

玻璃&定制权益

1 parent b3ea87d0
......@@ -12,7 +12,7 @@
"dayjs": "^1.10.7",
"el-tree-transfer": "^2.2.6",
"element-ui": "^2.4.5",
"glsx-common": "^1.4.6",
"glsx-common": "^2.0.4",
"glsx-components": "^1.5.2",
"lodash": "^4.17.21",
"vue": "^2.6.10",
......
......@@ -49,7 +49,14 @@
<el-checkbox-group v-model="curSelectPro" :disabled="disabled">
<div v-for="(item, index) in productList" :key="index" class="product_wrapper">
<div style="padding-left: 73px">
<el-checkbox @change="changeCheckBox($event, item)" :disabled="item.disabled" :label="item.packageName"></el-checkbox>
<!-- <el-checkbox @change="changeCheckBox($event, item, index)" :disabled="item.disabled" :label="errGlassName&&item.idName=='glass'?item.packageName+`(${errGlassName})`:item.packageName"> -->
<el-checkbox @change="changeCheckBox($event, item, index)" :label="item.packageName" :disabled="item.disabled">
<div v-if="errGlassName && item.idName == 'glass'">
{{ item.packageName }}
<span style="color: red; font-weight: normal">({{ errGlassName }})</span>
</div>
<div v-else>{{ item.packageName }}</div>
</el-checkbox>
</div>
<div class="customer-form">
<!-- 属性 -->
......@@ -502,7 +509,8 @@ export default {
crash: {},
stolen: {},
tire: {},
vip: {}
vip: {},
glass: {}
},
// 其他信息
editRuleOther: {
......@@ -705,13 +713,17 @@ export default {
pickerOptions: {},
pickerOptions2: {},
hotline: '',
compensationNameDisable: false
compensationNameDisable: false,
errGlassName: ''
}
},
watch: {
'editForm.vehicle.invoicePrice'(newValue, oldValue) {
this.editForm.vehicle.invoicePrice = limitPrice(newValue, oldValue, 7, 2, 0, 2000000)
if (this.currentVaildItem) {
this.vailGlassPackage(this.currentVaildItem, this.currentVaildIndex)
}
},
'editForm.actualSalesPrice'(newValue, oldValue) {
this.editForm.actualSalesPrice = limitPrice(newValue, oldValue, 7, 2)
......@@ -819,8 +831,8 @@ export default {
// item.optionList.push({ value: '5', label: '5年' })
// }
let optionObj = {
'4': { value: '4', label: '4年' },
'5': { value: '5', label: '5年' }
4: { value: '4', label: '4年' },
5: { value: '5', label: '5年' }
}
if (res.servicePeriod == '4' || res.servicePeriod == '5') {
const Target = item.optionList.find(item => {
......@@ -855,8 +867,47 @@ export default {
}
})
},
// 轮胎玻璃验证车辆价格不能大于50w
vailGlassPackage(item, index) {
this.currentVaildItem = item
this.currentVaildIndex = index
let glassNameFlag = this.curSelectPro.includes(this.vailGlassName)
if (item.idName == 'glass') this.vailIndex = index
if (glassNameFlag) {
let vaild = this.editForm.vehicle.invoicePrice && Number(this.editForm.vehicle.invoicePrice) > 500000
if (vaild) {
this.productList[this.vailIndex].groupAttributeList.forEach((el, i) => {
if (el.groupName == 'actual_sales_price') this.vail_sale_price_index = i
})
this.$set(this.productList[this.vailIndex], 'disabled', true)
this.$set(this.productList[this.vailIndex].groupAttributeList[this.vail_sale_price_index], 'disabled', true)
this.errGlassName = '车辆价格超过50万,无法购买'
} else {
this.errGlassName = ''
if (this.vailIndex !=undefined) this.$set(this.productList[this.vailIndex], 'disabled', false)
if (this.vail_sale_price_index) this.$set(this.productList[this.vailIndex].groupAttributeList[this.vail_sale_price_index], 'disabled', false)
}
} else {
if (this.vailIndex) this.$set(this.productList[this.vailIndex], 'disabled', false)
if (this.vail_sale_price_index) this.$set(this.productList[this.vailIndex].groupAttributeList[this.vail_sale_price_index], 'disabled', false)
}
},
// 轮胎玻璃提单参数处理
vaildGlassParams(para){
const index = this.checkCodeList.indexOf(this.vailGlassCode)
if(index!=-1&&this.errGlassName){
for(let key in para){
if(key.indexOf(`attributes[${index}]`)!=-1){
delete para[key]
}
}
return para
}
return para
},
// 切换套餐---赋默认值
changeCheckBox(e, item) {
changeCheckBox(e, item, index) {
this.vailGlassPackage(item, index)
if (e) {
this.checkCodeList.push(item.packageCode)
this.packageCodeList.push(item.packageCode)
......@@ -1073,7 +1124,6 @@ export default {
concactArr.forEach(item => {
this.autoFormatProduct = Object.assign(this.autoFormatProduct, item)
})
// console.log(this.autoFormatProduct, '定制权益')
}
},
// 处理传参价格问题
......@@ -1097,7 +1147,7 @@ export default {
})
},
// 获取产品的数据
toTestProductData(arr) {
toGetProductData(arr) {
arr.forEach(item => {
if (item.packageName.includes('整车全损')) {
item.idName = 'car'
......@@ -1110,12 +1160,12 @@ export default {
this.getCase(item.planId)
} else if (item.packageName.includes('盗抢')) {
item.idName = 'stolen'
} else if (item.packageName.includes('尊享版')) {
item.idName = 'vip'
} else if (item.packageName.includes('舒享版')) {
item.idName = 'vip'
} else if (item.packageName.includes('优享版')) {
} else if (item.packageType == 1) {
item.idName = 'vip'
} else if (item.packageName.includes('玻璃')) {
this.vailGlassName = item.packageName // 备用
this.vailGlassCode = item.packageCode
item.idName = 'glass'
}
item.disabled = false
item.serviceItems = item.serviceItemsList.length ? item.serviceItemsList.map(k => k.serviceName).join(',') : ''
......@@ -1138,17 +1188,29 @@ export default {
} else if (e.attributeDesc == '购车类型') {
e.optionList = this.baseData.buyCarTypeList
this.productModal[item.idName][e.attributeName] = '0'
} else if ((item.idName == 'tire' || item.idName == 'crash' || item.idName == 'vip') && e.attributeDesc == '服务期限') {
} else if ((item.idName == 'tire' || item.idName == 'crash' || item.idName == 'vip' || item.idName == 'glass') && e.attributeDesc == '服务期限') {
if (item.idName == 'tire' || item.idName == 'crash') {
e.optionList = this.baseData.servicePeriodList
} else {
e.optionList = this.baseData.servicePeriodList2
}
this.productModal[item.idName][e.attributeName] = '1'
e.disabled = true
// v3.1.2--新版的定制权益-服务期限--改为1,2,3年---旧版的依然是一年
let isOld = item.packageName.includes('尊享版') || item.packageName.includes('舒享版') || item.packageName.includes('优享版')
if(item.idName == 'vip' && !isOld){
e.disabled = false
e.optionList = this.baseData.servicePeriodList
}
this.productModal[item.idName][e.attributeName] = '1'
} else if (e.attributeDesc == '生效日期') {
let nextDay = new Date().getTime() + 24 * 60 * 60 * 1000
this.productModal[item.idName][e.attributeName] = utils.dateFormat(nextDay)
if (item.idName == 'glass') {
let tAdd2 = new Date().getTime() + 24 * 60 * 60 * 1000 * 2
this.productModal[item.idName][e.attributeName] = utils.dateFormat(tAdd2)
e.disabled = true
}
}
ele.tempobj = { ...e }
})
......@@ -1273,7 +1335,7 @@ export default {
})
if (id > -1) item.groupAttributeList.splice(id + 1, 0, obj)
})
this.toTestProductData(res)
this.toGetProductData(res)
})
},
// 改建议价,实际销售价
......@@ -1654,6 +1716,7 @@ export default {
params.attributes = []
}
params = Object.assign(params, vaidObj)
params = this.vaildGlassParams(params)
this.updateEquity(params)
},
updateEquity(params) {
......@@ -1748,6 +1811,7 @@ export default {
...params,
...vaidObj
}
params = this.vaildGlassParams(params)
this.$apis.beforeSale.checkOrderApi({ vin: this.editForm.vehicle.vin, contractNo: this.routeInfo.contractNo || '' }).then(res => {
if (res.code == '0') {
this.updateEquity(params)
......@@ -1801,7 +1865,8 @@ export default {
crash: {},
stolen: {},
tire: {},
vip: {}
vip: {},
glass: {}
}
this.customProductList = []
this.productList = []
......
......@@ -329,7 +329,7 @@ export default {
label: '店面名称',
line: 1,
prop: 'merchantName',
width: '160px',
width: '200px',
formatter: cellValue => {
return cellValue.merchantName || '-'
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!