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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
| <template>
| <el-bus-crud ref="crud" v-bind="tableConfig" />
| </template>
|
| <script>
| import { getGoodsCategoryListConfig } from '@/utils/form-item-config'
|
| export default {
| data() {
| return {
| tableConfig: {
| url: 'flower/api/flower/markup/sp/flower/list',
| hasNew: false,
| hasEdit: false,
| hasDelete: false,
| hasView: false,
| persistSelection: true,
| afterRequest: (list) => {
| return list.map((i) => ({ ...i, id: i.flowerId }))
| },
| operationAttrs: {
| width: '80px',
| fixed: 'right',
| },
| columns: [
| { label: '', type: 'selection', minWidth: 60, fixed: 'left' },
| { 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: 'sales', minWidth: 100 },
| { label: '库存', prop: 'stock', minWidth: 100 },
| { label: '加价(元)', prop: 'fee', minWidth: 100, fixed: 'right' },
| ],
| 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,
| },
| },
| ],
| },
| ],
| extraDialogs: [
| {
| title: '商品加价',
| form: [],
| atConfirm: async (val) => {
| const { code } = await this.$elBusHttp.request(
| 'flower/api/flower/markup/sp/flower/list/save',
| {
| method: 'post',
| data: val,
| }
| )
| if (code === 0) {
| this.$message.success('操作成功')
| this.$refs.crud.clearSelection()
| } else {
| return false
| }
| },
| },
| ],
| extraButtons: [
| {
| text: '设置加价',
| atClick: (row) => {
| this.$refs.crud.$refs.extraDialog[0].show({
| flowerIds: [row.flowerId],
| fee: row.fee ?? undefined,
| })
| return false
| },
| },
| ],
| headerButtons: [
| {
| text: '批量设置加价',
| type: 'primary',
| disabled: (selected) => selected.length === 0,
| atClick: (selected) => {
| this.$refs.crud.$refs.extraDialog[0].show({
| flowerIds: selected.map((i) => i.flowerId),
| fee:
| selected.length === 1
| ? selected[0].fee ?? undefined
| : undefined,
| })
| return false
| },
| },
| ],
| form: [
| {
| id: 'flowerIds',
| type: 'select',
| el: {
| multiple: true,
| },
| hidden: () => true,
| },
| {
| label: '加价:',
| id: 'fee',
| type: 'input-number',
| el: {
| min: 0,
| precision: 2,
| },
| unit: '元',
| },
| ],
| },
| }
| },
| head() {
| return {
| title: '商品加价',
| }
| },
| }
| </script>
|
| <style lang="scss" scoped></style>
|
|