form18.vue
9.1 KB
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<template>
<div class="NCC-common-layout">
<div class="NCC-common-layout-center">
<!-- 筛选条件 -->
<el-row class="NCC-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item label="品项">
<el-select
v-model="query.ItemId"
placeholder="请选择品项"
filterable
clearable
:style='{"width":"100%"}'>
<el-option
v-for="item in itemOptions"
:key="item.id"
:label="item.xmmc"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="最小金额">
<el-input-number
v-model="query.MinAmount"
placeholder="请输入最小金额"
:min="0"
:precision="2"
:style='{"width":"100%"}'
clearable>
</el-input-number>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="最大金额">
<el-input-number
v-model="query.MaxAmount"
placeholder="请输入最大金额"
:min="0"
:precision="2"
:style='{"width":"100%"}'
clearable>
</el-input-number>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button>
<el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<!-- 数据表格 -->
<div class="NCC-common-layout-main NCC-flex-main">
<NCC-table v-loading="listLoading" :data="list" has-c>
<el-table-column prop="Id" label="储扣记录ID" width="150">
<template slot-scope="scope">
<span>{{ scope.row.Id || '无' }}</span>
</template>
</el-table-column>
<el-table-column prop="DeductType" label="扣减类型" >
<template slot-scope="scope">
<span>{{ scope.row.DeductType || '无' }}</span>
</template>
</el-table-column>
<el-table-column prop="DeductTypeName" label="扣减类型名称" >
<template slot-scope="scope">
<span>{{ getDeductTypeName(scope.row.DeductType) || '无' }}</span>
</template>
</el-table-column>
<el-table-column prop="BillingId" label="开单ID" width="150">
<template slot-scope="scope">
<span>{{ scope.row.BillingId || '无' }}</span>
</template>
</el-table-column>
<el-table-column prop="Amount" label="合计金额" >
<template slot-scope="scope">
<span class="amount-value">¥{{ formatMoney(scope.row.Amount) }}</span>
</template>
</el-table-column>
<el-table-column prop="ItemName" label="品项名称" >
<template slot-scope="scope">
<span>{{ scope.row.ItemName || '无' }}</span>
</template>
</el-table-column>
<el-table-column prop="ItemCategory" label="品项分类" >
<template slot-scope="scope">
<el-tag
:type="getItemCategoryType(scope.row.ItemCategory)"
size="small">
{{ scope.row.ItemCategory || '无' }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="BillingDate" label="开单日期">
<template slot-scope="scope">
<span>{{ formatDate(scope.row.BillingDate) }}</span>
</template>
</el-table-column>
<el-table-column prop="MemberName" label="客户名称" >
<template slot-scope="scope">
<span>{{ scope.row.MemberName || '无' }}</span>
</template>
</el-table-column>
<el-table-column prop="MemberPhone" label="客户手机号" min-width="130">
<template slot-scope="scope">
<span>{{ scope.row.MemberPhone || '无' }}</span>
</template>
</el-table-column>
<el-table-column prop="StoreName" label="门店名称" >
<template slot-scope="scope">
<span>{{ scope.row.StoreName || '无' }}</span>
</template>
</el-table-column>
</NCC-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.currentPage"
:limit.sync="listQuery.pageSize"
@pagination="handlePagination"
/>
</div>
</div>
</div>
</template>
<script>
import request from '@/utils/request'
import Pagination from '@/components/Pagination'
export default {
name: 'DeductList',
components: {
Pagination
},
data() {
return {
query: {
ItemId: undefined,
MinAmount: undefined,
MaxAmount: undefined
},
itemOptions: [],
list: [],
listLoading: false,
total: 0,
listQuery: {
currentPage: 1,
pageSize: 10
}
}
},
created() {
this.initItemOptions()
this.search()
},
methods: {
// 初始化品项选项
initItemOptions() {
request({
url: '/api/Extend/LqXmzl',
method: 'GET',
data: {
currentPage: 1,
pageSize: 1000
}
}).then(res => {
if (res.data && res.data.list) {
this.itemOptions = res.data.list
}
}).catch(() => {
this.itemOptions = []
})
},
// 查询数据
search() {
this.listLoading = true
const params = {
currentPage: this.listQuery.currentPage,
pageSize: this.listQuery.pageSize
}
if (this.query.ItemId) {
params.ItemId = this.query.ItemId
}
if (this.query.MinAmount !== null && this.query.MinAmount !== undefined && this.query.MinAmount !== '') {
params.MinAmount = this.query.MinAmount
}
if (this.query.MaxAmount !== null && this.query.MaxAmount !== undefined && this.query.MaxAmount !== '') {
params.MaxAmount = this.query.MaxAmount
}
request({
url: '/api/Extend/lqkdkdjlb/deduct-list',
method: 'GET',
data: params,
}).then(res => {
if (res.data && res.data.list) {
this.list = res.data.list
this.total = (res.data.pagination && res.data.pagination.total) || res.data.list.length || 0
} else {
this.list = []
this.total = 0
}
this.listLoading = false
}).catch(err => {
console.error('查询失败:', err)
this.$message({
type: 'error',
message: '查询失败,请重试',
duration: 1500
})
this.listLoading = false
this.list = []
this.total = 0
})
},
// 处理分页变化
handlePagination({ page, limit }) {
this.listQuery.currentPage = page
this.listQuery.pageSize = limit
this.search()
},
// 重置查询条件
reset() {
this.query = {
ItemId: undefined,
MinAmount: undefined,
MaxAmount: undefined
}
this.listQuery.currentPage = 1
this.listQuery.pageSize = 10
this.list = []
this.total = 0
this.search()
},
// 格式化金额
formatMoney(value) {
if (value === null || value === undefined || value === '') {
return '0.00'
}
const num = parseFloat(value)
if (isNaN(num)) {
return '0.00'
}
return num.toFixed(2)
},
// 格式化日期
formatDate(value) {
if (!value) {
return '无'
}
const date = new Date(value)
if (isNaN(date.getTime())) {
return '无'
}
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
},
// 获取品项分类的标签类型
getItemCategoryType(category) {
if (!category) {
return 'info'
}
if (category === '医美') {
return 'danger'
} else if (category === '科美') {
return 'warning'
} else if (category === '生美') {
return 'success'
}
return 'info'
},
// 获取扣减类型名称
getDeductTypeName(deductType) {
if (!deductType) {
return '无'
}
// 根据扣减类型返回对应的名称
const typeMap = {
'储值': '储值扣减',
'品项': '品项扣减',
'体验': '体验扣减',
'赠送': '赠送扣减'
}
return typeMap[deductType] || deductType
}
}
}
</script>
<style lang="scss" scoped>
.amount-value {
color: #F56C6C;
font-weight: 500;
}
</style>