| | |
| | | columns: [ |
| | | ...couponColumn(), |
| | | { |
| | | label: '优惠券图片', |
| | | formatter: (row) => ( |
| | | <el-bus-image |
| | | style="width:50px;height:50px" |
| | | lazy={true} |
| | | src={row.imageUrl} |
| | | /> |
| | | ), |
| | | }, |
| | | { |
| | | label: '领取时间', |
| | | formatter: getActivityReceiveTime, |
| | | minWidth: 320, |
| | |
| | | str: true, |
| | | strKey: 'getTypeName', |
| | | rules: { required: true, message: '请选择领取渠道' }, |
| | | on: { |
| | | change: (e, updateForm,obj) => { |
| | | |
| | | if(e[0]==='home'){ |
| | | // 如果是首页领取的话,则图片为必传递 |
| | | this.updateImageUrlRules(this.tableConfig.form,"imageUrl",true,"图片为必填项目") |
| | | }else{ |
| | | this.updateImageUrlRules(this.tableConfig.form,"imageUrl",false,"请输入图片") |
| | | } |
| | | }, |
| | | }, |
| | | |
| | | }, |
| | | { |
| | | label: '优惠券图片:', |
| | | id: 'imageUrl', |
| | | type: 'bus-upload', |
| | | el: { |
| | | listType: 'picture-card', |
| | | limit: 1, |
| | | limitSize: 2, |
| | | tipText: '大小不超过2M', |
| | | valueType: 'string', |
| | | }, |
| | | forceDisabled: true, |
| | | rules: { |
| | | required: true, |
| | | message: '请上传商品图片', |
| | | trigger: 'blur', |
| | | }, |
| | | }, |
| | | { |
| | | label: '领取时间:', |
| | |
| | | title: '活动优惠券', |
| | | } |
| | | }, |
| | | methods: { |
| | | updateImageUrlRules(form,id,required,message) { |
| | | const curField =form.find( |
| | | (field) => field.id === id |
| | | ); |
| | | if (curField && curField.rules && required) { |
| | | curField.rules.required = true; |
| | | curField.rules.message = message; |
| | | }else if(curField && curField.rules){ |
| | | curField.rules.required = false; |
| | | curField.rules.message = message; |
| | | } |
| | | }, |
| | | }, |
| | | } |
| | | </script> |