order_detail.dart 59 KB

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