陶杰
2024-08-22 973662aeae3e7c788c14671d17c5962395141770
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
104
105
106
107
108
109
110
<template>
  <el-bus-crud v-bind="tableConfig" />
</template>
 
<script>
import {
  getGoodsListConfig,
  getGoodsCategoryListConfig,
} from '@/utils/form-item-config'
 
export default {
  data() {
    return {
      tableConfig: {
        url: 'flower/api/flower/markup/sp/list',
        newUrl: 'flower/api/flower/markup/sp/list/save',
        editUrl: 'flower/api/flower/markup/sp/list/save',
        onDelete: (row) => {
          return this.$elBusHttp.request(
            'flower/api/flower/markup/sp/list/delete',
            {
              params: {
                flowerId: row.flowerId,
              },
            }
          )
        },
        operationAttrs: {
          width: '140px',
          fixed: 'right',
        },
        columns: [
          { label: '商品名称', prop: 'name', minWidth: 150, fixed: 'left' },
          {
            label: '商品封面',
            formatter: (row) => (
              <el-bus-image style="width:50px;height:50px" src={row.cover} />
            ),
            minWidth: 100,
          },
          { label: '商品分类', prop: 'categoryStr', minWidth: 100 },
          { label: '上级分类', prop: 'parentCategoryStr', minWidth: 120 },
          { label: '级别', prop: 'levelStr', minWidth: 100 },
          { label: '规格', prop: 'unit', minWidth: 120 },
          { label: '标签', prop: 'tags', minWidth: 120 },
          { label: '供应商', prop: 'supplierName', minWidth: 100 },
          { label: '底价(元)', prop: 'price', minWidth: 100 },
          { label: '加价(元)', prop: 'fee', minWidth: 100 },
          { label: '销量', prop: 'sales', minWidth: 100 },
          { label: '库存', prop: 'stock', minWidth: 100 },
        ],
        searchForm: [
          {
            type: 'row',
            items: [
              {
                label: '商品名称:',
                id: 'name',
                type: 'input',
              },
              {
                ...getGoodsCategoryListConfig(),
                id: 'category',
              },
              {
                label: '级别:',
                id: 'level',
                type: 'bus-select-dict',
                el: {
                  code: 'FLOWER_LEVEL',
                  style: 'width:100%',
                  clearable: true,
                },
              },
            ],
          },
        ],
        form: [
          {
            ...getGoodsListConfig(),
            rules: { required: true, message: '请选择商品' },
            str: true,
            strKey: 'name',
            readonly: (row, item, mode) => {
              return mode === 'edit'
            },
          },
          {
            label: '加价:',
            id: 'fee',
            type: 'input-number',
            el: {
              min: 0,
              precision: 2,
            },
            unit: '元',
          },
        ],
      },
    }
  },
  head() {
    return {
      title: '商品加价',
    }
  },
}
</script>
 
<style lang="scss" scoped></style>