Commit 075941c6 by chenwq

礼包编辑-礼包设置必填

1 parent 9e13cf7a
...@@ -126,23 +126,26 @@ export default { ...@@ -126,23 +126,26 @@ export default {
remarkName: [{ required: true, message: '请输入备注名称', trigger: 'change' }], remarkName: [{ required: true, message: '请输入备注名称', trigger: 'change' }],
receiveWay: [{ required: true, message: '请选择领取条件', trigger: 'change' }], receiveWay: [{ required: true, message: '请选择领取条件', trigger: 'change' }],
staffList: [{ required: true, message: '请选择发放员工', trigger: 'change' }], staffList: [{ required: true, message: '请选择发放员工', trigger: 'change' }],
receiveDetails: [{ required: true, message: '请输入领取条件', trigger: 'change' }, couponList: [{ required: true, message: '请选择礼包', trigger: 'change' }],
{ receiveDetails: [
required: true, { required: true, message: '请输入领取条件', trigger: 'change' },
validator: (rule, value, callback) => { {
if (!value) { required: true,
return callback() validator: (rule, value, callback) => {
} if (!value) {
if (this.editForm.receiveWay == '1') { return callback()
let phoneReg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/ }
return phoneReg.test(value) ? callback() : callback(new Error('请输入正确的手机号')) if (this.editForm.receiveWay == '1') {
} else { let phoneReg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/
let cjhReg = /^[0-9a-zA-Z]{6}$/ return phoneReg.test(value) ? callback() : callback(new Error('请输入正确的手机号'))
return cjhReg.test(value) ? callback() : callback(new Error('请输入正确的车架号后6位')) } else {
} let cjhReg = /^[0-9a-zA-Z]{6}$/
}, return cjhReg.test(value) ? callback() : callback(new Error('请输入正确的车架号后6位'))
trigger: 'change' }
}] },
trigger: 'change'
}
]
}, },
isEdit: true, isEdit: true,
editFormData: [ editFormData: [
...@@ -167,7 +170,8 @@ export default { ...@@ -167,7 +170,8 @@ export default {
}, },
{ {
label: '', label: '',
name: '', name: 'couponListBlock',
isHide: true,
addHtml: 'couponListBlock' addHtml: 'couponListBlock'
}, },
{ {
...@@ -276,6 +280,7 @@ export default { ...@@ -276,6 +280,7 @@ export default {
this.editForm.couponList.forEach(item => { this.editForm.couponList.forEach(item => {
this.couponObj[this.numToCoupon[item.discountType]].list.push(item) this.couponObj[this.numToCoupon[item.discountType]].list.push(item)
}) })
this.hasCouponBlock(false)
}, },
receiveWayChange(val) { receiveWayChange(val) {
...@@ -298,6 +303,12 @@ export default { ...@@ -298,6 +303,12 @@ export default {
this.totalEstimatedCost = (this.totalEstimatedCost / 100).toFixed(2) this.totalEstimatedCost = (this.totalEstimatedCost / 100).toFixed(2)
}, },
hasCouponBlock(isValidate = true) {
var idx = this.editFormData.findIndex(item => item.name == 'couponListBlock')
this.editFormData[idx].isHide = !this.editForm.couponList.length
isValidate && this.$refs.editFormRef.$refs[this.editChildRef].validateField('couponList')
},
// 礼包 // 礼包
recoveryGiftList() { recoveryGiftList() {
this.editForm.couponList = [] this.editForm.couponList = []
...@@ -306,6 +317,7 @@ export default { ...@@ -306,6 +317,7 @@ export default {
this.editForm.couponList.push(k) this.editForm.couponList.push(k)
}) })
}) })
this.hasCouponBlock()
}, },
handleGiftAdd() { handleGiftAdd() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!