From b1207d7cba21fc9f81fff64842c9040c8cf1473c Mon Sep 17 00:00:00 2001
From: 陶杰 <1378534974@qq.com>
Date: 星期一, 30 十二月 2024 10:00:33 +0800
Subject: [PATCH] 1.批量任务-用户列表传入userId

---
 pages/goods/list/index.vue |  103 ++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 73 insertions(+), 30 deletions(-)

diff --git a/pages/goods/list/index.vue b/pages/goods/list/index.vue
index b033e04..f126596 100644
--- a/pages/goods/list/index.vue
+++ b/pages/goods/list/index.vue
@@ -1,9 +1,9 @@
 <template>
-  <el-bus-crud ref="crud" v-bind="tableConfig" />
+  <el-bus-crud ref="crud" v-bind="tableConfig" ></el-bus-crud>
 </template>
 
 <script>
-import { getSortConfig } from '@/utils/form-item-config'
+import { getSortConfig,getGoodsCategoryListConfig} from '@/utils/form-item-config'
 export default {
   data() {
     return {
@@ -106,13 +106,30 @@
                   hasAll: true,
                   childType: 'el-radio-button',
                 },
-                default: '',
+                default: this.$route.query.status || '',
                 span: 24,
                 searchImmediately: true,
               },
               {
                 label: '是否推荐:',
                 id: 'recommend',
+                type: 'bus-radio',
+                el: {
+                  fromDict: false,
+                  hasAll: true,
+                  childType: 'el-radio-button',
+                  options: [
+                    { label: '是', value: true },
+                    { label: '否', value: false },
+                  ],
+                },
+                default: '',
+                span: 24,
+                searchImmediately: true,
+              },
+              {
+                label: '是否限购:',
+                id: 'isLimited',
                 type: 'bus-radio',
                 el: {
                   fromDict: false,
@@ -144,25 +161,47 @@
                 span: 24,
                 searchImmediately: true,
               },
+              // {
+              //   label: '商品分类:',
+              //   id: 'category',
+              //   component: 'cascader-filter',
+              //   el: {
+              //     otherInterfaceUri: 'flower/api/flower/category/tree',
+              //     props: {
+              //       label: 'name',
+              //       value: 'id',
+              //       checkStrictly: true,
+              //     },
+              //     emitPath: false,
+              //     style: 'width:100%',
+              //     clearable: true,
+              //     hasAll: true,
+              //     childType: 'el-radio-button',
+              //   },
+              //   span: 24,
+              //   searchImmediately: true,
+              // },
               {
-                label: '商品分类:',
+                label: '商品分类',
                 id: 'category',
-                component: 'cascader-filter',
+                type: 'bus-cascader',
                 el: {
                   otherInterfaceUri: 'flower/api/flower/category/tree',
                   props: {
                     label: 'name',
                     value: 'id',
+                    emitPath: false,
+                    checkStrictly: true,
                   },
-                  emitPath: false,
-                  style: 'width:100%',
                   clearable: true,
-                  hasAll: true,
-                  childType: 'el-radio-button',
+                  filterable: true,
+                  style: 'width:100%',
                 },
-                span: 24,
-                searchImmediately: true,
               },
+              // {
+              //   ...getGoodsCategoryListConfig(),
+              //   id: 'category',
+              // },
               { label: '商品名称:', id: 'name', type: 'input' },
               { label: '供应商:', id: 'supplierName', type: 'input' },
             ],
@@ -276,18 +315,6 @@
             },
           },
           {
-            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
-            },
-          },
-          {
             text: '批量取消推荐',
             type: 'primary',
             disabled: (selected) =>
@@ -328,6 +355,23 @@
                 ids: selected
                   .filter((item) => item.status === 'PENDING')
                   .map((item) => item.id),
+              })
+              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
+                    ? this.$elBusUtil.isTrueEmpty(selected[0].limited)
+                      ? undefined
+                      : selected[0].limited
+                    : undefined,
               })
               return false
             },
@@ -522,7 +566,7 @@
             },
           },
           {
-            title: '批量设置限购数量',
+            title: '每人限购',
             form: [
               {
                 id: 'ids',
@@ -536,16 +580,15 @@
                 label: '限购数量:',
                 id: 'limited',
                 type: 'input-number',
-                el: { precision: 0, min: 0,  max: 99999999, style: 'width:100%' },
-                rules: {
-                  required: true,
-                  message: '请输入限购数量',
-                  trigger: 'blur',
+                el: {
+                  precision: 0,
+                  min: 1,
+                  max: 99999999,
+                  style: 'width:100%',
                 },
               },
             ],
             atConfirm: async (val) => {
-
               const { code } = await this.$elBusHttp.request(
                 'flower/api/flower/list/limiteds',
                 {

--
Gitblit v1.9.3