From 8e219beed40e701537eac9ea8b5817b884d947ec Mon Sep 17 00:00:00 2001
From: mayf <m13160102112@163.com>
Date: 星期三, 04 九月 2024 10:20:51 +0800
Subject: [PATCH] 优惠券修改

---
 pages/marketing/coupon/member/_id.vue       |    4 ++--
 pages/marketing/point-mall/coupon/index.vue |    4 +++-
 pages/marketing/coupon/user/_id.vue         |   11 ++++++++---
 pages/marketing/coupon/user/index.vue       |    6 +++---
 utils/coupon-form.js                        |   12 ++++--------
 pages/marketing/point-mall/coupon/_id.vue   |    4 ++--
 pages/marketing/point-mall/goods.vue        |    2 ++
 pages/marketing/coupon/activity/_id.vue     |    6 ++++--
 8 files changed, 28 insertions(+), 21 deletions(-)

diff --git a/pages/marketing/coupon/activity/_id.vue b/pages/marketing/coupon/activity/_id.vue
index 864d8d9..104927b 100644
--- a/pages/marketing/coupon/activity/_id.vue
+++ b/pages/marketing/coupon/activity/_id.vue
@@ -35,9 +35,11 @@
           type: 'row',
           items: [
             ...couponForm(),
-            { label: '总数:', id: 'couponAmount', type: 'input' },
+            { label: '发放数量:', id: 'couponAmount', type: 'input' },
+            { label: '每人限领:', id: 'getLimit', type: 'input' },
             { label: '已领取:', id: 'getNum', type: 'input' },
             { label: '剩余:', id: 'unGetNum', type: 'input' },
+            { label: '领取渠道:', id: 'getTypeName', type: 'input' },
             {
               label: '领取时间:',
               id: 'getStartDate',
@@ -55,7 +57,7 @@
       ],
       recordTableConfig: {
         ...recordTableConfig(this.$route.params.id),
-        columns: [...couponRecordColumn()],
+        columns: [...couponRecordColumn('领取时间')],
       },
     }
   },
diff --git a/pages/marketing/coupon/member/_id.vue b/pages/marketing/coupon/member/_id.vue
index 4084dd5..3fea1d4 100644
--- a/pages/marketing/coupon/member/_id.vue
+++ b/pages/marketing/coupon/member/_id.vue
@@ -33,7 +33,7 @@
           type: 'row',
           items: [
             ...couponForm(),
-            { label: '已发放总数:', id: 'todo' },
+            { label: '已发放总数:', id: 'getNum' },
             {
               label: '有效期:',
               id: 'usageStartDate',
@@ -49,7 +49,7 @@
       ],
       recordTableConfig: {
         ...recordTableConfig(this.$route.params.id),
-        columns: [...couponRecordColumn()],
+        columns: [...couponRecordColumn('发放时间')],
       },
     }
   },
diff --git a/pages/marketing/coupon/user/_id.vue b/pages/marketing/coupon/user/_id.vue
index a660b02..7922c77 100644
--- a/pages/marketing/coupon/user/_id.vue
+++ b/pages/marketing/coupon/user/_id.vue
@@ -34,12 +34,17 @@
           items: [
             ...couponForm(),
             {
+              label: '发放时间:',
+              id: 'createTime',
+              type: 'input',
+            },
+            {
               label: '有效期:',
-              id: 'usageStartDate',
+              id: 'effectiveTime',
               inputFormat: (row) => {
                 return row.usageStartDate
                   ? `${row.usageStartDate} ~ ${row.usageEndDate || ''}`
-                  : ''
+                  : `发放后${row.usageTimeNum}${row.usageTimeTypeName || ''}`
               },
               span: 24,
             },
@@ -48,7 +53,7 @@
       ],
       recordTableConfig: {
         ...recordTableConfig(this.$route.params.id),
-        columns: [...couponRecordColumn()],
+        columns: [...couponRecordColumn('发放时间')],
       },
     }
   },
