cloudroam
2025-03-28 cef2bb0eeeb91a22860cf5d23c7348af1ba921dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<template>
  <el-bus-crud ref="crud" v-bind="tableConfig" />
</template>
 
<script>
import { getSortConfig } from '@/utils/form-item-config'
export default {
  data() {
    return {
      tableConfig: {
        url: 'flower/api/flower/zone/page/flower/list',
        hasNew: false,
        hasEdit: false,
        hasDelete: false,
        hasView: false,
        extraQuery: {
          zoneId: this.$route.params.id,
        },
        columns: [
          { label: '商品名称', prop: 'name', minWidth: 150, fixed: 'left' },
          {
            label: '商品封面',
            formatter: (row) =>
              row.cover ? (
                <el-bus-image
                  src={row.cover}
                  lazy={true}
                  style="width:50px;height:50px"
                ></el-bus-image>
              ) : null,
            minWidth: 100,
          },
          { label: '级别', prop: 'levelStr', minWidth: 80 },
          { label: '颜色', prop: 'color', minWidth: 100 },
          { label: '供应商名称', prop: 'supplierName', minWidth: 150 },
          { label: '商品售价', prop: 'price', minWidth: 120 },
          { label: '库存', prop: 'stock', minWidth: 120 },
          { label: '商品状态', prop: 'statusStr', minWidth: 80 },
          { label: '商品标签', prop: 'tags', minWidth: 150 },
          { label: '提交时间', prop: 'createTime', minWidth: 180 },
          { label: '排序', prop: 'zoneRank', minWidth: 120, fixed: 'right' },
        ],
        searchForm: [
          {
            type: 'row',
            items: [
              { label: '商品名称:', id: 'name', type: 'input' },
              { label: '供应商:', id: 'supplierName', type: 'input' },
            ],
          },
        ],
        extraButtons: [
          {
            text: '设置排序',
            atClick: (row) => {
              this.$refs.crud.$refs.extraDialog[0].show({
                flowerId: row.id,
                rank: row.zoneRank,
              })
              return false
            },
          },
        ],
        extraDialogs: [
          {
            title: '设置排序',
            form: [
              {
                id: 'flowerId',
                type: 'input',
                hidden: () => true,
              },
              {
                ...getSortConfig('rank'),
              },
            ],
            atConfirm: async (val) => {
              const { code } = await this.$elBusHttp.request(
                'flower/api/flower/zone/page/set/rank',
                {
                  method: 'post',
                  data: {
                    ...val,
                    id: this.$route.params.id,
                  },
                }
              )
              if (code === 0) {
                this.$message.success('设置成功')
              }
            },
          },
        ],
      },
    }
  },
  head() {
    return {
      title: '专区商品',
    }
  },
}
</script>