From e6bb5ebadfd072f147d015797b6fb43ec2165d80 Mon Sep 17 00:00:00 2001 From: cloudroam <cloudroam> Date: 星期三, 18 九月 2024 14:46:20 +0800 Subject: [PATCH] add:商品限购数量 --- pages/marketing/coupon/activity/index.vue | 69 ++++++++++++++++++++++++++++++++++ 1 files changed, 68 insertions(+), 1 deletions(-) diff --git a/pages/marketing/coupon/activity/index.vue b/pages/marketing/coupon/activity/index.vue index 5826244..265bbb3 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, @@ -53,9 +63,11 @@ formatter: getActivityEffectiveTime, minWidth: 320, }, + { label: '领取渠道', prop: 'getTypeName', minWidth: 120 }, { 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 }, ], // 页面上要到分,后端要传到秒 @@ -88,8 +100,19 @@ searchForm: [ { type: 'row', - items: [...couponSearchForm()], + items: [...couponSearchForm(), + { + label: '领取渠道:', + id: 'getType', + type: 'bus-select-dict', + el: { + code: 'COUPON_GET_TYPE', + style: 'width:100%', + }, + }, + ], }, + ], form: [ ...couponForm(), @@ -104,6 +127,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: '领取时间:', @@ -258,5 +311,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