|
@@ -2,9 +2,9 @@ import BlackSpot from "@/assets/icons/GuideCheck/BlackSpot.png";
|
2
|
2
|
import Taro from "@tarojs/taro";
|
3
|
3
|
import { Button, Icon, Text, Textarea } from "@tarojs/components";
|
4
|
4
|
|
5
|
|
-import { useState,useEffect } from "react";
|
|
5
|
+import { useState, useEffect } from "react";
|
6
|
6
|
import withLayout from "@/layouts";
|
7
|
|
-import { getOrderSub } from "@/services/payOrder";
|
|
7
|
+import { getOrderSub, refund } from "@/services/payOrder";
|
8
|
8
|
import image from "@/assets/icons/ProCard/8kb.jpg";
|
9
|
9
|
import food from "@/assets/icons/ProCard/food.png";
|
10
|
10
|
import ProCard_hot from "@/assets/icons/ProCard/ProCard_hot.png";
|
|
@@ -12,6 +12,32 @@ import CustomNav from "@/components/CustomNav";
|
12
|
12
|
import "./style.less";
|
13
|
13
|
import formatTime from "@/utils/formatTime";
|
14
|
14
|
|
|
15
|
+const options = [
|
|
16
|
+ {
|
|
17
|
+ title: "计划有变,没时间消费",
|
|
18
|
+ key: 1,
|
|
19
|
+ },
|
|
20
|
+ {
|
|
21
|
+ title: "误认为是外卖",
|
|
22
|
+ key: 2,
|
|
23
|
+ },
|
|
24
|
+ {
|
|
25
|
+ title: "没看清楚使用规则,要用时才发现限制很多",
|
|
26
|
+ key: 3,
|
|
27
|
+ },
|
|
28
|
+ {
|
|
29
|
+ title: "预约不上",
|
|
30
|
+ key: 4,
|
|
31
|
+ },
|
|
32
|
+ {
|
|
33
|
+ title: "店里更优惠",
|
|
34
|
+ key: 5,
|
|
35
|
+ },
|
|
36
|
+ {
|
|
37
|
+ title: "网友/朋友评价不好",
|
|
38
|
+ key: 6,
|
|
39
|
+ },
|
|
40
|
+];
|
15
|
41
|
|
16
|
42
|
export default withLayout((props) => {
|
17
|
43
|
const { router, person } = props;
|
|
@@ -22,10 +48,14 @@ export default withLayout((props) => {
|
22
|
48
|
const [view4, setView4] = useState(false);
|
23
|
49
|
const [view5, setView5] = useState(false);
|
24
|
50
|
const [view6, setView6] = useState(false);
|
|
51
|
+ // 说明
|
|
52
|
+ const [explain, setExplain] = useState();
|
25
|
53
|
|
26
|
54
|
const [list, setList] = useState([]);
|
27
|
|
- // 总价 totalPrice
|
28
|
|
- const [totalPrice, setTotalPrice] = useState({});
|
|
55
|
+ // 总价 totalPrice
|
|
56
|
+ const [totalPrice, setTotalPrice] = useState({});
|
|
57
|
+
|
|
58
|
+ const [checkeds, setCheckeds] = useState([1]);
|
29
|
59
|
|
30
|
60
|
const getData = (orderId) => {
|
31
|
61
|
Taro.showLoading();
|
|
@@ -43,27 +73,29 @@ export default withLayout((props) => {
|
43
|
73
|
getData(id);
|
44
|
74
|
}, []);
|
45
|
75
|
|
46
|
|
- const viewOK = () => {
|
47
|
|
- setView(!view);
|
48
|
|
- };
|
49
|
|
-
|
50
|
|
- const view2OK = () => {
|
51
|
|
- setView2(!view2);
|
|
76
|
+ const viewOK = (e) => {
|
|
77
|
+ if (checkeds.indexOf(e.key) > -1) {
|
|
78
|
+ setCheckeds(checkeds.filter((x) => x != e.key));
|
|
79
|
+ } else {
|
|
80
|
+ let arr = checkeds;
|
|
81
|
+ arr.push(e.key);
|
|
82
|
+ setCheckeds([...arr]);
|
|
83
|
+ }
|
52
|
84
|
};
|
53
|
85
|
|
54
|
|
- const view3OK = () => {
|
55
|
|
- setView3(!view3);
|
56
|
|
- };
|
57
|
|
-
|
58
|
|
- const view4OK = () => {
|
59
|
|
- setView4(!view4);
|
60
|
|
- };
|
61
|
|
- const view5OK = () => {
|
62
|
|
- setView5(!view5);
|
63
|
|
- };
|
64
|
|
-
|
65
|
|
- const view6OK = () => {
|
66
|
|
- setView6(!view6);
|
|
86
|
+ const onRefund = () => {
|
|
87
|
+ // console.log(explain, checkeds, "----onRefund----");
|
|
88
|
+ refund(id, {
|
|
89
|
+ refundDecription: checkeds?.map(x=>options.filter(y=>y.key==x)[0]?.title).join(';'),
|
|
90
|
+ refundReason: explain,
|
|
91
|
+ }).then((res) => {
|
|
92
|
+ Taro.showToast({
|
|
93
|
+ title: "退款成功",
|
|
94
|
+ icon: "none",
|
|
95
|
+ duration: 2000,
|
|
96
|
+ });
|
|
97
|
+ Taro.navigateBack({delta: 1})
|
|
98
|
+ });
|
67
|
99
|
};
|
68
|
100
|
|
69
|
101
|
useEffect(() => {
|
|
@@ -73,7 +105,7 @@ export default withLayout((props) => {
|
73
|
105
|
refundPrice: 0, //退款金额
|
74
|
106
|
};
|
75
|
107
|
list.map((x) => {
|
76
|
|
- total.cashback += x.cashback ;
|
|
108
|
+ total.cashback += x.cashback;
|
77
|
109
|
total.charges += x.charges;
|
78
|
110
|
total.refundPrice += x.charges - x.cashback;
|
79
|
111
|
});
|
|
@@ -100,7 +132,9 @@ export default withLayout((props) => {
|
100
|
132
|
<view class="wrapper" key={item.orderId}>
|
101
|
133
|
<view class="left-complete-one">
|
102
|
134
|
<image className="left-image-1" src={ProCard_hot}></image>
|
103
|
|
- <view className="left-viewText">返现¥{item.cashback/100}</view>
|
|
135
|
+ <view className="left-viewText">
|
|
136
|
+ 返现¥{item.cashback / 100}
|
|
137
|
+ </view>
|
104
|
138
|
<view className="title-image">
|
105
|
139
|
<image
|
106
|
140
|
className="image-1"
|
|
@@ -113,15 +147,20 @@ export default withLayout((props) => {
|
113
|
147
|
<view className="Pro-title">
|
114
|
148
|
<view className="title-text">
|
115
|
149
|
{item.packageDescription}
|
116
|
|
- <text className="title-money-2">数量:{item.amount}张</text>
|
|
150
|
+ <text className="title-money-2">
|
|
151
|
+ 数量:{item.amount}张
|
|
152
|
+ </text>
|
117
|
153
|
</view>
|
118
|
154
|
</view>
|
119
|
155
|
<text className="title-money">
|
120
|
|
- ¥{item.unitPrice/100}元<text className="title-money-2">门市价{item.standardPrice/100}元</text>
|
|
156
|
+ ¥{item.unitPrice / 100}元
|
|
157
|
+ <text className="title-money-2">
|
|
158
|
+ 门市价{item.standardPrice / 100}元
|
|
159
|
+ </text>
|
121
|
160
|
</text>
|
122
|
161
|
<view className="title-time">
|
123
|
162
|
有效期:{formatTime(item?.startTime, "yyyy/MM/dd")}-
|
124
|
|
- {formatTime(item.endTime, "yyyy/MM/dd")}
|
|
163
|
+ {formatTime(item.endTime, "yyyy/MM/dd")}
|
125
|
164
|
</view>
|
126
|
165
|
</view>
|
127
|
166
|
</view>
|
|
@@ -146,53 +185,21 @@ export default withLayout((props) => {
|
146
|
185
|
{/* 退款结束 */}
|
147
|
186
|
</view>
|
148
|
187
|
<view className="Refund-content">
|
149
|
|
- <text
|
150
|
|
- className={`Refund-star-view ${view ? "bg2" : "Refund-star-view"}`}
|
151
|
|
- onClick={() => viewOK()}
|
152
|
|
- >
|
153
|
|
- 计划有变,没时间消费
|
154
|
|
- </text>
|
155
|
|
- <text
|
156
|
|
- className={`Refund-star-view2 ${view2 ? "bg2" : "Refund-star-view2"}`}
|
157
|
|
- onClick={() => view2OK()}
|
158
|
|
- >
|
159
|
|
- 误认为是外卖
|
160
|
|
- </text>
|
161
|
|
- <text
|
162
|
|
- className={`Refund-star-view3 ${view3 ? "bg2" : "Refund-star-view3"}`}
|
163
|
|
- onClick={() => view3OK()}
|
164
|
|
- >
|
165
|
|
- 没看清楚使用规则,要用时才发现限制很多
|
166
|
|
- </text>
|
167
|
|
- <text
|
168
|
|
- className={`Refund-star-view4 ${view4 ? "bg2" : "Refund-star-view4"}`}
|
169
|
|
- onClick={() => view4OK()}
|
170
|
|
- >
|
171
|
|
- 预约不上
|
172
|
|
- </text>
|
173
|
|
- <text
|
174
|
|
- className={`Refund-star-view5 ${view5 ? "bg2" : "Refund-star-view5"}`}
|
175
|
|
- onClick={() => view5OK()}
|
176
|
|
- >
|
177
|
|
- 店里更优惠
|
178
|
|
- </text>
|
179
|
|
- <text
|
180
|
|
- className={`Refund-star-view6 ${view6 ? "bg2" : "Refund-star-view6"}`}
|
181
|
|
- onClick={() => view6OK()}
|
182
|
|
- >
|
183
|
|
- 网友/朋友评价不好
|
184
|
|
- </text>
|
185
|
|
- {/*
|
186
|
|
- <view>
|
187
|
|
- {
|
188
|
|
- list.map(item => {
|
189
|
|
- return <text onClick={() => view4OK()} key={item.value} className={item.className}>
|
190
|
|
- {item.name}
|
191
|
|
- </text>
|
192
|
|
-
|
193
|
|
- })
|
194
|
|
- }
|
195
|
|
- </view> */}
|
|
188
|
+ {options.map((x) => {
|
|
189
|
+ return (
|
|
190
|
+ <text
|
|
191
|
+ className={`Refund-star-view${x.key} ${
|
|
192
|
+ checkeds.indexOf(x.key) > -1
|
|
193
|
+ ? "bg2"
|
|
194
|
+ : `Refund-star-view${x.key}`
|
|
195
|
+ }`}
|
|
196
|
+ key={x.key}
|
|
197
|
+ onClick={() => viewOK(x)}
|
|
198
|
+ >
|
|
199
|
+ {x.title}
|
|
200
|
+ </text>
|
|
201
|
+ );
|
|
202
|
+ })}
|
196
|
203
|
</view>
|
197
|
204
|
|
198
|
205
|
<view className="Refund-Content-box">
|
|
@@ -206,16 +213,23 @@ export default withLayout((props) => {
|
206
|
213
|
</view>
|
207
|
214
|
</view>
|
208
|
215
|
<view class="section">
|
209
|
|
- <Textarea placeholder="请补充退款说明(选填)!" confirm-type="done" />
|
|
216
|
+ <Textarea
|
|
217
|
+ placeholder="请补充退款说明(选填)!"
|
|
218
|
+ onInput={(e) => setExplain(e.detail.value)}
|
|
219
|
+ confirm-type="done"
|
|
220
|
+ />
|
210
|
221
|
</view>
|
211
|
222
|
<view className="money-title">
|
212
|
|
- 实付金额: <text className="money-name">{totalPrice.charges/100}元</text>
|
|
223
|
+ 实付金额:{" "}
|
|
224
|
+ <text className="money-name">{totalPrice.charges / 100}元</text>
|
213
|
225
|
</view>
|
214
|
226
|
<view className="money-title">
|
215
|
|
- 已获返现: <text className="money-name">{totalPrice.cashback/100}元</text>
|
|
227
|
+ 已获返现:{" "}
|
|
228
|
+ <text className="money-name">{totalPrice.cashback / 100}元</text>
|
216
|
229
|
</view>
|
217
|
230
|
<view className="money-title">
|
218
|
|
- 退款金额: <text className="money-name">{totalPrice.refundPrice/100}元</text>
|
|
231
|
+ 退款金额:{" "}
|
|
232
|
+ <text className="money-name">{totalPrice.refundPrice / 100}元</text>
|
219
|
233
|
</view>
|
220
|
234
|
<view className="ul-li-text">
|
221
|
235
|
<view className="ul-li-view"></view>
|
|
@@ -233,7 +247,9 @@ export default withLayout((props) => {
|
233
|
247
|
</view>
|
234
|
248
|
|
235
|
249
|
<view className="button-info">
|
236
|
|
- <Button className="button-box">提交申请</Button>
|
|
250
|
+ <Button className="button-box" onClick={() => onRefund()}>
|
|
251
|
+ 提交申请
|
|
252
|
+ </Button>
|
237
|
253
|
</view>
|
238
|
254
|
</view>
|
239
|
255
|
);
|