|
@@ -8,7 +8,7 @@ import withLayout from '@/layouts'
|
8
|
8
|
import formatPrice from "@/utils/formatPrice"
|
9
|
9
|
import AssessModel from "@/components/AssessModel"
|
10
|
10
|
|
11
|
|
-import { generateOrder, orderDelete, orderInfo } from "@/services/order"
|
|
11
|
+import { orderPrepay, orderDelete, orderInfo, orderRefund } from "@/services/order"
|
12
|
12
|
// import BottomMoadl from '@/components/BottomMoadl/index'
|
13
|
13
|
|
14
|
14
|
|
|
@@ -84,10 +84,88 @@ export default withLayout((props) => {
|
84
|
84
|
|
85
|
85
|
}, [orderId])
|
86
|
86
|
|
|
87
|
+ const requestPayment = (params) => {
|
|
88
|
+ Taro.hideLoading()
|
|
89
|
+ console.log("🚀 ~ file: index.jsx ~ line 92 ~ requestPayment ~ params", params)
|
|
90
|
+ Taro.requestPayment({
|
|
91
|
+ ...params,
|
|
92
|
+
|
|
93
|
+ package: params.packageValue,
|
|
94
|
+ success: () => {
|
|
95
|
+ Taro.showToast({
|
|
96
|
+ title: "支付成功",
|
|
97
|
+ icon: "success",
|
|
98
|
+ duration: 1000,
|
|
99
|
+ }).then(() => {
|
|
100
|
+ setTimeout(() => {
|
|
101
|
+ Taro.reLaunch({
|
|
102
|
+ url: `/pages/index/index?tab=1`
|
|
103
|
+ })
|
|
104
|
+ }, 400)
|
|
105
|
+ })
|
|
106
|
+ },
|
|
107
|
+ fail: (e) => {
|
|
108
|
+ Taro.showToast({
|
|
109
|
+ title: "支付失败",
|
|
110
|
+ icon: "none",
|
|
111
|
+ duration: 2000,
|
|
112
|
+ });
|
|
113
|
+ Taro.reLaunch({
|
|
114
|
+ // url: `/pages/MineUserAll/AllOrder/index?tabJump=1`
|
|
115
|
+ })
|
|
116
|
+ },
|
|
117
|
+ })
|
|
118
|
+ }
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
87
|
124
|
const pay = () => {
|
|
125
|
+ orderPrepay(orderId, {
|
|
126
|
+ payType: 'wx',
|
|
127
|
+
|
|
128
|
+ }).then((e) => {
|
|
129
|
+ console.log('订单返回', e);
|
|
130
|
+ Taro.showLoading({
|
|
131
|
+ title: '支付中',
|
|
132
|
+ })
|
|
133
|
+ requestPayment(e)
|
|
134
|
+
|
|
135
|
+ })
|
88
|
136
|
//支付逻辑
|
89
|
137
|
}
|
90
|
138
|
|
|
139
|
+ //退单
|
|
140
|
+ const orderRefunds = () => {
|
|
141
|
+ Taro.showLoading({
|
|
142
|
+ title: '退单申请中',
|
|
143
|
+ })
|
|
144
|
+ orderRefund(orderId).then(() => {
|
|
145
|
+ Taro.showLoading()
|
|
146
|
+
|
|
147
|
+ Taro.showToast({
|
|
148
|
+ title: "退单成功",
|
|
149
|
+ icon: "none",
|
|
150
|
+ duration: 2000,
|
|
151
|
+ }).then(() => {
|
|
152
|
+ setTimeout(() => {
|
|
153
|
+ Taro.navigateBack({
|
|
154
|
+ delta: 1
|
|
155
|
+ })
|
|
156
|
+ }, 400)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+ })
|
|
160
|
+ }).catch(() => {
|
|
161
|
+ Taro.showLoading()
|
|
162
|
+ Taro.showToast({
|
|
163
|
+ title: "请重试",
|
|
164
|
+ icon: "error",
|
|
165
|
+ duration: 2000,
|
|
166
|
+ });
|
|
167
|
+ })
|
|
168
|
+ }
|
91
|
169
|
const startModle = () => {
|
92
|
170
|
setIsAssessVisible(true)
|
93
|
171
|
|
|
@@ -114,10 +192,10 @@ export default withLayout((props) => {
|
114
|
192
|
<View>作业面积:<Text>{orderInfos?.amount}</Text></View>
|
115
|
193
|
<View>需求时间:<Text>{formatTimes(orderInfos?.appointmentDate, 'yyyy-MM-dd')}</Text></View>
|
116
|
194
|
<View>下单时间:<Text>{formatTimes(orderInfos?.createDate, 'yyyy-MM-dd')}</Text></View>
|
117
|
|
- <View>订单状态:<Text >{orderInfos?.payStatus}</Text></View>
|
|
195
|
+ <View>订单状态:<Text style={{ color: `${stateStyle}` }} >{stateType}</Text></View>
|
118
|
196
|
<View className='View-LiftTextBotton'>
|
119
|
197
|
<View className='feiyongStyle'>费用:<Text className='feiyongStyle-charges' >{formatPrice(orderInfos?.charges)}</Text></View>
|
120
|
|
- <View className='feiyongStyle'>状态:<Text style={{ color: `${stateStyle}` }} className='feiyongStyle-stateStyle' >{stateType}</Text></View>
|
|
198
|
+ <View className='feiyongStyle'>状态:<Text style={{ color: `${stateStyle}` }} className='feiyongStyle-stateStyle' >{orderInfos?.payStatus === 1 ? '已付款' : '待付款'}</Text></View>
|
121
|
199
|
</View>
|
122
|
200
|
</View>
|
123
|
201
|
<View className='BottomtBut' >
|
|
@@ -126,13 +204,20 @@ export default withLayout((props) => {
|
126
|
204
|
stateType == '已完成' ? <></>
|
127
|
205
|
: stateType == '进行中' ? <></>
|
128
|
206
|
: stateType == '待评价' ? <ButtontWX butText='评价' onClick={startModle} butWidth={323} butHeight={49} butFontSize={16} butBorderRadius={49} />
|
129
|
|
- : stateType == '待作业' ? <ButtontWX butText='退单' onClick={cancelPay} butWidth={323} butHeight={49} butFontSize={16} butBorderRadius={49} />
|
|
207
|
+ : stateType == '待作业' ? <ButtontWX butText='退单' onClick={orderRefunds} butWidth={323} butHeight={49} butFontSize={16} butBorderRadius={49} />
|
130
|
208
|
: stateType == '待付款' ? <>
|
131
|
209
|
<ButtontWX butText='取消' styleType onClick={cancelPay} butWidth={150} butHeight={39} butFontSize={16} butBorderRadius={49} />
|
132
|
210
|
<ButtontWX butText='支付' onClick={pay} butWidth={150} butHeight={39} butFontSize={16} butBorderRadius={49} />
|
133
|
211
|
</> : stateType == '已付款' ?
|
134
|
|
- <ButtontWX butText='退单' onClick={cancelPay} butWidth={323} butHeight={49} butFontSize={16} butBorderRadius={49} />
|
135
|
|
- : stateType == '已退单' ? <></> : <></>
|
|
212
|
+ <ButtontWX butText='退单' onClick={orderRefunds} butWidth={323} butHeight={49} butFontSize={16} butBorderRadius={49} />
|
|
213
|
+
|
|
214
|
+ // <ButtontWX butText={`${orderInfos?.payStatus == 3 ? '退单申请中' : '退单'}`} disabled={orderInfos?.payStatus == 3 ? true : false} onClick={orderInfos?.payStatus == 3 ? '' : orderRefunds} butWidth={323} butHeight={49} butFontSize={16} butBorderRadius={49} />
|
|
215
|
+ : stateType == '待作业' ? <ButtontWX butText={`${orderInfos?.payStatus == 3 ? '退单申请中' : '退单'}`} disabled={orderInfos?.payStatus == 3 ? true : false} onClick={orderInfos?.payStatus == 3 ? '' : orderRefunds} butWidth={323} butHeight={49} butFontSize={16} butBorderRadius={49} />
|
|
216
|
+
|
|
217
|
+ : stateType == '已退单' ? <></>
|
|
218
|
+ : stateType == '退单申请中' ? <ButtontWX butText={`${orderInfos?.payStatus == 3 ? '退单申请中' : '退单'}`} disabled={orderInfos?.payStatus == 3 ? true : false} onClick={orderInfos?.payStatus == 3 ? '' : orderRefunds} butWidth={323} butHeight={49} butFontSize={16} butBorderRadius={49} />
|
|
219
|
+
|
|
220
|
+ : <></>
|
136
|
221
|
}
|
137
|
222
|
</>
|
138
|
223
|
|