funeralcremation.vue
12.7 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
<template>
<view class="page">
<pyh-nv ref="nv" :config="nvConfig"></pyh-nv>
<view class="listBox" :style="{'padding-top':(pageTop+'px')}">
<view class="content">
<view class="message-list">
<view class="titleall-box">
<view class="titleall-left"><view class="titleall-left-line"></view>预约日期</view>
<view class="" style="font-size: 32rpx;font-weight: 600;display: flex;" @click="bspersonshow = true">{{bspersoninfo.name}} <u-icon name="arrow-down-fill" color="#2979ff" size="20"></u-icon></view>
</view>
<u-picker :show="bspersonshow" @confirm="bspersonxz" @close="bspersongb" :columns="bspersonselector" defaultIndex="2"></u-picker>
<view>
<!-- 插入模式 -->
<uni-calendar class="uni-calendar--hook" :selected="info.selected" :showMonth="false" @change="change" @monthSwitch="monthSwitch" />
</view>
</view>
<view class="message-list">
<view class="titleall-box">
<view class="titleall-left"><view class="titleall-left-line"></view>预约时间</view>
</view>
<view class="recharge-list">
<view class="list" @click="xztime(index)" v-for="(item,index) in sjlist" :key="index" :class="{ 'action': item.status }" v-if="sjlist.length > 0">
<view class="price">
<text>{{item.time}}</text>
</view>
</view>
<view class="list" v-for="(item,index) in sjlist" :key="index" :class="{ 'action': item.status }" v-if="sjlist.length == 0 || sjlist == '' || sjlist == ''">
<span>没有空闲时间</span>
</view>
</view>
</view>
<view class="message-list">
<view class="info-box">
<view class="info-box-list">
<view class="serve">
<view class="serve-title">火化炉</view>
<view class="serve-right" @click="hhlopen">
<text>*</text>{{from.cremationFurnaceInfo}}
<image src="../../static/down3.png"></image>
</view>
</view>
</view>
</view>
</view>
<!-- 火化炉弹窗 -->
<u-picker :show="hhlshow" @confirm="hhlqr" @close="hhlclose" :columns="columns"></u-picker>
<view class="tips">
<view class="tips-top">温馨提示:</view>
<view>
请于预约时间段提前30分钟到达殡仪馆,办理相关手续,高温炉火化时间为50秒左右,普通炉火化时间约为40分钟左右,具遗体情况可能会提前或延长火化时间的情况:请于谅解!
</view>
</view>
<view class="page-footer">
<view class="footer-buy">
<view class="cart-add" @click="open">
<view><image src="../../static/btn3.png"></image></view>
<view class="cart-add-text"><image src="../../static/phone.png"></image><text>联系电话</text></view>
</view>
<view class="buy-at" @click="funeralresult">
<image src="../../static/btn4.png"></image>
<text>立即预约</text>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
/**
* 获取任意时间
*/
function getDate(date, AddDayCount = 0) {
if (!date) {
date = new Date();
}
if (typeof date !== 'object') {
date = date.replace(/-/g, '/');
}
const dd = new Date(date);
dd.setDate(dd.getDate() + AddDayCount); // 获取AddDayCount天后的日期
const y = dd.getFullYear();
const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1; // 获取当前月份的日期,不足10补0
const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate(); // 获取当前几号,不足10补0
return {
fullDate: y + '-' + m + '-' + d,
year: y,
month: m,
date: d,
day: dd.getDay()
};
}
export default {
name: "index",
data() {
return {
OrderType: 0,
nvConfig:{
title:"遗体火化",
bgColor:"#ffffff",
color:"#000000",
fixedAssist:{
hide:true,
},
},
bzpersonlist:[],
bspersoninfo:{
name:"",
obituaryOrderNumber:0,
},
bspersonshow:false,
bspersonselector: [
// ['中国', '美国', '日本']
],
info: {
lunar: true,
range: true,
insert: false,
selected: []
},
sjlist:[],
from:{
// obituaryOrderNumber:24681216,
scheduledCremationDate:"",
scheduledCremationTime:"",
cremationFurnaceInfo:"火化炉选择",
contactPhone: "联系电话",
cremationDate: "2023-09-06",
cremationTime: "2023-09-20",
// 经办日期
handledTime: "2023-09-19",
handlerName: "姓名",
rating: "未评价",
status:"等通知"
},
hhlshow:false,
// 火化炉完整列表
hhlwzlist:[],
hhlid:"",
columns: [
['拣灰炉', '平板炉']
],
// 当前天数
nowdate:"",
// 报丧人的数据
bsform: {
name: '',
intro: '',
sex: '难受'
},
};
},
onPageScroll(e) {this.$refs.nv.pageScroll(e)},
computed:{
pageTop(){return parseInt(88*uni.getSystemInfoSync().windowWidth/750) + uni.getSystemInfoSync().statusBarHeight}
},
onLoad(params) {
this.OrderType = params.type;
var now = new Date();
this.nowdate = now
this.from.scheduledCremationDate = now
// this.gethhsjsl(this.parseTime(now));
this.getbsinfo();
this.zxhhllist(now);
},
onReady() {
this.$nextTick(() => {
this.showCalendar = true;
});
// TODO 模拟请求异步同步数据
setTimeout(() => {
this.info.date = getDate(new Date(), -30).fullDate;
this.info.startDate = getDate(new Date(), -60).fullDate;
this.info.endDate = getDate(new Date(), 30).fullDate;
this.info.selected = [
{
date: getDate(new Date(), -3).fullDate,
info: '打卡'
},
{
date: getDate(new Date(), -2).fullDate,
info: '签到',
data: {
custom: '自定义信息',
name: '自定义消息头'
}
},
{
date: getDate(new Date(), -1).fullDate,
info: '已打卡'
}
];
}, 2000);
},
methods:{
// 火化炉列表获取
zxhhllist(date){
this.API.zxhhllist().then(res=>{
console.log("火化炉",res);
this.columns = [];
this.hhlwzlis = []
var info = []
for(let i = 0;i < res.data.length;i++){
for(let s = 0;s < res.data[i].funeralCrematoriumFurnaceInfoPos.length;s++){
info.push(res.data[i].funeralCrematoriumFurnaceInfoPos[s].furnaceName)
this.hhlwzlist.push(res.data[i].funeralCrematoriumFurnaceInfoPos[s])
if(i == 0 && s == 0){
console.log("时间");
this.hhlid = res.data[i].funeralCrematoriumFurnaceInfoPos[s].id
this.from.cremationFurnaceInfo = res.data[i].funeralCrematoriumFurnaceInfoPos[s].furnaceName
this.zxhqhhltimelist(date);
}
}
}
this.columns.push(info)
console.log("整理火化炉信息",this.hhlwzlist);
})
},
open(){
console.log("123",this.contentshow);
var that = this
uni.showModal({
title: '联系电话',
content: '如有问题请拨打电话:' + "02836241643",
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
// 获取用户的报丧记录
getbsinfo(){
console.log("userinfo",uni.getStorageSync("USERS_KEY"));
var info = {
userId:uni.getStorageSync("USERS_KEY").userId
}
this.API.getbsinfo(info).then(res=>{
console.log("获取用户报丧信息",res);
this.bzpersonlist = res.rows;
this.bspersoninfo.name = res.rows[0].deceasedName
this.bspersoninfo.obituaryOrderNumber = res.rows[0].orderNumber
var info = []
for(let i = 0;i < res.rows.length;i++){
info.push(res.rows[i].deceasedName)
}
this.bspersonselector.push(info)
})
},
// 选择预约时间
xztime(index){
console.log(index);
for(let i = 0;i < this.sjlist.length;i++){
if(index == i){
this.sjlist[i].status = true;
this.from.scheduledCremationTime = this.sjlist[i].time
}else{
this.sjlist[i].status = false;
}
}
},
// 获取预约时间和数量
gethhsjsl(times){
this.API.gethhsjsl().then(res=>{
console.log("获取预约时间和数量",res);
console.log("时间",times);
this.sjlist = []
for(let i = 0;i < res.data.length;i++){
if(res.data[i].DateStr == times){
for(let s = 0;s < res.data[i].timeAndTotalList.length;s++){
var info = {
time:"",
total:0,
residue:0,
status:false
}
info.time = res.data[i].timeAndTotalList[s].timePeriod;
info.total = res.data[i].timeAndTotalList[s].totalNumber;
info.residue = res.data[i].timeAndTotalList[s].restNumber;
if(s == 0){
info.status = true
this.from.scheduledCremationTime = res.data[i].timeAndTotalList[s].timePeriod;
}
this.sjlist.push(info)
}
}
}
console.log("this.sjlist",this.sjlist);
})
},
// 报丧人确认
bspersonxz(e){
console.log(e);
this.bspersoninfo.name = e.value[0]
this.bspersoninfo.obituaryOrderNumber = this.bzpersonlist[e.indexs[0]].orderNumber
console.log(this.bspersoninfo);
this.bspersonshow = false;
},
bspersongb(){
this.bspersonshow = false;
},
// 火化炉点击事件
hhlopen(){
this.hhlshow = true
},
// 火化炉确认事件
hhlqr(e){
console.log(e,this.hhlwzlist[e.indexs[0]]);
this.hhlid = this.hhlwzlist[e.indexs[0]].id;
console.log("火化炉id",this.hhlid);
this.zxhqhhltimelist(this.nowdate);
this.hhlshow = false;
this.from.cremationFurnaceInfo = e.value[0];
},
// 最新获取时间火化炉时间
zxhqhhltimelist(time){
var infos = {
furnaceId:this.hhlid,
useStatus:"2",
date:time
}
this.API.gethhsjsl(infos).then(res=>{
console.log("最新时间列表",res);
this.sjlist = []
for(let i = 0;i < res.data.length;i++){
for(let s = 0;s < res.data[i].timeAndTotalList.length;s++){
var info = {
time:"",
status:false
}
info.time = res.data[i].timeAndTotalList[s].timePeriod;
// if(s == 0){
// info.status = true
// this.from.scheduledCremationTime = res.data[i].timeAndTotalList[s].timePeriod;
// }
this.sjlist.push(info)
}
}
})
},
// 火化炉取消事件
hhlclose(){
this.hhlshow = false;
},
funeralresult(){
console.log("user",uni.getStorageSync('USERS_KEY'));
var user = uni.getStorageSync('USERS_KEY')
this.from.handlerName = user.nickName
this.from.handledTime = user.loginDate;
this.from.userId = uni.getStorageSync('USERS_KEY').userId
this.from.contactPhone = uni.getStorageSync('USERS_KEY').phonenumber
this.from.cremationDate = this.from.scheduledCremationDate
this.from.cremationTime = this.from.scheduledCremationDate
// this.from.scheduledCremationTime = this.from.scheduledCremationTime
if(this.from.scheduledCremationTime == ''){
uni.showToast({
title: '请选择预约时间',
//将值设置为 success 或者直接不用写icon这个参数
icon: 'error',
//显示持续时间为 2秒
duration: 2000
})
return
}
this.from.obituaryOrderNumber = this.bspersoninfo.obituaryOrderNumber
console.log("from",this.from);
// return
this.API.hhlyy(this.from).then(res=>{
console.log("遗体火化预约",res);
})
uni.navigateTo({
url: '/pages/funeralresult/funeralresult',
})
},
// 选择日期返回火化日期
change(e) {
console.log('change 返回:', e);
this.zxhqhhltimelist(e.fulldate);
this.this.from.scheduledCremationTime = ''
// this.gethhsjsl(e.fulldate)
this.from.scheduledCremationDate = e.fulldate;
// 模拟动态打卡
if (this.info.selected.length > 5) return;
this.info.selected.push({
date: e.fulldate,
info: '打卡'
});
},
confirm(e) {
console.log('confirm 返回:', e);
},
monthSwitch(e) {
console.log('monthSwitchs 返回:', e);
},
// 时间搓数据处理
parseTime(timestamp){
var date = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
var Y = date.getFullYear() + '-';
var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
var D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
var h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
var m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':';
var s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds());
let strDate = Y+M+D;
console.log(strDate) //2020-05-08 17:44:56
return strDate;
}
}
}
</script>
<style scoped lang="scss">
@import 'funeralcremation.scss';
</style>