|
@@ -9,30 +9,33 @@ import { getEarningsOrderTab, getEarningsOrderList } from "../../../service";
|
9
|
9
|
export default class Index extends Component {
|
10
|
10
|
state = {
|
11
|
11
|
current: 0,
|
12
|
|
- orderType: 2,//默认为推广订单
|
|
12
|
+ orderType: 2, //默认为推广订单
|
13
|
13
|
value: "", //搜索值
|
14
|
14
|
tabList: [{ title: "全部" }],
|
15
|
15
|
page: 1, //页数
|
16
|
16
|
loading: false, //加载状态
|
17
|
17
|
totalPages: 1, // 添加总页数
|
18
|
18
|
isNoMore: false,
|
19
|
|
- orderList: [],//订单列表
|
20
|
|
- userInfo: {},//个人信息
|
|
19
|
+ orderList: [], //订单列表
|
|
20
|
+ userInfo: {}, //个人信息
|
21
|
21
|
};
|
22
|
22
|
componentDidShow() {
|
23
|
23
|
const { router } = Taro.getCurrentInstance();
|
24
|
24
|
const params = router.params;
|
25
|
|
- this.setState({
|
26
|
|
- orderType: params.type||2,
|
27
|
|
- },()=>{
|
28
|
|
- this.getEarningsOrderTab();
|
29
|
|
- });
|
|
25
|
+ this.setState(
|
|
26
|
+ {
|
|
27
|
+ orderType: params.type || 2,
|
|
28
|
+ },
|
|
29
|
+ () => {
|
|
30
|
+ this.getEarningsOrderTab();
|
|
31
|
+ }
|
|
32
|
+ );
|
30
|
33
|
}
|
31
|
34
|
// 获取个人信息
|
32
|
35
|
getUserInfo = async () => {
|
33
|
36
|
const res = await getUserInfo();
|
34
|
37
|
this.setState({ userInfo: res });
|
35
|
|
- }
|
|
38
|
+ };
|
36
|
39
|
// 获取收益订单列表
|
37
|
40
|
getEarningsOrderList = async (isRefresh) => {
|
38
|
41
|
const { page } = this.state;
|
|
@@ -43,18 +46,17 @@ export default class Index extends Component {
|
43
|
46
|
page,
|
44
|
47
|
page_size: 10,
|
45
|
48
|
search_name: this.state.value,
|
46
|
|
- user_type:this.state.orderType
|
|
49
|
+ user_type: this.state.orderType,
|
47
|
50
|
});
|
48
|
51
|
|
49
|
|
- this.setState(
|
50
|
|
- (prevState) => ({
|
51
|
|
- orderList: isRefresh
|
52
|
|
- ? res.income_list
|
53
|
|
- : [...prevState.orderList, ...res.income_list],
|
54
|
|
- totalPages: res.total_pages,
|
55
|
|
- loading: false,
|
56
|
|
- isNoMore: res.total_pages <= page,
|
57
|
|
- }));
|
|
52
|
+ this.setState((prevState) => ({
|
|
53
|
+ orderList: isRefresh
|
|
54
|
+ ? res.income_list
|
|
55
|
+ : [...prevState.orderList, ...res.income_list],
|
|
56
|
+ totalPages: res.total_pages,
|
|
57
|
+ loading: false,
|
|
58
|
+ isNoMore: res.total_pages <= page,
|
|
59
|
+ }));
|
58
|
60
|
};
|
59
|
61
|
// 获取收益订单tab
|
60
|
62
|
getEarningsOrderTab = async () => {
|
|
@@ -62,21 +64,24 @@ export default class Index extends Component {
|
62
|
64
|
const newTabList = res.tabs.map((item) => ({
|
63
|
65
|
title: item,
|
64
|
66
|
}));
|
65
|
|
- this.setState({
|
66
|
|
- tabList: newTabList,
|
67
|
|
- },()=>{
|
68
|
|
- this.getEarningsOrderList(true);
|
69
|
|
- });
|
|
67
|
+ this.setState(
|
|
68
|
+ {
|
|
69
|
+ tabList: newTabList,
|
|
70
|
+ },
|
|
71
|
+ () => {
|
|
72
|
+ this.getEarningsOrderList(true);
|
|
73
|
+ }
|
|
74
|
+ );
|
70
|
75
|
};
|
71
|
76
|
// 订单类型切换
|
72
|
77
|
handleOrderTypeClick = (type) => {
|
73
|
|
- this.setState({ orderType: type, page: 1, value: '' },()=>{
|
|
78
|
+ this.setState({ orderType: type, page: 1, value: "" }, () => {
|
74
|
79
|
this.getEarningsOrderList(true);
|
75
|
80
|
});
|
76
|
81
|
};
|
77
|
82
|
// tab切换
|
78
|
83
|
handleTabClick = (index) => {
|
79
|
|
- this.setState({ current: index, page: 1, value: '' },()=>{
|
|
84
|
+ this.setState({ current: index, page: 1, value: "" }, () => {
|
80
|
85
|
this.getEarningsOrderList(true);
|
81
|
86
|
});
|
82
|
87
|
};
|
|
@@ -119,15 +124,22 @@ export default class Index extends Component {
|
119
|
124
|
}
|
120
|
125
|
};
|
121
|
126
|
render() {
|
122
|
|
- const { current, tabList, value, orderList, loading, isNoMore, orderType } = this.state;
|
|
127
|
+ const { current, tabList, value, orderList, loading, isNoMore, orderType } =
|
|
128
|
+ this.state;
|
123
|
129
|
return (
|
124
|
130
|
<View className="index">
|
125
|
131
|
{/* 订单类型切换 */}
|
126
|
132
|
<View className="order-type-switch">
|
127
|
|
- <View className={`order-type-item ${orderType == 2 ? "active" : ""}`} onClick={() => this.handleOrderTypeClick(2)}>
|
|
133
|
+ <View
|
|
134
|
+ className={`order-type-item ${orderType == 2 ? "active" : ""}`}
|
|
135
|
+ onClick={() => this.handleOrderTypeClick(2)}
|
|
136
|
+ >
|
128
|
137
|
<Text>推广订单</Text>
|
129
|
138
|
</View>
|
130
|
|
- <View className={`order-type-item ${orderType == 1 ? "active" : ""}`} onClick={() => this.handleOrderTypeClick(1)}>
|
|
139
|
+ <View
|
|
140
|
+ className={`order-type-item ${orderType == 1 ? "active" : ""}`}
|
|
141
|
+ onClick={() => this.handleOrderTypeClick(1)}
|
|
142
|
+ >
|
131
|
143
|
<Text>购买订单</Text>
|
132
|
144
|
</View>
|
133
|
145
|
</View>
|
|
@@ -177,49 +189,53 @@ export default class Index extends Component {
|
177
|
189
|
</View>
|
178
|
190
|
<Text className="pay-status">{item.state_text}</Text>
|
179
|
191
|
</View> */}
|
180
|
|
- {/* 订单信息 */}
|
181
|
|
- <View className="order-info">
|
182
|
|
- <View className="order-details">
|
183
|
|
- <View className="detail-item">
|
184
|
|
- <Text className="label">订单编号:</Text>
|
185
|
|
- <Text className="value">{item.order_number}</Text>
|
186
|
|
- <Text
|
187
|
|
- className="copy-text"
|
188
|
|
- onClick={() => this.handleCopy(item.order_number)}
|
189
|
|
- >
|
190
|
|
- 复制
|
191
|
|
- </Text>
|
192
|
|
- </View>
|
193
|
|
- <View className="detail-item">
|
194
|
|
- <Text className="label">下单时间:</Text>
|
195
|
|
- <Text className="value">{item.pay_time}</Text>
|
|
192
|
+ {/* 订单信息 */}
|
|
193
|
+ <View className="order-info">
|
|
194
|
+ <View className="order-details">
|
|
195
|
+ <View className="detail-item">
|
|
196
|
+ <Text className="label">订单编号:</Text>
|
|
197
|
+ <Text className="value">{item.order_number}</Text>
|
|
198
|
+ <Text
|
|
199
|
+ className="copy-text"
|
|
200
|
+ onClick={() => this.handleCopy(item.order_number)}
|
|
201
|
+ >
|
|
202
|
+ 复制
|
|
203
|
+ </Text>
|
|
204
|
+ </View>
|
|
205
|
+ <View className="detail-item">
|
|
206
|
+ <Text className="label">下单时间:</Text>
|
|
207
|
+ <Text className="value">{item.pay_time}</Text>
|
|
208
|
+ </View>
|
196
|
209
|
</View>
|
197
|
|
- </View>
|
198
|
|
- {/* <View className="member-info">
|
|
210
|
+ {/* <View className="member-info">
|
199
|
211
|
<Image className="member-icon" src={vip} />
|
200
|
212
|
<Text className="member-text">闲鱼会员</Text>
|
201
|
213
|
</View> */}
|
202
|
|
- </View>
|
|
214
|
+ </View>
|
203
|
215
|
|
204
|
|
- {/* 产品信息 */}
|
205
|
|
- <View className="product-info">
|
206
|
|
- <Image mode="aspectFill" className="product-image" src={item.item_pic_url} />
|
207
|
|
- <View className="product-details">
|
208
|
|
- <Text className="product-name">
|
209
|
|
- {item.item_title}
|
210
|
|
- </Text>
|
211
|
|
- {orderType == 2 && (
|
|
216
|
+ {/* 产品信息 */}
|
|
217
|
+ <View className="product-info">
|
|
218
|
+ <Image
|
|
219
|
+ mode="aspectFill"
|
|
220
|
+ className="product-image"
|
|
221
|
+ src={item.item_pic_url}
|
|
222
|
+ />
|
|
223
|
+ <View className="product-details">
|
|
224
|
+ <Text className="product-name">{item.item_title}</Text>
|
212
|
225
|
<View className="promotion-info">
|
213
|
226
|
<View className="tag">预估收入</View>
|
214
|
|
- <Text className="amount">¥{item.assess_amount_text}</Text>
|
|
227
|
+ <Text className="amount">
|
|
228
|
+ ¥
|
|
229
|
+ {orderType == 2
|
|
230
|
+ ? item.assess_amount_text_promotion_yuan
|
|
231
|
+ : item.assess_amount_text_buy_yuan}
|
|
232
|
+ </Text>
|
|
233
|
+ </View>
|
|
234
|
+ <View className="payment-info"></View>
|
|
235
|
+ <View className="payment-info">
|
|
236
|
+ <Text className="label">实付金额:</Text>
|
|
237
|
+ <Text className="amount">¥{item.actual_paid_fee}</Text>
|
215
|
238
|
</View>
|
216
|
|
- )}
|
217
|
|
- <View className="payment-info">
|
218
|
|
- </View>
|
219
|
|
- <View className="payment-info">
|
220
|
|
- <Text className="label">实付金额:</Text>
|
221
|
|
- <Text className="amount">¥{item.actual_paid_fee}</Text>
|
222
|
|
- </View>
|
223
|
239
|
</View>
|
224
|
240
|
</View>
|
225
|
241
|
</View>
|
|
@@ -239,11 +255,14 @@ export default class Index extends Component {
|
239
|
255
|
{/* 没有更多 */}
|
240
|
256
|
{isNoMore && (
|
241
|
257
|
<View className="no-more">
|
242
|
|
- <AtDivider fontSize={18} fontColor="#949494" content="我是有底线的" />
|
|
258
|
+ <AtDivider
|
|
259
|
+ fontSize={18}
|
|
260
|
+ fontColor="#949494"
|
|
261
|
+ content="我是有底线的"
|
|
262
|
+ />
|
243
|
263
|
</View>
|
244
|
264
|
)}
|
245
|
265
|
</View>
|
246
|
266
|
);
|
247
|
267
|
}
|
248
|
268
|
}
|
249
|
|
-
|