order_detail.dart 53 KB

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