[baozhangchao] 3 年 前
コミット
d90a2f4d8e
共有3 個のファイルを変更した165 個の追加39 個の削除を含む
  1. 95
    0
      lib/models/entities/OrderListAll.dart
  2. 37
    24
      lib/pages/TabBar/widgets/order/index.dart
  3. 33
    15
      lib/widgets/OrderListCard.dart

+ 95
- 0
lib/models/entities/OrderListAll.dart ファイルの表示

@@ -0,0 +1,95 @@
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 ファイルの表示

@@ -1,6 +1,8 @@
1 1
 import 'package:flutter/material.dart';
2 2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3 3
 
4
+import '../../../../models/entities/OrderListAll.dart';
5
+import '../../../../services/orderAPI.dart';
4 6
 import '../../../../widgets/OrderListCard.dart';
5 7
 import '../../../orderInfo/index.dart';
6 8
 
@@ -12,6 +14,22 @@ class OrderPage extends StatefulWidget {
12 14
 }
13 15
 
14 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 33
   @override
16 34
   Widget build(BuildContext context) {
17 35
     return ListView(
@@ -19,43 +37,38 @@ class _OrderPageState extends State<OrderPage> {
19 37
         Container(
20 38
           padding: EdgeInsets.fromLTRB(15, 0, 15, 0),
21 39
           height: 55.w,
22
-          decoration: BoxDecoration(
23
-            color: Colors.white
24
-          ),
40
+          decoration: BoxDecoration(color: Colors.white),
25 41
           child: Row(
26 42
             mainAxisAlignment: MainAxisAlignment.spaceBetween,
27
-
28 43
             children: [
29 44
               Row(
30 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 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 ファイルの表示

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