recordingOrderPopup.js
4.07 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
// tabIndex/components/recordingOrderPopup/recordingOrderPopup.js
import api from '~/api/api'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
observer: function (n) {
if (n) {
this.getWaitinputorder()
}
}
},
outTradeNo: String,
title: String
},
/**
* 组件的初始数据
*/
data: {
IMG_URL,
itemFormObj: [
{
label: '交易参考号',
// prop: 'outTradeNo',
prop: 'tradeNo',
type: 'copy'
}, {
label: '支付时间',
prop: 'accountDate'
}, {
label: '支付金额',
prop: 'totalFee',
type: 'price'
},
// {
// label: '选择产品',
// prop: 'filmOrder',
// type: 'select'
// }
],
currentPage: 1,
pageSize: 10,
pages: '',
orderNoList: [],
popupSlotStyle: 'height: calc(100% - var(--fontSize120));',
filmOrderData: ['太阳膜', '精品升级']
},
/**
* 组件的方法列表
*/
methods: {
// 选择交易流水号
changeOrderNo(e) {
let { target } = e.currentTarget.dataset
let { orderNoList } = this.data
orderNoList.map(i => {
i.active = false
if (i.outTradeNo && i.outTradeNo == target.outTradeNo) {
i.active = true
}
return i
})
this.setData({ orderNoList, outTradeNo: '' })
},
// 产品类型切换
selectTap(e) {
let { index } = e.currentTarget.dataset
this.setData({
showSelect: !this.data.showSelect,
filmOrderIndex: index
});
},
closeSelect() {
this.setData({
showSelect: false
})
},
optionTap(e) {
let { index, orderIndex } = e.currentTarget.dataset
let prop = `orderNoList[${orderIndex}].filmOrder`
this.setData({
[prop]: index,
showSelect: false
})
},
// 复制单号
copyOutTradeNo(e) {
let { item } = e.currentTarget.dataset
wx.$util.setCopyData(`${item?.tradeNo}`)
},
restPageNum() {
this.setData({
currentPage: 1
})
this.getWaitinputorder()
},
scrollonReachBottom() {
let { pages, currentPage } = this.data
// 判断当前页是否是末页
if (pages == currentPage) return wx.$util.showToast('列表已到底')
this.setData({
currentPage: currentPage + 1
})
this.getWaitinputorder()
},
getWaitinputorder() {
let { currentPage, pageSize, orderNoList, outTradeNo } = this.data
api
.waitinputorder({ currentPage, pageSize })
.then(result => {
let { code, data } = result
if (code == 0) {
data.list.forEach(element => {
element.filmOrder = 0
element.accountDate = new Date(element.accountDate).format('yyyy-MM-dd hh:mm:ss')
if (outTradeNo == element.outTradeNo) {
element.active = true
} else {
element.active = false
}
})
this.setData({
orderNoList: currentPage == 1 ? data.list : [...orderNoList, ...data.list],
pages: data.pages,
triggered: false
})
}
})
.catch(err => { })
},
confirm() {
let { orderNoList } = this.data
let arr = orderNoList?.filter(v => v.active) || []
if (!arr.length) {
return wx.showToast({
title: '请选择交易参考号',
icon: 'none'
})
}
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
showOrderpop: false
})
let { accountDate, outTradeNo, totalFee, filmOrder, tradeNo } = arr[0]
arr?.length && this.triggerEvent('success', { accountDate, outTradeNo, totalFee, tradeNo, filmOrder })
},
cancel() {
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
showOrderpop: false
})
}
}
})