李志伟 před 3 roky
rodič
revize
979d5dae27

+ 28
- 0
lib/models/entities/Banner.dart Zobrazit soubor

@@ -0,0 +1,28 @@
1
+class Banners {
2
+  String? bannerId;
3
+  String? title;
4
+  String? thumb;
5
+  String? position;
6
+  num? sortNo;
7
+  num? status;
8
+  String? createDat;
9
+  Banners();
10
+
11
+  Banners.fromJson(Map<String, dynamic> json)
12
+      : bannerId = json["bannerId"],
13
+        title = json["title"],
14
+        thumb = json["thumb"],
15
+        position = json["position"],
16
+        sortNo = json["sortNo"],
17
+        status = json["status"],
18
+        createDat = json["createDat"];
19
+  Map<String, dynamic> toJson() => {
20
+    "bannerId": bannerId,
21
+    "title": title,
22
+    "thumb": thumb,
23
+    "position": position,
24
+    "sortNo": sortNo,
25
+    "status": status,
26
+    "createDat": createDat,
27
+  };
28
+}

+ 118
- 0
lib/models/entities/Job.dart Zobrazit soubor

@@ -0,0 +1,118 @@
1
+import 'dart:core';
2
+
3
+class Job {
4
+  //地址
5
+  String? address;
6
+  //预约时间
7
+  String? appointmentDate;
8
+  //作业面积
9
+  String? area;
10
+  //费用
11
+  int? charges;
12
+  //创建时间
13
+  String? createDate;
14
+//  创建人
15
+  String? createUser;
16
+//  调度ID
17
+  String? dispatchId;
18
+//  结束时间
19
+  String? endDate;
20
+//  作业ID
21
+  String? jobId;
22
+//  农机ID
23
+  String? machineryId;
24
+//  农机名称
25
+  String? machineryName;
26
+//  农机型号Id
27
+  String? machineryTypeId;
28
+//  农机型号名称
29
+  String? machineryTypeName;
30
+//  下单时间
31
+  String? orderDate;
32
+//  订单ID
33
+  String? orderId;
34
+//  订单号
35
+  String? orderNo;
36
+//  机构ID
37
+  String? orgId;
38
+//  机构名称
39
+  String? orgName;
40
+//  下单人Id
41
+  String? personId;
42
+//  下单人名称
43
+  String? personName;
44
+//  下单人手机号
45
+  String? phone;
46
+//  区域ID
47
+  String? regionId;
48
+//  开始时间
49
+  String? startDate;
50
+//  状态
51
+  int? status;
52
+//  作业类型
53
+  String? typeId;
54
+//  农机手ID
55
+  String? workerId;
56
+//  农机手名称
57
+  String? workerName;
58
+
59
+  Job();
60
+  Job.fromJson(Map<String, dynamic> json)
61
+      : jobId = json["jobId"],
62
+        dispatchId = json["dispatchId"],
63
+        orderId = json["orderId"],
64
+        workerId = json["workerId"],
65
+        machineryId = json["machineryId"],
66
+        startDate = json["startDate"],
67
+        endDate = json["endDate"],
68
+        regionId = json["regionId"],
69
+        typeId = json["typeId"],
70
+        area = json["area"],
71
+        orgId = json["orgId"],
72
+        status = json["status"],
73
+        createUser = json["createUser"],
74
+        createDate = json["createDate"],
75
+        orderNo = json["orderNo"],
76
+        personId = json["personId"],
77
+        personName = json["personName"],
78
+        phone = json["phone"],
79
+        address = json["address"],
80
+        charges = json["charges"],
81
+        appointmentDate = json["appointmentDate"],
82
+        orderDate = json["orderDate"],
83
+        workerName = json["workerName"],
84
+        machineryName = json["machineryName"],
85
+        orgName = json["orgName"],
86
+        machineryTypeId = json["machineryTypeId"],
87
+        machineryTypeName = json["machineryTypeName"];
88
+
89
+  Map<String, dynamic> toJson() => {
90
+        'jobId': jobId,
91
+        'dispatchId': dispatchId,
92
+        'orderId': orderId,
93
+        'workerId': workerId,
94
+        'machineryId': machineryId,
95
+        'startDate': startDate,
96
+        'endDate': endDate,
97
+        'regionId': regionId,
98
+        'typeId': typeId,
99
+        'area': area,
100
+        'orgId': orgId,
101
+        'status': status,
102
+        'createUser': createUser,
103
+        'createDate': createDate,
104
+        'orderNo': orderNo,
105
+        'personId': personId,
106
+        'personName': personName,
107
+        'phone': phone,
108
+        'address': address,
109
+        'charges': charges,
110
+        'appointmentDate': appointmentDate,
111
+        'orderDate': orderDate,
112
+        'workerName': workerName,
113
+        'machineryName': machineryName,
114
+        'orgName': orgName,
115
+        'machineryTypeId': machineryTypeId,
116
+        'machineryTypeName': machineryTypeName,
117
+      };
118
+}

