YSPay.dart 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033
  1. import 'dart:convert';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter/cupertino.dart';
  4. import 'package:ysairplane/base/YSBase.dart';
  5. import 'package:ysairplane/code/YSCourseDetail.dart';
  6. import 'package:ysairplane/code/YSMoney.dart';
  7. import 'package:ysairplane/code/YSSetPayPass.dart';
  8. import 'package:ysairplane/tools/YSNetWorking.dart';
  9. import 'package:ysairplane/tools/YSPayKeybord.dart';
  10. import 'package:ysairplane/tools/YSTools.dart';
  11. enum payType{
  12. doctor,
  13. help,
  14. goods,
  15. marry,
  16. sport,
  17. short,
  18. business,//商务
  19. preferential,//特惠
  20. sightseeing//游览
  21. }
  22. class YSPay extends StatefulWidget {
  23. final orderDict;
  24. final payType type;
  25. const YSPay({Key key, this.orderDict, this.type}) : super(key: key);
  26. @override
  27. _YSPayState createState() => _YSPayState();
  28. }
  29. class _YSPayState extends State<YSPay> {
  30. int _selected = 0;
  31. bool _isSucceed = false;
  32. @override
  33. Widget build(BuildContext context) {
  34. return YSBase(
  35. ystitle: '支付方式',
  36. yschild: _isSucceed==true?Column(
  37. children: [
  38. Container(
  39. color: Colors.white,
  40. width: MediaQuery.of(context).size.width,
  41. padding: EdgeInsets.only(left: wsp(30),right: wsp(30),top: hsp(60),bottom: hsp(60)),
  42. child: Column(
  43. children: [
  44. Image(
  45. image: AssetImage('lib/images/succeed.png'),
  46. height: hsp(130),
  47. width: wsp(130)
  48. ),
  49. Container(
  50. child: Text('支付成功',style: TextStyle(fontSize: zsp(40),color: Color(0xFF333333)),),
  51. margin: EdgeInsets.only(top: hsp(40),bottom: hsp(33)),
  52. ),
  53. Text('本次支付金额${widget.orderDict['price']}元',style: TextStyle(fontSize: zsp(28),color: Color(0xFF878787)),),
  54. ],
  55. ),
  56. ),
  57. GestureDetector(
  58. onTap: (){
  59. Navigator.pop(context);
  60. },
  61. child: Container(
  62. height: hsp(94),
  63. width: MediaQuery.of(context).size.width-wsp(24)*2,
  64. alignment: Alignment.center,
  65. margin: EdgeInsets.only(top: hsp(58)),
  66. decoration: BoxDecoration(
  67. color: Color(0xFF0079FF),
  68. borderRadius: BorderRadius.all(Radius.circular(5))
  69. ),
  70. child: Text('完成',style: TextStyle(color: Colors.white,fontSize: zsp(34)),),
  71. ),
  72. ),
  73. GestureDetector(
  74. onTap: (){
  75. Navigator.of(context).push(
  76. CupertinoPageRoute(
  77. builder: (context){
  78. return YSCourseDetail(orderStr: widget.orderDict['orderSn'],);
  79. }
  80. ));
  81. },
  82. child: Container(
  83. height: hsp(94),
  84. width: MediaQuery.of(context).size.width-wsp(24)*2,
  85. alignment: Alignment.center,
  86. margin: EdgeInsets.only(top: hsp(58)),
  87. decoration: BoxDecoration(
  88. color: Color(0xFF0079FF),
  89. borderRadius: BorderRadius.all(Radius.circular(5))
  90. ),
  91. child: Text('查看订单',style: TextStyle(color: Colors.white,fontSize: zsp(34)),),
  92. ),
  93. )
  94. ],
  95. ):Column(
  96. children: [
  97. Container(
  98. height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44-hsp(120),
  99. width: MediaQuery.of(context).size.width,
  100. color: Color(0xFFF1F2F3),
  101. child: SingleChildScrollView(
  102. child: Column(
  103. children: [
  104. Container(
  105. width: MediaQuery.of(context).size.width,
  106. padding: EdgeInsets.all(hsp(30)),
  107. color: Colors.white,
  108. child: Column(
  109. crossAxisAlignment: CrossAxisAlignment.start,
  110. children: [
  111. Container(
  112. child: Text('未支付',style: TextStyle(fontSize: zsp(32),color: Color(0xFFFF4747),fontWeight: FontWeight.bold),),
  113. margin: EdgeInsets.only(top: hsp(10),bottom: hsp(10)),
  114. ),
  115. Text('请在${_getMin('${widget.orderDict['expireHour']}')}分钟内完成支付, 否则该订单将被自动取消',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),)//${int.parse('${(widget.orderDict['expireHour'])*60}')}
  116. ],
  117. ),
  118. ),
  119. widget.type==payType.doctor?Column(
  120. children: [
  121. Container(
  122. padding: EdgeInsets.all(hsp(30)),
  123. margin: EdgeInsets.only(top: hsp(12)),
  124. width: MediaQuery.of(context).size.width,
  125. color: Colors.white,
  126. child: Row(
  127. crossAxisAlignment: CrossAxisAlignment.start,
  128. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  129. children: [
  130. Container(
  131. width: MediaQuery.of(context).size.width*0.6,
  132. child: ListView.builder(
  133. itemBuilder: (context,index){
  134. return Row(
  135. crossAxisAlignment: CrossAxisAlignment.start,
  136. children: [
  137. Column(
  138. children: [
  139. Container(
  140. height: hsp(30),
  141. width: hsp(30),
  142. decoration: BoxDecoration(
  143. color: Colors.white,
  144. borderRadius: BorderRadius.all(Radius.circular(50)),
  145. border: Border.all(color: index==0?Color(0xFF02C094):Color(0xFFFB9658),width: wsp(6))
  146. ),
  147. margin: EdgeInsets.only(top: hsp(7),bottom: hsp(7)),
  148. ),
  149. if(index<1)Container(
  150. height: hsp(30),
  151. width: hsp(5),
  152. color: Color(0xFFCACAD4),
  153. )
  154. ],
  155. ),
  156. Container(
  157. child: RichText(
  158. text: TextSpan(
  159. text: '${widget.orderDict[index==0?'citySetout':'cityArrive']}',
  160. style: TextStyle(color: Color(0xFF000000),fontSize: zsp(32),fontWeight: FontWeight.bold),
  161. children: [
  162. TextSpan(
  163. text: ' ${widget.orderDict[index==0?'airportSetout':'airportArrive']}',
  164. style: TextStyle(color: Color(0xFF999999),fontSize: zsp(20),fontWeight: FontWeight.normal),
  165. )
  166. ]
  167. ),
  168. ),
  169. margin: EdgeInsets.only(left: wsp(10),top: hsp(5)),
  170. )
  171. ],
  172. );
  173. },
  174. itemCount: 2,
  175. shrinkWrap: true,
  176. physics: NeverScrollableScrollPhysics(),
  177. ),
  178. ),
  179. Container(
  180. child: Text('¥ ${widget.orderDict['retailPrice']} x ${widget.orderDict['travelersNumber']}人',style: TextStyle(fontSize: zsp(28),color: Color(0xFFA2A2A2)),),
  181. padding: EdgeInsets.only(top: hsp(10)),
  182. )
  183. ],
  184. ),
  185. ),
  186. Container(
  187. padding: EdgeInsets.all(hsp(30)),
  188. margin: EdgeInsets.only(top: hsp(12)),
  189. width: MediaQuery.of(context).size.width,
  190. color: Colors.white,
  191. child: Column(
  192. crossAxisAlignment: CrossAxisAlignment.start,
  193. children: [
  194. RichText(
  195. text: TextSpan(
  196. text: '乘机人数 ',
  197. style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
  198. children: [
  199. TextSpan(
  200. text: '${widget.orderDict['travelersNumber']}人',
  201. style: TextStyle(fontSize: zsp(32),color: Color(0xFF333333)),
  202. )
  203. ]
  204. ),
  205. ),
  206. Container(height: 0.5,color: Color(0xFFE5E5E5),margin: EdgeInsets.only(top: hsp(20),bottom: hsp(20),left: hsp(170)),),
  207. RichText(
  208. text: TextSpan(
  209. text: '出发时间 ',
  210. style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
  211. children: [
  212. TextSpan(
  213. text: '${widget.orderDict['flightTime']}',
  214. style: TextStyle(fontSize: zsp(32),color: Color(0xFF333333)),
  215. )
  216. ]
  217. ),
  218. ),
  219. ],
  220. ),
  221. ),
  222. ],
  223. ):widget.type==payType.help?Column(
  224. children: [
  225. Container(
  226. padding: EdgeInsets.all(hsp(30)),
  227. margin: EdgeInsets.only(top: hsp(12)),
  228. width: MediaQuery.of(context).size.width,
  229. color: Colors.white,
  230. child: Row(
  231. crossAxisAlignment: CrossAxisAlignment.start,
  232. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  233. children: [
  234. Container(
  235. width: MediaQuery.of(context).size.width*0.6,
  236. child: ListView.builder(
  237. itemBuilder: (context,index){
  238. return Row(
  239. crossAxisAlignment: CrossAxisAlignment.start,
  240. children: [
  241. Column(
  242. children: [
  243. Container(
  244. height: hsp(30),
  245. width: hsp(30),
  246. decoration: BoxDecoration(
  247. color: Colors.white,
  248. borderRadius: BorderRadius.all(Radius.circular(50)),
  249. border: Border.all(color: index==0?Color(0xFF02C094):Color(0xFFFB9658),width: wsp(6))
  250. ),
  251. margin: EdgeInsets.only(top: hsp(7),bottom: hsp(7)),
  252. ),
  253. if(index<1)Container(
  254. height: hsp(30),
  255. width: hsp(5),
  256. color: Color(0xFFCACAD4),
  257. )
  258. ],
  259. ),
  260. Container(
  261. child: RichText(
  262. text: TextSpan(
  263. text: '${widget.orderDict[index==0?'citySetout':'cityArrive']}',
  264. style: TextStyle(color: Color(0xFF000000),fontSize: zsp(32),fontWeight: FontWeight.bold),
  265. ),
  266. ),
  267. margin: EdgeInsets.only(left: wsp(10),top: hsp(5)),
  268. )
  269. ],
  270. );
  271. },
  272. itemCount: 2,
  273. shrinkWrap: true,
  274. physics: NeverScrollableScrollPhysics(),
  275. ),
  276. ),
  277. Container(
  278. child: Text('¥ ${widget.orderDict['retailPrice']} x ${widget.orderDict['travelersNumber']}人',style: TextStyle(fontSize: zsp(28),color: Color(0xFFA2A2A2)),),
  279. padding: EdgeInsets.only(top: hsp(10)),
  280. )
  281. ],
  282. ),
  283. ),
  284. Container(
  285. padding: EdgeInsets.all(hsp(30)),
  286. margin: EdgeInsets.only(top: hsp(12)),
  287. width: MediaQuery.of(context).size.width,
  288. color: Colors.white,
  289. child: Column(
  290. crossAxisAlignment: CrossAxisAlignment.start,
  291. children: [
  292. RichText(
  293. text: TextSpan(
  294. text: '人数 ',
  295. style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
  296. children: [
  297. TextSpan(
  298. text: '${widget.orderDict['travelersNumber']}人',
  299. style: TextStyle(fontSize: zsp(32),color: Color(0xFF333333)),
  300. )
  301. ]
  302. ),
  303. ),
  304. Container(height: 0.5,color: Color(0xFFE5E5E5),margin: EdgeInsets.only(top: hsp(20),bottom: hsp(20),left: hsp(120)),),
  305. RichText(
  306. text: TextSpan(
  307. text: '电话 ',
  308. style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
  309. children: [
  310. TextSpan(
  311. text: '${widget.orderDict['phone']}',
  312. style: TextStyle(fontSize: zsp(32),color: Color(0xFF333333)),
  313. )
  314. ]
  315. ),
  316. ),
  317. Container(height: 0.5,color: Color(0xFFE5E5E5),margin: EdgeInsets.only(top: hsp(20),bottom: hsp(20),left: hsp(120)),),
  318. RichText(
  319. text: TextSpan(
  320. text: '描述 ',
  321. style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
  322. children: [
  323. TextSpan(
  324. text: '${widget.orderDict['des']==null?'无':widget.orderDict['des']}',
  325. style: TextStyle(fontSize: zsp(32),color: Color(0xFF333333)),
  326. )
  327. ]
  328. ),
  329. ),
  330. ],
  331. ),
  332. ),
  333. ],
  334. ):widget.type==payType.goods?Column(
  335. children: [
  336. Container(
  337. padding: EdgeInsets.all(hsp(30)),
  338. margin: EdgeInsets.only(top: hsp(12)),
  339. width: MediaQuery.of(context).size.width,
  340. color: Colors.white,
  341. child: Row(
  342. crossAxisAlignment: CrossAxisAlignment.start,
  343. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  344. children: [
  345. Container(
  346. child: Text('费用明细',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
  347. ),
  348. Container(
  349. width: (MediaQuery.of(context).size.width-hsp(280))*0.55,
  350. padding: EdgeInsets.only(right: wsp(30)),
  351. child: Column(
  352. crossAxisAlignment: CrossAxisAlignment.start,
  353. children: [
  354. Text(widget.orderDict['sourceType']==1?'整机':'拼机',style: TextStyle(fontSize: zsp(32),color: Colors.black,fontWeight: FontWeight.bold),),
  355. Container(
  356. margin: EdgeInsets.only(top: hsp(20),bottom: hsp(20)),
  357. child: Row(
  358. children: [
  359. Text('${widget.orderDict['setoutInfo']['display']} ',style: TextStyle(fontSize: zsp(25),color: Color(0xFF9A9A9A))),
  360. Container(
  361. height: 1,
  362. width: wsp(20),
  363. color: Color(0xFFCCCCCC),
  364. ),
  365. Text(' ${widget.orderDict['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(25),color: Color(0xFF9A9A9A)))
  366. ],
  367. ),
  368. ),
  369. RichText(
  370. text: TextSpan(
  371. text: '预订须知',
  372. style: TextStyle(fontSize: zsp(24),color: Color(0xFF348AE1)),
  373. children: [
  374. TextSpan(
  375. text: ' >',
  376. style: TextStyle(color: Color(0xFF000000))
  377. ),
  378. ]
  379. ),
  380. )
  381. ],
  382. ),
  383. ),
  384. Container(
  385. width: (MediaQuery.of(context).size.width-wsp(280))*0.4,
  386. alignment: Alignment.centerRight,
  387. child: Text('¥ ${widget.orderDict['price']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFFA2A2A2)),),
  388. padding: EdgeInsets.only(top: hsp(10)),
  389. )
  390. ],
  391. ),
  392. ),
  393. Container(
  394. padding: EdgeInsets.all(hsp(30)),
  395. margin: EdgeInsets.only(top: hsp(12)),
  396. width: MediaQuery.of(context).size.width,
  397. color: Colors.white,
  398. child: Row(
  399. crossAxisAlignment: CrossAxisAlignment.start,
  400. children: [
  401. Container(
  402. width: wsp(150),
  403. alignment: Alignment.center,
  404. child: Text('乘机人 ',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
  405. ),
  406. Container(
  407. width: MediaQuery.of(context).size.width-hsp(60)-wsp(150),
  408. child: ListView.separated(
  409. itemBuilder: (context,index){
  410. return Container(
  411. width: MediaQuery.of(context).size.width-hsp(60)-wsp(150),
  412. padding: EdgeInsets.only(bottom: index==1?0:hsp(20),top: index==0?0:hsp(20)),
  413. child: Column(
  414. crossAxisAlignment: CrossAxisAlignment.start,
  415. children: [
  416. Text('${widget.orderDict['dtAirplaneGoods']['contactPerson']}',style: TextStyle(fontSize: zsp(32),color: Color(0xFF343434),fontWeight: FontWeight.bold),),
  417. Text('联系方式 ${widget.orderDict['dtAirplaneGoods']['phone']}',style: TextStyle(fontSize: zsp(25),color: Color(0xFF666666),))
  418. ],
  419. ),
  420. );
  421. },
  422. separatorBuilder: (context,index){
  423. return Divider(color: Color(0xFFE5E5E5),height: 0.5,thickness: 0.5,);
  424. },
  425. itemCount: 1,
  426. padding: EdgeInsets.all(0),
  427. shrinkWrap: true,
  428. ),
  429. ),
  430. ],
  431. ),
  432. ),
  433. ],
  434. ):widget.type==payType.marry||widget.type==payType.sport||widget.type==payType.sightseeing?Column(
  435. children: [
  436. Container(
  437. padding: EdgeInsets.all(hsp(30)),
  438. margin: EdgeInsets.only(top: hsp(12)),
  439. width: MediaQuery.of(context).size.width,
  440. color: Colors.white,
  441. child: Row(
  442. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  443. children: [
  444. Text('${widget.orderDict['orderName']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFF000000)),),
  445. Text('¥${widget.orderDict['price']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),)
  446. ],
  447. ),
  448. ),
  449. Container(
  450. padding: EdgeInsets.all(hsp(30)),
  451. margin: EdgeInsets.only(top: hsp(2)),
  452. width: MediaQuery.of(context).size.width,
  453. color: Colors.white,
  454. child: RichText(
  455. text: TextSpan(
  456. text: '联系方式 ',
  457. style: TextStyle(color: Colors.black,fontWeight: FontWeight.bold,fontSize: zsp(30)),
  458. children: [
  459. TextSpan(
  460. text: '${widget.orderDict['phone']}',
  461. style: TextStyle(fontWeight: FontWeight.normal,color: Color(0xFF666666))
  462. )
  463. ]
  464. ),
  465. ),
  466. ),
  467. if(widget.type==payType.marry)Container(
  468. padding: EdgeInsets.only(top: hsp(30),left: hsp(30),right: hsp(30),bottom: hsp(10)),
  469. margin: EdgeInsets.only(top: hsp(2)),
  470. width: MediaQuery.of(context).size.width,
  471. color: Colors.white,
  472. child: Text('贺卡备注',style: TextStyle(color: Colors.black,fontWeight: FontWeight.bold,fontSize: zsp(30)),),
  473. ),
  474. if(widget.type==payType.marry)Container(
  475. padding: EdgeInsets.only(left: hsp(40),right: hsp(30),bottom: hsp(30)),
  476. width: MediaQuery.of(context).size.width,
  477. color: Colors.white,
  478. child: Text(widget.orderDict['des']==null?'':'${widget.orderDict['des']}',style: TextStyle(color: Color(0xFF666666),fontWeight: FontWeight.normal,fontSize: zsp(30)),),
  479. )
  480. ],
  481. ):widget.type==payType.short?Column(
  482. children: [
  483. Container(
  484. padding: EdgeInsets.all(hsp(30)),
  485. margin: EdgeInsets.only(top: hsp(12)),
  486. width: MediaQuery.of(context).size.width,
  487. color: Colors.white,
  488. child: Row(
  489. crossAxisAlignment: CrossAxisAlignment.start,
  490. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  491. children: [
  492. Container(
  493. width: MediaQuery.of(context).size.width*0.6,
  494. child: ListView.builder(
  495. itemBuilder: (context,index){
  496. return Row(
  497. crossAxisAlignment: CrossAxisAlignment.start,
  498. children: [
  499. Column(
  500. children: [
  501. Container(
  502. height: hsp(30),
  503. width: hsp(30),
  504. decoration: BoxDecoration(
  505. color: Colors.white,
  506. borderRadius: BorderRadius.all(Radius.circular(50)),
  507. border: Border.all(color: index==0?Color(0xFF02C094):Color(0xFFFB9658),width: wsp(6))
  508. ),
  509. margin: EdgeInsets.only(top: hsp(7),bottom: hsp(7)),
  510. ),
  511. if(index<1)Container(
  512. height: hsp(30),
  513. width: hsp(5),
  514. color: Color(0xFFCACAD4),
  515. )
  516. ],
  517. ),
  518. Container(
  519. child: RichText(
  520. text: TextSpan(
  521. text: '${widget.orderDict[index==0?'setoutInfo':'arriveInfo']['display']}',
  522. style: TextStyle(color: Color(0xFF000000),fontSize: zsp(32),fontWeight: FontWeight.bold),
  523. children: [
  524. TextSpan(
  525. text: ' ${widget.orderDict[index==0?'setoutInfo':'arriveInfo']['airplanename']}',
  526. style: TextStyle(color: Color(0xFF999999),fontSize: zsp(20),fontWeight: FontWeight.normal),
  527. )
  528. ]
  529. ),
  530. ),
  531. margin: EdgeInsets.only(left: wsp(10),top: hsp(5)),
  532. )
  533. ],
  534. );
  535. },
  536. itemCount: 2,
  537. shrinkWrap: true,
  538. physics: NeverScrollableScrollPhysics(),
  539. ),
  540. ),
  541. Container(
  542. child: Text('¥ ${widget.orderDict['retailPrice']} x ${widget.orderDict['travelersNumber']}人',style: TextStyle(fontSize: zsp(28),color: Color(0xFFA2A2A2)),),
  543. padding: EdgeInsets.only(top: hsp(10)),
  544. )
  545. ],
  546. ),
  547. )
  548. ],
  549. ):widget.type==payType.business?Container(
  550. margin: EdgeInsets.only(top: hsp(10)),
  551. child: Column(
  552. children: [
  553. ListView.separated(
  554. shrinkWrap: true,
  555. itemBuilder: (context,index){
  556. return Container(
  557. color: Colors.white,
  558. child: Column(
  559. children: [
  560. widget.orderDict['charterType']==1?Container(
  561. padding: EdgeInsets.only(left: wsp(32),right: wsp(32),top: hsp(20),bottom: hsp(20)),
  562. child: Column(
  563. children: [
  564. Row(
  565. children: [
  566. Container(
  567. child: Text('${widget.orderDict['itineraries'][index]['setOutInfo']['display']}',
  568. style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
  569. width: (MediaQuery.of(context).size.width-hsp(210))/2,
  570. ),
  571. Image(height: hsp(60),width: hsp(60),image: AssetImage('lib/images/plane.png'),),
  572. Container(
  573. child: Text('${widget.orderDict['itineraries'][index]['arriveInfo']['display']}',
  574. style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
  575. width: (MediaQuery.of(context).size.width-hsp(210))/2,
  576. alignment: Alignment.centerRight,
  577. ),
  578. ],
  579. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  580. ),
  581. Row(
  582. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  583. children: [
  584. Container(
  585. child: Text('${widget.orderDict['itineraries'][index]['setOutInfo']['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  586. width: (MediaQuery.of(context).size.width-hsp(300))/2,
  587. ),
  588. Text('${widget.orderDict['itineraries'][index]['time']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  589. Container(
  590. child: Text('${widget.orderDict['itineraries'][index]['arriveInfo']['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  591. width: (MediaQuery.of(context).size.width-hsp(300))/2,
  592. alignment: Alignment.centerRight,
  593. ),
  594. ],
  595. )
  596. ],
  597. ),
  598. ):Container(
  599. width: MediaQuery.of(context).size.width-hsp(60),
  600. child: ListView.builder(
  601. itemBuilder: (context,indexSub){
  602. return Row(
  603. crossAxisAlignment: CrossAxisAlignment.start,
  604. children: [
  605. Column(
  606. children: [
  607. Container(
  608. height: hsp(30),
  609. width: hsp(30),
  610. decoration: BoxDecoration(
  611. color: Colors.white,
  612. borderRadius: BorderRadius.all(Radius.circular(50)),
  613. border: Border.all(color: indexSub%2==0?Color(0xFF02C094):Color(0xFFFB9658),width: wsp(6))
  614. ),
  615. margin: EdgeInsets.only(top: hsp(10),bottom: hsp(7)),
  616. ),
  617. if(indexSub<1)Container(
  618. height: hsp(30),
  619. width: hsp(5),
  620. color: Color(0xFFCACAD4),
  621. )
  622. ],
  623. ),
  624. Container(
  625. child: RichText(
  626. text: TextSpan(
  627. text: '${widget.orderDict['itineraries'][index][indexSub==0?'setout':'arrive']}',
  628. style: TextStyle(color: Color(0xFF000000),fontSize: hsp(30),fontWeight: FontWeight.bold),
  629. children: [
  630. ]
  631. ),
  632. ),
  633. margin: EdgeInsets.only(left: wsp(10),top: hsp(5)),
  634. )
  635. ],
  636. );
  637. },
  638. itemCount: 2,
  639. shrinkWrap: true,
  640. physics: NeverScrollableScrollPhysics(),
  641. padding: EdgeInsets.only(top: hsp(10),bottom: hsp(10)),
  642. ),
  643. ),
  644. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),),
  645. Container(
  646. padding: EdgeInsets.only(left: wsp(32),right: wsp(32),top: hsp(20),bottom: hsp(20)),
  647. child: Row(
  648. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  649. children: [
  650. Column(
  651. children: [
  652. Text('出发',style: TextStyle(fontSize: zsp(24),color: Color(0xFF666666)),),
  653. RichText(
  654. text: TextSpan(
  655. text: _getDateStr('${widget.orderDict['itineraries'][index]['timeSetout']}'),style: TextStyle(fontSize: zsp(28),fontWeight: FontWeight.bold,color: Colors.black),
  656. children: [
  657. // TextSpan(
  658. // text: '今天',
  659. // style: TextStyle(fontSize: zsp(24),fontWeight: FontWeight.normal),
  660. // )
  661. ]
  662. ),
  663. )],
  664. crossAxisAlignment: CrossAxisAlignment.start,
  665. ),
  666. Column(
  667. children: [
  668. Text('到达',style: TextStyle(fontSize: zsp(24),color: Color(0xFF666666)),),
  669. RichText(
  670. text: TextSpan(
  671. text: _getDateStr('${widget.orderDict['itineraries'][index]['timeArrive']}'),style: TextStyle(fontSize: zsp(28),fontWeight: FontWeight.bold,color: Colors.black),
  672. children: [
  673. // TextSpan(
  674. // text: '今天',
  675. // style: TextStyle(fontSize: zsp(24),fontWeight: FontWeight.normal),
  676. // )
  677. ]
  678. ),
  679. )
  680. ],
  681. crossAxisAlignment: CrossAxisAlignment.start,
  682. ),
  683. // Icon(Icons.keyboard_arrow_right,size: hsp(50),color: Color(0xFFC1C1C1),)
  684. ],
  685. ),
  686. ),
  687. ],
  688. ),
  689. );
  690. },
  691. separatorBuilder: (context,index){
  692. return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),);
  693. },
  694. itemCount: (widget.orderDict['itineraries']).length,
  695. padding: EdgeInsets.all(0),
  696. physics: NeverScrollableScrollPhysics(),
  697. ),
  698. ],
  699. ),
  700. ):Column(
  701. children: [
  702. Container(
  703. padding: EdgeInsets.all(hsp(30)),
  704. margin: EdgeInsets.only(top: hsp(12)),
  705. width: MediaQuery.of(context).size.width,
  706. color: Colors.white,
  707. child: Row(
  708. crossAxisAlignment: CrossAxisAlignment.start,
  709. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  710. children: [
  711. Container(
  712. width: (MediaQuery.of(context).size.width-hsp(280))*0.65,
  713. padding: EdgeInsets.only(right: wsp(30)),
  714. child: Column(
  715. crossAxisAlignment: CrossAxisAlignment.start,
  716. children: [
  717. Row(
  718. children: [
  719. Text('${widget.orderDict['setoutInfo']['display']}',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),),
  720. Container(
  721. height: 2,
  722. width: wsp(40),
  723. color: Color(0xFFCCCCCC),
  724. ),
  725. Text('${widget.orderDict['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),)
  726. ],
  727. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  728. ),
  729. Container(
  730. child: Row(
  731. children: [
  732. Text('${widget.orderDict['setoutInfo']['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
  733. Text('${widget.orderDict['arriveInfo']['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
  734. ],
  735. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  736. ),
  737. margin: EdgeInsets.only(top: hsp(10),bottom: hsp(20)),
  738. ),
  739. // Row(
  740. // children: [
  741. // Container(
  742. // color: Color(0xFF000000),
  743. // height: hsp(35),
  744. // child: Row(
  745. // children: [
  746. // Image(image: AssetImage('lib/images/vip2.png'),height: hsp(15),width: wsp(16),),
  747. // Text(' G450',style: TextStyle(fontSize: zsp(18),color: Color(0xFFF9DEAC)),)
  748. // ],
  749. // ),
  750. // padding: EdgeInsets.only(left: wsp(5),right: wsp(5)),
  751. // ),
  752. // Container(
  753. // padding: EdgeInsets.only(left: wsp(5),right: wsp(5)),
  754. // height: hsp(35),
  755. // child: Text('座位30',style: TextStyle(fontSize: zsp(20),color: Color(0xFF565656)),),
  756. // decoration: BoxDecoration(
  757. // border: Border.all(color: Color(0xFF565656),width: 0.5)
  758. // ),
  759. // alignment: Alignment.center,
  760. // ),
  761. // ],
  762. // ),
  763. ],
  764. ),
  765. ),
  766. Container(
  767. width: (MediaQuery.of(context).size.width-wsp(280))*0.35,
  768. child: Text('¥ ${widget.orderDict['price']}x ${widget.orderDict['travelersNumber']}人',style: TextStyle(fontSize: zsp(28),color: Color(0xFFA2A2A2)),),
  769. padding: EdgeInsets.only(top: hsp(10)),
  770. )
  771. ],
  772. ),
  773. ),
  774. Container(
  775. padding: EdgeInsets.all(hsp(30)),
  776. margin: EdgeInsets.only(top: hsp(12)),
  777. width: MediaQuery.of(context).size.width,
  778. color: Colors.white,
  779. child: Row(
  780. crossAxisAlignment: CrossAxisAlignment.start,
  781. children: [
  782. Container(
  783. width: wsp(150),
  784. alignment: Alignment.center,
  785. child: Text('乘机人',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
  786. ),
  787. Container(
  788. width: MediaQuery.of(context).size.width-hsp(60)-wsp(150),
  789. child: ListView.separated(
  790. itemBuilder: (context,index){
  791. return Container(
  792. width: MediaQuery.of(context).size.width-hsp(60)-wsp(150),
  793. padding: EdgeInsets.only(bottom: index==1?0:hsp(20),top: index==0?0:hsp(20)),
  794. child: Column(
  795. crossAxisAlignment: CrossAxisAlignment.start,
  796. children: [
  797. Text('${widget.orderDict['personnelInfo'][index]['username']} ${widget.orderDict['personnelInfo'][index]['phone']}',style: TextStyle(fontSize: zsp(32),color: Color(0xFF343434),fontWeight: FontWeight.bold),),
  798. Text('身份证 ${widget.orderDict['personnelInfo'][index]['cardid']}',style: TextStyle(fontSize: zsp(25),color: Color(0xFF666666),))
  799. ],
  800. ),
  801. );
  802. },
  803. separatorBuilder: (context,index){
  804. return Divider(color: Color(0xFFE5E5E5),height: 0.5,thickness: 0.5,);
  805. },
  806. itemCount: widget.orderDict['personnelInfo']!=null?widget.orderDict['personnelInfo'].length:0,
  807. padding: EdgeInsets.all(0),
  808. shrinkWrap: true,
  809. ),
  810. ),
  811. ],
  812. ),
  813. ),
  814. ],
  815. ),
  816. Container(
  817. padding: EdgeInsets.all(hsp(30)),
  818. margin: EdgeInsets.only(top: hsp(12)),
  819. width: MediaQuery.of(context).size.width,
  820. color: Colors.white,
  821. child: RichText(
  822. text: TextSpan(
  823. text: '应付总额:',
  824. style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),
  825. children: [
  826. TextSpan(
  827. text: '¥${widget.orderDict['price']}',
  828. style: TextStyle(color: Color(0xFF007EFF),fontWeight: FontWeight.bold),
  829. )
  830. ]
  831. ),
  832. ),
  833. ),
  834. Container(
  835. padding: EdgeInsets.all(hsp(30)),
  836. margin: EdgeInsets.only(top: hsp(12)),
  837. width: MediaQuery.of(context).size.width,
  838. color: Colors.white,
  839. child: Text('订单编号:${widget.orderDict['orderSn']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF9A9A9A)),),
  840. ),
  841. Container(
  842. padding: EdgeInsets.all(hsp(30)),
  843. margin: EdgeInsets.only(top: hsp(12)),
  844. width: MediaQuery.of(context).size.width,
  845. color: Colors.white,
  846. child: Text('支付方式',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
  847. ),
  848. ListView.separated(
  849. itemBuilder: (context,index){
  850. return GestureDetector(
  851. onTap: (){
  852. setState(() {
  853. _selected = index;
  854. });
  855. },
  856. behavior: HitTestBehavior.opaque,
  857. child: Container(
  858. height: hsp(92),
  859. color: Colors.white,
  860. padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  861. child: Row(
  862. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  863. children: [
  864. Row(
  865. children: [
  866. Container(
  867. height: hsp(50),
  868. width: hsp(50),
  869. margin: EdgeInsets.only(right: hsp(25)),
  870. child: Image.asset(index==0?'lib/images/wexinLogo.png':index==1?'lib/images/aliLogo.png':'lib/images/wexinLogo.png'),
  871. ),
  872. Text(index==0?'余额':index==1?'微信支付':'支付宝',style: TextStyle(fontSize: zsp(30),color: Color(0xFF343434),)),
  873. ],
  874. ),
  875. Icon(Icons.check,color:index==_selected?Color(0xFF007EFF):Colors.transparent,size: hsp(40),),
  876. ],
  877. ),
  878. ),
  879. );
  880. },
  881. separatorBuilder: (context,index){
  882. return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF1F2F3),);
  883. },
  884. itemCount: 3,
  885. padding: EdgeInsets.all(0),
  886. physics: NeverScrollableScrollPhysics(),
  887. shrinkWrap: true,
  888. )
  889. ],
  890. ),
  891. ),
  892. ),
  893. Container(
  894. height: hsp(120),
  895. width: MediaQuery.of(context).size.width,
  896. color: Colors.white,
  897. padding: EdgeInsets.only(left: wsp(60),right: wsp(60)),
  898. child: Row(
  899. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  900. children: [
  901. GestureDetector(
  902. onTap: (){
  903. showDialog(
  904. context: context,
  905. builder: (context) {
  906. return AlertDialog(
  907. actionsPadding: EdgeInsets.all(0),
  908. title: Text('提示',style: TextStyle(fontWeight: FontWeight.bold,fontSize: zsp(36)),),
  909. content: Text('确认取消订单吗?',style: TextStyle(fontWeight: FontWeight.bold,fontSize: zsp(30))),
  910. actions: <Widget>[
  911. FlatButton(child: Text('取消',style: TextStyle(fontWeight: FontWeight.bold,fontSize: zsp(30))),onPressed: (){
  912. Navigator.pop(context);
  913. },),
  914. FlatButton(child: Text('确认',style: TextStyle(fontWeight: FontWeight.bold,fontSize: zsp(30))),onPressed: (){
  915. Navigator.pop(context);
  916. _postCancelOrderData();
  917. },),
  918. ],
  919. );
  920. }
  921. );
  922. },
  923. child: Container(
  924. height: hsp(88),
  925. width: wsp(300),
  926. decoration: BoxDecoration(
  927. borderRadius: BorderRadius.all(Radius.circular(50)),
  928. border: Border.all(color: Color(0xFFD9D9D9),width: 1)
  929. ),
  930. alignment: Alignment.center,
  931. child: Text('取消订单',style: TextStyle(fontSize: zsp(34),color: Color(0xFF343434)),),
  932. ),
  933. ),
  934. GestureDetector(
  935. onTap: (){
  936. showDialog(context: context,builder: (context){
  937. return AlertDialog(
  938. contentPadding: EdgeInsets.all(0),
  939. actionsPadding: EdgeInsets.all(0),
  940. buttonPadding: EdgeInsets.all(0),
  941. insetPadding: EdgeInsets.all(0),
  942. titlePadding: EdgeInsets.all(0),
  943. backgroundColor: Colors.transparent,
  944. content: ysPayKeybord(context,(value){
  945. _postPayData(value);
  946. },widget.type==payType.marry||widget.type==payType.sport||widget.type==payType.sightseeing?'${widget.orderDict['orderName']}':(widget.type==payType.doctor||
  947. widget.type==payType.help)?'${widget.orderDict['citySetout']}到${widget.orderDict['cityArrive']}':widget.type==payType.business?'商旅包机':'${widget.orderDict['setoutInfo']['display']}到'
  948. '${widget.orderDict['arriveInfo']['display']}',
  949. '${widget.orderDict['price']}')
  950. );
  951. });
  952. },
  953. child: Container(
  954. height: hsp(88),
  955. width: wsp(300),
  956. decoration: BoxDecoration(
  957. borderRadius: BorderRadius.all(Radius.circular(50)),
  958. color: Color(0xFF007EFF)
  959. ),
  960. alignment: Alignment.center,
  961. child: Text('去付款',style: TextStyle(fontSize: zsp(34),color: Colors.white),),
  962. ),
  963. )
  964. ],
  965. ),
  966. )
  967. ],
  968. ),
  969. );
  970. }
  971. _getMin(String hours){
  972. double time = double.parse(hours);
  973. return '${(time*60)~/1}';
  974. }
  975. _postCancelOrderData() async{
  976. Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneorder/cancelOrder',parameter: {'orderSn':widget.orderDict['orderSn']},isLoading: false,isToken: true);
  977. if(dict!=null){
  978. Navigator.pop(context);
  979. }
  980. }
  981. _postPayData(String pass) async{
  982. var dict = await ysRequestHttpEncrypt(context,type: requestType.post,api: '/app/applets/balance/balancePay',
  983. parameter: {'orderSn':widget.orderDict['orderSn'],'price':widget.orderDict['price'],'password': pass},isLoading: true,isToken: true);
  984. if(dict!=null){
  985. if(dict==''){
  986. setState(() {
  987. _isSucceed = true;
  988. });
  989. }else if(dict['code']==804){
  990. _showAlertView(1);
  991. }else if(dict['code']==801){
  992. _showAlertView(2);
  993. }
  994. }
  995. }
  996. _showAlertView (int type) async{
  997. showCupertinoDialog(
  998. context: context,
  999. builder: (context) {
  1000. return CupertinoAlertDialog(
  1001. title: Text('提示\n'),
  1002. content: Text(type==1?'未设置支付密码':'余额不足请充值'),
  1003. actions: <Widget>[
  1004. CupertinoDialogAction(child: Text('取消'),onPressed: (){Navigator.pop(context);},),
  1005. CupertinoDialogAction(child: Text(type==1?'去设置':'去充值'),onPressed: (){
  1006. Navigator.pop(context);
  1007. Navigator.of(context).push(
  1008. CupertinoPageRoute(
  1009. builder: (context){
  1010. return type==1?YSSetPayPass():YSMoney();
  1011. }
  1012. )
  1013. );
  1014. },),
  1015. ],
  1016. );
  1017. }
  1018. );
  1019. }
  1020. _getDateStr(String date){
  1021. return date.substring(0,date.length-3);
  1022. }
  1023. }