order_detail.dart 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398
  1. import 'package:chewie/chewie.dart';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter/services.dart';
  5. import 'package:flutter_screenutil/flutter_screenutil.dart';
  6. import 'package:liftmanager/internal/account/provider/user_provider.dart';
  7. import 'package:liftmanager/internal/bbs/bbs_router.dart';
  8. import 'package:liftmanager/internal/bbs/model/liftcase_model.dart';
  9. import 'package:liftmanager/internal/wode/order_const.dart';
  10. import 'package:liftmanager/internal/wode/wode_router.dart';
  11. import 'package:liftmanager/net/api_service.dart';
  12. import 'package:liftmanager/res/colors.dart';
  13. import 'package:liftmanager/routers/fluro_navigator.dart';
  14. import 'package:liftmanager/utils/theme_utils.dart';
  15. import 'package:liftmanager/utils/time_format.dart';
  16. import 'package:liftmanager/utils/toast.dart';
  17. import 'package:liftmanager/utils/utils.dart';
  18. import 'package:liftmanager/widgets/app_bar.dart';
  19. import 'package:liftmanager/widgets/bbs_content.dart';
  20. import 'package:liftmanager/widgets/load_image.dart';
  21. import 'package:oktoast/oktoast.dart';
  22. import 'package:orientation/orientation.dart';
  23. import 'package:provider/provider.dart';
  24. import 'package:shared_preferences/shared_preferences.dart';
  25. import 'package:video_player/video_player.dart';
  26. class OrderDetail extends StatefulWidget {
  27. OrderDetail(this.id);
  28. final String id;
  29. @override
  30. State<StatefulWidget> createState() {
  31. return OrderDetailState();
  32. }
  33. }
  34. class OrderDetailState extends State<OrderDetail>
  35. with AutomaticKeepAliveClientMixin {
  36. UserProvider provider = UserProvider();
  37. bool _hasData = false;
  38. LiftCasesDetailModel detailObj;
  39. double totalPay;
  40. getBrandDetail() {
  41. NewApiService().getLiftcaseDetail(widget.id, onSuccess: (res) {
  42. detailObj = res;
  43. double serviceCost =
  44. detailObj.serviceCost != null ? detailObj.serviceCost : 0.0;
  45. double travelCost =
  46. detailObj.travelCost != null ? detailObj.travelCost : 0.0;
  47. double couponDeduction =
  48. detailObj.couponDeduction != null ? detailObj.couponDeduction : 0.0;
  49. double redEnvelopeDeduction = detailObj.redEnvelopeDeduction != null
  50. ? detailObj.redEnvelopeDeduction
  51. : 0.0;
  52. totalPay =
  53. (serviceCost + travelCost) - (couponDeduction + redEnvelopeDeduction);
  54. print(serviceCost);
  55. print(travelCost);
  56. print(couponDeduction);
  57. print(redEnvelopeDeduction);
  58. print(totalPay);
  59. print("456456456465");
  60. if (totalPay < 0) {
  61. totalPay = 0.0;
  62. }
  63. if (_controllerBefore == null && detailObj.beforeRepair != null) {
  64. _controllerBefore?.pause();
  65. _controllerBefore?.dispose();
  66. _controllerBefore = VideoPlayerController.network(
  67. Utils.getImagePath(detailObj.beforeRepair));
  68. }
  69. if (_controllerAfter == null && detailObj.afterRepair != null) {
  70. _controllerAfter?.pause();
  71. _controllerAfter?.dispose();
  72. _controllerAfter = VideoPlayerController.network(
  73. Utils.getImagePath(detailObj.afterRepair));
  74. }
  75. print(totalPay);
  76. print("totalPay-------------------------");
  77. _hasData = true;
  78. setState(() {});
  79. }, onError: (code, msg) {
  80. toasts(msg);
  81. });
  82. }
  83. getPayCost() {
  84. bool isPay = true;
  85. if ((detailObj.dataTable == 1 && detailObj.statuz == 0) ||
  86. (detailObj.dataTable == 2 && detailObj.statuz == 2)) {
  87. isPay = false;
  88. }
  89. return isPay;
  90. }
  91. List<Widget> btnWidget = [];
  92. VideoPlayerController _controllerBefore;
  93. VideoPlayerController _controllerAfter;
  94. @override
  95. void initState() {
  96. if (this.mounted) {
  97. getBrandDetail();
  98. }
  99. super.initState();
  100. }
  101. @override
  102. void dispose() {
  103. if (detailObj?.beforeRepair != null) {
  104. _controllerBefore?.pause();
  105. _controllerBefore?.dispose();
  106. }
  107. if (detailObj?.afterRepair != null) {
  108. _controllerAfter?.pause();
  109. _controllerAfter?.dispose();
  110. }
  111. // SystemChrome.setPreferredOrientations([
  112. // DeviceOrientation.portraitUp,
  113. // ]);
  114. OrientationPlugin.forceOrientation(DeviceOrientation.portraitUp);
  115. // provider.dispose();
  116. super.dispose();
  117. }
  118. // 用户确认订单
  119. void confirmOrder() {
  120. showLoading(context);
  121. NewApiService().userConfirmOrder(widget.id, onSuccess: (res) {
  122. dismissLoading(context);
  123. toasts("订单确认成功");
  124. getBrandDetail();
  125. setState(() {});
  126. }, onError: (code, msg) {
  127. dismissLoading(context);
  128. toasts(msg);
  129. });
  130. }
  131. // 用户删除订单
  132. void deleteOrder() {
  133. showLoading(context);
  134. NewApiService().deleteOrder(widget.id, onSuccess: (res) {
  135. dismissLoading(context);
  136. toasts("订单删除成功");
  137. Navigator.pop(context);
  138. setState(() {});
  139. }, onError: (code, msg) {
  140. dismissLoading(context);
  141. toasts(msg);
  142. });
  143. }
  144. // 用户取消订单
  145. void cancelOrder() {
  146. showLoading(context);
  147. NewApiService().cancelOrder(widget.id, onSuccess: (res) {
  148. dismissLoading(context);
  149. toasts("订单取消成功");
  150. Navigator.pop(context);
  151. getBrandDetail();
  152. setState(() {});
  153. }, onError: (code, msg) {
  154. dismissLoading(context);
  155. toasts(msg);
  156. });
  157. }
  158. // 用户确认打卡
  159. void confirmPunchin() {
  160. showLoading(context);
  161. NewApiService().userToClock(widget.id, onSuccess: (res) {
  162. dismissLoading(context);
  163. toasts("确认打卡成功");
  164. getBrandDetail();
  165. setState(() {});
  166. }, onError: (code, msg) {
  167. dismissLoading(context);
  168. toasts(msg);
  169. });
  170. }
  171. // 付款
  172. void payment() {
  173. showLoading(context);
  174. NewApiService().getTestAlipayNotify(detailObj.orderNo, onSuccess: (res) {
  175. dismissLoading(context);
  176. toasts("付款成功");
  177. getBrandDetail();
  178. setState(() {});
  179. }, onError: (code, msg) {
  180. dismissLoading(context);
  181. toasts(msg);
  182. });
  183. }
  184. getHeight(detailObj) {
  185. bool isHeight = false;
  186. if ((OrderConstant.isShow(detailObj.statuz, detailObj.dataTable,
  187. 'showUserPaymentButton') &&
  188. detailObj.chargerId != null) ||
  189. (OrderConstant.isShow(
  190. detailObj.statuz, detailObj.dataTable, 'showUserConfirmPunchButton',
  191. arrivedFlag: detailObj.arrivedFlag)) ||
  192. (OrderConstant.isShow(
  193. detailObj.statuz, detailObj.dataTable, 'showUserAppealButton')) ||
  194. (OrderConstant.isShow(detailObj.statuz, detailObj.dataTable,
  195. 'showUserConfirmOrderButton')) ||
  196. (OrderConstant.isShow(detailObj.statuz, detailObj.dataTable,
  197. 'showUserEvaluationButton')) ||
  198. (OrderConstant.isShow(detailObj.statuz, detailObj.dataTable,
  199. 'showUserChooseExpertButton') ||
  200. (detailObj.chargerId == null &&
  201. detailObj.isPlatformSpecified == 0)) ||
  202. (OrderConstant.isShow(detailObj.statuz, detailObj.dataTable,
  203. 'showUserCancelOrderButton'))) {
  204. isHeight = true;
  205. }
  206. return isHeight;
  207. }
  208. @override
  209. Widget build(BuildContext context) {
  210. double width = MediaQuery.of(context).size.width;
  211. double height = MediaQuery.of(context).size.height;
  212. if (width > height) {
  213. // SystemChrome.setPreferredOrientations([
  214. // DeviceOrientation.portraitUp,
  215. // ]);
  216. OrientationPlugin.forceOrientation(DeviceOrientation.portraitUp);
  217. }
  218. return
  219. // Center(child:new Text("个人中心"));
  220. ChangeNotifierProvider<UserProvider>(
  221. create: (_) => provider,
  222. child: Scaffold(
  223. appBar: MyAppBar(
  224. centerTitle: "订单详情",
  225. ),
  226. body: _hasData
  227. ? Consumer<UserProvider>(
  228. builder: (_, provider, __) {
  229. return SafeArea(
  230. child: Stack(
  231. children: <Widget>[
  232. ListView(
  233. padding: EdgeInsets.all(0.0),
  234. children: <Widget>[
  235. // OrderListItemWidget(detailObj),
  236. _orderTypeHead(),
  237. _lineSpase(),
  238. _orderUserDetail(),
  239. isShowMoneyDetail() ? _lineSpase() : Container(),
  240. isShowMoneyDetail()
  241. ? _orderMoneyDetail()
  242. : Container(),
  243. _lineSpase(),
  244. _orderTime(),
  245. _lineSpase(),
  246. detailObj.liftCaseAppealEntity != null
  247. ? Container(
  248. padding: EdgeInsets.only(
  249. left: ScreenUtil().setWidth(15),
  250. top: ScreenUtil().setWidth(10),
  251. bottom: ScreenUtil().setWidth(10)),
  252. child: Column(
  253. children: <Widget>[
  254. Row(
  255. children: <Widget>[
  256. Text(
  257. '驳回原因:',
  258. textAlign: TextAlign.left,
  259. style: TextStyle(
  260. fontSize: ScreenUtil().setSp(13),
  261. color: Color(0xff666666),
  262. ),
  263. ),
  264. Container(
  265. width: width * 0.75,
  266. child: Text(
  267. detailObj.liftCaseAppealEntity
  268. ?.cancelSeason ??
  269. "",
  270. textAlign: TextAlign.left,
  271. style: TextStyle(
  272. fontSize:
  273. ScreenUtil().setSp(13),
  274. color: Color(0xff666666),
  275. ),
  276. ),
  277. )
  278. ],
  279. )
  280. ],
  281. ),
  282. )
  283. : Container(
  284. child: null,
  285. ),
  286. isShowOrderLive() ? _orderLiveVideo() : Container(),
  287. OrderConstant.isShow(detailObj.statuz,
  288. detailObj.dataTable, 'showUserAppealInfo')
  289. ? _orderSSInfo()
  290. : Container(child: null),
  291. SizedBox(
  292. height: 70,
  293. )
  294. ],
  295. ),
  296. Positioned(
  297. bottom: 0,
  298. left: 0,
  299. child: Container(
  300. width: width,
  301. height: !getHeight(detailObj) ? 0 : 60,
  302. padding: EdgeInsets.only(
  303. // right: ScreenUtil().setWidth(15),
  304. // left: ScreenUtil().setWidth(15),
  305. top: 7.5,
  306. bottom: 7.5,
  307. ),
  308. decoration: BoxDecoration(
  309. border: Border(
  310. top: BorderSide(
  311. width: 0.5,
  312. color: Color(0xffeeeeee),
  313. ),
  314. ),
  315. color: ThemeUtils.getDialogTextFieldColor(context),
  316. ),
  317. child: Row(
  318. mainAxisAlignment: MainAxisAlignment.end,
  319. crossAxisAlignment: CrossAxisAlignment.center,
  320. // children: btnWidget,
  321. children: <Widget>[
  322. OrderConstant.isShow(
  323. detailObj.statuz,
  324. detailObj.dataTable,
  325. 'showUserCancelOrderButton')
  326. ? BottomBtn(
  327. title: "取消订单",
  328. isBlueBtn: false,
  329. fun: () {
  330. showAlert(
  331. context,
  332. "提示",
  333. "确认取消吗?",
  334. "确认",
  335. () {
  336. cancelOrder();
  337. NavigatorUtils.goBack(context);
  338. },
  339. txt2: "取消",
  340. onPre2: () {
  341. NavigatorUtils.goBack(context);
  342. });
  343. },
  344. )
  345. : Container(child: null),
  346. OrderConstant.isShow(
  347. detailObj.statuz,
  348. detailObj.dataTable,
  349. 'showUserPaymentButton') &&
  350. detailObj.chargerId != null
  351. ? BottomBtn(
  352. title: "立即付款",
  353. fun: () {
  354. if (_controllerBefore != null) {
  355. _controllerBefore?.pause();
  356. }
  357. if (_controllerAfter != null) {
  358. _controllerAfter?.pause();
  359. }
  360. NavigatorUtils.push(context,
  361. "${WodeRouter.buyService}?id=${detailObj.id}");
  362. },
  363. )
  364. : Container(child: null),
  365. OrderConstant.isShow(
  366. detailObj.statuz,
  367. detailObj.dataTable,
  368. 'showUserConfirmPunchButton',
  369. arrivedFlag: detailObj.arrivedFlag)
  370. ? BottomBtn(
  371. title: "确认到现场",
  372. fun: () {
  373. confirmPunchin();
  374. },
  375. )
  376. : Container(child: null),
  377. OrderConstant.isShow(
  378. detailObj.statuz,
  379. detailObj.dataTable,
  380. 'showUserAppealButton')
  381. ? BottomBtn(
  382. title: "提出申诉",
  383. isBlueBtn: false,
  384. fun: () {
  385. if (detailObj.liftCaseAppealEntity !=
  386. null) {
  387. toasts("当前诊单不能申诉");
  388. } else {
  389. if (_controllerBefore != null) {
  390. _controllerBefore?.pause();
  391. }
  392. if (_controllerAfter != null) {
  393. _controllerAfter?.pause();
  394. }
  395. NavigatorUtils.push(context,
  396. "${WodeRouter.representations}?id=${detailObj.id}");
  397. }
  398. },
  399. )
  400. : Container(child: null),
  401. OrderConstant.isShow(
  402. detailObj.statuz,
  403. detailObj.dataTable,
  404. 'showUserConfirmOrderButton')
  405. ? BottomBtn(
  406. title: "立即确认",
  407. fun: () {
  408. showAlert(
  409. context,
  410. "提示",
  411. "确认完成吗?",
  412. "确认",
  413. () {
  414. NavigatorUtils.goBack(context);
  415. confirmOrder();
  416. },
  417. txt2: "取消",
  418. onPre2: () {
  419. NavigatorUtils.goBack(context);
  420. });
  421. },
  422. )
  423. : Container(child: null),
  424. OrderConstant.isShow(
  425. detailObj.statuz,
  426. detailObj.dataTable,
  427. 'showUserEvaluationButton')
  428. ? BottomBtn(
  429. title: "立即评价",
  430. fun: () {
  431. if (_controllerBefore != null) {
  432. _controllerBefore?.pause();
  433. }
  434. if (_controllerAfter != null) {
  435. _controllerAfter?.pause();
  436. }
  437. NavigatorUtils.push(context,
  438. "${WodeRouter.comment}?id=${detailObj.id}");
  439. },
  440. )
  441. : Container(child: null),
  442. OrderConstant.isShow(
  443. detailObj.statuz,
  444. detailObj.dataTable,
  445. 'showUserDeleteOrderButton')
  446. ? BottomBtn(
  447. title: "删除订单",
  448. isBlueBtn: false,
  449. fun: () {
  450. showAlert(
  451. context,
  452. "提示",
  453. "确认删除吗?",
  454. "确认",
  455. () {
  456. deleteOrder();
  457. NavigatorUtils.goBack(context);
  458. },
  459. txt2: "取消",
  460. onPre2: () {
  461. NavigatorUtils.goBack(context);
  462. });
  463. },
  464. )
  465. : Container(child: null),
  466. OrderConstant.isShow(
  467. detailObj.statuz,
  468. detailObj.dataTable,
  469. 'showUserChooseExpertButton') ||
  470. (detailObj.chargerId == null &&
  471. detailObj.isPlatformSpecified == 0)
  472. ? BottomBtn(
  473. title: "重新提交",
  474. fun: () {
  475. setDataId(detailObj.id);
  476. setType(detailObj.dataTable.toString());
  477. if (_controllerBefore != null) {
  478. _controllerBefore?.pause();
  479. }
  480. if (_controllerAfter != null) {
  481. _controllerAfter?.pause();
  482. }
  483. NavigatorUtils.push(context,
  484. "${BbsRouter.expertList}?id=${detailObj.brandId}");
  485. },
  486. )
  487. : Container(child: null),
  488. ],
  489. ),
  490. ),
  491. ),
  492. ],
  493. ));
  494. },
  495. )
  496. : Center(
  497. child: Text("正在加载..."),
  498. ),
  499. ),
  500. );
  501. }
  502. _lineSpase() {
  503. return Container(
  504. color: ThemeUtils.getDialogTextFieldColor(context),
  505. height: ScreenUtil().setWidth(5),
  506. );
  507. }
  508. _orderTypeHead() {
  509. return Container(
  510. // decoration: BoxDecoration(
  511. // gradient: const LinearGradient(
  512. // colors: [Color(0xFF00D9FF), Color(0xFF0287FF)],
  513. // ),
  514. // ),
  515. padding: EdgeInsets.only(
  516. top: ScreenUtil().setWidth(10), left: ScreenUtil().setWidth(10)),
  517. height: ScreenUtil().setWidth(90),
  518. child: Column(
  519. crossAxisAlignment: CrossAxisAlignment.start,
  520. children: <Widget>[
  521. Row(
  522. // crossAxisAlignment: CrossAxisAlignment.start,
  523. // mainAxisAlignment: MainAxisAlignment.center,
  524. children: [
  525. Icon(
  526. // : 0xe604,
  527. OrderConstant.getIconFontCode(
  528. detailObj.statuz, detailObj.dataTable),
  529. size: 20.0,
  530. color: Color(0xff333333),
  531. ),
  532. SizedBox(
  533. width: 5,
  534. ),
  535. Text(
  536. OrderConstant.getStatusName(
  537. detailObj.statuz, detailObj.dataTable,
  538. arrivedFlag: detailObj.arrivedFlag, userType: 'USER'),
  539. textAlign: TextAlign.left,
  540. style: TextStyle(
  541. fontSize: ScreenUtil().setSp(14),
  542. color: Colours.text,
  543. ),
  544. ),
  545. Expanded(child: Container()),
  546. Text(
  547. '订单号:',
  548. textAlign: TextAlign.left,
  549. style: TextStyle(
  550. fontSize: ScreenUtil().setSp(14),
  551. color: Colours.text,
  552. ),
  553. ),
  554. Text(
  555. '${detailObj.orderNo ?? '无'}',
  556. textAlign: TextAlign.left,
  557. style: TextStyle(
  558. fontSize: ScreenUtil().setSp(14),
  559. color: Colours.text_gray,
  560. ),
  561. ),
  562. //
  563. SizedBox(
  564. width: 10,
  565. )
  566. ],
  567. ),
  568. Container(
  569. margin: EdgeInsets.only(left: 25, top: 10),
  570. child: Text(
  571. // '',
  572. OrderConstant.getdetailStatusName(
  573. detailObj.statuz, detailObj.dataTable,
  574. arrivedFlag: detailObj.arrivedFlag, userType: 'USER'),
  575. textAlign: TextAlign.left,
  576. style: TextStyle(
  577. fontSize: ScreenUtil().setSp(13),
  578. color: Colours.dark_text_gray,
  579. ),
  580. ),
  581. )
  582. // detailObj.statuz == 6
  583. // ? Text(
  584. // '还剩23小时59分钟自动确认',
  585. // textAlign: TextAlign.left,
  586. // style: TextStyle(
  587. // fontSize: ScreenUtil().setSp(13),
  588. // color: Color(0xffeeeeee),
  589. // ),
  590. // )
  591. // : Container(
  592. // child: null,
  593. // ),
  594. ],
  595. ),
  596. );
  597. }
  598. _orderUserDetail() {
  599. return Container(
  600. // height: 20,
  601. padding: EdgeInsets.only(
  602. bottom: ScreenUtil().setWidth(20), top: ScreenUtil().setWidth(10)),
  603. child: Row(
  604. crossAxisAlignment: CrossAxisAlignment.start,
  605. children: <Widget>[
  606. Expanded(
  607. child: GestureDetector(
  608. onTap: () {
  609. if (_controllerBefore != null) {
  610. _controllerBefore.pause();
  611. }
  612. if (_controllerAfter != null) {
  613. _controllerAfter.pause();
  614. }
  615. NavigatorUtils.push(context,
  616. "${BbsRouter.recommendAsk}?id=${detailObj.id}&type=3");
  617. },
  618. child: Row(
  619. crossAxisAlignment: CrossAxisAlignment.start,
  620. children: <Widget>[
  621. SizedBox(
  622. width: 10,
  623. ),
  624. ClipRRect(
  625. borderRadius: BorderRadius.circular(20),
  626. child: LoadNetworkImage(
  627. detailObj.avatarUrl,
  628. width: ScreenUtil().setWidth(43),
  629. height: ScreenUtil().setWidth(43),
  630. // alignment: Alignment.centerLeft,
  631. ),
  632. // Container(
  633. // margin: EdgeInsets.only(
  634. // left: ScreenUtil().setWidth(15),
  635. // right: ScreenUtil().setWidth(10),
  636. // // top: ScreenUtil().setWidth(5)
  637. // ),
  638. // decoration: BoxDecoration(
  639. // borderRadius: BorderRadius.circular(
  640. // ScreenUtil().setWidth(22)),
  641. // ),
  642. // child: LoadNetworkImage(
  643. // detailObj.avatarUrl,
  644. // width: ScreenUtil().setWidth(43),
  645. // height: ScreenUtil().setWidth(43),
  646. // // alignment: Alignment.centerLeft,
  647. // ),
  648. // ),
  649. ),
  650. SizedBox(
  651. width: 10,
  652. ),
  653. Expanded(
  654. child: Container(
  655. padding:
  656. EdgeInsets.only(right: ScreenUtil().setWidth(15)),
  657. child: Column(
  658. children: <Widget>[
  659. Container(
  660. child: Row(
  661. mainAxisAlignment: MainAxisAlignment.start,
  662. children: <Widget>[
  663. Row(
  664. crossAxisAlignment: CrossAxisAlignment.center,
  665. children: <Widget>[
  666. Text(
  667. detailObj.name ?? '',
  668. style: TextStyle(
  669. fontSize: ScreenUtil().setSp(17),
  670. ),
  671. textAlign: TextAlign.start,
  672. ),
  673. Container(
  674. decoration: BoxDecoration(
  675. //背景
  676. color: detailObj.dataTable == 1
  677. ? Colours.blue_app_main
  678. : Color(0xffFDAF2C),
  679. //设置四周圆角 角度
  680. borderRadius: BorderRadius.all(
  681. Radius.circular(4.0)),
  682. ),
  683. margin: EdgeInsets.only(left: 5),
  684. padding: EdgeInsets.only(
  685. left: 5, right: 5, top: 2, bottom: 2),
  686. child: Text(
  687. detailObj.dataTable == 1
  688. ? '问诊服务'
  689. : '出诊服务',
  690. style: TextStyle(
  691. color: Colors.white,
  692. fontSize: ScreenUtil().setSp(14),
  693. ),
  694. textAlign: TextAlign.start,
  695. ),
  696. ),
  697. ],
  698. ),
  699. ],
  700. ),
  701. ),
  702. Container(
  703. child: Row(
  704. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  705. children: <Widget>[
  706. Row(
  707. crossAxisAlignment: CrossAxisAlignment.center,
  708. children: <Widget>[
  709. Text(
  710. detailObj.createTime != null
  711. ? DateUtils.instance.getFormartData(
  712. timeSamp: detailObj.createTime,
  713. format: "MM月dd日")
  714. : '',
  715. style: TextStyle(
  716. color: Color(0xff999999),
  717. fontSize: ScreenUtil().setSp(13),
  718. ),
  719. textAlign: TextAlign.start,
  720. ),
  721. Container(
  722. padding: EdgeInsets.only(left: 5),
  723. child: Text(
  724. detailObj.brandName ?? '',
  725. style: TextStyle(
  726. color: Colours.blue_app_main,
  727. fontSize: ScreenUtil().setSp(13),
  728. ),
  729. textAlign: TextAlign.start,
  730. ),
  731. )
  732. ],
  733. ),
  734. ],
  735. ),
  736. ),
  737. detailObj.dataTable != 1
  738. ? Container(
  739. child: Row(
  740. mainAxisAlignment:
  741. MainAxisAlignment.spaceBetween,
  742. children: <Widget>[
  743. Row(
  744. crossAxisAlignment:
  745. CrossAxisAlignment.start,
  746. children: <Widget>[
  747. Container(
  748. // padding: EdgeInsets.only(left: 5),
  749. child: Text(
  750. '出诊时间:',
  751. style: TextStyle(
  752. color: Color(0xff999999),
  753. fontSize:
  754. ScreenUtil().setSp(13),
  755. ),
  756. textAlign: TextAlign.start,
  757. ),
  758. ),
  759. Text(
  760. detailObj.arrivedTime != null
  761. ? DateUtils.instance
  762. .getFormartData(
  763. timeSamp: detailObj
  764. .arrivedTime,
  765. format: "MM月dd日 HH:mm")
  766. : '',
  767. style: TextStyle(
  768. color: Color(0xff666666),
  769. fontSize: ScreenUtil().setSp(13),
  770. ),
  771. textAlign: TextAlign.start,
  772. ),
  773. ],
  774. ),
  775. ],
  776. ),
  777. )
  778. : Container(),
  779. detailObj.dataTable != 1
  780. ? Container(
  781. // margin: EdgeInsets.only(top: 6),
  782. child: Row(
  783. children: <Widget>[
  784. Container(
  785. // padding: EdgeInsets.only(left: 5),
  786. child: Text(
  787. '出诊地点:',
  788. style: TextStyle(
  789. color: Color(0xff999999),
  790. fontSize: ScreenUtil().setSp(13),
  791. ),
  792. textAlign: TextAlign.start,
  793. ),
  794. ),
  795. Container(
  796. width: ScreenUtil().setWidth(230),
  797. child: Text(
  798. '${detailObj.address ?? ''}',
  799. style: TextStyle(
  800. color: Color(0xff666666),
  801. fontSize: ScreenUtil().setSp(13),
  802. // color: Color(0xff666666),
  803. // fontSize: ScreenUtil().setSp(15),
  804. ),
  805. textAlign: TextAlign.start,
  806. maxLines: 1,
  807. overflow: TextOverflow.ellipsis,
  808. ),
  809. ),
  810. ],
  811. ),
  812. )
  813. : Container(),
  814. Container(
  815. // margin: EdgeInsets.only(top: 6),
  816. child: Row(
  817. children: <Widget>[
  818. Container(
  819. // padding: EdgeInsets.only(left: 5),
  820. child: Text(
  821. '问题描述:',
  822. style: TextStyle(
  823. color: Color(0xff999999),
  824. fontSize: ScreenUtil().setSp(13),
  825. ),
  826. textAlign: TextAlign.start,
  827. ),
  828. ),
  829. Container(
  830. width: ScreenUtil().setWidth(230),
  831. child: Text(
  832. '${detailObj.expression ?? ''}',
  833. style: TextStyle(
  834. color: Color(0xff666666),
  835. fontSize: ScreenUtil().setSp(13),
  836. // color: Color(0xff666666),
  837. // fontSize: ScreenUtil().setSp(15),
  838. ),
  839. textAlign: TextAlign.start,
  840. maxLines: 1,
  841. overflow: TextOverflow.ellipsis,
  842. ),
  843. ),
  844. ],
  845. ),
  846. ),
  847. Container(
  848. // margin: EdgeInsets.only(top: 6),
  849. child: Row(
  850. children: <Widget>[
  851. Container(
  852. // padding: EdgeInsets.only(left: 5),
  853. child: Text(
  854. '出厂日期:',
  855. style: TextStyle(
  856. color: Color(0xff999999),
  857. fontSize: ScreenUtil().setSp(13),
  858. ),
  859. textAlign: TextAlign.start,
  860. ),
  861. ),
  862. Container(
  863. width: ScreenUtil().setWidth(230),
  864. child: Text(
  865. '${detailObj.productionDate ?? ''}',
  866. style: TextStyle(
  867. color: Color(0xff666666),
  868. fontSize: ScreenUtil().setSp(13),
  869. // color: Color(0xff666666),
  870. // fontSize: ScreenUtil().setSp(15),
  871. ),
  872. textAlign: TextAlign.start,
  873. maxLines: 1,
  874. overflow: TextOverflow.ellipsis,
  875. ),
  876. ),
  877. ],
  878. ),
  879. ),
  880. // Container(
  881. // child: Row(
  882. // mainAxisAlignment:
  883. // MainAxisAlignment.start,
  884. // children: <Widget>[
  885. // Row(
  886. // crossAxisAlignment:
  887. // CrossAxisAlignment
  888. // .center,
  889. // children: <Widget>[
  890. // Text(
  891. // detailObj.createTime !=
  892. // null
  893. // ? DateUtils
  894. // .instance
  895. // .getFormartData(
  896. // timeSamp:
  897. // detailObj
  898. // .createTime,
  899. // format:
  900. // "MM月dd日",
  901. // )
  902. // : '',
  903. // style: TextStyle(
  904. // color: Color(
  905. // 0xff999999),
  906. // fontSize:
  907. // ScreenUtil()
  908. // .setSp(
  909. // 13),
  910. // ),
  911. // textAlign:
  912. // TextAlign.left,
  913. // ),
  914. // Container(
  915. // padding:
  916. // EdgeInsets.only(
  917. // left: 5),
  918. // child: Text(
  919. // detailObj
  920. // .brandName ??
  921. // '',
  922. // style: TextStyle(
  923. // color: Color(
  924. // 0xff999999),
  925. // fontSize:
  926. // ScreenUtil()
  927. // .setSp(
  928. // 13),
  929. // ),
  930. // textAlign:
  931. // TextAlign
  932. // .left,
  933. // ),
  934. // )
  935. // ],
  936. // ),
  937. // ],
  938. // ),
  939. // ),
  940. // Row(
  941. // mainAxisAlignment:
  942. // MainAxisAlignment.start,
  943. // children: <Widget>[
  944. // Container(
  945. // width: 260,
  946. // child: Text(
  947. // detailObj.expression ??
  948. // '',
  949. // style: TextStyle(
  950. // color:
  951. // Color(0xff0288FF),
  952. // fontSize: ScreenUtil()
  953. // .setSp(15),
  954. // ),
  955. // textAlign:
  956. // TextAlign.left,
  957. // maxLines: 1,
  958. // overflow: TextOverflow
  959. // .ellipsis,
  960. // ),
  961. // ),
  962. // ],
  963. // ),
  964. ],
  965. ),
  966. ),
  967. )
  968. ],
  969. ),
  970. ),
  971. ),
  972. ],
  973. ),
  974. );
  975. }
  976. _orderMoneyDetail() {
  977. return Column(
  978. children: [
  979. detailObj.dataTable == 2
  980. ? Heng(
  981. left: "差旅费",
  982. right: detailObj.travelCost != null
  983. ? "¥" + detailObj.travelCost.toString()
  984. : '¥0',
  985. leftColor: 0xff333333,
  986. rightColor: 0xff333333,
  987. )
  988. : Container(),
  989. Heng(
  990. left: "技术服务费",
  991. right: detailObj.serviceCost != null
  992. ? "¥" + detailObj.serviceCost.toString()
  993. : '¥0',
  994. leftColor: 0xff333333,
  995. rightColor: 0xff333333,
  996. ),
  997. Heng(
  998. left: "优惠券抵扣",
  999. right: detailObj.couponDeduction != null
  1000. ? "-¥" + detailObj.couponDeduction.toString()
  1001. : '-¥0',
  1002. leftColor: 0xff333333,
  1003. rightColor: 0xff333333,
  1004. ),
  1005. Heng(
  1006. left: "红包抵扣",
  1007. right: detailObj.redEnvelopeDeduction != null
  1008. ? "-¥" + detailObj.redEnvelopeDeduction.toString()
  1009. : '-¥0',
  1010. leftColor: 0xff333333,
  1011. rightColor: 0xff333333,
  1012. ),
  1013. Heng(
  1014. left: "实付款",
  1015. right: detailObj.payCost != null && getPayCost()
  1016. ? "¥" + detailObj.payCost.toString()
  1017. : '¥' + totalPay.toStringAsFixed(2).toString(),
  1018. leftColor: 0xff333333,
  1019. rightColor: 0xffFD0808,
  1020. ),
  1021. ],
  1022. );
  1023. }
  1024. _orderTime() {
  1025. return Container(
  1026. padding: EdgeInsets.only(
  1027. left: ScreenUtil().setWidth(15),
  1028. top: ScreenUtil().setWidth(10),
  1029. bottom: ScreenUtil().setWidth(10)),
  1030. child: Row(
  1031. children: <Widget>[
  1032. Text(
  1033. '下单时间:',
  1034. textAlign: TextAlign.left,
  1035. style: TextStyle(
  1036. fontSize: 14,
  1037. color: Color(0xff333333),
  1038. ),
  1039. ),
  1040. Text(
  1041. detailObj.createTime != null
  1042. ? DateUtils.instance.getFormartData(
  1043. timeSamp: detailObj.createTime,
  1044. format: "yyyy-MM-dd HH:mm:ss")
  1045. : '',
  1046. textAlign: TextAlign.left,
  1047. style: TextStyle(
  1048. fontSize: ScreenUtil().setSp(13),
  1049. color: Color(0xff999999),
  1050. ),
  1051. ),
  1052. ],
  1053. ),
  1054. );
  1055. }
  1056. ///现场视频维修前维修后
  1057. _orderLiveVideo() {
  1058. double width = MediaQuery.of(context).size.width;
  1059. return Column(
  1060. crossAxisAlignment: CrossAxisAlignment.start,
  1061. children: <Widget>[
  1062. Container(
  1063. width: width,
  1064. padding: EdgeInsets.only(
  1065. left: ScreenUtil().setWidth(15),
  1066. top: ScreenUtil().setWidth(10),
  1067. bottom: ScreenUtil().setWidth(10)),
  1068. decoration: BoxDecoration(
  1069. border: Border(
  1070. bottom: BorderSide(width: .5, color: Color(0xfff5f5f5)),
  1071. ),
  1072. ),
  1073. child: Text(
  1074. '现场情况(维修前)',
  1075. textAlign: TextAlign.left,
  1076. style: TextStyle(
  1077. fontSize: ScreenUtil().setSp(17),
  1078. color: Color(0xff333333),
  1079. ),
  1080. ),
  1081. ),
  1082. detailObj.beforeRepair != null
  1083. ? Container(
  1084. padding: EdgeInsets.only(
  1085. left: ScreenUtil().setWidth(15),
  1086. right: ScreenUtil().setWidth(15),
  1087. top: ScreenUtil().setWidth(15)),
  1088. child: ClipRRect(
  1089. borderRadius: BorderRadius.circular(5),
  1090. child: new Chewie(
  1091. controller: ChewieController(
  1092. videoPlayerController:
  1093. // VideoPlayerController.network(
  1094. // Utils.getImagePath(detailObj.beforeRepair)
  1095. // // imgFontUrl + detailObj.url
  1096. // )
  1097. _controllerBefore,
  1098. aspectRatio: 3 / 2,
  1099. autoPlay: false,
  1100. looping: true,
  1101. showControls: true,
  1102. deviceOrientationsAfterFullScreen: [
  1103. DeviceOrientation.portraitUp,
  1104. ],
  1105. // 占位图
  1106. // placeholder: Image.network(
  1107. // imgFontUrl+detailObj.cover,
  1108. // fit: BoxFit.contain,
  1109. // ),
  1110. // 是否在 UI 构建的时候就加载视频
  1111. autoInitialize: true,
  1112. // 拖动条样式颜色
  1113. materialProgressColors: new ChewieProgressColors(
  1114. playedColor: Colors.red,
  1115. handleColor: Colors.blue,
  1116. backgroundColor: Colors.grey,
  1117. bufferedColor: Colors.lightGreen,
  1118. ),
  1119. ),
  1120. ),
  1121. ))
  1122. : Container(
  1123. padding: EdgeInsets.only(left: 15),
  1124. child: Text("暂无"),
  1125. ),
  1126. Container(
  1127. width: width,
  1128. padding: EdgeInsets.only(
  1129. left: ScreenUtil().setWidth(15),
  1130. top: ScreenUtil().setWidth(10),
  1131. bottom: ScreenUtil().setWidth(10)),
  1132. decoration: BoxDecoration(
  1133. border: Border(
  1134. bottom: BorderSide(width: .5, color: Color(0xfff5f5f5)),
  1135. ),
  1136. ),
  1137. child: Text(
  1138. '现场情况(维修后)',
  1139. textAlign: TextAlign.left,
  1140. style: TextStyle(
  1141. fontSize: ScreenUtil().setSp(17),
  1142. color: Color(0xff333333),
  1143. ),
  1144. ),
  1145. ),
  1146. detailObj.afterRepair != null
  1147. ? Container(
  1148. padding: EdgeInsets.only(
  1149. left: ScreenUtil().setWidth(15),
  1150. right: ScreenUtil().setWidth(15),
  1151. top: ScreenUtil().setWidth(15)),
  1152. child: ClipRRect(
  1153. borderRadius: BorderRadius.circular(5),
  1154. child: new Chewie(
  1155. controller: ChewieController(
  1156. videoPlayerController:
  1157. // VideoPlayerController.network(
  1158. // Utils.getImagePath(detailObj.afterRepair)
  1159. // // imgFontUrl + detailObj.url
  1160. // )
  1161. _controllerAfter,
  1162. aspectRatio: 3 / 2,
  1163. autoPlay: false,
  1164. looping: true,
  1165. showControls: true,
  1166. deviceOrientationsAfterFullScreen: [
  1167. DeviceOrientation.portraitUp,
  1168. ],
  1169. // 占位图
  1170. // placeholder: Image.network(
  1171. // imgFontUrl+detailObj.cover,
  1172. // fit: BoxFit.contain,
  1173. // ),
  1174. // 是否在 UI 构建的时候就加载视频
  1175. autoInitialize: true,
  1176. // 拖动条样式颜色
  1177. materialProgressColors: new ChewieProgressColors(
  1178. playedColor: Colors.red,
  1179. handleColor: Colors.blue,
  1180. backgroundColor: Colors.grey,
  1181. bufferedColor: Colors.lightGreen,
  1182. ),
  1183. ),
  1184. ),
  1185. ))
  1186. : Container(
  1187. padding: EdgeInsets.only(left: 15),
  1188. child: Text("暂无"),
  1189. ),
  1190. ],
  1191. );
  1192. }
  1193. _orderSSInfo() {
  1194. return Container(
  1195. padding: EdgeInsets.only(
  1196. left: ScreenUtil().setWidth(15),
  1197. top: ScreenUtil().setWidth(10),
  1198. bottom: ScreenUtil().setWidth(10)),
  1199. child: Column(
  1200. children: <Widget>[
  1201. Row(
  1202. children: <Widget>[
  1203. Text(
  1204. '申诉内容:',
  1205. textAlign: TextAlign.left,
  1206. style: TextStyle(
  1207. fontSize: 14,
  1208. color: Color(0xff333333),
  1209. ),
  1210. ),
  1211. Text(
  1212. detailObj.liftCaseAppealEntity != null &&
  1213. detailObj.liftCaseAppealEntity.content != null
  1214. ? detailObj.liftCaseAppealEntity.content
  1215. : '',
  1216. textAlign: TextAlign.left,
  1217. style: TextStyle(
  1218. fontSize: 14,
  1219. color: Color(0xff999999),
  1220. ),
  1221. ),
  1222. ],
  1223. ),
  1224. Row(
  1225. children: <Widget>[
  1226. Text(
  1227. '申诉时间:',
  1228. textAlign: TextAlign.left,
  1229. style: TextStyle(
  1230. fontSize: 14,
  1231. color: Color(0xff333333),
  1232. ),
  1233. ),
  1234. Text(
  1235. detailObj.liftCaseAppealEntity != null &&
  1236. detailObj.liftCaseAppealEntity.createTime != null
  1237. ? DateUtils.instance.getFormartData(
  1238. timeSamp: detailObj.liftCaseAppealEntity.createTime,
  1239. format: "yyyy-MM-dd HH:mm:ss")
  1240. : '',
  1241. textAlign: TextAlign.left,
  1242. style: TextStyle(
  1243. fontSize: 14,
  1244. color: Color(0xff999999),
  1245. ),
  1246. ),
  1247. ],
  1248. ),
  1249. ],
  1250. ),
  1251. );
  1252. }
  1253. isShowMoneyDetail() {
  1254. bool show = true;
  1255. if (detailObj.dataTable == 2) {
  1256. switch (detailObj.statuz) {
  1257. case 0:
  1258. case 1:
  1259. show = false;
  1260. break;
  1261. default:
  1262. }
  1263. }
  1264. // else if (detailObj.dataTable == 1) {
  1265. // switch (detailObj.statuz) {
  1266. // case 0:
  1267. // case 1:
  1268. // show = false;
  1269. // break;
  1270. // default:
  1271. // }
  1272. // }
  1273. // if ((detailObj.dataTable == 2 && (detailObj.statuz == 2)) ||
  1274. // (detailObj.dataTable == 2 && detailObj.statuz == 2)) {
  1275. // show = false;
  1276. // }
  1277. return show;
  1278. }
  1279. isShowOrderLive() {
  1280. bool show = false;
  1281. if (detailObj.dataTable == 2) {
  1282. show = true;
  1283. switch (detailObj.statuz) {
  1284. case 0:
  1285. case 1:
  1286. case 2:
  1287. show = false;
  1288. break;
  1289. default:
  1290. }
  1291. }
  1292. return show;
  1293. }
  1294. void setDataId(int id) async {
  1295. SharedPreferences prefs = await SharedPreferences.getInstance();
  1296. prefs.setInt("dataId", id);
  1297. }
  1298. void setType(String type) async {
  1299. SharedPreferences prefs = await SharedPreferences.getInstance();
  1300. prefs.setString("questionType", type);
  1301. }
  1302. @override
  1303. bool get wantKeepAlive => true;
  1304. }
  1305. class BottomBtn extends StatelessWidget {
  1306. BottomBtn({Key key, this.title, this.fun, this.isBlueBtn = true})
  1307. : super(key: key);
  1308. Function fun;
  1309. String title;
  1310. bool isBlueBtn;
  1311. @override
  1312. Widget build(BuildContext context) {
  1313. return Expanded(
  1314. // margin: EdgeInsets.only(left: 10),
  1315. child: GestureDetector(
  1316. onTap: () {
  1317. fun();
  1318. },
  1319. child: Container(
  1320. child: Container(
  1321. margin: EdgeInsets.only(left: 15, right: 15),
  1322. // height:22,
  1323. // padding: EdgeInsets.only(
  1324. // left: ScreenUtil().setWidth(20),
  1325. // right: ScreenUtil().setWidth(20)),
  1326. decoration: BoxDecoration(
  1327. // border: Border.all(width: 1, color: Color(0xff1B87F6)),
  1328. borderRadius: BorderRadius.circular(23),
  1329. color: isBlueBtn ? Colours.blue_app_main : Color(0xffEEEEEE)),
  1330. child: Column(
  1331. mainAxisAlignment: MainAxisAlignment.center,
  1332. children: <Widget>[
  1333. Text(
  1334. title,
  1335. textAlign: TextAlign.center,
  1336. style: TextStyle(
  1337. fontSize: ScreenUtil().setSp(15),
  1338. color: isBlueBtn ? Colors.white : Color(0xff666666),
  1339. ),
  1340. ),
  1341. ],
  1342. ),
  1343. ),
  1344. ),
  1345. ),
  1346. );
  1347. }
  1348. }