OrderListCard.dart 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'package:get/get.dart';
  4. import '../models/entities/OrderListAll.dart';
  5. import '../pages/OrderConfirmation/index.dart';
  6. import '../pages/orderInfo/index.dart';
  7. import 'package:intl/intl.dart';
  8. import 'LinearGradientText.dart';
  9. class OrderListCard extends StatefulWidget {
  10. final OrderListAll item;
  11. const OrderListCard({Key? key, required this.item}) : super(key: key);
  12. @override
  13. _OrderListCardPages createState() => _OrderListCardPages(item);
  14. }
  15. class StyleObj {
  16. String title;
  17. Color styleColor;
  18. StyleObj ({ required this.title, required this.styleColor});
  19. }
  20. class _OrderListCardPages extends State<OrderListCard> {
  21. final OrderListAll item;
  22. _OrderListCardPages(this.item);
  23. StyleObj orderStates(){
  24. if (item.payStatus == 0) {
  25. return StyleObj(
  26. title: '待付款',
  27. styleColor: Color(0xFF51D4FF)
  28. );
  29. } else if (item.payStatus == 1 && item.workStatus == 0 && item.dispatchStatus == 0) {
  30. return StyleObj(
  31. title: '已付款',
  32. styleColor: Color(0xFFFF703B)
  33. );
  34. } else if (item.payStatus == 1 && item.dispatchStatus == 1 && item.workStatus == 0) {
  35. return StyleObj(
  36. title: '待作业',
  37. styleColor: Color(0xFFFF703B)
  38. );
  39. } else if (item.payStatus == 1 && (item.workStatus == 1 || item.workStatus == 2)) {
  40. return StyleObj(
  41. title: '进行中',
  42. styleColor: Color(0xFF44F68B)
  43. );
  44. } else if (item.workStatus == 3 && item.isEvaluated == 0) {
  45. return StyleObj(
  46. title: '待评价',
  47. styleColor: Color(0xFF51D4FF)
  48. );
  49. } if (item.workStatus == 3 && item.isEvaluated == 1 && item.dispatchStatus == 1) {
  50. return StyleObj(
  51. title: '已完成',
  52. styleColor: Color(0xFFFF703B)
  53. );
  54. } else if (item.payStatus == -1 && item.workStatus == 0 && item.isRefund == 1) {
  55. return StyleObj(
  56. title: '已退单',
  57. styleColor: Color(0xFFFF703B)
  58. );
  59. } else if (item.payStatus == 3 && (item.dispatchStatus == 1 || item.dispatchStatus == 0)) {
  60. return StyleObj(
  61. title: '退单申请中',
  62. styleColor: Color(0xFFFF703B)
  63. );
  64. } else {
  65. return StyleObj(
  66. title: '异常',
  67. styleColor: Color(0xFFFF0000)
  68. );
  69. }
  70. }
  71. @override
  72. Widget build(BuildContext context) {
  73. return
  74. Container(
  75. width: 375.w,
  76. height: 345.h,
  77. margin: EdgeInsets.fromLTRB(0, 0, 0, 20),
  78. decoration: const BoxDecoration(color: Colors.white, boxShadow: [
  79. BoxShadow(
  80. color: Colors.black12,
  81. offset: Offset(0.0, 15.0), //阴影xy轴偏移量
  82. blurRadius: 15.0, //阴影模糊程度
  83. spreadRadius: 1.0 //阴影扩散程度
  84. )
  85. ]),
  86. child: Row(
  87. crossAxisAlignment: CrossAxisAlignment.start,
  88. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  89. children: [
  90. Container(
  91. margin: EdgeInsets.fromLTRB(15, 20, 15, 0),
  92. width: 18.0,
  93. height: 275.h,
  94. child: Image(
  95. image: AssetImage('images/ordersLeft.png'),
  96. ),
  97. ),
  98. Expanded(
  99. child: Column(
  100. crossAxisAlignment: CrossAxisAlignment.start,
  101. children: [
  102. Container(
  103. width: 320.w,
  104. margin: EdgeInsets.fromLTRB(0, 10, 0, 15),
  105. padding: EdgeInsets.fromLTRB(0, 0, 0, 20),
  106. decoration: const BoxDecoration(
  107. border: Border(
  108. bottom:
  109. BorderSide(width: 0.5, color: Color(0x20000000)
  110. // 0x17000000
  111. ))),
  112. child: Row(
  113. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  114. children: [
  115. Container(
  116. child: RichText(
  117. text: TextSpan(children: <InlineSpan>[
  118. TextSpan(
  119. text: '订单编号:',
  120. style: TextStyle(
  121. color: Color(0xff666666),
  122. fontSize: 16,
  123. fontWeight: FontWeight.bold)),
  124. TextSpan(
  125. text: item.orderNo,
  126. style: TextStyle(
  127. color: Color(0xff222222),
  128. fontSize: 16,
  129. fontWeight: FontWeight.bold)),
  130. ]),
  131. ),
  132. ),
  133. GestureDetector(
  134. child: const Text('详情 >>',
  135. style: TextStyle(
  136. color: Color(0xff222222),
  137. fontSize: 16,
  138. fontWeight: FontWeight.bold,
  139. )),
  140. onTap: () {
  141. print('进入详情');
  142. Get.toNamed('/orderPageInfo',arguments:{'id':item.orderId,'title':orderStates().title,'styleColor':orderStates().styleColor});
  143. },
  144. )
  145. ],
  146. ),
  147. ),
  148. Expanded(
  149. child: Column(
  150. crossAxisAlignment: CrossAxisAlignment.start,
  151. children: [
  152. Padding(
  153. padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
  154. child: RichText(
  155. text: TextSpan(children: <InlineSpan>[
  156. TextSpan(
  157. text: '农机名称:',
  158. style: TextStyle(
  159. color: Color(0xff666666),
  160. fontSize: 16,
  161. fontWeight: FontWeight.bold)),
  162. TextSpan(
  163. text: item.machineryName,
  164. style: TextStyle(
  165. color: Color(0xff222222),
  166. fontSize: 16,
  167. fontWeight: FontWeight.bold)),
  168. ]),
  169. ),
  170. ),
  171. Padding(
  172. padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
  173. child: RichText(
  174. text: TextSpan(children: <InlineSpan>[
  175. TextSpan(
  176. text: '作业面积:',
  177. style: TextStyle(
  178. color: Color(0xff666666),
  179. fontSize: 16,
  180. fontWeight: FontWeight.bold)),
  181. TextSpan(
  182. text: item.amount.toString(),
  183. style: TextStyle(
  184. color: Color(0xff222222),
  185. fontSize: 16,
  186. fontWeight: FontWeight.bold)),
  187. ]),
  188. ),
  189. ),
  190. Padding(
  191. padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
  192. child: RichText(
  193. text: TextSpan(children: <InlineSpan>[
  194. TextSpan(
  195. text: '需求时间:',
  196. style: TextStyle(
  197. color: Color(0xff666666),
  198. fontSize: 16,
  199. fontWeight: FontWeight.bold)),
  200. TextSpan(
  201. text: DateFormat("yyyy-MM-dd").format(DateTime.parse(item.appointmentDate.toString())),
  202. style: TextStyle(
  203. color: Color(0xff222222),
  204. fontSize: 16,
  205. fontWeight: FontWeight.bold)),
  206. ]),
  207. ),
  208. ),
  209. Padding(
  210. padding: EdgeInsets.fromLTRB(0, 0, 0, 4),
  211. child: RichText(
  212. text: TextSpan(children: <InlineSpan>[
  213. TextSpan(
  214. text: '下单时间:',
  215. style: TextStyle(
  216. color: Color(0xff666666),
  217. fontSize: 16,
  218. fontWeight: FontWeight.bold)),
  219. TextSpan(
  220. text: DateFormat("yyyy-MM-dd").format(DateTime.parse(item.createDate.toString())),
  221. style: TextStyle(
  222. color: Color(0xff222222),
  223. fontSize: 16,
  224. fontWeight: FontWeight.bold)),
  225. ]),
  226. ),
  227. ),
  228. ],
  229. )),
  230. Container(
  231. margin: EdgeInsets.fromLTRB(0, 0, 0, 30),
  232. padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
  233. decoration: const BoxDecoration(
  234. border: Border(
  235. top: BorderSide(
  236. width: 0.5, color: Color(0x20000000)))),
  237. width: 320.w,
  238. child: Row(
  239. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  240. children: [
  241. RichText(
  242. text: TextSpan(children: <InlineSpan>[
  243. TextSpan(
  244. text: '订单状态:',
  245. style: TextStyle(
  246. color:Color(0xff666666),
  247. fontSize: 16,
  248. fontWeight: FontWeight.bold)),
  249. TextSpan(
  250. text: orderStates().title,
  251. style: TextStyle(
  252. color:orderStates().styleColor,
  253. fontSize: 16,
  254. fontWeight: FontWeight.bold)),
  255. ]),
  256. ),
  257. Container(
  258. child: Row(
  259. children: [
  260. const Text('费用:',style: TextStyle(
  261. color: Color(0xff666666),
  262. fontSize: 16,
  263. fontWeight: FontWeight.bold)),
  264. LinearGradientText(
  265. colors: const <Color>[
  266. Color(0xFFFA7878),
  267. Color(0xFFB61515),
  268. ],
  269. child: RichText(
  270. text: TextSpan(
  271. children: <InlineSpan>[
  272. TextSpan(
  273. text:( item.charges!/100).toString(),
  274. style: TextStyle(
  275. fontSize: 16,
  276. fontWeight: FontWeight.bold,
  277. )),
  278. TextSpan(
  279. text: "元",
  280. style: TextStyle(
  281. fontSize: 16,
  282. fontWeight: FontWeight.bold,
  283. )),
  284. ]
  285. ),
  286. ),
  287. ),
  288. ],
  289. ),
  290. ),
  291. ],
  292. ),
  293. ),
  294. ],
  295. ),
  296. ),
  297. ],
  298. ),
  299. );
  300. }
  301. }