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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
| import utils from 'el-business-utils'
|
| // 优惠券表单公共字段
| export const couponForm = () => {
| return [
| {
| label: '优惠券名称:',
| id: 'couponName',
| type: 'input',
| rules: {
| required: true,
| message: '请输入优惠券名称',
| trigger: 'blur',
| },
| },
| {
| label: '优惠券类型:',
| id: 'couponDiscountType',
| type: 'bus-select-dict',
| el: {
| code: 'COUPON_TYPE',
| style: 'width:100%',
| },
| on: {
| change: (e, updateForm, obj) => {
| if (e[0] === 'zero') {
| updateForm({ minOrderAmount: 0 })
| obj.elBusForm
| .getComponentById('minOrderAmount')
| .$parent.clearValidate()
| }
| },
| },
| rules: { required: true, message: '请选择优惠券类型' },
| str: true,
| strKey: 'couponDiscountTypeName',
| },
| {
| label: '使用规则:',
| id: 'couponDescription',
| type: 'input',
| el: {
| type: 'textarea',
| rows: 6,
| },
| rules: {
| required: true,
| message: '请输入使用规则',
| trigger: 'blur',
| },
| },
| {
| label: '优惠券使用条件:',
| id: 'minOrderAmount',
| type: 'input-number',
| el: {
| min: 0,
| precision: 2,
| controls: false,
| },
| prefix: '满',
| unit: '元',
| rules: {
| required: true,
| message: '请输入优惠券使用条件',
| trigger: 'blur',
| },
| disabled: (row) => row.couponDiscountType === 'zero',
| },
| {
| label: '优惠券面值:',
| id: 'couponDiscountValue',
| type: 'input-number',
| el: {
| min: 0.01,
| precision: 2,
| controls: false,
| },
| unit: '元',
| rules: {
| required: true,
| message: '请输入优惠券面值',
| trigger: 'blur',
| },
| },
| ]
| }
|
| export const couponSearchForm = () => {
| return [
| {
| label: '优惠券类型',
| id: 'couponDiscountType',
| type: 'bus-select-dict',
| el: {
| code: 'COUPON_TYPE',
| style: 'width:100%',
| clearable: true,
| },
| },
| {
| label: '优惠券名称',
| id: 'name',
| type: 'input',
| },
| ]
| }
|
| export const getActivityEffectiveTime = (row) => {
| if (row.usageType === 'get') {
| return `${utils.formatDate(row.getStartDate, 'YYYY-MM-DD HH:mm') || ''} ~ ${
| utils.formatDate(row.getEndDate, 'YYYY-MM-DD HH:mm') || ''
| }`
| } else if (row.usageType === 'fixed') {
| return `${
| utils.formatDate(row.usageStartDate, 'YYYY-MM-DD HH:mm') || ''
| } ~ ${utils.formatDate(row.usageEndDate, 'YYYY-MM-DD HH:mm') || ''}`
| } else if (row.usageType === 'get_after_time') {
| return `领取后${row.usageTimeNum}${row.usageTimeTypeName || ''}`
| }
| return ''
| }
|
| export const getActivityReceiveTime = (row) => {
| return `${utils.formatDate(
| row.getStartDate,
| 'YYYY-MM-DD HH:mm'
| )} ~ ${utils.formatDate(row.getEndDate, 'YYYY-MM-DD HH:mm')}`
| }
|
| // 优惠券列表公共字段
| export const couponColumn = () => {
| return [
| { label: '序号', type: 'index', minWidth: 60, fixed: 'left' },
| { label: '优惠券名称', prop: 'couponName', minWidth: 150, fixed: 'left' },
| { label: '优惠券类型', prop: 'couponDiscountTypeName', minWidth: 120 },
| {
| label: '使用条件',
| formatter: (row) => `满${row.minOrderAmount}`,
| minWidth: 120,
| },
| { label: '优惠券面值', prop: 'couponDiscountValue', minWidth: 120 },
| ]
| }
|
| // 优惠券领取/发放记录
| export const couponRecordColumn = () => {
| return [
| { label: '序号', type: 'index' },
| { label: '店铺名称', prop: 'customerName' },
| { label: '优惠券类型', prop: 'couponDiscountTypeName' },
| {
| label: '使用条件',
| formatter: (row) => `满${row.minOrderAmount}`,
| },
| { label: '优惠券面值', prop: 'couponDiscountValue' },
| { label: '状态', prop: 'statusName' },
| { label: '使用时间', prop: 'index' },
| { label: '订单号', prop: 'orderNo' },
| ]
| }
|
| export const recordTableConfig = (couponId) => {
| return {
| url: 'flower/v2/coupon-record/page',
| hasNew: false,
| hasOperation: false,
| saveQuery: false,
| extraQuery: {
| couponId,
| },
| }
| }
|
|