|
@@ -16,14 +16,11 @@ import '../../widgets/layout/BasicPage.dart';
|
16
|
16
|
// StyleObj ({ required this.title, required this.styleColor});
|
17
|
17
|
// }
|
18
|
18
|
|
19
|
|
-
|
20
|
|
-
|
21
|
19
|
class OrderPageInfo extends BasicPage {
|
22
|
|
- final id=Rx<String>('');
|
23
|
|
- final orderStateText=Rx<String>('待支付');
|
24
|
|
- final orderStateColor=Rx<Color>(Colors.black);
|
|
20
|
+ final id = Rx<String>('');
|
|
21
|
+ final orderStateText = Rx<String>('待支付');
|
|
22
|
+ final orderStateColor = Rx<Color>(Colors.black);
|
25
|
23
|
final orderInfoContent = Rx<OrderInfoModel>(OrderInfoModel());
|
26
|
|
-
|
27
|
24
|
// orderStates
|
28
|
25
|
|
29
|
26
|
@override
|
|
@@ -42,157 +39,265 @@ class OrderPageInfo extends BasicPage {
|
42
|
39
|
}
|
43
|
40
|
}
|
44
|
41
|
|
45
|
|
-
|
46
|
42
|
@override
|
47
|
43
|
Widget builder(BuildContext context) {
|
48
|
44
|
naviTitle = '订单详情';
|
49
|
45
|
|
50
|
46
|
return Column(
|
51
|
47
|
children: [
|
52
|
|
- Obx(() =>
|
53
|
|
- OrderInfoCard(
|
54
|
|
- item: orderInfoContent(),
|
55
|
|
- orderStateText: orderStateText(),
|
56
|
|
- orderStateColor: orderStateColor()
|
57
|
|
- ),
|
|
48
|
+ Obx(
|
|
49
|
+ () => OrderInfoCard(
|
|
50
|
+ item: orderInfoContent(),
|
|
51
|
+ orderStateText: orderStateText(),
|
|
52
|
+ orderStateColor: orderStateColor()),
|
|
53
|
+ ),
|
|
54
|
+ // Obx(() => _BottomWidget(id: id())),
|
|
55
|
+
|
|
56
|
+ Obx(
|
|
57
|
+ () => Container(
|
|
58
|
+ padding: EdgeInsets.fromLTRB(15, 50.w, 15, 0),
|
|
59
|
+ child: _bottomJudgment(id.value)),
|
58
|
60
|
),
|
59
|
|
- Obx(()=>_BottomWidget(id: id()))
|
60
|
|
- // orderStateText=='已完成'? Text('')
|
61
|
|
- // :orderStateText== '进行中' ?Text('')
|
62
|
|
- // :orderStateText=='待评价'? DefaultButton(
|
63
|
|
- // color: const Color(0xffffffff),
|
64
|
|
- // backColor: const Color(0xFFFF703B),
|
65
|
|
- // width: 300.w,
|
66
|
|
- // height: 49.h,
|
67
|
|
- // text: '评价',
|
68
|
|
- // onPressed: () {
|
69
|
|
- // Fluttertoast.showToast(msg: '评价成功!');
|
70
|
|
- // Get.offAllNamed('/');
|
71
|
|
- // },
|
72
|
|
- // margin: const EdgeInsets.all(0),
|
73
|
|
- // fontSize: 20.sp,
|
74
|
|
- // radius: 24.5.w,
|
75
|
|
- // )
|
76
|
|
- // :orderStateText=='待作业'?DefaultButton(
|
77
|
|
- // color: const Color(0xffffffff),
|
78
|
|
- // backColor: const Color(0xFFFF703B),
|
79
|
|
- // width: 300.w,
|
80
|
|
- // height: 49.h,
|
81
|
|
- // text: '退单',
|
82
|
|
- // onPressed: () {
|
83
|
|
- // Fluttertoast.showToast(msg: '评价成功!');
|
84
|
|
- // Get.offAllNamed('/');
|
85
|
|
- // },
|
86
|
|
- // margin: const EdgeInsets.all(0),
|
87
|
|
- // fontSize: 20.sp,
|
88
|
|
- // radius: 24.5.w,
|
89
|
|
- // )
|
90
|
|
- // :orderStateText=='待付款'?_BottomWidget
|
91
|
|
- // :orderStateText=='已退单'?Text('')
|
92
|
|
- // :orderStateText=='退单申请中'?DefaultButton(
|
93
|
|
- // color: const Color(0xffffffff),
|
94
|
|
- // backColor: const Color(0xFFFF703B),
|
95
|
|
- // width: 300.w,
|
96
|
|
- // height: 49.h,
|
97
|
|
- // text: orderStateText,
|
98
|
|
- // onPressed: () {
|
99
|
|
- // Fluttertoast.showToast(msg: '评价成功!');
|
100
|
|
- // Get.offAllNamed('/');
|
101
|
|
- // },
|
102
|
|
- // margin: const EdgeInsets.all(0),
|
103
|
|
- // fontSize: 20.sp,
|
104
|
|
- // radius: 24.5.w,
|
105
|
|
- // ):Text(''),
|
106
|
|
-
|
107
|
|
- // Spacer(),
|
108
|
61
|
],
|
109
|
62
|
);
|
110
|
63
|
}
|
|
64
|
+
|
|
65
|
+ Widget _bottomJudgment(String id) {
|
|
66
|
+ return orderStateText.value == '已完成'
|
|
67
|
+ ? Text('')
|
|
68
|
+ : orderStateText.value == '进行中'
|
|
69
|
+ ? Text('')
|
|
70
|
+ : orderStateText.value == '待评价'
|
|
71
|
+ ? DefaultButton(
|
|
72
|
+ color: const Color(0xffffffff),
|
|
73
|
+ backColor: const Color(0xFFFF703B),
|
|
74
|
+ width: 300.w,
|
|
75
|
+ height: 49.h,
|
|
76
|
+ text: '评价',
|
|
77
|
+ onPressed: () {
|
|
78
|
+ Fluttertoast.showToast(msg: '评价成功!');
|
|
79
|
+ Get.offNamed('/order');
|
|
80
|
+ },
|
|
81
|
+ margin: const EdgeInsets.all(0),
|
|
82
|
+ fontSize: 20.sp,
|
|
83
|
+ radius: 24.5.w,
|
|
84
|
+ )
|
|
85
|
+ : orderStateText.value == '待作业'
|
|
86
|
+ ? DefaultButton(
|
|
87
|
+ color: const Color(0xffffffff),
|
|
88
|
+ backColor: const Color(0xFFFF703B),
|
|
89
|
+ width: 300.w,
|
|
90
|
+ height: 49.h,
|
|
91
|
+ text: '退单',
|
|
92
|
+ onPressed: () {
|
|
93
|
+ modal.showDialog(
|
|
94
|
+ title: '提示',
|
|
95
|
+ content: Container(
|
|
96
|
+ alignment: Alignment.center,
|
|
97
|
+ child: Text('确定要申请退单吗?'),
|
|
98
|
+ ),
|
|
99
|
+ onCancel: () => true,
|
|
100
|
+ onConfirm: () => {
|
|
101
|
+ orderRefund(id).then((value) {
|
|
102
|
+ Fluttertoast.showToast(msg: '退单成功!');
|
|
103
|
+ Get.offNamed('/order');
|
|
104
|
+ }),
|
|
105
|
+ });
|
|
106
|
+ },
|
|
107
|
+ margin: const EdgeInsets.all(0),
|
|
108
|
+ fontSize: 20.sp,
|
|
109
|
+ radius: 24.5.w,
|
|
110
|
+ )
|
|
111
|
+ : orderStateText.value == '已付款'
|
|
112
|
+ ? DefaultButton(
|
|
113
|
+ color: const Color(0xffffffff),
|
|
114
|
+ backColor: const Color(0xFFFF703B),
|
|
115
|
+ width: 300.w,
|
|
116
|
+ height: 49.h,
|
|
117
|
+ text: '退单',
|
|
118
|
+ onPressed: () {
|
|
119
|
+ modal.showDialog(
|
|
120
|
+ title: '提示',
|
|
121
|
+ content: Container(
|
|
122
|
+ alignment: Alignment.center,
|
|
123
|
+ child: Text('确定要申请退单吗?'),
|
|
124
|
+ ),
|
|
125
|
+ onCancel: () => true,
|
|
126
|
+ onConfirm: () => {
|
|
127
|
+ orderRefund(id).then((value) {
|
|
128
|
+ Fluttertoast.showToast(msg: '退单成功!');
|
|
129
|
+ Get.offNamed('/order');
|
|
130
|
+ }),
|
|
131
|
+ });
|
|
132
|
+ },
|
|
133
|
+ margin: const EdgeInsets.all(0),
|
|
134
|
+ fontSize: 20.sp,
|
|
135
|
+ radius: 24.5.w,
|
|
136
|
+ )
|
|
137
|
+ : orderStateText.value == '待付款'
|
|
138
|
+ ? _BottomWidget(
|
|
139
|
+ id: id,
|
|
140
|
+ )
|
|
141
|
+ : orderStateText.value == '已退单'
|
|
142
|
+ ? Text('')
|
|
143
|
+ : orderStateText.value == '退单申请中'
|
|
144
|
+ ? Text(orderStateText.value)
|
|
145
|
+ : Text('');
|
|
146
|
+ }
|
111
|
147
|
}
|
112
|
148
|
|
113
|
149
|
class _BottomWidget extends StatelessWidget {
|
114
|
150
|
final id;
|
115
|
|
- const _BottomWidget({Key? key, required this.id}) : super(key: key);
|
|
151
|
+ final resultMessage = Rx<String>('---');
|
116
|
152
|
|
|
153
|
+ _BottomWidget({Key? key, required this.id}) : super(key: key);
|
117
|
154
|
|
118
|
|
- void _orderDeletels (){
|
119
|
|
- modal.showDialog(title: '测试', content: SizedBox(width: 400, height: 300,), onConfirm: () => true);
|
120
|
|
- // orderDelete(id).then((value) {
|
121
|
|
- // Fluttertoast.showToast(
|
122
|
|
- // msg: '订单取消成功!'
|
123
|
|
- // );
|
124
|
|
- // Get.offNamed('/order');
|
125
|
|
- // });
|
|
155
|
+ void _orderDeletels() {
|
|
156
|
+ modal.showDialog(
|
|
157
|
+ title: '提示',
|
|
158
|
+ content: Container(
|
|
159
|
+ alignment: Alignment.center,
|
|
160
|
+ child: Text('确定要取消此订单吗?'),
|
|
161
|
+ ),
|
|
162
|
+ onCancel: () => true,
|
|
163
|
+ onConfirm: () => {
|
|
164
|
+ orderDelete(id).then((value) {
|
|
165
|
+ Fluttertoast.showToast(msg: '订单取消成功!');
|
|
166
|
+ Get.offNamed('/order');
|
|
167
|
+ })
|
|
168
|
+ });
|
126
|
169
|
}
|
127
|
170
|
|
|
171
|
+ //显示底部弹框的功能
|
|
172
|
+ void showBottomSheet(context) {
|
|
173
|
+ //用于在底部打开弹框的效果
|
|
174
|
+ showModalBottomSheet(
|
|
175
|
+ context: context,
|
|
176
|
+ isScrollControlled: false,
|
|
177
|
+ backgroundColor: Colors.white,
|
|
178
|
+ shape: RoundedRectangleBorder(
|
|
179
|
+ borderRadius: BorderRadius.all(Radius.circular(10))),
|
|
180
|
+ builder: (BuildContext context) {
|
|
181
|
+ return Container(
|
|
182
|
+ height: 200.w, //对话框高度就是此高度
|
|
183
|
+ child: Center(
|
|
184
|
+ child: Column(
|
|
185
|
+ children: [
|
|
186
|
+ Padding(
|
|
187
|
+ padding: EdgeInsets.fromLTRB(0, 25.w, 0, 34.w),
|
|
188
|
+ child: Text(
|
|
189
|
+ "支付方式",
|
|
190
|
+ style:
|
|
191
|
+ TextStyle(fontSize: 17.sp, fontWeight: FontWeight.bold),
|
|
192
|
+ ),
|
|
193
|
+ ),
|
|
194
|
+ Padding(
|
|
195
|
+ padding: EdgeInsets.fromLTRB(15.w, 0, 15.w, 0),
|
|
196
|
+ child: ListTile(
|
|
197
|
+ contentPadding: EdgeInsets.symmetric(horizontal: 0.0),
|
|
198
|
+ // 这边使用了contentPadding
|
|
199
|
+ leading: Image(
|
|
200
|
+ image: AssetImage('images/alipay.png'),
|
|
201
|
+ width: 30.w,
|
|
202
|
+ height: 30.w,
|
|
203
|
+ ),
|
|
204
|
+ title: Transform(
|
|
205
|
+ transform: Matrix4.translationValues(-15, 0.0, 0.0),
|
|
206
|
+ child: Text("支付宝",
|
|
207
|
+ style: TextStyle(
|
|
208
|
+ fontSize: 18.sp, color: Color(0xff333333))),
|
|
209
|
+ ),
|
|
210
|
+ trailing: Image(
|
|
211
|
+ image: AssetImage('images/userRight.png'),
|
|
212
|
+ width: 10.w,
|
|
213
|
+ height: 18.w,
|
|
214
|
+ ),
|
|
215
|
+ ),
|
|
216
|
+ ),
|
|
217
|
+ Padding(
|
|
218
|
+ padding: EdgeInsets.fromLTRB(15.w, 0, 15.w, 0),
|
|
219
|
+ child: ListTile(
|
|
220
|
+ onTap: (){
|
128
|
221
|
|
|
222
|
+ },
|
|
223
|
+ contentPadding: EdgeInsets.symmetric(horizontal: 0.0),
|
|
224
|
+ // 这边使用了contentPadding
|
|
225
|
+ leading: Image(
|
|
226
|
+ image: AssetImage('images/weChatPay.png'),
|
|
227
|
+ width: 30.w,
|
|
228
|
+ height: 30.w,
|
|
229
|
+ ),
|
|
230
|
+ title: Transform(
|
|
231
|
+ transform: Matrix4.translationValues(-15, 0.0, 0.0),
|
|
232
|
+ child: Text("微信",
|
|
233
|
+ style: TextStyle(
|
|
234
|
+ fontSize: 18.sp, color: Color(0xff333333))),
|
|
235
|
+ ),
|
|
236
|
+ trailing: Image(
|
|
237
|
+ image: AssetImage('images/userRight.png'),
|
|
238
|
+ width: 10.w,
|
|
239
|
+ height: 18.w,
|
|
240
|
+ ),
|
|
241
|
+ ),
|
|
242
|
+ ),
|
|
243
|
+ ],
|
|
244
|
+ )),
|
|
245
|
+ );
|
|
246
|
+ });
|
|
247
|
+ }
|
129
|
248
|
|
130
|
249
|
@override
|
131
|
250
|
Widget build(BuildContext context) {
|
132
|
|
-
|
133
|
251
|
return Container(
|
134
|
|
- height: 100.w,
|
135
|
252
|
alignment: Alignment.bottomCenter,
|
136
|
|
- margin: EdgeInsets.fromLTRB(15.w, 0, 15.w, 50.h),
|
137
|
253
|
child: Row(
|
138
|
254
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
139
|
255
|
children: [
|
140
|
|
- Container(
|
|
256
|
+ SizedBox(
|
141
|
257
|
width: 150.w,
|
142
|
258
|
height: 49.h,
|
143
|
|
- margin: EdgeInsets.fromLTRB(0, 30.w, 0, 30.w),
|
144
|
|
- alignment: Alignment.bottomCenter,
|
145
|
|
- child: SizedBox(
|
146
|
|
- width: 150.w,
|
147
|
|
- height: 49.h,
|
148
|
|
- child: ElevatedButton(
|
149
|
|
- onPressed: () {
|
150
|
|
- _orderDeletels();
|
151
|
|
- },
|
152
|
|
- child: const Text(
|
153
|
|
- "取消",
|
154
|
|
- style: TextStyle(
|
155
|
|
- fontSize: 18,
|
156
|
|
- color: Color(0xFFFF703B),
|
157
|
|
- fontWeight: FontWeight.bold),
|
158
|
|
- ),
|
159
|
|
- style: ButtonStyle(
|
160
|
|
- side: MaterialStateProperty.all(
|
161
|
|
- BorderSide(width: 1, color: Color(0xFFFF703B))), //边框
|
162
|
|
- elevation: MaterialStateProperty.all(0),
|
163
|
|
- backgroundColor: MaterialStateProperty.all(Colors.white),
|
164
|
|
- shape: MaterialStateProperty.all(
|
165
|
|
- RoundedRectangleBorder(
|
166
|
|
- borderRadius:
|
167
|
|
- BorderRadius.all(Radius.circular(24.4))),
|
168
|
|
- ),
|
|
259
|
+ child: ElevatedButton(
|
|
260
|
+ onPressed: () {
|
|
261
|
+ _orderDeletels();
|
|
262
|
+ },
|
|
263
|
+ child: const Text(
|
|
264
|
+ "取消",
|
|
265
|
+ style: TextStyle(
|
|
266
|
+ fontSize: 18,
|
|
267
|
+ color: Color(0xFFFF703B),
|
|
268
|
+ fontWeight: FontWeight.bold),
|
|
269
|
+ ),
|
|
270
|
+ style: ButtonStyle(
|
|
271
|
+ side: MaterialStateProperty.all(
|
|
272
|
+ BorderSide(width: 1, color: Color(0xFFFF703B))), //边框
|
|
273
|
+ elevation: MaterialStateProperty.all(0),
|
|
274
|
+ backgroundColor: MaterialStateProperty.all(Colors.white),
|
|
275
|
+ shape: MaterialStateProperty.all(
|
|
276
|
+ RoundedRectangleBorder(
|
|
277
|
+ borderRadius: BorderRadius.all(Radius.circular(24.4))),
|
169
|
278
|
),
|
170
|
279
|
),
|
171
|
280
|
),
|
172
|
281
|
),
|
173
|
|
- Container(
|
174
|
|
- margin: EdgeInsets.fromLTRB(0, 30.w, 0, 30.w),
|
175
|
|
- alignment: Alignment.bottomCenter,
|
176
|
|
- child: DefaultButton(
|
177
|
|
- color: const Color(0xffffffff),
|
178
|
|
- backColor: const Color(0xFFFF703B),
|
179
|
|
- width: 150.w,
|
180
|
|
- height: 49.h,
|
181
|
|
- text: '支付',
|
182
|
|
- onPressed: () {
|
183
|
|
- Fluttertoast.showToast(msg: '支付成功!');
|
184
|
|
- Get.offAllNamed('/');
|
185
|
|
- },
|
186
|
|
- margin: const EdgeInsets.all(0),
|
187
|
|
- fontSize: 20.sp,
|
188
|
|
- radius: 24.5.w,
|
|
282
|
+ SizedBox(
|
|
283
|
+ child: DefaultButton(
|
|
284
|
+ color: const Color(0xffffffff),
|
|
285
|
+ backColor: const Color(0xFFFF703B),
|
|
286
|
+ width: 150.w,
|
|
287
|
+ height: 49.h,
|
|
288
|
+ text: '支付',
|
|
289
|
+ onPressed: () {
|
|
290
|
+ showBottomSheet(context);
|
|
291
|
+ // Fluttertoast.showToast(msg: '支付成功!');
|
|
292
|
+ // Get.offAllNamed('/');
|
|
293
|
+ },
|
|
294
|
+ margin: const EdgeInsets.all(0),
|
|
295
|
+ fontSize: 20.sp,
|
|
296
|
+ radius: 24.5.w,
|
|
297
|
+ ),
|
189
|
298
|
),
|
190
|
|
- ),
|
191
|
299
|
],
|
192
|
300
|
),
|
193
|
301
|
);
|
194
|
302
|
}
|
195
|
303
|
}
|
196
|
|
-
|
197
|
|
-
|
198
|
|
-
|