Browse Source

orderPages

[baozhangchao] 3 years ago
parent
commit
d90a2f4d8e

+ 95
- 0
lib/models/entities/OrderListAll.dart View File

1
+class OrderListAll {
2
+
3
+  String? orderId;
4
+  String? orderNo;
5
+  String? personId;
6
+  String? personName;
7
+  String? phone;
8
+  num? charges;
9
+  num? price;
10
+  num? amount;
11
+  String? machineryId;
12
+  String? machineryName;
13
+  String? machineryType;
14
+  String? typeName;
15
+  String? address;
16
+  String? appointmentDate;
17
+  num? payStatus;
18
+  num? dispatchStatus;
19
+  num? workStatus;
20
+  num? isEvaluated;
21
+  num? payType;
22
+  num? isRefund;
23
+  String? orgId;
24
+  String? orgName;
25
+  num? status;
26
+  String? createDate;
27
+  String? dispatchId;
28
+  String? workId;
29
+  String? workName;
30
+
31
+
32
+  OrderListAll();
33
+
34
+  OrderListAll.fromJson(Map<String, dynamic> json)
35
+      :orderId=json["orderId"],
36
+        orderNo=json["orderNo"],
37
+        personId=json["personId"],
38
+        personName=json["personName"],
39
+        phone=json["phone"],
40
+        charges=json["charges"],
41
+        price=json["price"],
42
+        amount=json["amount"],
43
+        machineryId=json["machineryId"],
44
+        machineryName=json["machineryName"],
45
+        machineryType=json["machineryType"],
46
+        typeName=json["typeName"],
47
+        address=json["address"],
48
+        appointmentDate=json["appointmentDate"],
49
+        payStatus=json["payStatus"],
50
+        dispatchStatus=json["dispatchStatus"],
51
+        workStatus=json["workStatus"],
52
+        isEvaluated=json["isEvaluated"],
53
+        payType=json["payType"],
54
+        isRefund=json["isRefund"],
55
+        orgId=json["orgId"],
56
+        orgName=json["orgName"],
57
+        status=json["status"],
58
+        createDate=json["createDate"],
59
+        dispatchId=json["dispatchId"],
60
+        workId=json["workId"],
61
+        workName=json["workName"];
62
+
63
+  Map<String, dynamic> toJson() => {
64
+    'orderId':orderId,
65
+    'orderNo':orderNo,
66
+    'personId':personId,
67
+    'personName':personName,
68
+    'phone':phone,
69
+    'charges':charges,
70
+    'price':price,
71
+    'amount':amount,
72
+    'machineryId':machineryId,
73
+    'machineryName':machineryName,
74
+    'machineryType':machineryType,
75
+    'typeName':typeName,
76
+    'address':address,
77
+    'appointmentDate':appointmentDate,
78
+    'payStatus':payStatus,
79
+    'dispatchStatus':dispatchStatus,
80
+    'workStatus':workStatus,
81
+    'isEvaluated':isEvaluated,
82
+    'payType':payType,
83
+    'isRefund':isRefund,
84
+    'orgId':orgId,
85
+    'orgName':orgName,
86
+    'status':status,
87
+    'createDate':createDate,
88
+    'dispatchId':dispatchId,
89
+    'workId':workId,
90
+    'workName':workName,
91
+
92
+
93
+
94
+  };
95
+}

+ 37
- 24
lib/pages/TabBar/widgets/order/index.dart View File

1
 import 'package:flutter/material.dart';
1
 import 'package:flutter/material.dart';
2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
 
3
 
4
+import '../../../../models/entities/OrderListAll.dart';
5
+import '../../../../services/orderAPI.dart';
4
 import '../../../../widgets/OrderListCard.dart';
6
 import '../../../../widgets/OrderListCard.dart';
5
 import '../../../orderInfo/index.dart';
7
 import '../../../orderInfo/index.dart';
6
 
8
 
12
 }
14
 }
13
 
15
 
