appointment.vue
14.4 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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
<template>
<div class="container" style="margin:10px;">
<el-form :inline="true" :model="model" class="demo-form-inline">
<el-form-item label="用户ID">
<el-input v-model="model.UserId" placeholder="用户ID"></el-input>
</el-form-item>
<el-form-item label="开始时间">
<el-date-picker v-model="model.startdate" type="date" placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item label="至">
<el-date-picker v-model="model.enddate" type="date" placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item label="状态">
<el-select v-model="model.State" placeholder="请选择" @change="SelectedState">
<el-option label="查所有" value="-1"></el-option>
<el-option label="已预约" value="0"></el-option>
<el-option label="已取消" value="1"></el-option>
<el-option label="已完成" value="2">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="success" @click="SubmitCard">查询</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit" style="float: right;">导出</el-button>
</el-form-item>
</el-form>
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="date" label="预约设置ID" width="180" v-if="false">
<template slot-scope="scope">
{{scope.row.ReservationId}}
</template>
</el-table-column>
<el-table-column prop="date" label="用户ID" width="80">
<template slot-scope="scope">
{{scope.row.UserId}}
</template>
</el-table-column>
<el-table-column prop="date" label="预约的车辆ID" width="180" v-if="false">
<template slot-scope="scope">
{{scope.row.CarId}}
</template>
</el-table-column>
<el-table-column prop="date" label="用户微信名" width="180">
<template slot-scope="scope">
{{scope.row.UserName}}
</template>
</el-table-column>
<el-table-column prop="date" label="手机号" width="120">
<template slot-scope="scope">
{{scope.row.UserPhone}}
</template>
</el-table-column>
<el-table-column prop="date" label="备用手机号" width="120">
<template slot-scope="scope">
{{scope.row.BeiYongPhone}}
</template>
</el-table-column>
<el-table-column prop="date" label="贵姓" width="120">
<template slot-scope="scope">
{{scope.row.Full_Name}}
</template>
</el-table-column>
<el-table-column prop="date" label="状态" width="100">
<template slot-scope="scope">
<el-tag type="success">
{{scope.row.State==0?'已预约':scope.row.State==1?'已取消':scope.row.State==2?'已完成':'未知'}}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="date" label="车型" width="180">
<template slot-scope="scope">
{{scope.row.CarModel}}
</template>
</el-table-column>
<el-table-column prop="date" label="颜色" width="80">
<template slot-scope="scope">
{{scope.row.CarColour}}
</template>
</el-table-column>
<el-table-column prop="date" label="划痕" width="80">
<template slot-scope="scope">
{{scope.row.Scratch}}
</template>
</el-table-column>
<el-table-column prop="date" label="腐蚀" width="80">
<template slot-scope="scope">
{{scope.row.Corrosion}}
</template>
</el-table-column>
<el-table-column prop="date" label="破损" width="80">
<template slot-scope="scope">
{{scope.row.BeDamaged}}
</template>
</el-table-column>
<el-table-column prop="date" label="飞漆" width="80">
<template slot-scope="scope">
{{scope.row.FlyingPaint}}
</template>
</el-table-column>
<el-table-column prop="date" label="地址" width="280">
<template slot-scope="scope">
{{scope.row.Address}}
</template>
</el-table-column>
<el-table-column prop="date" label="预约服务时间" width="180">
<template slot-scope="scope">
{{scope.row.MakeTime}}
</template>
</el-table-column>
<el-table-column prop="date" label="添加时间" width="180" v-if="false">
<template slot-scope="scope">
{{scope.row.AddTime}}
</template>
</el-table-column>
<el-table-column prop="date" label="修改时间" width="180" v-if="false">
<template slot-scope="scope">
{{scope.row.UpdateTime}}
</template>
</el-table-column>
<el-table-column prop="date" label="备注">
<template slot-scope="scope">
{{scope.row.Remarks}}
</template>
</el-table-column>
<el-table-column prop="date" label="编辑" width="180" v-if="false">
<template slot-scope="scope">
<el-button type="primary" @click="EidtRecord(scope.row)">编辑</el-button>
</template>
</el-table-column>
<el-table-column prop="date" label="操作" width="220" fixed="right">
<template slot-scope="scope">
<el-button type="danger" @click="DelInfo(scope.row.id)" v-if="false">删除</el-button>
<el-button type="success" @click="Results(scope.row)" :disabled="scope.row.State==0?false:true">
预约结算</el-button>
</template>
</el-table-column>
<!-- <el-table-column prop="date" label="修改状态" width="180">
<template slot-scope="scope">
<el-button type="primary" @click="UpdateState(scope.row.id)">修改状态</el-button>
</template>
</el-table-column> -->
<el-table-column prop="date" label="预约结算" width="180" fixed="right" v-if="false">
<template slot-scope="scope">
<el-button type="success" @click="Results(scope.row)" :disabled="scope.row.State==0?false:true">
预约结算</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination background layout="prev, pager, next" :total="model.TotalCount" @current-change='Pages'
style="text-align:center;margin-top: 10px;">
</el-pagination>
<el-dialog title="提示" width="50%" :visible.sync="dialogVisible">
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="用户名">
<el-input v-model="form.UserName"></el-input>
</el-form-item>
<el-form-item label="用户电话">
<el-input v-model="form.UserPhone"></el-input>
</el-form-item>
<el-form-item label="地址">
<el-input v-model="form.Address"></el-input>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.Remarks"></el-input>
</el-form-item>
<el-form-item label="车型">
<el-input v-model="form.CarModel"></el-input>
</el-form-item>
<el-form-item label="颜色">
<el-input v-model="form.CarColour"></el-input>
</el-form-item>
<el-form-item label="划痕">
<el-radio-group v-model="form.Scratch">
<el-radio label="良好">良好</el-radio>
<el-radio label="一般">一般</el-radio>
<el-radio label="中等">中等</el-radio>
<el-radio label="严重">严重</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="腐蚀">
<el-radio-group v-model="form.Corrosion">
<el-radio label="良好">良好</el-radio>
<el-radio label="一般">一般</el-radio>
<el-radio label="中等">中等</el-radio>
<el-radio label="严重">严重</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="破损">
<el-radio-group v-model="form.BeDamaged">
<el-radio label="良好">良好</el-radio>
<el-radio label="一般">一般</el-radio>
<el-radio label="中等">中等</el-radio>
<el-radio label="严重">严重</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="飞漆">
<el-radio-group v-model="form.FlyingPaint">
<el-radio label="良好">良好</el-radio>
<el-radio label="一般">一般</el-radio>
<el-radio label="中等">中等</el-radio>
<el-radio label="严重">严重</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="SubmitRecord">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {
GetAppointmentRecord,
DeleteRecord,
UpdateRecord,
Collection,
deriveExcel,
UpdateState,
UpdResultTime,
} from '../../api/AppointmentRecord.js'
import {
UpdnowNum,
SendPaymentAppointment,
UpdVipNum
} from '../../api/user.js'
import {
UpdReservationStatus
} from '../../api/RobotReservation.js'
import utils from '../../utils/utils.js'
import {
ReservationAreaList
} from '../../api/ReservationArea.js'
export default {
data() {
return {
form: {
"id": 0,
"ReservationId": 0,
"UserId": 0,
"UserName": "",
"UserPhone": "",
"CarId": 0,
"CarModel": "",
"CarColour": "",
"Scratch": "",
"Corrosion": "",
"BeDamaged": "",
"FlyingPaint": "",
"Address": "",
"State": 0,
"Remarks": "",
"AddTime": "2022-01-05T07:38:12.364Z",
"UpdateTime": "2022-01-05T07:38:12.364Z"
},
dialogVisible: false,
tableData: [],
models: {
ids: 0
},
model: {
"UserId": 0,
"State": '-1',
"startdate": "",
"enddate": "",
"KeyWord": "",
"TotalCount": 0,
"PageIndex": 1,
"PageSize": 20,
"Sort": [{
"Field": "MakeTime",
"Type": 1
}]
},
StateModel: {
"id": 0,
"state": 0
},
// 付款发送短信
paramModel: {
"param": "",
"mobile": ""
},
// 修改滚屏预约状态
UpdRobot: {
"userName": "",
"ReservationStatus": ""
},
// 导出Excel参数
ExcelModel: {
"startdate": "",
"enddate": "",
"UserId": 0,
"State": -1
}
}
},
created() {
this.ShowRecord()
},
methods: {
//导出
onSubmit() {
this.ExcelModel.startdate=this.model.startdate
this.ExcelModel.enddate=this.model.enddate
this.ExcelModel.State=this.model.State
this.ExcelModel.UserId=this.model.UserId
deriveExcel(this.ExcelModel).then(res => {
console.log('导出数据', res)
if (res.data.code == 200) {
this.$message.success('导出成功')
// 派发附件下载
this.exportCostlistp(res.data.data)
} else {
this.$message.error('导出失败')
}
})
},
// 派发附件下载
exportCostlistp(url) {
let a = document.createElement("a");
a.download = url;
a.style.display = "none";
a.href = url
document.body.appendChild(a);
a.click();
URL.revokeObjectURL(a.href); // 释放URL 对象
document.body.removeChild(a); // 删除 a 标签
},
// 完成预约线下收款
async Results(item) {
console.log('预约结算数据', item)
Collection(item.id).then(res => {
this.$message.success(res.data.message)
this.UpdRobotReservation(item)
// 完成单数
UpdnowNum(item.UserId).then(res => {
console.log('修改后的数据单量', res)
if (res.data.code == 200) {
console.log('单量完成加1')
} else {
console.log('单量完成失败')
}
})
// 修改VIP
let models = {
UserId: item.UserId
}
UpdVipNum(models).then(res => {
if (res.data.code == 200) {
console.log('特权次数已用')
} else {
console.log('特权次数未用')
}
})
// 付款时间
UpdResultTime(item.id).then(res => {
if (res.data.code == 200) {
console.log('付款时间更新成功')
} else {
console.log('付款时间更新失败')
}
})
// 发送短信
this.paramModel.mobile = item.UserPhone
SendPaymentAppointment(this.paramModel).then(res => {
console.log('付款数据啊', res)
if (res.data.data.code == '000000') {
console.log('发送短信成功')
} else {
console.log('发送短信失败')
}
})
console.log('付款参数', this.paramModel)
this.ShowRecord()
})
},
// // 添加滚动设置
UpdRobotReservation(item) {
this.UpdRobot.userName = item.UserName
this.UpdRobot.ReservationStatus = '已完成'
UpdReservationStatus(this.UpdRobot).then(res => {
console.log('数据', res)
if (res.data.code == 200) {
console.log('修改完毕')
} else {
console.log('修改失败')
}
})
},
EidtRecord(item) {
this.dialogVisible = true
console.log('item', item)
this.form.id = item.id
this.form.ReservationId = item.ReservationId
this.form.UserId = item.UserId
this.form.CarId = item.CarId
this.form.Remarks = item.Remarks
this.form.Address = item.Address
this.form.UserName = item.UserName
this.form.UserPhone = item.UserPhone
this.form.CarModel = item.CarModel
this.form.CarColour = item.CarColour
this.form.Scratch = item.Scratch
this.form.Corrosion = item.Corrosion
this.form.BeDamaged = item.BeDamaged
this.form.FlyingPaint = item.FlyingPaint
// this.form.UpdateTime=utils.formatTime(new Date(),"yyyy-MM-dd")
},
SubmitRecord() {
UpdateRecord(this.form).then(res => {
console.log('resXiugai', res)
if (res.data.code == 200) {
this.$message.success('修改成功')
this.dialogVisible = false
this.ShowRecord()
} else {
this.$message.watch('修改失败')
}
})
},
ShowRecord() {
GetAppointmentRecord(this.model).then(res => {
console.log(res)
if (res.data.data.total > 0) {
this.$message.success('查询成功')
res.data.data.rows.forEach((item, index) => {
item.AddTime = utils.formatTime(item.AddTime, "yyyy-MM-dd")
item.UpdateTime = utils.formatTime(item.UpdateTime, "yyyy-MM-dd")
item.MakeTime = utils.formatTime(item.MakeTime, "yyyy-MM-dd")
})
this.tableData = res.data.data.rows
this.model.TotalCount = res.data.data.total
} else {
this.$message.error('暂无数据')
}
})
},
// 状态查询预约情况
SelectedState(e) {
console.log('eee', e)
this.model.State = parseInt(e)
this.model.KeyWord = ''
this.model.startdate = ''
this.model.enddate = ''
this.ShowRecord()
},
// 提交查询
SubmitCard() {
this.ShowRecord()
},
// 删除信息
DelInfo(id) {
this.models.ids = id
console.log('数据ID', id)
DeleteRecord(this.models).then(res => {
console.log('删除后的数', res)
if (res.data.code == 200) {
this.$message.success('删除成功')
this.ShowRecord()
} else {
this.$message.warn('删除失败')
}
})
},
Pages(e) {
this.model.PageIndex = e
this.ShowRecord()
}
}
}
</script>
<style>
</style>