orderPromptPop.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
86
87
88
89
90
91
92
93
94
// components/orderPromptPop/orderPromptPop.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean
},
popupSlotStyle: {
type: String,
value: 'height: calc(100% - var(--fontSize120));'
},
height: {
type: String,
value: 'var(--fontSize500)'
},
includesChildHeight: {
type: String,
value: 'var(--fontSize980)'
},
sceneObj: {
observer: function(v) {
// 是否是扫码核销或再次下单,是的话不显示补录入口
if (Object.keys(v)?.length) {
let { payTypeList } = this.data
let index = payTypeList?.findIndex(v => v.value == 5)
if (index > -1) {
payTypeList?.splice(index, 1)
this.setData({
payTypeList,
includesChildHeight: 'var(--fontSize870)'
})
}
this.setData({
payTypeList
})
}
}
}
},
/**
* 组件的初始数据
*/
data: {
infoData: {},
payTypeList: [{
label: '收款方为门店收款',
value: '3'
}, {
label: '收款方为嘀加且属于对公转账收款',
value: '4'
}, {
label: '收款方为嘀加二维码收款',
value: '5',
tips: '适用于已有交易收款流水需补录订单时'
}, {
label: '收款方为嘀加二维码收款',
value: '6',
tips: '适用于多笔订单一笔流水付款'
}]
},
/**
* 组件的方法列表
*/
methods: {
chooseParent(e) {
let { type } = e.currentTarget.dataset
this.setData({
'infoData.payFlag': type
})
},
chooseChild(e) {
let { type } = e.currentTarget.dataset
this.setData({
'infoData.payType': type
})
},
cancel() {
this.triggerEvent('cancel')
},
confirm() {
let { infoData } = this.data
if (!infoData.payFlag || (infoData.payFlag == 2 && !infoData.payType)) {
return wx.$util.showToast('请选择订单收款方式')
}
this.cancel()
this.triggerEvent('confirm', infoData)
}
}
})