14
 class _OrderPageState extends State<OrderPage> {
16
 class _OrderPageState extends State<OrderPage> {
17
+  List<OrderListAll> orderListItem = [];
18
+
19
+  @override
20
+  void initState() {
21
+    // TODO: implement initState
22
+    super.initState();
23
+    
24
+    getOrderList(true).then((value) {
25
+      setState(() {
26
+        value['records'].forEach((item) {
27
+          orderListItem.add(OrderListAll.fromJson(item));
28
+        });
29
+      });
30
+    });
31
+  }
32
+
15
   @override
33
   @override
16
   Widget build(BuildContext context) {
34
   Widget build(BuildContext context) {
17
     return ListView(
35
     return ListView(
19
         Container(
37
         Container(
20
           padding: EdgeInsets.fromLTRB(15, 0, 15, 0),
38
           padding: EdgeInsets.fromLTRB(15, 0, 15, 0),
21
           height: 55.w,
39
           height: 55.w,
22
-          decoration: BoxDecoration(
23
-            color: Colors.white
24
-          ),
40
+          decoration: BoxDecoration(color: Colors.white),
25
           child: Row(
41
           child: Row(
26
             mainAxisAlignment: MainAxisAlignment.spaceBetween,
42
             mainAxisAlignment: MainAxisAlignment.spaceBetween,
27
-
28
             children: [
43
             children: [
29
               Row(
44
               Row(
30
                 children: [
45
                 children: [
31
-                  Padding(padding: EdgeInsets.fromLTRB(0, 0, 8, 0),
32
-                  child:Image(image: AssetImage('images/ordersListImga.png'),fit: BoxFit.cover,width: 18.w,),
46
+                  Padding(
47
+                    padding: EdgeInsets.fromLTRB(0, 0, 8, 0),
48
+                    child: Image(
49
+                      image: AssetImage('images/ordersListImga.png'),
50
+                      fit: BoxFit.cover,
51
+                      width: 18.w,
52
+                    ),
33
                   ),
53
                   ),
34
-                  Text('订单列表',
54
+                  Text(
55
+                    '订单列表',
35
                     style: TextStyle(
56
                     style: TextStyle(
36
-                      color: Color(0xff222222),
37
-                      fontSize: 20.sp,
38
-                      fontWeight: FontWeight.bold
39
-                    ),
57
+                        color: Color(0xff222222),
58
+                        fontSize: 20.sp,
59
+                        fontWeight: FontWeight.bold),
40
                   )
60
                   )
41
                 ],
61
                 ],
42
               ),
62
               ),
43
             ],
63
             ],
44
           ),
64
           ),
45
         ),
65
         ),
46
- Column(
47
-        mainAxisSize: MainAxisSize.min,
48
-        children: [
49
-          OrderListCard(),
50
-          OrderListCard(),
51
-          OrderListCard(),
52
-          OrderListCard(),
53
-
54
-
55
-        ],
56
-      ),
57
-
58
-    ],
66
+        Column(
67
+          mainAxisSize: MainAxisSize.min,
68
+          children:
69
+              orderListItem.map((item) => OrderListCard(item: item)).toList(),
70
+        ),
71
+      ],
59
     );
72
     );
60
   }
73
   }
61
 }
74
 }

+ 33
- 15
lib/widgets/OrderListCard.dart View File

2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
 import 'package:get/get.dart';
3
 import 'package:get/get.dart';
4
 
4
 
5
+import '../models/entities/OrderListAll.dart';
5
 import '../pages/OrderConfirmation/index.dart';
6
 import '../pages/OrderConfirmation/index.dart';
6
 import '../pages/orderInfo/index.dart';
7
 import '../pages/orderInfo/index.dart';
7
 import 'LinearGradientText.dart';
8
 import 'LinearGradientText.dart';
8
-import 'OrderInfoCard.dart';
9
 
9
 
