order_detail.dart 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:liftmanager/common/common.dart';
  4. import 'package:liftmanager/internal/account/account_router.dart';
  5. import 'package:liftmanager/internal/account/model/user_info_entity.dart';
  6. import 'package:liftmanager/internal/account/provider/user_provider.dart';
  7. import 'package:liftmanager/internal/wode/wode_router.dart';
  8. import 'package:liftmanager/net/api_service.dart';
  9. import 'package:liftmanager/routers/fluro_navigator.dart';
  10. import 'package:liftmanager/utils/image_utils.dart';
  11. import 'package:liftmanager/widgets/app_bar.dart';
  12. import 'package:liftmanager/widgets/click_item.dart';
  13. import 'package:liftmanager/widgets/load_image.dart';
  14. import 'package:liftmanager/widgets/my_button.dart';
  15. import 'package:provider/provider.dart';
  16. import 'package:liftmanager/widgets/bbs_content.dart';
  17. import 'package:liftmanager/internal/bbs/bbs_router.dart';
  18. import 'package:flutter_screenutil/flutter_screenutil.dart';
  19. import 'package:liftmanager/internal/bbs/model/liftcase_model.dart';
  20. import 'package:liftmanager/utils/toast.dart';
  21. import 'package:liftmanager/utils/time_format.dart';
  22. import 'package:liftmanager/utils/url.dart';
  23. import 'package:liftmanager/internal/wode/order_const.dart';
  24. import 'package:shared_preferences/shared_preferences.dart';
  25. import 'package:video_player/video_player.dart';
  26. import 'package:chewie/chewie.dart';
  27. import 'package:liftmanager/utils/utils.dart';
  28. import 'package:liftmanager/utils/theme_utils.dart';
  29. import 'package:flutter/services.dart';
  30. import 'package:orientation/orientation.dart';
  31. class OrderDetail extends StatefulWidget {
  32. OrderDetail(this.id);
  33. final String id;
  34. @override
  35. State<StatefulWidget> createState() {
  36. return OrderDetailState();
  37. }
  38. }
  39. class OrderDetailState extends State<OrderDetail>
  40. with AutomaticKeepAliveClientMixin {
  41. UserProvider provider = UserProvider();
  42. bool _hasData = false;
  43. LiftCasesDetailModel detailObj;
  44. double totalPay;
  45. getBrandDetail() {
  46. if(_controllerBefore != null){
  47. _controllerBefore.pause();
  48. _controllerBefore = null;
  49. }
  50. if(_controllerAfter != null){
  51. _controllerAfter.pause();
  52. _controllerAfter = null;
  53. }
  54. NewApiService().getLiftcaseDetail(widget.id, onSuccess: (res) {
  55. detailObj = res;
  56. double serviceCost = detailObj.serviceCost!=null?detailObj.serviceCost:0.0;
  57. double travelCost = detailObj.travelCost!=null?detailObj.travelCost:0.0;
  58. double couponDeduction = detailObj.couponDeduction!=null?detailObj.couponDeduction:0.0;
  59. double redEnvelopeDeduction = detailObj.redEnvelopeDeduction!=null?detailObj.redEnvelopeDeduction:0.0;
  60. totalPay = (serviceCost + travelCost) - ( couponDeduction + redEnvelopeDeduction);
  61. print(serviceCost);
  62. print(travelCost);
  63. print(couponDeduction);
  64. print(redEnvelopeDeduction);
  65. print(totalPay);
  66. print("456456456465");
  67. if(totalPay < 0){
  68. totalPay = 0.0;
  69. }
  70. if(detailObj.beforeRepair!=null){
  71. _controllerBefore = VideoPlayerController.network(
  72. Utils.getImagePath(detailObj.beforeRepair)
  73. );
  74. }
  75. if(detailObj.afterRepair!=null){
  76. _controllerAfter = VideoPlayerController.network(
  77. Utils.getImagePath(detailObj.afterRepair)
  78. );
  79. }
  80. print(totalPay);
  81. print("totalPay-------------------------");
  82. _hasData = true;
  83. setState(() {});
  84. }, onError: (code, msg) {
  85. toasts(msg);
  86. });
  87. }
  88. getPayCost(){
  89. bool isPay = true;
  90. if((detailObj.dataTable == 1 && detailObj.statuz == 0) || (detailObj.dataTable == 2 && detailObj.statuz == 2)){
  91. isPay = false;
  92. }
  93. return isPay;
  94. }
  95. List<Widget> btnWidget = [];
  96. VideoPlayerController _controllerBefore;
  97. VideoPlayerController _controllerAfter;
  98. @override
  99. void initState() {
  100. if(this.mounted){
  101. getBrandDetail();
  102. }
  103. super.initState();
  104. }
  105. @override
  106. void dispose() {
  107. if(detailObj.beforeRepair!=null){
  108. _controllerBefore.pause();
  109. _controllerBefore.dispose();
  110. }
  111. if(detailObj.afterRepair!=null){
  112. _controllerAfter.pause();
  113. _controllerAfter.dispose();
  114. }
  115. // SystemChrome.setPreferredOrientations([
  116. // DeviceOrientation.portraitUp,
  117. // ]);
  118. OrientationPlugin.forceOrientation(DeviceOrientation.portraitUp);
  119. // provider.dispose();
  120. super.dispose();
  121. }
  122. // 用户确认订单
  123. void confirmOrder() {
  124. showLoading(context);
  125. NewApiService().userConfirmOrder(widget.id, onSuccess: (res) {
  126. dismissLoading(context);
  127. toasts("订单确认成功");
  128. getBrandDetail();
  129. setState(() {});
  130. }, onError: (code, msg) {
  131. dismissLoading(context);
  132. toasts(msg);
  133. });
  134. }
  135. // 用户确认打卡
  136. void confirmPunchin() {
  137. showLoading(context);
  138. NewApiService().userToClock(widget.id, onSuccess: (res) {
  139. dismissLoading(context);
  140. toasts("确认打卡成功");
  141. getBrandDetail();
  142. setState(() {});
  143. }, onError: (code, msg) {
  144. dismissLoading(context);
  145. toasts(msg);
  146. });
  147. }
  148. // 付款
  149. void payment() {
  150. showLoading(context);
  151. NewApiService().getTestAlipayNotify(detailObj.orderNo, onSuccess: (res) {
  152. dismissLoading(context);
  153. toasts("付款成功");
  154. getBrandDetail();
  155. setState(() {});
  156. }, onError: (code, msg) {
  157. dismissLoading(context);
  158. toasts(msg);
  159. });
  160. }
  161. getHeight(detailObj){
  162. bool isHeight = false;
  163. if((OrderConstant.isShow(detailObj.statuz,detailObj.dataTable,'showUserPaymentButton') && detailObj.chargerId!=null)||
  164. (OrderConstant.isShow(detailObj.statuz,detailObj.dataTable,'showUserConfirmPunchButton',arrivedFlag: detailObj.arrivedFlag))||
  165. (OrderConstant.isShow(detailObj.statuz,detailObj.dataTable,'showUserAppealButton'))||
  166. (OrderConstant.isShow(detailObj.statuz,detailObj.dataTable,'showUserConfirmOrderButton'))||
  167. (OrderConstant.isShow(detailObj.statuz,detailObj.dataTable,'showUserEvaluationButton'))||
  168. (OrderConstant.isShow(detailObj.statuz,detailObj.dataTable,'showUserChooseExpertButton') || (detailObj.chargerId==null && detailObj.isPlatformSpecified == 0))
  169. ){
  170. isHeight = true;
  171. }
  172. return isHeight;
  173. }
  174. @override
  175. Widget build(BuildContext context) {
  176. double width = MediaQuery.of(context).size.width;
  177. double height = MediaQuery.of(context).size.height;
  178. if(width > height){
  179. // SystemChrome.setPreferredOrientations([
  180. // DeviceOrientation.portraitUp,
  181. // ]);
  182. OrientationPlugin.forceOrientation(DeviceOrientation.portraitUp);
  183. }
  184. return
  185. // Center(child:new Text("个人中心"));
  186. ChangeNotifierProvider<UserProvider>(
  187. create: (_) => provider,
  188. child: Scaffold(
  189. appBar: MyAppBar(
  190. centerTitle: "订单详情",
  191. ),
  192. body: _hasData
  193. ? Consumer<UserProvider>(
  194. builder: (_, provider, __) {
  195. return Stack(
  196. children: <Widget>[
  197. ListView(
  198. padding: EdgeInsets.all(0.0),
  199. children: <Widget>[
  200. Container(
  201. decoration: BoxDecoration(
  202. gradient: const LinearGradient(
  203. colors: [Color(0xFF00D9FF), Color(0xFF0287FF)],
  204. ),
  205. ),
  206. padding: EdgeInsets.only(
  207. top: ScreenUtil().setWidth(10),
  208. left: ScreenUtil().setWidth(30)),
  209. height: ScreenUtil().setWidth(70),
  210. child: Column(
  211. crossAxisAlignment: CrossAxisAlignment.start,
  212. children: <Widget>[
  213. Text(
  214. OrderConstant.getStatusName(
  215. detailObj.statuz, detailObj.dataTable,
  216. arrivedFlag: detailObj.arrivedFlag,
  217. userType: 'USER'),
  218. textAlign: TextAlign.left,
  219. style: TextStyle(
  220. fontSize: ScreenUtil().setSp(17),
  221. color: Color(0xffffffff),
  222. ),
  223. ),
  224. // detailObj.statuz == 6
  225. // ? Text(
  226. // '还剩23小时59分钟自动确认',
  227. // textAlign: TextAlign.left,
  228. // style: TextStyle(
  229. // fontSize: ScreenUtil().setSp(13),
  230. // color: Color(0xffeeeeee),
  231. // ),
  232. // )
  233. // : Container(
  234. // child: null,
  235. // ),
  236. ],
  237. ),
  238. ),
  239. Container(
  240. // height: 20,
  241. padding: EdgeInsets.only(
  242. bottom: ScreenUtil().setWidth(20),
  243. top: ScreenUtil().setWidth(10)),
  244. child: Row(
  245. crossAxisAlignment: CrossAxisAlignment.start,
  246. children: <Widget>[
  247. Expanded(
  248. child: GestureDetector(
  249. onTap: () {
  250. NavigatorUtils.push(context, "${BbsRouter.recommendAsk}?id=${detailObj.id}&type=3");
  251. },
  252. child: Row(
  253. crossAxisAlignment:
  254. CrossAxisAlignment.start,
  255. children: <Widget>[
  256. Container(
  257. margin: EdgeInsets.only(
  258. left: ScreenUtil().setWidth(15),
  259. right: ScreenUtil().setWidth(10),
  260. top: ScreenUtil().setWidth(5)),
  261. decoration: BoxDecoration(
  262. borderRadius: BorderRadius.circular(
  263. ScreenUtil().setWidth(22)),
  264. ),
  265. child: LoadNetworkImage(
  266. detailObj.avatarUrl,
  267. width: ScreenUtil().setWidth(43),
  268. height: ScreenUtil().setWidth(43),
  269. // alignment: Alignment.centerLeft,
  270. ),
  271. ),
  272. Expanded(
  273. child: Container(
  274. padding: EdgeInsets.only(
  275. right:
  276. ScreenUtil().setWidth(15)),
  277. child: Column(
  278. children: <Widget>[
  279. Container(
  280. child: Row(
  281. mainAxisAlignment:
  282. MainAxisAlignment.start,
  283. children: <Widget>[
  284. Row(
  285. crossAxisAlignment:
  286. CrossAxisAlignment
  287. .center,
  288. children: <Widget>[
  289. Text(
  290. detailObj.name ??
  291. '',
  292. style: TextStyle(
  293. fontSize:
  294. ScreenUtil()
  295. .setSp(
  296. 17),
  297. ),
  298. textAlign:
  299. TextAlign.start,
  300. ),
  301. Container(
  302. padding:
  303. EdgeInsets.only(
  304. left: 5),
  305. child: Text(
  306. detailObj.dataTable ==
  307. 1
  308. ? '问诊服务'
  309. : '出诊服务',
  310. style: TextStyle(
  311. color: Color(
  312. 0xff0288FF),
  313. fontSize:
  314. ScreenUtil()
  315. .setSp(
  316. 13),
  317. ),
  318. textAlign:
  319. TextAlign
  320. .start,
  321. ),
  322. ),
  323. ],
  324. ),
  325. ],
  326. ),
  327. ),
  328. Container(
  329. child: Row(
  330. mainAxisAlignment:
  331. MainAxisAlignment.start,
  332. children: <Widget>[
  333. Row(
  334. crossAxisAlignment:
  335. CrossAxisAlignment
  336. .center,
  337. children: <Widget>[
  338. Text(
  339. detailObj.createTime !=
  340. null
  341. ? DateUtils
  342. .instance
  343. .getFormartData(
  344. timeSamp:
  345. detailObj
  346. .createTime,
  347. format:
  348. "MM月dd日",
  349. )
  350. : '',
  351. style: TextStyle(
  352. color: Color(
  353. 0xff999999),
  354. fontSize:
  355. ScreenUtil()
  356. .setSp(
  357. 13),
  358. ),
  359. textAlign:
  360. TextAlign.left,
  361. ),
  362. Container(
  363. padding:
  364. EdgeInsets.only(
  365. left: 5),
  366. child: Text(
  367. detailObj
  368. .brandName ??
  369. '',
  370. style: TextStyle(
  371. color: Color(
  372. 0xff999999),
  373. fontSize:
  374. ScreenUtil()
  375. .setSp(
  376. 13),
  377. ),
  378. textAlign:
  379. TextAlign
  380. .left,
  381. ),
  382. )
  383. ],
  384. ),
  385. ],
  386. ),
  387. ),
  388. Row(
  389. mainAxisAlignment:
  390. MainAxisAlignment.start,
  391. children: <Widget>[
  392. Container(
  393. width: 260,
  394. child: Text(
  395. detailObj.expression ??
  396. '',
  397. style: TextStyle(
  398. color:
  399. Color(0xff0288FF),
  400. fontSize: ScreenUtil()
  401. .setSp(15),
  402. ),
  403. textAlign:
  404. TextAlign.left,
  405. maxLines: 1,
  406. overflow: TextOverflow
  407. .ellipsis,
  408. ),
  409. ),
  410. ],
  411. ),
  412. ],
  413. ),
  414. ),
  415. )
  416. ],
  417. ),
  418. ),
  419. ),
  420. ],
  421. ),
  422. ),
  423. Container(
  424. color: ThemeUtils.getDialogTextFieldColor(context),
  425. height: ScreenUtil().setWidth(5),
  426. ),
  427. detailObj.dataTable == 2
  428. ? Heng(
  429. left: "差旅费",
  430. right: detailObj.travelCost != null
  431. ? "¥" + detailObj.travelCost.toString()
  432. : '¥0',
  433. leftColor: 0xff666666,
  434. rightColor: 0xff666666,
  435. )
  436. : Container(),
  437. Heng(
  438. left: "技术服务费",
  439. right: detailObj.serviceCost != null
  440. ? "¥" + detailObj.serviceCost.toString()
  441. : '¥0',
  442. leftColor: 0xff666666,
  443. rightColor: 0xff666666,
  444. ),
  445. Heng(
  446. left: "优惠券抵扣",
  447. right: detailObj.couponDeduction != null
  448. ? "-¥" + detailObj.couponDeduction.toString()
  449. : '-¥0',
  450. leftColor: 0xff666666,
  451. rightColor: 0xff666666,
  452. ),
  453. Heng(
  454. left: "红包抵扣",
  455. right: detailObj.redEnvelopeDeduction != null
  456. ? "-¥" +
  457. detailObj.redEnvelopeDeduction.toString()
  458. : '-¥0',
  459. leftColor: 0xff666666,
  460. rightColor: 0xff666666,
  461. ),
  462. Heng(
  463. left: "实付款",
  464. right: detailObj.payCost != null && getPayCost()
  465. ? "¥" + detailObj.payCost.toString()
  466. : '¥' + totalPay.toStringAsFixed(2).toString(),
  467. leftColor: 0xff666666,
  468. rightColor: 0xffFD0808,
  469. ),
  470. Container(
  471. color: ThemeUtils.getDialogTextFieldColor(context),
  472. height: ScreenUtil().setWidth(5),
  473. ),
  474. Container(
  475. padding: EdgeInsets.only(
  476. left: ScreenUtil().setWidth(15),
  477. top: ScreenUtil().setWidth(10),
  478. bottom: ScreenUtil().setWidth(10),
  479. ),
  480. decoration: BoxDecoration(
  481. border: Border(
  482. bottom: BorderSide(
  483. width: .5,
  484. color:
  485. Color(0xffFAF7FA),
  486. ),
  487. ),
  488. ),
  489. child: Text(
  490. '订单信息',
  491. textAlign: TextAlign.left,
  492. style: TextStyle(
  493. fontSize: ScreenUtil().setSp(17),
  494. ),
  495. ),
  496. ),
  497. Container(
  498. padding: EdgeInsets.only(
  499. left: ScreenUtil().setWidth(15),
  500. top: ScreenUtil().setWidth(10),
  501. bottom: ScreenUtil().setWidth(10)),
  502. child: Column(
  503. children: <Widget>[
  504. Row(
  505. children: <Widget>[
  506. Text(
  507. '订单编号:',
  508. textAlign: TextAlign.left,
  509. style: TextStyle(
  510. fontSize: ScreenUtil().setSp(13),
  511. color: Color(0xff666666),
  512. ),
  513. ),
  514. Text(
  515. detailObj.orderNo ?? '',
  516. textAlign: TextAlign.left,
  517. style: TextStyle(
  518. fontSize: ScreenUtil().setSp(13),
  519. color: Color(0xff666666),
  520. ),
  521. ),
  522. ],
  523. ),
  524. Row(
  525. children: <Widget>[
  526. Text(
  527. '创建时间:',
  528. textAlign: TextAlign.left,
  529. style: TextStyle(
  530. fontSize: ScreenUtil().setSp(13),
  531. color: Color(0xff666666),
  532. ),
  533. ),
  534. Text(
  535. detailObj.createTime != null
  536. ? DateUtils.instance.getFormartData(
  537. timeSamp: detailObj.createTime,
  538. format: "yyyy-MM-dd HH:mm:ss")
  539. : '',
  540. textAlign: TextAlign.left,
  541. style: TextStyle(
  542. fontSize: ScreenUtil().setSp(13),
  543. color: Color(0xff666666),
  544. ),
  545. ),
  546. ],
  547. ),
  548. detailObj.liftCaseAppealEntity!=null? Row(
  549. children: <Widget>[
  550. Text(
  551. '驳回原因:',
  552. textAlign: TextAlign.left,
  553. style: TextStyle(
  554. fontSize: ScreenUtil().setSp(13),
  555. color: Color(0xff666666),
  556. ),
  557. ),
  558. Container(
  559. width: width*0.75,
  560. child: Text(
  561. detailObj.liftCaseAppealEntity?.cancelSeason??"",
  562. textAlign: TextAlign.left,
  563. style: TextStyle(
  564. fontSize: ScreenUtil().setSp(13),
  565. color: Color(0xff666666),
  566. ),
  567. ),
  568. )
  569. ],
  570. ):Container(child: null,),
  571. ],
  572. ),
  573. ),
  574. detailObj.dataTable==2? Column(
  575. crossAxisAlignment: CrossAxisAlignment.start,
  576. children: <Widget>[
  577. Container(
  578. width: width,
  579. padding: EdgeInsets.only(left:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10)),
  580. decoration: BoxDecoration(
  581. border: Border(
  582. bottom: BorderSide(width: .5, color:Color(0xfff5f5f5)),
  583. ),
  584. ),
  585. child: Text(
  586. '现场情况(维修前)',
  587. textAlign: TextAlign.left,
  588. style: TextStyle(
  589. fontSize:ScreenUtil().setSp(17),
  590. color:Color(0xff333333),
  591. ),
  592. ),
  593. ),
  594. detailObj.beforeRepair!=null?Container(
  595. padding: EdgeInsets.only(
  596. left: ScreenUtil().setWidth(15),
  597. right: ScreenUtil().setWidth(15),
  598. top: ScreenUtil().setWidth(15)),
  599. child: ClipRRect(
  600. borderRadius: BorderRadius.circular(5),
  601. child: new Chewie(
  602. controller: ChewieController(
  603. videoPlayerController:
  604. // VideoPlayerController.network(
  605. // Utils.getImagePath(detailObj.beforeRepair)
  606. // // imgFontUrl + detailObj.url
  607. // )
  608. _controllerBefore,
  609. aspectRatio: 3 / 2,
  610. autoPlay: false,
  611. looping: true,
  612. showControls: true,
  613. deviceOrientationsAfterFullScreen:[DeviceOrientation.portraitUp,],
  614. // 占位图
  615. // placeholder: Image.network(
  616. // imgFontUrl+detailObj.cover,
  617. // fit: BoxFit.contain,
  618. // ),
  619. // 是否在 UI 构建的时候就加载视频
  620. autoInitialize: true,
  621. // 拖动条样式颜色
  622. materialProgressColors:
  623. new ChewieProgressColors(
  624. playedColor: Colors.red,
  625. handleColor: Colors.blue,
  626. backgroundColor: Colors.grey,
  627. bufferedColor: Colors.lightGreen,
  628. ),
  629. ),
  630. ),
  631. )):Container(
  632. padding: EdgeInsets.only(left:15),
  633. child: Text("暂无"),
  634. ),
  635. Container(
  636. width: width,
  637. padding: EdgeInsets.only(left:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10)),
  638. decoration: BoxDecoration(
  639. border: Border(
  640. bottom: BorderSide(width: .5, color:Color(0xfff5f5f5)),
  641. ),
  642. ),
  643. child: Text(
  644. '现场情况(维修后)',
  645. textAlign: TextAlign.left,
  646. style: TextStyle(
  647. fontSize:ScreenUtil().setSp(17),
  648. color:Color(0xff333333),
  649. ),
  650. ),
  651. ),
  652. detailObj.afterRepair!=null? Container(
  653. padding: EdgeInsets.only(
  654. left: ScreenUtil().setWidth(15),
  655. right: ScreenUtil().setWidth(15),
  656. top: ScreenUtil().setWidth(15)),
  657. child: ClipRRect(
  658. borderRadius: BorderRadius.circular(5),
  659. child: new Chewie(
  660. controller: ChewieController(
  661. videoPlayerController:
  662. // VideoPlayerController.network(
  663. // Utils.getImagePath(detailObj.afterRepair)
  664. // // imgFontUrl + detailObj.url
  665. // )
  666. _controllerAfter,
  667. aspectRatio: 3 / 2,
  668. autoPlay: false,
  669. looping: true,
  670. showControls: true,
  671. deviceOrientationsAfterFullScreen:[DeviceOrientation.portraitUp,],
  672. // 占位图
  673. // placeholder: Image.network(
  674. // imgFontUrl+detailObj.cover,
  675. // fit: BoxFit.contain,
  676. // ),
  677. // 是否在 UI 构建的时候就加载视频
  678. autoInitialize: true,
  679. // 拖动条样式颜色
  680. materialProgressColors:
  681. new ChewieProgressColors(
  682. playedColor: Colors.red,
  683. handleColor: Colors.blue,
  684. backgroundColor: Colors.grey,
  685. bufferedColor: Colors.lightGreen,
  686. ),
  687. ),
  688. ),
  689. )):Container(
  690. padding: EdgeInsets.only(left:15),
  691. child: Text("暂无"),
  692. ),
  693. ],
  694. ):Container(child: null,),
  695. OrderConstant.isShow(
  696. detailObj.statuz,
  697. detailObj.dataTable,
  698. 'showUserAppealInfo') ==
  699. false
  700. ? SizedBox(height: 80)
  701. : Container(child: null),
  702. OrderConstant.isShow(detailObj.statuz,
  703. detailObj.dataTable, 'showUserAppealInfo')
  704. ? Container(
  705. padding: EdgeInsets.only(
  706. left: ScreenUtil().setWidth(15),
  707. top: ScreenUtil().setWidth(10),
  708. bottom: ScreenUtil().setWidth(10)),
  709. decoration: BoxDecoration(
  710. border: Border(
  711. bottom: BorderSide(
  712. width: .5, color: Color(0xfff5f5f5)),
  713. ),
  714. ),
  715. child: Text(
  716. '申诉信息',
  717. textAlign: TextAlign.left,
  718. style: TextStyle(
  719. fontSize: ScreenUtil().setSp(17),
  720. ),
  721. ),
  722. )
  723. : Container(child: null),
  724. OrderConstant.isShow(detailObj.statuz,
  725. detailObj.dataTable, 'showUserAppealInfo')
  726. ? Container(
  727. padding: EdgeInsets.only(
  728. left: ScreenUtil().setWidth(15),
  729. top: ScreenUtil().setWidth(10),
  730. bottom: ScreenUtil().setWidth(10)),
  731. child: Column(
  732. children: <Widget>[
  733. Row(
  734. children: <Widget>[
  735. Text(
  736. '申诉内容:',
  737. textAlign: TextAlign.left,
  738. style: TextStyle(
  739. fontSize: ScreenUtil().setSp(12),
  740. color: Color(0xff666666),
  741. ),
  742. ),
  743. Text(
  744. detailObj.liftCaseAppealEntity !=
  745. null &&
  746. detailObj
  747. .liftCaseAppealEntity
  748. .content !=
  749. null
  750. ? detailObj.liftCaseAppealEntity
  751. .content
  752. : '',
  753. textAlign: TextAlign.left,
  754. style: TextStyle(
  755. fontSize: ScreenUtil().setSp(12),
  756. color: Color(0xff666666),
  757. ),
  758. ),
  759. ],
  760. ),
  761. Row(
  762. children: <Widget>[
  763. Text(
  764. '申诉时间:',
  765. textAlign: TextAlign.left,
  766. style: TextStyle(
  767. fontSize: ScreenUtil().setSp(12),
  768. color: Color(0xff666666),
  769. ),
  770. ),
  771. Text(
  772. detailObj.liftCaseAppealEntity !=
  773. null &&
  774. detailObj
  775. .liftCaseAppealEntity
  776. .createTime !=
  777. null
  778. ? DateUtils.instance.getFormartData(
  779. timeSamp: detailObj
  780. .liftCaseAppealEntity
  781. .createTime,
  782. format:
  783. "yyyy-MM-dd HH:mm:ss")
  784. : '',
  785. textAlign: TextAlign.left,
  786. style: TextStyle(
  787. fontSize: ScreenUtil().setSp(12),
  788. color: Color(0xff666666),
  789. ),
  790. ),
  791. ],
  792. ),
  793. ],
  794. ),
  795. )
  796. : Container(child: null),
  797. SizedBox(
  798. height: 70,
  799. )
  800. ],
  801. ),
  802. Positioned(
  803. bottom: 0,
  804. left: 0,
  805. child: Container(
  806. width: width,
  807. height:
  808. !getHeight(detailObj)?0:
  809. 60,
  810. padding: EdgeInsets.only(
  811. right: ScreenUtil().setWidth(15),
  812. left: ScreenUtil().setWidth(15),
  813. top: ScreenUtil().setWidth(12),
  814. bottom: ScreenUtil().setWidth(12),
  815. ),
  816. decoration: BoxDecoration(
  817. border: Border(
  818. top: BorderSide(
  819. width: 0.5,
  820. color: Color(0xffeeeeee),
  821. ),
  822. ),
  823. color: ThemeUtils.getDialogTextFieldColor(context),
  824. ),
  825. child: Row(
  826. mainAxisAlignment: MainAxisAlignment.end,
  827. crossAxisAlignment: CrossAxisAlignment.center,
  828. // children: btnWidget,
  829. children: <Widget>[
  830. OrderConstant.isShow(
  831. detailObj.statuz,
  832. detailObj.dataTable,
  833. 'showUserPaymentButton') && detailObj.chargerId!=null
  834. ? BottomBtn(
  835. title: "立即付款",
  836. fun: () {
  837. // showAlert(
  838. // context,
  839. // "提示",
  840. // "确认付款吗?",
  841. // "确认",
  842. // () {
  843. // // payment();
  844. // // NavigatorUtils.goBack(context);
  845. // NavigatorUtils.push(
  846. // context, "${WodeRouter.buyService}?id=${detailObj.id}");
  847. // },
  848. // txt2: "取消",
  849. // onPre2: () {
  850. // NavigatorUtils.goBack(context);
  851. // });
  852. NavigatorUtils.push(
  853. context, "${WodeRouter.buyService}?id=${detailObj.id}");
  854. },
  855. )
  856. : Container(child: null),
  857. OrderConstant.isShow(
  858. detailObj.statuz,
  859. detailObj.dataTable,
  860. 'showUserConfirmPunchButton',
  861. arrivedFlag: detailObj.arrivedFlag)
  862. ? BottomBtn(
  863. title: "确认打卡",
  864. fun: () {
  865. confirmPunchin();
  866. },
  867. )
  868. : Container(child: null),
  869. OrderConstant.isShow(
  870. detailObj.statuz,
  871. detailObj.dataTable,
  872. 'showUserAppealButton')
  873. ? BottomBtn(
  874. title: "提出申诉",
  875. fun: () {
  876. if(detailObj.liftCaseAppealEntity != null){
  877. toasts("当前诊单不能申诉");
  878. }else {
  879. NavigatorUtils.push(context,
  880. "${WodeRouter.representations}?id=${detailObj.id}");
  881. }
  882. },
  883. )
  884. : Container(child: null),
  885. OrderConstant.isShow(
  886. detailObj.statuz,
  887. detailObj.dataTable,
  888. 'showUserConfirmOrderButton')
  889. ? BottomBtn(
  890. title: "立即确认",
  891. fun: () {
  892. showAlert(
  893. context,
  894. "提示",
  895. "确认完成吗?",
  896. "确认",
  897. () {
  898. confirmOrder();
  899. NavigatorUtils.goBack(context);
  900. },
  901. txt2: "取消",
  902. onPre2: () {
  903. NavigatorUtils.goBack(context);
  904. });
  905. },
  906. )
  907. : Container(child: null),
  908. OrderConstant.isShow(
  909. detailObj.statuz,
  910. detailObj.dataTable,
  911. 'showUserEvaluationButton')
  912. ? BottomBtn(
  913. title: "评价",
  914. fun: () {
  915. NavigatorUtils.push(context,
  916. "${WodeRouter.comment}?id=${detailObj.id}");
  917. },
  918. )
  919. : Container(child: null),
  920. OrderConstant.isShow(
  921. detailObj.statuz,
  922. detailObj.dataTable,
  923. 'showUserChooseExpertButton') || (detailObj.chargerId==null && detailObj.isPlatformSpecified == 0)
  924. ? BottomBtn(
  925. title: "选择专家",
  926. fun: () {
  927. setDataId(detailObj.id);
  928. setType(detailObj.dataTable.toString());
  929. NavigatorUtils.push(context, "${BbsRouter.expertList}?id=${detailObj.brandId}");
  930. },
  931. )
  932. : Container(child: null),
  933. ],
  934. ),
  935. ),
  936. ),
  937. ],
  938. );
  939. },
  940. )
  941. : Center(
  942. child: Text("正在加载..."),
  943. ),
  944. ),
  945. );
  946. }
  947. void setDataId (int id)async{
  948. SharedPreferences prefs = await SharedPreferences.getInstance();
  949. prefs.setInt("dataId", id);
  950. }
  951. void setType (String type)async{
  952. SharedPreferences prefs = await SharedPreferences.getInstance();
  953. prefs.setString("questionType", type);
  954. }
  955. @override
  956. bool get wantKeepAlive => true;
  957. }
  958. class BottomBtn extends StatelessWidget {
  959. BottomBtn({Key key, this.title, this.fun}) : super(key: key);
  960. Function fun;
  961. String title;
  962. @override
  963. Widget build(BuildContext context) {
  964. return Container(
  965. margin: EdgeInsets.only(left: 10),
  966. child: GestureDetector(
  967. onTap: () {
  968. fun();
  969. },
  970. child: Container(
  971. child: Container(
  972. // height:22,
  973. padding: EdgeInsets.only(
  974. left: ScreenUtil().setWidth(20),
  975. right: ScreenUtil().setWidth(20)),
  976. decoration: BoxDecoration(
  977. border: Border.all(width: 1, color: Color(0xff1B87F6)),
  978. borderRadius: BorderRadius.circular(ScreenUtil().setWidth(17)),
  979. ),
  980. child: Column(
  981. mainAxisAlignment: MainAxisAlignment.center,
  982. children: <Widget>[
  983. Text(
  984. title,
  985. textAlign: TextAlign.center,
  986. style: TextStyle(
  987. fontSize: ScreenUtil().setSp(15),
  988. color: Color(0xff0288FF),
  989. ),
  990. ),
  991. ],
  992. ),
  993. ),
  994. ),
  995. ),
  996. );
  997. }
  998. }