From 5f84efe26a889f11e1c7241a869e176389b1e69b Mon Sep 17 00:00:00 2001 From: 陶杰 <1378534974@qq.com> Date: 星期六, 14 九月 2024 15:43:56 +0800 Subject: [PATCH] 1.优惠券添加图片 --- pages/marketing/coupon/activity/index.vue | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 58 insertions(+), 0 deletions(-) diff --git a/pages/marketing/coupon/activity/index.vue b/pages/marketing/coupon/activity/index.vue index 1dd3278..e9564a1 100644 --- a/pages/marketing/coupon/activity/index.vue +++ b/pages/marketing/coupon/activity/index.vue @@ -44,6 +44,16 @@ columns: [ ...couponColumn(), { + label: '优惠券图片', + formatter: (row) => ( + <el-bus-image + style="width:50px;height:50px" + lazy={true} + src={row.imageUrl} + /> + ), + }, + { label: '领取时间', formatter: getActivityReceiveTime, minWidth: 320, @@ -56,6 +66,7 @@ { label: '已领取总数', prop: 'getNum', minWidth: 150 }, { label: '剩余未领取总数', prop: 'unGetNum', minWidth: 150 }, { label: '状态', prop: 'statusName', minWidth: 120 }, + { label: '领取渠道', prop: 'getTypeName', minWidth: 120 }, { label: '操作人', prop: 'createByName', minWidth: 120 }, ], // 页面上要到分,后端要传到秒 @@ -104,6 +115,36 @@ 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: '领取时间:', @@ -165,6 +206,7 @@ el: { inputAttrs: { min: 1, + max: 99999999, precision: 0, controls: false, }, @@ -182,6 +224,7 @@ el: { precision: 0, min: 1, + max: 99999999, controls: false, }, unit: '张', @@ -198,6 +241,7 @@ el: { precision: 0, min: 1, + max: 99999999, controls: false, }, unit: '张', @@ -255,5 +299,19 @@ 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> -- Gitblit v1.9.3