Commit 075941c6 by chenwq

礼包编辑-礼包设置必填

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