From d66d833556ef54b06f6df33b6a29a1252590a39a Mon Sep 17 00:00:00 2001
From: mayf <m13160102112@163.com>
Date: 星期六, 21 九月 2024 20:24:29 +0800
Subject: [PATCH] 库存必须大于0

---
 pages/marketing/point-mall/coupon/index.vue |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/pages/marketing/point-mall/coupon/index.vue b/pages/marketing/point-mall/coupon/index.vue
index d445c10..28008a5 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>
@@ -59,6 +59,7 @@
             el: {
               inputAttrs: {
                 min: 1,
+                max: 99999999,
                 precision: 0,
                 controls: false,
               },
@@ -74,9 +75,18 @@
             el: {
               precision: 0,
               min: 0,
+              max: 99999999,
               controls: false,
             },
-            rules: { required: true, message: '请输入库存', trigger: 'blur' },
+            rules: [
+              { required: true, message: '请输入库存', trigger: 'blur' },
+              {
+                type: 'number',
+                min: 1,
+                message: '库存必须大于0',
+                trigger: 'blur',
+              },
+            ],
           },
           {
             label: '积分数量:',
@@ -85,6 +95,7 @@
             el: {
               precision: 0,
               min: 1,
+              max: 99999999,
               controls: false,
             },
             rules: {
@@ -98,7 +109,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('确定要上架吗?')
@@ -158,6 +170,7 @@
                 )
                 if (code === 0) {
                   this.$message.success('上架成功')
+                  this.$refs.crud.clearSelection()
                 }
               } catch (e) {
                 return false
@@ -184,6 +197,7 @@
                 )
                 if (code === 0) {
                   this.$message.success('下架成功')
+                  this.$refs.crud.clearSelection()
                 }
               } catch (e) {
                 return false

--
Gitblit v1.9.3