cloudroam
2024-09-20 e93234340fe0958b8c205ea6d60d43c9c0d76b14
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 },
@@ -112,6 +113,23 @@
              {
                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,
@@ -319,6 +337,18 @@
              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 : undefined,
              })
              return false
            },
          },
        ],
        extraDialogs: [
          {
@@ -508,6 +538,40 @@
              }
            },
          },
          {
            title: '每人限购',
            form: [
              {
                id: 'ids',
                type: 'select',
                el: {
                  multiple: true,
                },
                hidden: () => true,
              },
              {
                label: '限购数量:',
                id: 'limited',
                type: 'input-number',
                el: { precision: 0,  min:1, max: 99999999,  style: 'width:100%'},
              },
            ],
            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()
              }
            },
          },
        ],
      },
    }