CarQuotationDetail.js
4.54 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
// packageEquity/pages/carQuotation/CarQuotationDetail/CarQuotationDetail.js
import { getOrderDetail,getQuotationInfoById } from '../../../api'
let timer = null
Page({
/**
* 页面的初始数据
*/
data: {
textNameObj: {
confirmName: '下一步·去签名(4/4)(10s)',
// editName: '修改',
// cancelName: '稍后处理',
timer: null
}
},
// 倒计时10s功能
countDownTimer() {
let sec = 10
let { id, orderId, timer } = this.data
let that = this
timer = setInterval(() => {
let objNameStr = 'textNameObj.confirmName'
// const str = '前往提单(10s)'
that.setData({
[objNameStr]: `下一步·去签名(4/4)(${sec}s)`
})
sec--
if (sec == -1) {
clearInterval(timer) // 清除定时器
// 跳转提单页面
// this.navigator()
// 跳转签名页面
wx.$router.redirectTo('signature', { id, orderId })
}
}, 1000)
this.setData({timer})
},
btnTap(e) {
console.log(e)
let { name } = e.detail
let { id, orderId, timer } = this.data
if (name == 'confirm') {
clearInterval(timer)
wx.$router.redirectTo('signature', { id, orderId })
} else {
// this.triggerEvent('editSave')
this.navigator()
// wx.$router.reLaunch('packageEquity.equityPage')
// wx.$router.reLaunch('packageEquity.index')
}
},
navigator() {
let { orderId } = this.data
wx.$router.go('serviceInfo', {
orderId: orderId,
apiName: 'handler'
})
},
getQuotationInfoById() {
let { id } = this.data
getQuotationInfoById({ id }).then(res => {
let { code, data } = res
console.log(res)
let { orderId, payId, merchantAddress, merchantName4s, quotationGoodsInfoList } = data
quotationGoodsInfoList
if (quotationGoodsInfoList&"ationGoodsInfoList.length) {
quotationGoodsInfoList.forEach(item=>{
if (item.position) {
const fieldMap = {
"4大件": "燃油车4大件服务",
"3电": "新能源3电服务",
"6大件": "新能源6大件服务",
// 在这里可以添加更多的替换规则
};
// 如果输入字段在字段映射中有匹配项,则进行替换,否则保持不变
fieldMap[item.position]&&( item.position = fieldMap[item.position])
}
if (item.quotationGoodsServiceItemsRelationDTOList&&item.quotationGoodsServiceItemsRelationDTOList.length) {
item.serviceItems = item.quotationGoodsServiceItemsRelationDTOList.reduce((prev,subItm,index)=>{
let unit = index == 0 ? '':'/'
prev += unit+subItm.serviceName
return prev
},'')
}
})
}
this.setData({
orderCode: payId,
merchantAddress,
merchantName4s,
orderId,
['orderDetail.quotationGoodsInfoList']:quotationGoodsInfoList
// quotationGoodsInfoList
// id
})
this.createWxQrcode()
})
},
getOrderDetail() {
let { orderCode, orderDetail } = this.data
getOrderDetail({ orderCode }).then(res => {
let { code, data } = res
data.orderTime = data.orderTime ? wx.$util.tsFormatTime(data.orderTime, 'Y年M月D日 h:m:s') : ''
let paySuccessDate = data?.paySuccessDate || new Date()
data.paySuccessDate = wx.$util.tsFormatTime(paySuccessDate, 'Y年M月D日 h:m:s')
if (code == 0) {
this.setData({
orderDetail: {
...orderDetail,
...data.customer,
...data
}
})
}
})
},
onRoute(options) {
let { orderDetail, orderCode, orderId, id } = options
this.setData({
orderCode: orderCode,
orderDetail,
orderId,
id
})
this.getOrderDetail()
this.getQuotationInfoById()
// this.countDownTimer()
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.countDownTimer()
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
})