order_detail.dart 57 KB

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