+ 117
- 0
lib/models/entities/Order.dart Zobrazit soubor

@@ -0,0 +1,117 @@
1
+class OrderModel {
2
+  //作业地址
3
+  String? address;
4
+  //作业面积
5
+  int? amount;
6
+  //预约时间
7
+  String? appointmentDate;
8
+  //费用
9
+  int? charges;
10
+  //下单时间
11
+  String? createDate;
12
+  //调度ID
13
+  String? dispatchId;
14
+  //调度状态
15
+  int? dispatchStatus;
16
+  //是否评价
17
+  int? isEvaluated;
18
+  //是否退单
19
+  int? isRefund;
20
+  //农机ID
21
+  String? machineryId;
22
+  //农机名称
23
+  String? machineryName;
24
+  //农机类型
25
+  String? machineryType;
26
+  //订单Id
27
+  String? orderId;
28
+  //订单编号
29
+  String? orderNo;
30
+  //接单机构
31
+  String? orgId;
32
+  //接单机构名称
33
+  String? orgName;
34
+  //付款状态
35
+  int? payStatus;
36
+  //支付端
37
+  String? payType;
38
+  //下单人Id
39
+  String? personId;
40
+  //下单人名称
41
+  String? personName;
42
+  //下单人手机号
43
+  String? phone;
44
+  //单价
45
+  int? price;
46
+  //状态
47
+  int? status;
48
+  //类型名称
49
+  String? typeName;
50
+  //农机手ID
51
+  String? workId;
52
+  //农机手名称
53
+  String? workName;
54
+  //工作状态
55
+  int? workStatus;
56
+
57
+  OrderModel();
58
+
59
+  OrderModel.fromJson(Map<String, dynamic> json)
60
+      : orderId = json['orderId'],
61
+        orderNo = json['orderNo'],
62
+        personId = json['personId'],
63
+        personName = json['personName'],
64
+        phone = json['phone'],
65
+        charges = json['charges'],
66
+        price = json['price'],
67
+        amount = json['amount'],
68
+        machineryId = json['machineryId'],
69
+        machineryName = json['machineryName'],
70
+        machineryType = json['machineryType'],
71
+        typeName = json['typeName'],
72
+        address = json['address'],
73
+        appointmentDate = json['appointmentDate'],
74
+        payStatus = json['payStatus'],
75
+        dispatchStatus = json['dispatchStatus'],
76
+        workStatus = json['workStatus'],
77
+        isEvaluated = json['isEvaluated'],
78
+        payType = json['payType'],
79
+        isRefund = json['isRefund'],
80
+        orgId = json['orgId'],
81
+        orgName = json['orgName'],
82
+        status = json['status'],
83
+        createDate = json['createDate'],
84
+        dispatchId = json['dispatchId'],
85
+        workId = json['workId'],
86
+        workName = json['workName'];
87
+
88
+  Map<String, dynamic> toJson() => {
89
+        'orderId': orderId,
90
+        'orderNo': orderNo,
91
+        'personId': personId,
92
+        'personName': personName,
93
+        'phone': phone,
94
+        'charges': charges,
95
+        'price': price,
96
+        'amount': amount,
97
+        'machineryId': machineryId,
98
+        'machineryName': machineryName,
99
+        'machineryType': machineryType,
100
+        'typeName': typeName,
101
+        'address': address,
102
+        'appointmentDate': appointmentDate,
103
+        'payStatus': payStatus,
104
+        'dispatchStatus': dispatchStatus,
105
+        'workStatus': workStatus,
106
+        'isEvaluated': isEvaluated,
107
+        'payType': payType,
108
+        'isRefund': isRefund,
109
+        'orgId': orgId,
110
+        'orgName': orgName,
111
+        'status': status,
112
+        'createDate': createDate,
113
+        'dispatchId': dispatchId,
114
+        'workId': workId,
115
+        'workName': workName,
116
+      };
117
+}

