step1.js
2.12 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
// packageUsedCar/pages/deliveryNote/components/step1/step1.js
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
import newApi from '~/packageUsedCar/api'
Component({
/**
* 组件的属性列表
*/
properties: {
// 当前步骤
step: {
type: [String, Number],
value: 1
},
// 详情数据
detail: {
type: Object,
value: {}
}
},
/**
* 组件的初始数据
*/
data: {
IMG_URL,
isLoading: false, // 加载状态
deliveryTips: [
'核实车款: 引导客户现场完成尾款支付,并确认款项到账。',
'核验人车: 核对客户身份信息,并与客户共同确认车辆信息及实际车况。',
'交接资料: 清点并交付车辆登记证、行驶证、车钥匙等重要物品。',
'签署确认: 引导客户签署《车辆交付确认书》,完成交付流程。'
]
},
/**
* 组件生命周期
*/
lifetimes: {
attached: function() {
// 组件实例进入页面节点树时执行
console.log('delivery-step组件已加载')
}
},
/**
* 组件的方法列表
*/
methods: {
/**
* 确认到店按钮点击事件
*/
confirmArrive: async function() {
let { detail, step } = this.data
// 如果正在加载或禁用,直接返回
if (this.data.isLoading) {
return
}
// 埋点
wx.$track.setTrackData(0, 'delivery_arrive_shop', {}, '', 7)
wx.$util.showLoading('加载中')
// 设置加载状态
this.setData({
isLoading: true
})
try {
const result = await newApi.confirmArrive({deliveryOrderId: detail.deliveryOrderId})
console.log(result)
if (result.data.code == 0) {
// 成功回调
this.triggerEvent('confirm', step)
this.triggerEvent('refreshlog')
} else {
throw result.data.msg
}
} catch (error) {
this.triggerEvent('openError', error)
} finally {
wx.hideLoading()
this.setData({
isLoading: false
})
}
}
}
})