From 737fa999875ec2782d6c098ef490cf66d45bbfaf Mon Sep 17 00:00:00 2001
From: mayf <m13160102112@163.com>
Date: 星期五, 20 九月 2024 16:25:35 +0800
Subject: [PATCH] 分类表格文字修改 积分优惠券限制库存为0不能发布 删除用户优惠券选择用户弹窗中的新增按钮 优惠券使用条件和面值校验问题

---
 pages/marketing/point-mall/coupon/index.vue |    3 ++-
 pages/goods/category-list.vue               |    2 +-
 utils/coupon-form.js                        |   30 +++++++++++++++++++++++-------
 components/coupon/select-shop-user.vue      |    1 +
 4 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/components/coupon/select-shop-user.vue b/components/coupon/select-shop-user.vue
index c3da491..243d2d7 100644
--- a/components/coupon/select-shop-user.vue
+++ b/components/coupon/select-shop-user.vue
@@ -66,6 +66,7 @@
       tableConfig: {
         url: 'flower/api/customer/page',
         saveQuery: false,
+        hasNew: false,
         hasEdit: false,
         hasDelete: false,
         hasView: false,
diff --git a/pages/goods/category-list.vue b/pages/goods/category-list.vue
index 6875e1c..dc51929 100644
--- a/pages/goods/category-list.vue
+++ b/pages/goods/category-list.vue
@@ -83,7 +83,7 @@
             ),
           },
           { label: '排序', prop: 'sortBy' },
-          { label: '下级数量', formatter: (row) => row.childrenCount },
+          { label: '品种数量', formatter: (row) => row.childrenCount },
           {
             label: '是否显示',
             formatter: (row) => (
diff --git a/pages/marketing/point-mall/coupon/index.vue b/pages/marketing/point-mall/coupon/index.vue
index 0962726..f9c55c8 100644
--- a/pages/marketing/point-mall/coupon/index.vue
+++ b/pages/marketing/point-mall/coupon/index.vue
@@ -101,7 +101,8 @@
           {
             text: '上架',
             show: (row) =>
-              row.status === 'inactive' || row.status === 'expired',
+              (row.status === 'inactive' || row.status === 'expired') &&
+              row.couponAmount > 0,
             atClick: async (row) => {
               try {
                 await this.$elBusUtil.confirm('确定要上架吗?')
diff --git a/utils/coupon-form.js b/utils/coupon-form.js
index 07c9ae6..d695a94 100644
--- a/utils/coupon-form.js
+++ b/utils/coupon-form.js
@@ -28,6 +28,8 @@
             obj.elBusForm
               .getComponentById('minOrderAmount')
               .$parent.clearValidate()
+          } else {
+            updateForm({ minOrderAmount: undefined })
           }
         },
       },
@@ -55,12 +57,12 @@
       label: '优惠券使用条件:',
       id: 'minOrderAmount',
       type: 'input-number',
-      el: {
-        min: 0,
+      el: (row) => ({
+        min: row.couponDiscountType === 'discount' ? 0.01 : 0,
         max: 99999999,
         precision: 2,
         controls: false,
-      },
+      }),
       prefix: '满',
       unit: '元',
       rules: {
@@ -81,10 +83,24 @@
         controls: false,
       },
       unit: '元',
-      rules: {
-        required: true,
-        message: '请输入优惠券面值',
-        trigger: 'blur',
+      rules: (row) => {
+        return [
+          {
+            required: true,
+            message: '请输入优惠券面值',
+            trigger: 'blur',
+          },
+          {
+            validator: (rule, value, callback) => {
+              if (value && row.minOrderAmount && value > row.minOrderAmount) {
+                callback(new Error('优惠券面值不能大于优惠券使用条件'))
+              } else {
+                callback()
+              }
+            },
+            trigger: 'blur',
+          },
+        ]
       },
     },
   ]

--
Gitblit v1.9.3