From 2bc7d6bb5cfd9ed2034f2f616366d69e226c4d5d Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期六, 14 九月 2024 15:51:51 +0800
Subject: [PATCH] Merge branch 'master' of http://47.96.225.205:8888/r/operation_pc-v2

---
 pages/marketing/coupon/activity/index.vue |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/pages/marketing/coupon/activity/index.vue b/pages/marketing/coupon/activity/index.vue
index f534a7a..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,
@@ -117,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: '领取时间:',
@@ -271,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