diff --git a/pages/marketing/coupon/user/index.vue b/pages/marketing/coupon/user/index.vue
index ce68f1e..7940166 100644
--- a/pages/marketing/coupon/user/index.vue
+++ b/pages/marketing/coupon/user/index.vue
@@ -33,13 +33,13 @@
         },
         columns: [
           ...couponColumn(),
-          { label: '发放时间', prop: 'usageStartDate', minWidth: 180 },
+          { label: '发放时间', prop: 'createTime', minWidth: 180 },
           {
             label: '有效期',
             formatter: (row) =>
               row.usageStartDate
                 ? `${row.usageStartDate} ~ ${row.usageEndDate || ''}`
-                : '',
+                : `发放后${row.usageTimeNum}${row.usageTimeTypeName || ''}`,
             minWidth: 400,
           },
           { label: '状态', prop: 'statusName', minWidth: 120 },
@@ -78,7 +78,7 @@
             rules: { required: true, message: '请选择领取用户' },
             inputFormat: (row) => {
               if ('customerList' in row) {
-                return row.customerList
+                return row.customerList.filter((i) => i)
               }
             },
             outputFormat: (val) => {
diff --git a/pages/marketing/point-mall/coupon/_id.vue b/pages/marketing/point-mall/coupon/_id.vue
index 3fe87a6..71695c7 100644
--- a/pages/marketing/point-mall/coupon/_id.vue
+++ b/pages/marketing/point-mall/coupon/_id.vue
@@ -47,13 +47,13 @@
       ],
       recordTableConfig: {
         ...recordTableConfig(this.$route.params.id),
-        columns: [...couponRecordColumn()],
+        columns: [...couponRecordColumn('兑换时间')],
       },
     }
   },
   head() {
     return {
-      title: '会员优惠券详情',
+      title: '积分优惠券详情',
     }
   },
 }
diff --git a/pages/marketing/point-mall/coupon/index.vue b/pages/marketing/point-mall/coupon/index.vue
index d445c10..0d6fcc3 100644
--- a/pages/marketing/point-mall/coupon/index.vue
+++ b/pages/marketing/point-mall/coupon/index.vue
@@ -1,5 +1,5 @@
 <template>
-  <el-bus-crud v-bind="tableConfig" />
+  <el-bus-crud ref="crud" v-bind="tableConfig" />
 </template>
 
 <script>
@@ -158,6 +158,7 @@
                 )
                 if (code === 0) {
                   this.$message.success('上架成功')
+                  this.$refs.crud.clearSelection()
                 }
               } catch (e) {
                 return false
@@ -184,6 +185,7 @@
                 )
                 if (code === 0) {
                   this.$message.success('下架成功')
+                  this.$refs.crud.clearSelection()
                 }
               } catch (e) {
                 return false
diff --git a/pages/marketing/point-mall/goods.vue b/pages/marketing/point-mall/goods.vue
index 0821523..dbc71cf 100644
--- a/pages/marketing/point-mall/goods.vue
+++ b/pages/marketing/point-mall/goods.vue
@@ -177,6 +177,7 @@
                 )
                 if (code === 0) {
                   this.$message.success('上架成功')
+                  this.$refs.crud.clearSelection()
                 }
               } catch (e) {
                 return false
@@ -200,6 +201,7 @@
                 )
                 if (code === 0) {
                   this.$message.success('下架成功')
+                  this.$refs.crud.clearSelection()
                 }
               } catch (e) {
                 return false
diff --git a/utils/coupon-form.js b/utils/coupon-form.js
index cf3e885..e0aeb55 100644
--- a/utils/coupon-form.js
+++ b/utils/coupon-form.js
@@ -144,18 +144,14 @@
 }
 
 // 优惠券领取/发放记录
-export const couponRecordColumn = () => {
+export const couponRecordColumn = (timeName) => {
   return [
     { label: '序号', type: 'index' },
     { label: '店铺名称', prop: 'customerName' },
-    { label: '优惠券类型', prop: 'couponDiscountTypeName' },
-    {
-      label: '使用条件',
-      formatter: (row) => `满${row.minOrderAmount}`,
-    },
-    { label: '优惠券面值', prop: 'couponDiscountValue' },
+    { label: '联系方式', prop: 'tel' },
+    { label: timeName, prop: 'createTime' },
     { label: '状态', prop: 'statusName' },
-    { label: '使用时间', prop: 'index' },
+    { label: '使用时间', prop: 'usedTime' },
     { label: '订单号', prop: 'orderNo' },
   ]
 }

--
Gitblit v1.9.3