+ 13
- 39
lib/pages/home/widgets/home/index.dart Zobrazit soubor

@@ -1,8 +1,12 @@
1
+import 'dart:math';
2
+
1 3
 import 'package:carousel_slider/carousel_slider.dart';
2 4
 import 'package:flutter/material.dart';
3 5
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4 6
 import 'package:get/get.dart';
5 7
 import 'package:worker_client/pages/home/widgets/home/widgets/headers.dart';
8
+import 'package:worker_client/services/banner.dart';
9
+import 'package:worker_client/widgets/MyCard/index.dart';
6 10
 
7 11
 class HomePage extends StatefulWidget {
8 12
   const HomePage({Key? key}) : super(key: key);
@@ -12,6 +16,14 @@ class HomePage extends StatefulWidget {
12 16
 }
13 17
 
14 18
 class _HomePageState extends State<HomePage> {
19
+
20
+  @override
21
+  void initState() {
22
+    super.initState();
23
+    getBannerList('bannerWorker').then((value) {}
24
+    );
25
+  }
26
+
15 27
   final List<String> imgList = [
16 28
     'https://images.unsplash.com/photo-1520342868574-5fa3804e551c?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=6ff92caffcdd63681a35134a6770ed3b&auto=format&fit=crop&w=1951&q=80',
17 29
     'https://images.unsplash.com/photo-1522205408450-add114ad53fe?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=368f45b0888aeb0b7b08e3a1084d3ede&auto=format&fit=crop&w=1950&q=80',
@@ -71,45 +83,7 @@ class _HomePageState extends State<HomePage> {
71 83
               ],
72 84
             ),
73 85
           ),
74
-          Container(
75
-            margin: EdgeInsets.fromLTRB(0, 0, 0, 15.h),
76
-            padding: EdgeInsets.all(20.w),
77
-            width: 345.w,
78
-            height: 90.h,
79
-            decoration: BoxDecoration(
80
-              color: Colors.white,
81
-              boxShadow: [
82
-                BoxShadow(
83
-                    color: Color(0xE2000000),
84
-                    offset: Offset(0, 0),
85
-                    blurRadius: 22.w)
86
-              ],
87
-              borderRadius: BorderRadius.all(Radius.circular(20.w)),
88
-            ),
89
-            child: Stack(
90
-              children: [
91
-                Positioned(
92
-                    top: -122.w,
93
-                    left: -134.w,
94
-                    child: Container(
95
-                      width: 225.w,
96
-                      height: 217.w,
97
-                      decoration: BoxDecoration(
98
-                        borderRadius: BorderRadius.all(Radius.circular(137.w)),
99
-                        border: Border.all(width: 1.w,color: Color(0xFFc7c7c7),style: BorderStyle.solid),
100
-                        gradient: LinearGradient(
101
-                          colors: [
102
-                            Color(0xFF8f8f8f),
103
-                            Color(0xFFc0c0c0),
104
-                          ],
105
-                        ),
106
-                      ),
107
-                    ),
108
-                ),
109
-
110
-              ],
111
-            ),
112
-          ),
86
+          MyCard(),
113 87
         ],
114 88
       ),
115 89
     );

+ 17
- 0
lib/services/banner.dart Zobrazit soubor

@@ -0,0 +1,17 @@
1
+import 'package:dio/dio.dart';
2
+import '../utils/Request.dart';
3
+import 'package:fluttertoast/fluttertoast.dart';
4
+
5
+/**
6
+ * banner轮播图列表
7
+ * @param {*} data
8
+ * @returns
9
+ */
10
+Future getBannerList(String position) async {
11
+  return request('/banner',
12
+      options: Options(method: 'GET'), data: {'position': position})
13
+      .catchError((error) => {
14
+    Fluttertoast.showToast(msg: error.error['message']),
15
+  });
16
+}
17
+