10
-class OrderListCard extends StatelessWidget {
11
-  const OrderListCard({Key? key}) : super(key: key);
10
+
11
+class OrderListCard extends StatefulWidget {
12
+
13
+  final OrderListAll item;
14
+
15
+  const OrderListCard({Key? key, required this.item}) : super(key: key);
16
+
17
+  @override
18
+  _OrderListCardPages createState() => _OrderListCardPages(item);
19
+}
20
+
21
+
22
+
23
+
24
+class _OrderListCardPages extends State<OrderListCard> {
25
+
26
+  final OrderListAll item;
27
+
28
+  _OrderListCardPages(this.item);
29
+
12
 
30
 
13
   @override
31
   @override
14
   Widget build(BuildContext context) {
32
   Widget build(BuildContext context) {
55
                     children: [
73
                     children: [
56
                       Container(
74
                       Container(
57
                         child: RichText(
75
                         child: RichText(
58
-                          text: const TextSpan(children: <InlineSpan>[
76
+                          text:  TextSpan(children: <InlineSpan>[
59
                             TextSpan(
77
                             TextSpan(
60
                                 text: '订单编号:',
78
                                 text: '订单编号:',
61
                                 style: TextStyle(
79
                                 style: TextStyle(
63
                                     fontSize: 16,
81
                                     fontSize: 16,
64
                                     fontWeight: FontWeight.bold)),
82
                                     fontWeight: FontWeight.bold)),
65
                             TextSpan(
83
                             TextSpan(
66
-                                text: 'XUHUI12345',
84
+                                text: item.orderNo,
67
                                 style: TextStyle(
85
                                 style: TextStyle(
68
                                     color: Color(0xff222222),
86
                                     color: Color(0xff222222),
69
                                     fontSize: 16,
87
                                     fontSize: 16,
93
                     Padding(
111
                     Padding(
94
                       padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
112
                       padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
95
                       child: RichText(
113
                       child: RichText(
96
-                        text: const TextSpan(children: <InlineSpan>[
114
+                        text:  TextSpan(children: <InlineSpan>[
97
                           TextSpan(
115
                           TextSpan(
98
                               text: '农机名称:',
116
                               text: '农机名称:',
99
                               style: TextStyle(
117
                               style: TextStyle(
101
                                   fontSize: 16,
119
                                   fontSize: 16,
102
                                   fontWeight: FontWeight.bold)),
120
                                   fontWeight: FontWeight.bold)),
103
                           TextSpan(
121
                           TextSpan(
104
-                              text: '老李家收割机MVGV-005',
122
+                              text: item.machineryName,
105
                               style: TextStyle(
123
                               style: TextStyle(
106
                                   color: Color(0xff222222),
124
                                   color: Color(0xff222222),
107
                                   fontSize: 16,
125
                                   fontSize: 16,
112
                     Padding(
130
                     Padding(
113
                       padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
131
                       padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
114
                       child: RichText(
132
                       child: RichText(
115
-                        text: const TextSpan(children: <InlineSpan>[
133
+                        text:  TextSpan(children: <InlineSpan>[
116
                           TextSpan(
134
                           TextSpan(
117
                               text: '作业面积:',
135
                               text: '作业面积:',
118
                               style: TextStyle(
136
                               style: TextStyle(
120
                                   fontSize: 16,
138
                                   fontSize: 16,
121
                                   fontWeight: FontWeight.bold)),
139
                                   fontWeight: FontWeight.bold)),
122
                           TextSpan(
140
                           TextSpan(
123
-                              text: '2辆',
141
+                              text: item.amount.toString(),
124
                               style: TextStyle(
142
                               style: TextStyle(
125
                                   color: Color(0xff222222),
143
                                   color: Color(0xff222222),
126
                                   fontSize: 16,
144
                                   fontSize: 16,
131
                     Padding(
149
                     Padding(
132
                       padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
150
                       padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
133
                       child: RichText(
151
                       child: RichText(
134
-                        text: const TextSpan(children: <InlineSpan>[
152
+                        text:  TextSpan(children: <InlineSpan>[
135
                           TextSpan(
153
                           TextSpan(
136
                               text: '需求时间:',
154
                               text: '需求时间:',
137
                               style: TextStyle(
155
                               style: TextStyle(
139
                                   fontSize: 16,
157
                                   fontSize: 16,
140
                                   fontWeight: FontWeight.bold)),
158
                                   fontWeight: FontWeight.bold)),
141
                           TextSpan(
159
                           TextSpan(
142
-                              text: '2018-08-21',
160
+                              text: item.appointmentDate.toString(),
143
                               style: TextStyle(
161
                               style: TextStyle(
144
                                   color: Color(0xff222222),
162
                                   color: Color(0xff222222),
145
                                   fontSize: 16,
163
                                   fontSize: 16,
150
                     Padding(
168
                     Padding(
151
                       padding: EdgeInsets.fromLTRB(0, 0, 0, 4),
169
                       padding: EdgeInsets.fromLTRB(0, 0, 0, 4),
152
                       child: RichText(
170
                       child: RichText(
153
-                        text: const TextSpan(children: <InlineSpan>[
171
+                        text:  TextSpan(children: <InlineSpan>[
154
                           TextSpan(
172
                           TextSpan(
155
                               text: '下单时间:',
173
                               text: '下单时间:',
156
                               style: TextStyle(
174
                               style: TextStyle(
158
                                   fontSize: 16,
176
                                   fontSize: 16,
159
                                   fontWeight: FontWeight.bold)),
177
                                   fontWeight: FontWeight.bold)),
160
                           TextSpan(
178
                           TextSpan(
161
-                              text: '2022-04-13',
179
+                              text: item.createDate.toString(),
162
                               style: TextStyle(
180
                               style: TextStyle(
163
                                   color: Color(0xff222222),
181
                                   color: Color(0xff222222),
164
                                   fontSize: 16,
182
                                   fontSize: 16,
208
                                 Color(0xFFB61515),
226
                                 Color(0xFFB61515),
209
                               ],
227
                               ],
210
                               child: RichText(
228
                               child: RichText(
211
-                                text: const TextSpan(
229
+                                text:  TextSpan(
212
                                     children: <InlineSpan>[
230
                                     children: <InlineSpan>[
213
                                       TextSpan(
231
                                       TextSpan(
214
-                                          text: "8808",
232
+                                          text:( item.charges!/100).toString(),
215
                                           style: TextStyle(
233
                                           style: TextStyle(
216
                                             fontSize: 16,
234
                                             fontSize: 16,
217
                                             fontWeight: FontWeight.bold,
235
                                             fontWeight: FontWeight.bold,