|
@@ -1,26 +1,22 @@
|
1
|
|
-import 'package:farmer_client/pages/orderInfo/widgets/star.dart';
|
2
|
|
-import 'package:farmer_client/services/pay.dart';
|
3
|
|
-import 'package:farmer_client/widgets/DefaultButton.dart';
|
4
|
1
|
import 'package:ff_stars/ff_stars.dart';
|
5
|
2
|
import 'package:flutter/material.dart';
|
6
|
3
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
7
|
4
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
8
|
5
|
import 'package:fluttertoast/fluttertoast.dart';
|
9
|
6
|
import 'package:get/get.dart';
|
10
|
|
-import 'package:farmer_client/widgets/Modal.dart' as modal;
|
11
|
7
|
import 'package:fluwx/fluwx.dart' as fluwx;
|
12
|
8
|
import 'package:tobias/tobias.dart' as tobias;
|
|
9
|
+import 'package:farmer_client/services/pay.dart';
|
|
10
|
+import 'package:farmer_client/services/orderAPI.dart';
|
|
11
|
+import 'package:farmer_client/utils/processStatus.dart';
|
|
12
|
+import 'package:farmer_client/widgets/DefaultButton.dart';
|
|
13
|
+import 'package:farmer_client/widgets/Bold.dart';
|
|
14
|
+import 'package:farmer_client/widgets/OrderInfoCard.dart';
|
|
15
|
+import 'package:farmer_client/widgets/layout/BasicPage.dart';
|
|
16
|
+import 'package:farmer_client/widgets/Modal.dart' as modal;
|
|
17
|
+import 'package:farmer_client/models/entities/OrderInfoModel.dart';
|
13
|
18
|
|
14
|
|
-import '../../models/entities/OrderInfoModel.dart';
|
15
|
|
-import '../../services/orderAPI.dart';
|
16
|
|
-import '../../widgets/OrderInfoCard.dart';
|
17
|
|
-import '../../widgets/layout/BasicPage.dart';
|
18
|
|
-
|
19
|
|
-// class OrderContentInfo {
|
20
|
|
-// String title;
|
21
|
|
-// Color styleColor;
|
22
|
|
-// StyleObj ({ required this.title, required this.styleColor});
|
23
|
|
-// }
|
|
19
|
+import './widgets/PayItem.dart';
|
24
|
20
|
|
25
|
21
|
class OrderPageInfo extends BasicPage {
|
26
|
22
|
final id = Rx<String>('');
|
|
@@ -29,6 +25,7 @@ class OrderPageInfo extends BasicPage {
|
29
|
25
|
final orderInfoContent = Rx<OrderInfoModel>(OrderInfoModel());
|
30
|
26
|
final evalText = Rx<String>('');
|
31
|
27
|
final evalStars = Rx<num>(-1);
|
|
28
|
+ var processStatus;
|
32
|
29
|
|
33
|
30
|
// orderStates
|
34
|
31
|
@override
|
|
@@ -37,17 +34,16 @@ class OrderPageInfo extends BasicPage {
|
37
|
34
|
super.beforeShow();
|
38
|
35
|
if (Get.arguments['id'] != null) {
|
39
|
36
|
id(Get.arguments['id']);
|
40
|
|
- print(Get.arguments);
|
41
|
|
-
|
42
|
|
- orderStateText(Get.arguments['title']);
|
43
|
|
- orderStateColor(Get.arguments['styleColor']);
|
44
|
37
|
|
45
|
38
|
orderInfo(id()).then((value) {
|
46
|
39
|
EasyLoading.show(status: '数据加载中...');
|
47
|
|
-
|
48
|
|
- orderInfoContent(OrderInfoModel.fromJson(value));
|
|
40
|
+ OrderInfoModel orderInfo = OrderInfoModel.fromJson(value);
|
|
41
|
+ processStatus = getProcessStatus(orderInfo);
|
|
42
|
+ ProcessSign processSign = getProcessSign(processStatus);
|
|
43
|
+ orderStateText(processSign.label);
|
|
44
|
+ orderStateColor(processSign.color);
|
|
45
|
+ orderInfoContent(orderInfo);
|
49
|
46
|
EasyLoading.dismiss();
|
50
|
|
-
|
51
|
47
|
});
|
52
|
48
|
}
|
53
|
49
|
}
|
|
@@ -64,233 +60,153 @@ class OrderPageInfo extends BasicPage {
|
64
|
60
|
orderStateText: orderStateText(),
|
65
|
61
|
orderStateColor: orderStateColor()),
|
66
|
62
|
),
|
67
|
|
- // Obx(() => _BottomWidget(id: id())),
|
68
|
|
-
|
69
|
63
|
Obx(
|
70
|
64
|
() => Container(
|
71
|
65
|
padding: EdgeInsets.fromLTRB(15, 50.w, 15, 0),
|
72
|
|
- child: _bottomJudgment(id.value)),
|
|
66
|
+ child: _action(context, id.value)),
|
73
|
67
|
),
|
74
|
68
|
],
|
75
|
69
|
);
|
76
|
70
|
}
|
77
|
71
|
|
78
|
|
- Widget _bottomJudgment(String id) {
|
79
|
|
- return orderStateText.value == '已完成'
|
80
|
|
- ? Text('')
|
81
|
|
- : orderStateText.value == '进行中'
|
82
|
|
- ? Text('')
|
83
|
|
- : orderStateText.value == '待评价'
|
84
|
|
- ? DefaultButton(
|
85
|
|
- color: const Color(0xffffffff),
|
86
|
|
- backColor: const Color(0xFFFF703B),
|
87
|
|
- width: 300.w,
|
88
|
|
- height: 49.h,
|
89
|
|
- text: '评价',
|
90
|
|
- onPressed: () {
|
91
|
|
- modal.showDialog(
|
92
|
|
- title: '评价此订单',
|
93
|
|
- content: Container(
|
94
|
|
- alignment: Alignment.center,
|
95
|
|
- child: Container(
|
96
|
|
- margin:
|
97
|
|
- const EdgeInsets.fromLTRB(15, 20, 15, 20),
|
98
|
|
- child: Column(
|
99
|
|
- children: [
|
100
|
|
- Container(
|
101
|
|
- padding: const EdgeInsets.fromLTRB(
|
102
|
|
- 0, 0, 0, 10),
|
103
|
|
- decoration: const BoxDecoration(
|
104
|
|
- border: Border(
|
105
|
|
- bottom: BorderSide(
|
106
|
|
- width: 0.8,
|
107
|
|
- color: Color(0x20000000)
|
108
|
|
- // 0x17000000
|
109
|
|
- ))),
|
110
|
|
- child: Row(
|
111
|
|
- children: [
|
112
|
|
- Text(
|
113
|
|
- '满意度:',
|
114
|
|
- style: TextStyle(
|
115
|
|
- fontSize: 17.sp,
|
116
|
|
- fontWeight: FontWeight.bold),
|
117
|
|
- ),
|
118
|
|
- FFStars(
|
119
|
|
- //https://pub.dev/packages/ff_stars
|
120
|
|
- normalStar: Image.asset(
|
121
|
|
- 'images/icons/starOff.png'),
|
122
|
|
- selectedStar: Image.asset(
|
123
|
|
- 'images/icons/starOn.png'),
|
124
|
|
- starsChanged:
|
125
|
|
- (realStars, selectedStars) {
|
126
|
|
- evalStars(realStars);
|
127
|
|
- print(
|
128
|
|
- "real: $selectedStars, final: $realStars");
|
129
|
|
- },
|
130
|
|
- step: 1,
|
131
|
|
- defaultStars: 0,
|
132
|
|
- ),
|
133
|
|
- ],
|
134
|
|
- ),
|
135
|
|
- ),
|
136
|
|
- Container(
|
137
|
|
- margin: const EdgeInsets.fromLTRB(
|
138
|
|
- 0, 20, 0, 0),
|
139
|
|
- width: 300.w,
|
140
|
|
- height: 100.w,
|
141
|
|
- decoration: BoxDecoration(
|
142
|
|
- border: Border.all(
|
143
|
|
- color: Color(0x20000000),
|
144
|
|
- width: 0.8,
|
145
|
|
- ),
|
146
|
|
- ),
|
147
|
|
- child: TextField(
|
148
|
|
- minLines: 6,
|
149
|
|
- maxLines: 6,
|
150
|
|
- style: TextStyle(
|
151
|
|
- fontSize: 17.sp, height: 1.5),
|
152
|
|
- decoration: const InputDecoration(
|
153
|
|
- isCollapsed: true,
|
154
|
|
- border: InputBorder.none,
|
155
|
|
- counterText: '',
|
156
|
|
- hintText: '请输入评价内容',
|
157
|
|
- floatingLabelBehavior:
|
158
|
|
- FloatingLabelBehavior.never,
|
159
|
|
- ),
|
160
|
|
- onChanged: (e) {
|
161
|
|
- evalText(e);
|
162
|
|
- },
|
163
|
|
- ),
|
164
|
|
- )
|
165
|
|
- ],
|
166
|
|
- ),
|
167
|
|
- )),
|
168
|
|
- onCancel: () => true,
|
169
|
|
- onConfirm: () {
|
170
|
|
- if (evalStars.value != -1 && evalText.value != '') {
|
171
|
|
- orderEvaluation(
|
172
|
|
- id, evalStars.value, evalText.value)
|
173
|
|
- .then((value) {
|
174
|
|
- Fluttertoast.showToast(msg: '评价成功!');
|
175
|
|
- Get.offAllNamed('/order');
|
176
|
|
- });
|
177
|
|
- } else {
|
178
|
|
- Fluttertoast.showToast(msg: '请完整选择评分或输入评价内容');
|
179
|
|
- return false;
|
180
|
|
- }
|
181
|
|
- });
|
182
|
|
- },
|
183
|
|
- margin: const EdgeInsets.all(0),
|
184
|
|
- fontSize: 20.sp,
|
185
|
|
- radius: 24.5.w,
|
186
|
|
- )
|
187
|
|
- : orderStateText.value == '待作业'
|
188
|
|
- ? DefaultButton(
|
189
|
|
- color: const Color(0xffffffff),
|
190
|
|
- backColor: const Color(0xFFFF703B),
|
191
|
|
- width: 300.w,
|
192
|
|
- height: 49.h,
|
193
|
|
- text: '退单',
|
194
|
|
- onPressed: () {
|
195
|
|
- modal.showDialog(
|
196
|
|
- title: '提示',
|
197
|
|
- content: Container(
|
198
|
|
- alignment: Alignment.center,
|
199
|
|
- child: Text('确定要申请退单吗?'),
|
200
|
|
- ),
|
201
|
|
- onCancel: () => true,
|
202
|
|
- onConfirm: () => {
|
203
|
|
- orderRefund(id).then((value) {
|
204
|
|
- Fluttertoast.showToast(msg: '退单成功!');
|
205
|
|
- Get.offAllNamed('/order');
|
206
|
|
- }),
|
207
|
|
- });
|
208
|
|
- },
|
209
|
|
- margin: const EdgeInsets.all(0),
|
210
|
|
- fontSize: 20.sp,
|
211
|
|
- radius: 24.5.w,
|
212
|
|
- )
|
213
|
|
- : orderStateText.value == '已付款'
|
214
|
|
- ? DefaultButton(
|
215
|
|
- color: const Color(0xffffffff),
|
216
|
|
- backColor: const Color(0xFFFF703B),
|
217
|
|
- width: 300.w,
|
218
|
|
- height: 49.h,
|
219
|
|
- text: '退单',
|
220
|
|
- onPressed: () {
|
221
|
|
- modal.showDialog(
|
222
|
|
- title: '提示',
|
223
|
|
- content: Container(
|
224
|
|
- alignment: Alignment.center,
|
225
|
|
- child: Text('确定要申请退单吗?'),
|
226
|
|
- ),
|
227
|
|
- onCancel: () => true,
|
228
|
|
- onConfirm: () => {
|
229
|
|
- orderRefund(id).then((value) {
|
230
|
|
- Fluttertoast.showToast(msg: '退单成功!');
|
231
|
|
- Get.offAllNamed('/order');
|
232
|
|
- }),
|
233
|
|
- });
|
234
|
|
- },
|
235
|
|
- margin: const EdgeInsets.all(0),
|
236
|
|
- fontSize: 20.sp,
|
237
|
|
- radius: 24.5.w,
|
238
|
|
- )
|
239
|
|
- : orderStateText.value == '待付款'
|
240
|
|
- ? _BottomWidget(
|
241
|
|
- id: id,
|
242
|
|
- )
|
243
|
|
- : orderStateText.value == '已退单'
|
244
|
|
- ? Text('')
|
245
|
|
- : orderStateText.value == '退单申请中'
|
246
|
|
- ? Text(orderStateText.value)
|
247
|
|
- : Text('');
|
248
|
|
- }
|
249
|
|
-}
|
250
|
|
-
|
251
|
|
-class _BottomWidget extends StatelessWidget {
|
252
|
|
- final id;
|
253
|
|
- final resultMessage = Rx<String>('---');
|
254
|
|
-
|
255
|
|
- _BottomWidget({Key? key, required this.id}) : super(key: key);
|
256
|
|
-
|
257
|
|
-
|
258
|
|
- void _orderDeletels() {
|
|
72
|
+ // 取消订单
|
|
73
|
+ _cancelOrder(String orderId) {
|
259
|
74
|
modal.showDialog(
|
260
|
75
|
title: '提示',
|
261
|
76
|
content: Container(
|
262
|
77
|
alignment: Alignment.center,
|
263
|
|
- child: Text('确定要取消此订单吗?'),
|
|
78
|
+ child: const Text('确定要取消此订单吗?'),
|
264
|
79
|
),
|
265
|
80
|
onCancel: () => true,
|
266
|
81
|
onConfirm: () => {
|
267
|
|
- orderDelete(id).then((value) {
|
268
|
|
- Fluttertoast.showToast(msg: '订单取消成功!');
|
269
|
|
- Get.offAllNamed('/order');
|
270
|
|
- })
|
271
|
|
- });
|
|
82
|
+ orderDelete(orderId).then((value) {
|
|
83
|
+ Fluttertoast.showToast(msg: '订单取消成功!');
|
|
84
|
+ Get.offAllNamed('/order');
|
|
85
|
+ })
|
|
86
|
+ });
|
272
|
87
|
}
|
273
|
88
|
|
|
89
|
+ // 满意度表单
|
|
90
|
+ Widget _evaluateWidget(Function onEvaluate) {
|
|
91
|
+ double star = -1;
|
|
92
|
+ String desc = '';
|
|
93
|
+
|
|
94
|
+ return Container(
|
|
95
|
+ alignment: Alignment.center,
|
|
96
|
+ child: Container(
|
|
97
|
+ margin:
|
|
98
|
+ const EdgeInsets.fromLTRB(15, 20, 15, 20),
|
|
99
|
+ child: Column(
|
|
100
|
+ children: [
|
|
101
|
+ Container(
|
|
102
|
+ padding: const EdgeInsets.fromLTRB(
|
|
103
|
+ 0, 0, 0, 10),
|
|
104
|
+ decoration: const BoxDecoration(
|
|
105
|
+ border: Border(
|
|
106
|
+ bottom: BorderSide(
|
|
107
|
+ width: 0.8,
|
|
108
|
+ color: Color(0x20000000)
|
|
109
|
+ // 0x17000000
|
|
110
|
+ ))),
|
|
111
|
+ child: Row(
|
|
112
|
+ children: [
|
|
113
|
+ Text(
|
|
114
|
+ '满意度:',
|
|
115
|
+ style: TextStyle(
|
|
116
|
+ fontSize: 17.sp,
|
|
117
|
+ fontWeight: FontWeight.bold),
|
|
118
|
+ ),
|
|
119
|
+ FFStars(
|
|
120
|
+ //https://pub.dev/packages/ff_stars
|
|
121
|
+ normalStar: Image.asset(
|
|
122
|
+ 'images/icons/starOff.png'),
|
|
123
|
+ selectedStar: Image.asset(
|
|
124
|
+ 'images/icons/starOn.png'),
|
|
125
|
+ starsChanged:
|
|
126
|
+ (realStars, selectedStars) {
|
|
127
|
+ star = realStars;
|
|
128
|
+ onEvaluate(star, desc);
|
|
129
|
+ },
|
|
130
|
+ step: 1,
|
|
131
|
+ defaultStars: 0,
|
|
132
|
+ ),
|
|
133
|
+ ],
|
|
134
|
+ ),
|
|
135
|
+ ),
|
|
136
|
+ Container(
|
|
137
|
+ margin: const EdgeInsets.fromLTRB(
|
|
138
|
+ 0, 20, 0, 0),
|
|
139
|
+ width: 300.w,
|
|
140
|
+ height: 100.w,
|
|
141
|
+ decoration: BoxDecoration(
|
|
142
|
+ border: Border.all(
|
|
143
|
+ color: const Color(0x20000000),
|
|
144
|
+ width: 0.8,
|
|
145
|
+ ),
|
|
146
|
+ ),
|
|
147
|
+ child: TextField(
|
|
148
|
+ minLines: 6,
|
|
149
|
+ maxLines: 6,
|
|
150
|
+ style: TextStyle(
|
|
151
|
+ fontSize: 17.sp, height: 1.5),
|
|
152
|
+ decoration: const InputDecoration(
|
|
153
|
+ isCollapsed: true,
|
|
154
|
+ border: InputBorder.none,
|
|
155
|
+ counterText: '',
|
|
156
|
+ hintText: '请输入评价内容',
|
|
157
|
+ floatingLabelBehavior:
|
|
158
|
+ FloatingLabelBehavior.never,
|
|
159
|
+ ),
|
|
160
|
+ onChanged: (e) {
|
|
161
|
+ desc = e;
|
|
162
|
+ onEvaluate(star, desc);
|
|
163
|
+ },
|
|
164
|
+ ),
|
|
165
|
+ )
|
|
166
|
+ ],
|
|
167
|
+ ),
|
|
168
|
+ ));
|
|
169
|
+ }
|
|
170
|
+
|
|
171
|
+ // 评价
|
|
172
|
+ _fnEvaluate(String orderId) {
|
|
173
|
+ int evalStars = -1;
|
|
174
|
+ String evalText = '';
|
|
175
|
+
|
|
176
|
+ onEvaluate(int val1, String val2) {
|
|
177
|
+ evalStars = val1;
|
|
178
|
+ evalText = val2;
|
|
179
|
+ }
|
|
180
|
+
|
|
181
|
+ modal.showDialog(
|
|
182
|
+ title: '评价此订单',
|
|
183
|
+ content: _evaluateWidget(onEvaluate),
|
|
184
|
+ onCancel: () => true,
|
|
185
|
+ onConfirm: () {
|
|
186
|
+ if (evalStars != -1 && evalText != '') {
|
|
187
|
+ orderEvaluation(
|
|
188
|
+ orderId, evalStars, evalText)
|
|
189
|
+ .then((value) {
|
|
190
|
+ Fluttertoast.showToast(msg: '评价成功!');
|
|
191
|
+ Get.offAllNamed('/order');
|
|
192
|
+ });
|
|
193
|
+ } else {
|
|
194
|
+ Fluttertoast.showToast(msg: '请完整选择评分或输入评价内容');
|
|
195
|
+ return false;
|
|
196
|
+ }
|
|
197
|
+ },
|
|
198
|
+ );
|
|
199
|
+ }
|
274
|
200
|
|
275
|
|
-Future<void> payMoney (String payType) async {
|
|
201
|
+ // 调用支付接口
|
|
202
|
+ Future<void> payMoney (String payType) async {
|
276
|
203
|
if(payType=='wxPay'){
|
277
|
204
|
final isInstall=await fluwx.isWeChatInstalled;
|
278
|
205
|
if(!isInstall){
|
279
|
206
|
EasyLoading.showError('请先安装微信');
|
280
|
|
- print('isInstall--------$isInstall');
|
281
|
207
|
return;
|
282
|
208
|
}
|
283
|
|
- createOrder(id, "wx").then((value) {
|
284
|
|
- print('--------------微信支付-----------------');
|
285
|
|
- print('result--------$value');
|
286
|
|
- print('-------------------------------');
|
287
|
|
- print("appid--------${value['appid']}");
|
288
|
|
- print("partnerId--------${value['partnerId']}");
|
289
|
|
- print("prepayId--------${value['prepayId']}");
|
290
|
|
- print("packageValue--------${value['packageValue']}");
|
291
|
|
- print("noncestr--------${value['noncestr']}");
|
292
|
|
- print("timestamp--------${value['timestamp']}");
|
293
|
|
- print("sign--------${value['sign']}");
|
|
209
|
+ createOrder(id.value, "wx").then((value) {
|
294
|
210
|
fluwx.payWithWeChat(
|
295
|
211
|
appId: value['appid'].toString(),
|
296
|
212
|
partnerId: value['partnerId'].toString(),
|
|
@@ -301,20 +217,18 @@ Future<void> payMoney (String payType) async {
|
301
|
217
|
sign: value['sign'].toString(),
|
302
|
218
|
).then((res) {
|
303
|
219
|
print("payWithWeChat--------${res}");
|
304
|
|
- })
|
305
|
|
- .catchError((onError){
|
|
220
|
+ }).catchError((onError){
|
306
|
221
|
print("payWithWeChat错误--------${onError}");
|
307
|
222
|
});
|
308
|
223
|
});
|
309
|
224
|
|
310
|
|
-// 监听支付结果
|
|
225
|
+ // 监听支付结果
|
311
|
226
|
fluwx.weChatResponseEventHandler.listen((event) async {
|
312
|
227
|
print(event.errCode);
|
313
|
228
|
// 支付成功
|
314
|
229
|
if (event.errCode == 0) {
|
315
|
230
|
// EasyLoading.showSuccess('支付成功');
|
316
|
231
|
Get.snackbar('提示', "支付成功");
|
317
|
|
-
|
318
|
232
|
Get.offAllNamed('/order');
|
319
|
233
|
}else{
|
320
|
234
|
|
|
@@ -322,19 +236,15 @@ Future<void> payMoney (String payType) async {
|
322
|
236
|
}
|
323
|
237
|
// 关闭弹窗
|
324
|
238
|
});
|
325
|
|
-
|
326
|
|
-
|
327
|
239
|
return;
|
328
|
|
- }else if(payType=='aliPay'){
|
329
|
|
- print('--------------支付宝支付-----------------');
|
|
240
|
+ } else if(payType=='aliPay'){
|
330
|
241
|
final isInstall=await tobias.isAliPayInstalled();
|
331
|
242
|
if(!isInstall){
|
332
|
243
|
EasyLoading.showError('请先安装支付宝');
|
333
|
|
- print('isInstall------支付宝--$isInstall');
|
334
|
244
|
return;
|
335
|
245
|
}
|
336
|
246
|
// map["paySign"]
|
337
|
|
- createOrder(id, "aliPay").then((value) {
|
|
247
|
+ createOrder(id.value, "aliPay").then((value) {
|
338
|
248
|
tobias.aliPay(value).then((payResult) {
|
339
|
249
|
print("支付宝:" + payResult.toString());
|
340
|
250
|
|
|
@@ -343,152 +253,99 @@ Future<void> payMoney (String payType) async {
|
343
|
253
|
Get.offAllNamed('/order');
|
344
|
254
|
} else {
|
345
|
255
|
EasyLoading.showError('支付失败');
|
346
|
|
-
|
347
|
256
|
}
|
348
|
257
|
});
|
349
|
|
-
|
350
|
|
- });
|
351
|
|
-
|
352
|
|
-
|
353
|
|
-
|
354
|
|
-
|
|
258
|
+ });
|
355
|
259
|
}
|
|
260
|
+ }
|
356
|
261
|
|
357
|
|
-
|
358
|
|
-}
|
359
|
|
- //显示底部弹框的功能
|
360
|
|
- void showBottomSheet(context) {
|
|
262
|
+ // 支付 sheet
|
|
263
|
+ _bottomSheet(BuildContext context) {
|
361
|
264
|
//用于在底部打开弹框的效果
|
362
|
265
|
showModalBottomSheet(
|
363
|
266
|
context: context,
|
364
|
267
|
isScrollControlled: false,
|
365
|
268
|
backgroundColor: Colors.white,
|
366
|
|
- shape: RoundedRectangleBorder(
|
|
269
|
+ shape: const RoundedRectangleBorder(
|
367
|
270
|
borderRadius: BorderRadius.all(Radius.circular(10))),
|
368
|
271
|
builder: (BuildContext context) {
|
369
|
|
- return Container(
|
|
272
|
+ return SizedBox(
|
370
|
273
|
height: 200.w, //对话框高度就是此高度
|
371
|
274
|
child: Center(
|
372
|
275
|
child: Column(
|
373
|
|
- children: [
|
374
|
|
- Padding(
|
375
|
|
- padding: EdgeInsets.fromLTRB(0, 25.w, 0, 34.w),
|
376
|
|
- child: Text(
|
377
|
|
- "支付方式",
|
378
|
|
- style:
|
379
|
|
- TextStyle(fontSize: 17.sp, fontWeight: FontWeight.bold),
|
380
|
|
- ),
|
381
|
|
- ),
|
382
|
|
- Padding(
|
383
|
|
- padding: EdgeInsets.fromLTRB(15.w, 0, 15.w, 0),
|
384
|
|
- child: ListTile(
|
385
|
|
- onTap: (){
|
386
|
|
- payMoney('aliPay');
|
387
|
|
- },
|
388
|
|
- contentPadding: EdgeInsets.symmetric(horizontal: 0.0),
|
389
|
|
- // 这边使用了contentPadding
|
390
|
|
- leading: Image(
|
391
|
|
- image: AssetImage('images/alipay.png'),
|
392
|
|
- width: 30.w,
|
393
|
|
- height: 30.w,
|
|
276
|
+ children: [
|
|
277
|
+ Padding(
|
|
278
|
+ padding: EdgeInsets.fromLTRB(0, 25.w, 0, 34.w),
|
|
279
|
+ child: Bold(text: "支付方式", fontSize: 17.sp),
|
394
|
280
|
),
|
395
|
|
- title: Transform(
|
396
|
|
- transform: Matrix4.translationValues(-15, 0.0, 0.0),
|
397
|
|
- child: Text("支付宝",
|
398
|
|
- style: TextStyle(
|
399
|
|
- fontSize: 18.sp, color: Color(0xff333333))),
|
|
281
|
+ PayItem(
|
|
282
|
+ label: "支付宝",
|
|
283
|
+ icon: const AssetImage('images/alipay.png'),
|
|
284
|
+ onPress: () {
|
|
285
|
+ payMoney('aliPay');
|
|
286
|
+ },
|
400
|
287
|
),
|
401
|
|
- trailing: Image(
|
402
|
|
- image: AssetImage('images/userRight.png'),
|
403
|
|
- width: 10.w,
|
404
|
|
- height: 18.w,
|
|
288
|
+ PayItem(
|
|
289
|
+ label: "微信",
|
|
290
|
+ icon: const AssetImage('images/weChatPay.png'),
|
|
291
|
+ onPress: () {
|
|
292
|
+ payMoney('wxPay');
|
|
293
|
+ },
|
405
|
294
|
),
|
406
|
|
- ),
|
407
|
|
- ),
|
408
|
|
- Padding(
|
409
|
|
- padding: EdgeInsets.fromLTRB(15.w, 0, 15.w, 0),
|
410
|
|
- child: ListTile(
|
411
|
|
- onTap: () {
|
412
|
|
- payMoney('wxPay');
|
413
|
|
- },
|
414
|
|
- contentPadding: EdgeInsets.symmetric(horizontal: 0.0),
|
415
|
|
- // 这边使用了contentPadding
|
416
|
|
- leading: Image(
|
417
|
|
- image: AssetImage('images/weChatPay.png'),
|
418
|
|
- width: 30.w,
|
419
|
|
- height: 30.w,
|
420
|
|
- ),
|
421
|
|
- title: Transform(
|
422
|
|
- transform: Matrix4.translationValues(-15, 0.0, 0.0),
|
423
|
|
- child: Text("微信",
|
424
|
|
- style: TextStyle(
|
425
|
|
- fontSize: 18.sp, color: Color(0xff333333))),
|
426
|
|
- ),
|
427
|
|
- trailing: Image(
|
428
|
|
- image: AssetImage('images/userRight.png'),
|
429
|
|
- width: 10.w,
|
430
|
|
- height: 18.w,
|
431
|
|
- ),
|
432
|
|
- ),
|
433
|
|
- ),
|
434
|
|
- ],
|
435
|
|
- )),
|
|
295
|
+ ],
|
|
296
|
+ )),
|
436
|
297
|
);
|
437
|
298
|
});
|
438
|
299
|
}
|
439
|
300
|
|
440
|
|
- @override
|
441
|
|
- Widget build(BuildContext context) {
|
442
|
|
- return Container(
|
443
|
|
- alignment: Alignment.bottomCenter,
|
444
|
|
- child: Row(
|
445
|
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
446
|
|
- children: [
|
447
|
|
- SizedBox(
|
448
|
|
- width: 150.w,
|
449
|
|
- height: 49.h,
|
450
|
|
- child: ElevatedButton(
|
451
|
|
- onPressed: () {
|
452
|
|
- _orderDeletels();
|
453
|
|
- },
|
454
|
|
- child: const Text(
|
455
|
|
- "取消",
|
456
|
|
- style: TextStyle(
|
457
|
|
- fontSize: 18,
|
458
|
|
- color: Color(0xFFFF703B),
|
459
|
|
- fontWeight: FontWeight.bold),
|
460
|
|
- ),
|
461
|
|
- style: ButtonStyle(
|
462
|
|
- side: MaterialStateProperty.all(
|
463
|
|
- BorderSide(width: 1, color: Color(0xFFFF703B))), //边框
|
464
|
|
- elevation: MaterialStateProperty.all(0),
|
465
|
|
- backgroundColor: MaterialStateProperty.all(Colors.white),
|
466
|
|
- shape: MaterialStateProperty.all(
|
467
|
|
- RoundedRectangleBorder(
|
468
|
|
- borderRadius: BorderRadius.all(Radius.circular(24.4))),
|
469
|
|
- ),
|
470
|
|
- ),
|
471
|
|
- ),
|
472
|
|
- ),
|
473
|
|
- SizedBox(
|
474
|
|
- child: DefaultButton(
|
475
|
|
- color: const Color(0xffffffff),
|
476
|
|
- backColor: const Color(0xFFFF703B),
|
477
|
|
- width: 150.w,
|
478
|
|
- height: 49.h,
|
479
|
|
- text: '支付',
|
480
|
|
- onPressed: () {
|
481
|
|
- showBottomSheet(context);
|
482
|
|
- // Fluttertoast.showToast(msg: '支付成功!');
|
483
|
|
- // Get.offAllNamed('/');
|
484
|
|
- },
|
485
|
|
- margin: const EdgeInsets.all(0),
|
486
|
|
- fontSize: 20.sp,
|
487
|
|
- radius: 24.5.w,
|
488
|
|
- ),
|
489
|
|
- ),
|
490
|
|
- ],
|
491
|
|
- ),
|
492
|
|
- );
|
|
301
|
+ Widget _action(BuildContext context, String orderId) {
|
|
302
|
+ bool mustAction = false;
|
|
303
|
+ var btnLabel;
|
|
304
|
+ var btnFunction;
|
|
305
|
+
|
|
306
|
+ switch (processStatus) {
|
|
307
|
+ case 1:
|
|
308
|
+ case 2:
|
|
309
|
+ mustAction = true;
|
|
310
|
+ btnLabel = '取消';
|
|
311
|
+ btnFunction = () {
|
|
312
|
+ _cancelOrder(orderId);
|
|
313
|
+ };
|
|
314
|
+ break;
|
|
315
|
+ case 4:
|
|
316
|
+ mustAction = true;
|
|
317
|
+ btnLabel = '支付';
|
|
318
|
+ btnFunction = () {
|
|
319
|
+ _bottomSheet(context);
|
|
320
|
+ };
|
|
321
|
+ break;
|
|
322
|
+ case 5:
|
|
323
|
+ mustAction = true;
|
|
324
|
+ btnLabel = '评价';
|
|
325
|
+ btnFunction = () {
|
|
326
|
+ _fnEvaluate(orderId);
|
|
327
|
+ };
|
|
328
|
+ break;
|
|
329
|
+ case 3:
|
|
330
|
+ case 6:
|
|
331
|
+ default:
|
|
332
|
+ break;
|
|
333
|
+ }
|
|
334
|
+
|
|
335
|
+ if (mustAction) {
|
|
336
|
+ return DefaultButton(
|
|
337
|
+ color: const Color(0xffffffff),
|
|
338
|
+ backColor: const Color(0xFFFF703B),
|
|
339
|
+ width: 300.w,
|
|
340
|
+ height: 49.h,
|
|
341
|
+ text: btnLabel,
|
|
342
|
+ margin: const EdgeInsets.all(0),
|
|
343
|
+ fontSize: 20.sp,
|
|
344
|
+ radius: 24.5.w,
|
|
345
|
+ onPressed: btnFunction,
|
|
346
|
+ );
|
|
347
|
+ } else {
|
|
348
|
+ return const Text('');
|
|
349
|
+ }
|
493
|
350
|
}
|
494
|
351
|
}
|