+ 24
- 0
lib/services/job.dart Zobrazit soubor

@@ -0,0 +1,24 @@
1
+import 'package:dio/dio.dart';
2
+import '../utils/Request.dart';
3
+import 'package:fluttertoast/fluttertoast.dart';
4
+
5
+/// 作业列表
6
+/// @param {*} data
7
+/// @returns
8
+Future getJobList() async {
9
+  return request('/work-job', options: Options(method: 'GET'))
10
+      .catchError((error) => {
11
+            Fluttertoast.showToast(msg: error.error['message']),
12
+          });
13
+}
14
+
15
+/// 作业详情
16
+/// @param {*} data
17
+/// @returns
18
+Future getJobDetail(String id) async {
19
+  return request('/work-job',
20
+          options: Options(method: 'GET'), queryParameters: {'id': id})
21
+      .catchError((error) => {
22
+            Fluttertoast.showToast(msg: error.error['message']),
23
+          });
24
+}

+ 138
- 0
lib/widgets/MyCard/index.dart Zobrazit soubor

@@ -0,0 +1,138 @@
1
+import 'dart:math';
2
+import 'package:flutter/material.dart';
3
+import 'package:flutter_screenutil/flutter_screenutil.dart';
4
+import 'package:worker_client/widgets/MyCard/widgets/CardCell.dart';
5
+
6
+class MyCard extends StatelessWidget{
7
+
8
+  const MyCard({Key? key}) : super(key: key);
9
+
10
+  @override
11
+  Widget build(BuildContext context) {
12
+    return Container(
13
+      margin: EdgeInsets.fromLTRB(0, 0, 0, 15.w),
14
+      clipBehavior: Clip.hardEdge,
15
+      width: 345.w,
16
+      decoration: BoxDecoration(
17
+        color: Colors.white,
18
+        boxShadow: [
19
+          BoxShadow(
20
+              color: const Color(0x24000000),
21
+              offset: const Offset(0, 0),
22
+              blurRadius: 22.w)
23
+        ],
24
+        borderRadius: BorderRadius.all(Radius.circular(20.w)),
25
+      ),
26
+      child: Stack(
27
+        children: [
28
+          Positioned(
29
+            top: -61.w,
30
+            left: -67.w,
31
+            child: Transform.rotate(
32
+              angle: pi / 6,
33
+              child: Container(
34
+                width: 112.5.w,
35
+                height: 108.5.w,
36
+                decoration: BoxDecoration(
37
+                  borderRadius: BorderRadius.all(Radius.circular(68.5.w)),
38
+                  border: Border.all(
39
+                      width: 1.w,
40
+                      color: Color(0xFFc7c7c7),
41
+                      style: BorderStyle.solid),
42
+                  gradient: LinearGradient(
43
+                    colors: [
44
+                      Color(0xFFA0E067),
45
+                      Color(0xFF00AE39),
46
+                    ],
47
+                  ),
48
+                ),
49
+                child: Transform.rotate(
50
+                  angle: -pi / 2.3,
51
+                  child: Transform.translate(
52
+                    offset: Offset(38.w, 85.w),
53
+                    child: Text(
54
+                      '进行中',
55
+                      style: TextStyle(
56
+                          fontSize: 14.sp,
57
+                          fontWeight: FontWeight.bold,
58
+                          color: Color(0xffffffff)),
59
+                    ),
60
+                  ),
61
+                ),
62
+              ),
63
+            ),
64
+          ),
65
+          Container(
66
+            padding: EdgeInsets.all(20.w),
67
+            child: Column(
68
+              children: [
69
+                Container(
70
+                  padding: EdgeInsets.fromLTRB(19.w, 9.w, 0, 9.w),
71
+                  child: Row(
72
+                    children: [
73
+                      SizedBox(
74
+                        width: 70,
75
+                        child: Text(
76
+                          '需求时间',
77
+                          style: TextStyle(
78
+                              fontSize: 17.sp,
79
+                              color: const Color(0xFF606060),
80
+                              fontWeight: FontWeight.bold,
81
+                              letterSpacing: 2),
82
+                        ),
83
+                      ),
84
+                      Text(
85
+                        ':',
86
+                        style: TextStyle(
87
+                          fontSize: 17.sp,
88
+                          color: const Color(0xFF606060),
89
+                          fontWeight: FontWeight.bold,
90
+                        ),
91
+                      ),
92
+                      Expanded(
93
+                        flex: 1,
94
+                        child: Text(
95
+                          '2025-05-25',
96
+                          style: TextStyle(
97
+                              fontSize: 17.sp,
98
+                              color: Color(0xFF101010),
99
+                              fontWeight: FontWeight.bold),
100
+                        ),
101
+                      ),
102
+                      GestureDetector(
103
+                        onTap: () {},
104
+                        child: Container(
105
+                          margin: EdgeInsets.fromLTRB(0, 0, 7.5.w, 0),
106
+                          child: Text(
107
+                            '详情>>',
108
+                            style: TextStyle(
109
+                                fontSize: 17.sp,
110
+                                fontWeight: FontWeight.bold,
111
+                                color: Color(0xFF606060)),
112
+                          ),
113
+                        ),
114
+                      )
115
+                    ],
116
+                  ),
117
+                ),
118
+                Divider(
119
+                  color: Color(0xE5000000),
120
+                  height: 30.h,
121
+                  thickness: 0.5.w,
122
+                ),
123
+                CardCell(lable: '订单号', content: 'M-20220424000003', size: 8.6),
124
+                CardCell(lable: '农机名称', content: '源盛第四种农机的第一个农机', size: 2),
125
+                CardCell(lable: '下单人', content: '', size: 8.6),
126
+                CardCell(lable: '手机号', content: '18082043755', size: 8.6),
127
+                CardCell(lable: '订单时间', content: '2022-04-24', size: 2),
128
+                CardCell(lable: '作业时间', content: '2022-04-24 15:54:51 2022-04-25 15:54:51', size: 2),
129
+                CardCell(lable: '订单费用', content: '0.01元', size: 2),
130
+              ],
131
+            ),
132
+          ),
133
+        ],
134
+      ),
135
+    );
136
+  }
137
+
138
+}

