From e6bb5ebadfd072f147d015797b6fb43ec2165d80 Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期三, 18 九月 2024 14:46:20 +0800
Subject: [PATCH] add:商品限购数量

---
 pages/goods/list/index.vue       |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 pages/goods/list/_action/_id.vue |    6 ++++++
 2 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/pages/goods/list/_action/_id.vue b/pages/goods/list/_action/_id.vue
index 4bf6a64..73b6d70 100644
--- a/pages/goods/list/_action/_id.vue
+++ b/pages/goods/list/_action/_id.vue
@@ -80,6 +80,12 @@
               readonly: true,
             },
             {
+              label: '限购数量:',
+              id: 'limited',
+              type: 'input-number',
+              el: { precision: 0, min: 0, max: 99999999, style: 'width:100%' },
+            },
+            {
               label: '驳回原因:',
               id: 'auditRemarks',
               type: 'input',
diff --git a/pages/goods/list/index.vue b/pages/goods/list/index.vue
index a4bb316..b033e04 100644
--- a/pages/goods/list/index.vue
+++ b/pages/goods/list/index.vue
@@ -44,6 +44,7 @@
           { label: '虚拟销量', prop: 'sales', minWidth: 120 },
           { label: '真实销量', prop: 'realSales', minWidth: 120 },
           { label: '库存', prop: 'stock', minWidth: 120 },
+          { label: '限购数量', prop: 'limited', minWidth: 120 },
           { label: '商品状态', prop: 'statusStr', minWidth: 80 },
           { label: '商品标签', prop: 'tags', minWidth: 150 },
           { label: '所属专区', prop: 'zoneName', minWidth: 150 },
@@ -272,6 +273,18 @@
               } catch (e) {
                 return false
               }
+            },
+          },
+          {
+            text: '批量设置限购数量',
+            type: 'primary',
+            disabled: (selected) => selected.length === 0,
+            atClick: (selected) => {
+              this.$refs.crud.$refs.extraDialog[4].show({
+                ids: selected.map((item) => item.id),
+                limited: selected.length === 1 ? selected[0].limited : null,
+              })
+              return false
             },
           },
           {
@@ -508,6 +521,44 @@
               }
             },
           },
+          {
+            title: '批量设置限购数量',
+            form: [
+              {
+                id: 'ids',
+                type: 'select',
+                el: {
+                  multiple: true,
+                },
+                hidden: () => true,
+              },
+              {
+                label: '限购数量:',
+                id: 'limited',
+                type: 'input-number',
+                el: { precision: 0, min: 0,  max: 99999999, style: 'width:100%' },
+                rules: {
+                  required: true,
+                  message: '请输入限购数量',
+                  trigger: 'blur',
+                },
+              },
+            ],
+            atConfirm: async (val) => {
+
+              const { code } = await this.$elBusHttp.request(
+                'flower/api/flower/list/limiteds',
+                {
+                  method: 'post',
+                  data: val,
+                }
+              )
+              if (code === 0) {
+                this.$message.success('操作成功')
+                this.$refs.crud.clearSelection()
+              }
+            },
+          },
         ],
       },
     }

--
Gitblit v1.9.3