|
@@ -1,6 +1,7 @@
|
1
|
1
|
import React, { useState, useEffect } from "react";
|
2
|
2
|
import Taro, { useDidShow, AtSwipeAction } from "@tarojs/taro";
|
3
|
3
|
import { getOrderSub, deleteOrder } from "@/services/payOrder";
|
|
4
|
+import { View } from "@tarojs/components";
|
4
|
5
|
import NoData from '@/components/NoData'
|
5
|
6
|
import SpinBox from "@/components/Spin/SpinBox";
|
6
|
7
|
|
|
@@ -8,9 +9,6 @@ import ico_delete from '../../../assets/icons/ProCard/ico_delete.png'
|
8
|
9
|
import AlreadyUsed from "../AlreadyUsed";
|
9
|
10
|
import OrderCard from '../OrderCard'
|
10
|
11
|
import "./style.less";
|
11
|
|
-import { View } from "@tarojs/components";
|
12
|
|
-
|
13
|
|
-
|
14
|
12
|
|
15
|
13
|
const dict = {
|
16
|
14
|
0: { status: 0, isVerified: 0 },
|
|
@@ -22,28 +20,25 @@ export default (props) => {
|
22
|
20
|
const { type } = props;
|
23
|
21
|
const [list, setList] = useState([]);
|
24
|
22
|
const [IsPull, setPull] = useState(false);
|
25
|
|
- const [pageNum, setNumber] = useState(1);
|
|
23
|
+ const [pageNum, setNumber] = useState({ pageNum: 1 });
|
26
|
24
|
const [HasNextPage, setHasNextPage] = useState(true);
|
27
|
25
|
const [loading, setLoading] = useState(false)
|
28
|
26
|
|
29
|
27
|
useDidShow(() => {
|
30
|
|
- setNumber(1)
|
|
28
|
+ setNumber({ pageNum: 1 })
|
31
|
29
|
})
|
32
|
30
|
|
33
|
31
|
useEffect(() => {
|
34
|
32
|
if (pageNum) {
|
35
|
33
|
getList();
|
36
|
34
|
}
|
37
|
|
-
|
38
|
35
|
}, [pageNum]);
|
39
|
36
|
|
40
|
|
-
|
41
|
|
-
|
42
|
37
|
const getList = () => {
|
43
|
38
|
setLoading(true)
|
44
|
39
|
setHasNextPage(false);
|
45
|
40
|
getOrderSub({
|
46
|
|
- pageNum,
|
|
41
|
+ ...pageNum,
|
47
|
42
|
pageSize: 10,
|
48
|
43
|
isVerified: '',
|
49
|
44
|
...(type !== undefined ? dict[type] : null),
|
|
@@ -63,7 +58,8 @@ export default (props) => {
|
63
|
58
|
const pageLoadMore = () => {
|
64
|
59
|
// 页面上拉加载更多
|
65
|
60
|
if (HasNextPage) {
|
66
|
|
- setNumber(pageNum + 1);
|
|
61
|
+ const num = pageNum.pageNum + 1
|
|
62
|
+ setNumber({ pageNum: num });
|
67
|
63
|
}
|
68
|
64
|
};
|
69
|
65
|
|
|
@@ -76,7 +72,7 @@ export default (props) => {
|
76
|
72
|
useEffect(() => {
|
77
|
73
|
// 下拉刷新触发
|
78
|
74
|
if (IsPull) {
|
79
|
|
- if (pageNum === 1) {
|
|
75
|
+ if (pageNum.pageNum === 1) {
|
80
|
76
|
getList();
|
81
|
77
|
} else {
|
82
|
78
|
setNumber(1);
|
|
@@ -98,13 +94,14 @@ export default (props) => {
|
98
|
94
|
})
|
99
|
95
|
}
|
100
|
96
|
|
101
|
|
- const button = [{
|
102
|
|
- extClass: 'test-button',
|
103
|
|
- src: ico_delete
|
104
|
|
- }]
|
|
97
|
+ const handleFinishEvaluate = () => {
|
|
98
|
+ // 触发页面刷新
|
|
99
|
+ setNumber({ pageNum: 1 })
|
|
100
|
+ setShowCutover(false)
|
|
101
|
+ }
|
105
|
102
|
|
106
|
103
|
return (
|
107
|
|
- <View style={{ height: 'calc(100% - 46px)' }}>
|
|
104
|
+ <SpinBox loading={loading} style={{ height: 'calc(100% - 46px)' }}>
|
108
|
105
|
<scroll-view
|
109
|
106
|
scrollY
|
110
|
107
|
style={{ height: '100%' }}
|
|
@@ -114,41 +111,30 @@ export default (props) => {
|
114
|
111
|
list.length == 0 ?
|
115
|
112
|
<NoData /> :
|
116
|
113
|
<view className='complete-boxs'>
|
117
|
|
- <AlreadyUsed showCutover={showCutover} maskClosable={showCutover} onClose={onClose} item={ite} />
|
|
114
|
+ <AlreadyUsed showCutover={showCutover} maskClosable={showCutover} onClose={onClose} onFinish={handleFinishEvaluate} item={ite} />
|
118
|
115
|
{list.map((item, index) => {
|
119
|
116
|
/* 待支付 */
|
120
|
117
|
if (item.status === 0) {
|
121
|
118
|
return (
|
122
|
|
- <SpinBox loading={loading} className='index-container' >
|
123
|
|
-
|
124
|
|
- <view key={`${type}-${item.orderId}`} >
|
125
|
|
- <OrderCard item={item} handeDelete={slideButtonTap} />
|
126
|
|
- </view>
|
127
|
|
- </SpinBox>
|
|
119
|
+ <view key={`${type}-${item.orderId}`} >
|
|
120
|
+ <OrderCard item={item} handeDelete={slideButtonTap} />
|
|
121
|
+ </view>
|
128
|
122
|
);
|
129
|
123
|
}
|
130
|
124
|
/* 已使用 */
|
131
|
125
|
else if (item.isVerified == 1) {
|
132
|
126
|
return (
|
133
|
|
- <SpinBox loading={loading} className='index-container' >
|
134
|
|
-
|
135
|
|
- <view key={`${type}-${item.orderId}`}>
|
136
|
|
- <OrderCard item={item} setShowCutover={setShowCutover} show={show} />
|
137
|
|
- </view>
|
138
|
|
- </SpinBox>
|
139
|
|
-
|
|
127
|
+ <view key={`${type}-${item.orderId}`}>
|
|
128
|
+ <OrderCard item={item} setShowCutover={setShowCutover} show={show} />
|
|
129
|
+ </view>
|
140
|
130
|
);
|
141
|
131
|
}
|
142
|
132
|
/* 待核销 */
|
143
|
133
|
else {
|
144
|
134
|
return (
|
145
|
|
- <SpinBox loading={loading} className='index-container' >
|
146
|
|
-
|
147
|
|
- <view key={`${type}-${item.orderId}`}>
|
148
|
|
- <OrderCard item={item} />
|
149
|
|
- </view>
|
150
|
|
- </SpinBox>
|
151
|
|
-
|
|
135
|
+ <view key={`${type}-${item.orderId}`}>
|
|
136
|
+ <OrderCard item={item} />
|
|
137
|
+ </view>
|
152
|
138
|
);
|
153
|
139
|
}
|
154
|
140
|
})}
|
|
@@ -156,6 +142,6 @@ export default (props) => {
|
156
|
142
|
</view>
|
157
|
143
|
}
|
158
|
144
|
</scroll-view>
|
159
|
|
- </View>
|
|
145
|
+ </SpinBox>
|
160
|
146
|
)
|
161
|
147
|
};
|