+ 59
- 0
lib/widgets/MyCard/widgets/CardCell.dart Zobrazit soubor

@@ -0,0 +1,59 @@
1
+import 'package:flutter/material.dart';
2
+import 'package:flutter_screenutil/flutter_screenutil.dart';
3
+
4
+class CardCell extends StatelessWidget {
5
+  final String lable;
6
+  final String content;
7
+  final double size;
8
+
9
+  const CardCell(
10
+      {Key? key,
11
+        required this.lable,
12
+        required this.content,
13
+        required this.size})
14
+      : super(key: key);
15
+
16
+  @override
17
+  Widget build(BuildContext context) {
18
+    return Container(
19
+      padding: EdgeInsets.symmetric(vertical: 9.h, horizontal: 0),
20
+      child: Row(
21
+        crossAxisAlignment: CrossAxisAlignment.start,
22
+        children: [
23
+          SizedBox(
24
+            width: 65.w,
25
+            child: Text(
26
+              lable,
27
+              style: TextStyle(
28
+                  fontSize: 17.sp,
29
+                  color: const Color(0xFF606060),
30
+                  fontWeight: FontWeight.bold,
31
+                  letterSpacing: size),
32
+            ),
33
+          ),
34
+          Text(
35
+            ':',
36
+            style: TextStyle(
37
+              fontSize: 17.sp,
38
+              color: const Color(0xFF606060),
39
+              fontWeight: FontWeight.bold,
40
+            ),
41
+          ),
42
+          Expanded(
43
+            flex: 1,
44
+            child: Text(
45
+              content,
46
+              overflow: TextOverflow.visible,
47
+              style: TextStyle(
48
+                  fontSize: 17.sp,
49
+                  color: Color(0xFF101010),
50
+                  fontWeight: FontWeight.bold,
51
+                  height: 1.5
52
+              ),
53
+            ),
54
+          ),
55
+        ],
56
+      ),
57
+    );
58
+  }
59
+}