YSCourseDetail.dart 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:ysairplane2/base/YSBase.dart';
  4. import 'package:ysairplane2/tools/YSNetWorking.dart';
  5. import 'package:ysairplane2/tools/YSPayKeybord.dart';
  6. import 'package:ysairplane2/tools/YSTools.dart';
  7. import 'YSMoney.dart';
  8. import 'YSSetPayPass.dart';
  9. class YSCourseDetail extends StatefulWidget {
  10. final orderStr;
  11. const YSCourseDetail({Key key, this.orderStr}) : super(key: key);
  12. @override
  13. _YSCourseDetailState createState() => _YSCourseDetailState();
  14. }
  15. class _YSCourseDetailState extends State<YSCourseDetail> {
  16. Map _courseDict;
  17. @override
  18. void initState() {
  19. Future.delayed(Duration(seconds: 0)).then((value){
  20. _getCourseDetailData();
  21. });
  22. super.initState();
  23. }
  24. @override
  25. Widget build(BuildContext context) {
  26. return YSBase(
  27. ystitle: '订单详情',
  28. yscolor: Color(0xFFF5F5F5),
  29. yschild: _courseDict!=null?Column(
  30. children: [
  31. Container(
  32. height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44-(_courseDict['payStatus']==1?hsp(120):0),
  33. child: SingleChildScrollView(
  34. child: Column(
  35. children: [
  36. Container(
  37. padding: EdgeInsets.only(left: hsp(30),right: hsp(30),top: hsp(50),bottom: hsp(50)),
  38. color: Color(0xFF2B7BF6),
  39. child: Row(
  40. children: [
  41. Icon(Icons.access_time,color: Colors.white,size: hsp(60),),
  42. Container(
  43. padding: EdgeInsets.only(left: hsp(20)),
  44. height: hsp(100),
  45. alignment: Alignment.center,
  46. child: Column(
  47. crossAxisAlignment: CrossAxisAlignment.start,
  48. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  49. children: [
  50. Text(_courseDict['payStatus']==1?'未支付':_courseDict['consumed']==2?'已完成':'已支付',style: TextStyle(fontWeight: FontWeight.bold,fontSize: zsp(36),color: Colors.white),),
  51. Container(
  52. width: MediaQuery.of(context).size.width-hsp(200),
  53. child: SingleChildScrollView(
  54. child: Text(_courseDict['title']!=null?'${_courseDict['title']}':_courseDict['setoutCity']!=null?
  55. '${_courseDict['setoutCity']} - ${_courseDict['arriveCity']} ${_courseDict['name']}':'${_courseDict['name']}',
  56. style: TextStyle(fontSize: zsp(26),color: Colors.white),maxLines: 1,),
  57. scrollDirection: Axis.horizontal,
  58. ),
  59. )
  60. ],
  61. ),
  62. )
  63. ],
  64. ),
  65. ),
  66. _courseDict['type']==7?ListView.separated(
  67. itemBuilder: (context,index){
  68. return Container(
  69. color: Colors.white,
  70. child: Column(
  71. children: [
  72. Row(
  73. children: [
  74. Container(
  75. height: hsp(40),
  76. alignment: Alignment.center,
  77. child: Text('${index+1}',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
  78. padding: EdgeInsets.only(left: wsp(20),right: wsp(20)),
  79. margin: EdgeInsets.only(right: wsp(30)),
  80. decoration: BoxDecoration(
  81. color: Color(0xFF007EFF),
  82. borderRadius: BorderRadius.only(topRight: Radius.circular(3),bottomRight: Radius.circular(8))
  83. ),
  84. ),
  85. ],
  86. ),
  87. Container(
  88. padding: EdgeInsets.all(hsp(20)),
  89. child: Row(
  90. children: [
  91. Icon(Icons.access_time,color: Color(0xFFBABAC6),size: hsp(28),),
  92. Text(' ${_courseDict['Itinerary'][index]['timeSetout']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF24242B)),)
  93. ],
  94. ),
  95. ),
  96. Container(
  97. width: MediaQuery.of(context).size.width-hsp(40),
  98. child: ListView.builder(
  99. itemBuilder: (context,indexSub2){
  100. return Row(
  101. crossAxisAlignment: CrossAxisAlignment.start,
  102. children: [
  103. Column(
  104. children: [
  105. Container(
  106. height: hsp(28),
  107. width: hsp(28),
  108. decoration: BoxDecoration(
  109. color: Colors.white,
  110. borderRadius: BorderRadius.all(Radius.circular(50)),
  111. border: Border.all(color: indexSub2==0?Color(0xFF02C094):Color(0xFFFB9658),width: wsp(6))
  112. ),
  113. margin: EdgeInsets.only(top: hsp(7),bottom: hsp(7)),
  114. ),
  115. if(indexSub2<1)Container(
  116. height: hsp(28),
  117. child: DashedRect(
  118. color: Color(0xFFCACAD4),
  119. strokeWidth: 1,
  120. gap: 1
  121. ),
  122. )
  123. ],
  124. ),
  125. Container(
  126. child: Text(_courseDict['Itinerary'][index]['setout']!=null?' ${_courseDict['Itinerary'][index][indexSub2==0?'setout':'arrive']}':
  127. ' ${_courseDict['Itinerary'][index][indexSub2==0?'setOutInfo':'arriveInfo']['airplaneName']}',
  128. style: TextStyle(color: Color(0xFF68686F),fontSize: zsp(28))),
  129. width: MediaQuery.of(context).size.width-hsp(120),
  130. ),
  131. ],
  132. );
  133. },
  134. itemCount: 2,
  135. shrinkWrap: true,
  136. physics: NeverScrollableScrollPhysics(),
  137. padding: EdgeInsets.only(bottom: hsp(10)),
  138. ),
  139. )
  140. ],
  141. ),
  142. );
  143. },
  144. separatorBuilder: (context,index){
  145. return Divider(height: hsp(10),thickness: hsp(10),color: Color(0xFFF5F5F5),);
  146. },
  147. itemCount: _courseDict['Itinerary'].length,
  148. padding: EdgeInsets.only(bottom: hsp(10),top: hsp(10)),
  149. shrinkWrap: true,
  150. physics: NeverScrollableScrollPhysics(),
  151. ):_courseDict['type']==1||_courseDict['type']==3||_courseDict['type']==6||_courseDict['type']==8?ListView.separated(
  152. itemBuilder: (context,index){
  153. return Container(
  154. color: Colors.white,
  155. child: Column(
  156. children: [
  157. Container(
  158. padding: EdgeInsets.all(hsp(20)),
  159. child: Row(
  160. children: [
  161. Icon(Icons.access_time,color: Color(0xFFBABAC6),size: hsp(28),),
  162. Text(' ${_courseDict['time']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF24242B)),)
  163. ],
  164. ),
  165. ),
  166. Container(
  167. width: MediaQuery.of(context).size.width-hsp(40),
  168. child: ListView.builder(
  169. itemBuilder: (context,indexSub2){
  170. return Row(
  171. crossAxisAlignment: CrossAxisAlignment.start,
  172. children: [
  173. Column(
  174. children: [
  175. Container(
  176. height: hsp(28),
  177. width: hsp(28),
  178. decoration: BoxDecoration(
  179. color: Colors.white,
  180. borderRadius: BorderRadius.all(Radius.circular(50)),
  181. border: Border.all(color: indexSub2==0?Color(0xFF02C094):Color(0xFFFB9658),width: wsp(6))
  182. ),
  183. margin: EdgeInsets.only(top: hsp(7),bottom: hsp(7)),
  184. ),
  185. if(indexSub2<1)Container(
  186. height: hsp(28),
  187. child: DashedRect(
  188. color: Color(0xFFCACAD4),
  189. strokeWidth: 1,
  190. gap: 1
  191. ),
  192. )
  193. ],
  194. ),
  195. Container(
  196. child: Text(' ${indexSub2==0?_courseDict['setout']:_courseDict['arrive']} ',style: TextStyle(color: Color(0xFF68686F),fontSize: zsp(28))),
  197. width: MediaQuery.of(context).size.width-hsp(120),
  198. ),
  199. ],
  200. );
  201. },
  202. itemCount: 2,
  203. shrinkWrap: true,
  204. physics: NeverScrollableScrollPhysics(),
  205. padding: EdgeInsets.only(bottom: hsp(10)),
  206. ),
  207. )
  208. ],
  209. ),
  210. );
  211. },
  212. separatorBuilder: (context,index){
  213. return Divider(height: hsp(10),thickness: hsp(10),color: Color(0xFFF5F5F5),);
  214. },
  215. itemCount: 1,
  216. padding: EdgeInsets.only(bottom: hsp(10),top: hsp(10)),
  217. shrinkWrap: true,
  218. physics: NeverScrollableScrollPhysics(),
  219. ):_courseDict['type']==5||_courseDict['type']==9?Container(
  220. height: hsp(85),
  221. color: Colors.white,
  222. padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  223. margin: EdgeInsets.only(top: hsp(10),bottom: hsp(10)),
  224. child: Row(
  225. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  226. children: [
  227. Text(_courseDict['type']==5?'出行时间':'游览时间',style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),),
  228. Text('${_courseDict['time']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),)
  229. ],
  230. ),
  231. ):_courseDict['type']==4?ListView.separated(
  232. itemBuilder: (context,index){
  233. return Container(
  234. height: hsp(85),
  235. color: Colors.white,
  236. padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  237. child: Row(
  238. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  239. children: [
  240. Text(index==0?'婚礼地点':index==1?'婚礼时间':index==2?'婚礼人数':index==3?'飞行时长':'祝福贺语',
  241. style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),),
  242. Text(index==0?'${_courseDict['setout']}':index==1?'${_courseDict['time']}':index==2?'${_courseDict['personNum']}人'
  243. :index==3?'${_courseDict['hour']}':'${_courseDict['des']}',
  244. style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),)
  245. ],
  246. ),
  247. );
  248. },
  249. separatorBuilder: (context,index){
  250. return Divider(color: Color(0xFFF5F5F5),height: 0.5,thickness: 0.5,);
  251. },
  252. itemCount: _courseDict['des']==null?4:5,
  253. padding: EdgeInsets.only(top: hsp(10),bottom: hsp(10)),
  254. shrinkWrap: true,
  255. ):ListView.separated(
  256. itemBuilder: (context,index){
  257. return Container(
  258. height: hsp(85),
  259. color: Colors.white,
  260. padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  261. child: Row(
  262. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  263. children: [
  264. Text(index==0?'救援地点':index==1?'救援时间':index==2?'救援类型':index==3?'涉险人数':'联系电话',style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),),
  265. Text(index==0?'${_courseDict['setoutCity']}':index==1?'${_courseDict['time']}':index==2?'${_courseDict['rescueType']}':index==3?'${_courseDict['personNum']}人':'${getSecretStr('${_courseDict['phone']}')}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),)
  266. ],
  267. ),
  268. );
  269. },
  270. separatorBuilder: (context,index){
  271. return Divider(color: Color(0xFFF5F5F5),height: 0.5,thickness: 0.5,);
  272. },
  273. itemCount: 5,
  274. padding: EdgeInsets.only(top: hsp(10),bottom: hsp(10)),
  275. shrinkWrap: true,
  276. ),
  277. if(_courseDict['personInfos']!=null)Container(
  278. padding: EdgeInsets.only(top: hsp(30),bottom: hsp(30)),
  279. width: MediaQuery.of(context).size.width,
  280. color: Colors.white,
  281. child: Row(
  282. crossAxisAlignment: CrossAxisAlignment.start,
  283. children: [
  284. Container(
  285. width: wsp(150),
  286. alignment: Alignment.center,
  287. child: Text('乘机人',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
  288. ),
  289. Container(
  290. width: MediaQuery.of(context).size.width-hsp(60)-wsp(150),
  291. child: ListView.separated(
  292. itemBuilder: (context,index){
  293. return Container(
  294. width: MediaQuery.of(context).size.width-hsp(60)-wsp(150),
  295. padding: EdgeInsets.only(bottom: index==_courseDict['personInfos'].length-1?0:hsp(20),top: index==0?0:hsp(20)),
  296. child: Column(
  297. crossAxisAlignment: CrossAxisAlignment.start,
  298. children: [
  299. RichText(
  300. text: TextSpan(
  301. text: '${_courseDict['personInfos'][index]['username']}',
  302. style: TextStyle(fontSize: zsp(32),color: Color(0xFF343434),fontWeight: FontWeight.bold),
  303. children: [
  304. TextSpan(
  305. text: ' ${getSecretStr('${_courseDict['personInfos'][index]['phone']}')}',
  306. style: TextStyle(fontSize: zsp(25),color: Color(0xFF666666),fontWeight: FontWeight.normal)
  307. )
  308. ]
  309. ),
  310. ),
  311. Text('身份证 ${getSecretStr('${_courseDict['personInfos'][index]['cardid']}')}',style: TextStyle(fontSize: zsp(25),color: Color(0xFF666666),))
  312. ],
  313. ),
  314. );
  315. },
  316. separatorBuilder: (context,index){
  317. return Divider(color: Color(0xFFE5E5E5),height: 0.5,thickness: 0.5,);
  318. },
  319. itemCount: _courseDict['personInfos'].length,
  320. padding: EdgeInsets.all(0),
  321. shrinkWrap: true,
  322. physics: NeverScrollableScrollPhysics(),
  323. ),
  324. ),
  325. ],
  326. ),
  327. ),
  328. if(_courseDict['type']==3)ListView.separated(
  329. itemBuilder: (context,index){
  330. return Container(
  331. height: hsp(85),
  332. padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  333. color: Colors.white,
  334. alignment: Alignment.centerLeft,
  335. child: Row(
  336. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  337. children: [
  338. Text(index==0?'货物名称':index==1?'性质':index==2?'体积':'支付时间',style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),),
  339. Text(index==0?'${_courseDict['goods']['goodsName']}':index==1?'${_courseDict['goods']['goodsNatureName']}':index==2?
  340. '${_courseDict['goods']['goodsVolume']}立方米':'${_courseDict['goods']['goodsWeight']}吨',
  341. style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),)
  342. ],
  343. ),
  344. );
  345. },
  346. separatorBuilder: (context,index){
  347. return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF5F5F5),);
  348. },
  349. itemCount: 4,
  350. shrinkWrap: true,
  351. padding: EdgeInsets.only(top: hsp(10)),
  352. physics: NeverScrollableScrollPhysics(),
  353. ),
  354. if(_courseDict['personNum']!=null)if(_courseDict['type']!=2||_courseDict['type']!=3)Container(
  355. height: hsp(85),
  356. color: Colors.white,
  357. padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  358. margin: EdgeInsets.only(bottom: 0.5,top: hsp(10)),
  359. child: Row(
  360. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  361. children: [
  362. Text('出行人数',style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),),
  363. Text('${_courseDict['personNum']}个人',style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),)
  364. ],
  365. ),
  366. ),
  367. if(_courseDict['airplane']!=null)Container(
  368. height: hsp(85),
  369. color: Colors.white,
  370. padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  371. child: Row(
  372. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  373. children: [
  374. Text('飞机型号',style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),),
  375. Text('${_courseDict['airplane']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),)
  376. ],
  377. ),
  378. ),
  379. if(_courseDict['type']!=2)Container(
  380. height: hsp(85),
  381. color: Colors.white,
  382. padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  383. margin: EdgeInsets.only(top: hsp(10)),
  384. child: Row(
  385. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  386. children: [
  387. Text(_courseDict['payStatus']==1?'待支付':'已支付',style: TextStyle(fontSize: zsp(28),color: Colors.black),),
  388. Text('¥${_courseDict['payPrice']!=null?_courseDict['payPrice']:_courseDict['price']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFFEC364E)),)
  389. ],
  390. ),
  391. ),
  392. ListView.separated(
  393. padding: EdgeInsets.only(top: hsp(10)),
  394. itemBuilder: (context,index){
  395. return Container(
  396. height: hsp(85),
  397. padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  398. color: Colors.white,
  399. alignment: Alignment.centerLeft,
  400. child: index==0?Text('详细信息',style: TextStyle(fontSize: zsp(28),color: Colors.black),):Row(
  401. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  402. children: [
  403. Text(index==1?'订单编号':index==2?'订单时间':index==3?'支付方式':'支付时间',style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),),
  404. Text(index==1?'${_courseDict['orderSn']}':index==2?'${_courseDict['orderCreateTime']}':index==3?'${_courseDict['orderWay']==1?'余额':_courseDict['orderWay']==2?'微信':'支付宝'}':
  405. '${_courseDict['payTime']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),)
  406. ],
  407. ),
  408. );
  409. },
  410. separatorBuilder: (context,index){
  411. return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF5F5F5),);
  412. },
  413. itemCount: _courseDict['payStatus']==2?5:3,
  414. shrinkWrap: true,
  415. physics: NeverScrollableScrollPhysics(),
  416. ),
  417. if(_courseDict['refundStatus']==1)Container(
  418. width: MediaQuery.of(context).size.width,
  419. color: Colors.white,
  420. child: Column(
  421. children: [
  422. ListView.separated(
  423. physics: NeverScrollableScrollPhysics(),
  424. shrinkWrap: true,
  425. itemCount: 3,
  426. itemBuilder: (context,index){
  427. return Container(
  428. height: hsp(85),
  429. padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  430. child: Row(
  431. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  432. children: [
  433. Text(index==0?'退款时间':index==1?'退款金额':'违约金',style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),),
  434. Text('${index==0?'${_courseDict['refundTime']}':index==1?'¥${_courseDict['refundPrice']}':'¥${_courseDict['finePrice']}'}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),),
  435. ],
  436. ),
  437. );
  438. },
  439. separatorBuilder: (context,index){
  440. return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF5F5F5),);
  441. },
  442. )
  443. ],
  444. ),
  445. ),
  446. if(_courseDict['services']!=null)Container(
  447. margin: EdgeInsets.only(top: hsp(10)),
  448. width: MediaQuery.of(context).size.width,
  449. color: Colors.white,
  450. child: Column(
  451. children: [
  452. Container(
  453. height: hsp(85),
  454. padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  455. alignment: Alignment.centerLeft,
  456. child: Text('选择套餐',style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),),
  457. ),
  458. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF5F5F5),),
  459. ListView.separated(
  460. physics: NeverScrollableScrollPhysics(),
  461. shrinkWrap: true,
  462. itemCount: _courseDict['services'].length,
  463. itemBuilder: (context,index){
  464. return Container(
  465. height: hsp(85),
  466. padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  467. child: Row(
  468. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  469. children: [
  470. Text('${_courseDict['services'][index]['name']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),),
  471. Text('¥${_courseDict['services'][index]['price']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF727272)),),
  472. ],
  473. ),
  474. );
  475. },
  476. separatorBuilder: (context,index){
  477. return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF5F5F5),);
  478. },
  479. )
  480. ],
  481. ),
  482. ),
  483. if(_courseDict['codeUrl']!=null)Container(
  484. margin: EdgeInsets.only(top: hsp(10),bottom: hsp(50)),
  485. width: MediaQuery.of(context).size.width,
  486. padding: EdgeInsets.only(top: hsp(50),bottom: hsp(50)),
  487. color: Colors.white,
  488. alignment: Alignment.center,
  489. child: Image(
  490. height: hsp(400),
  491. width: hsp(400),
  492. image: NetworkImage('${_courseDict['codeUrl']}'),
  493. ),
  494. )
  495. ],
  496. ),
  497. ),
  498. ),
  499. if(_courseDict['payStatus']==1)Container(
  500. height: hsp(120),
  501. width: MediaQuery.of(context).size.width,
  502. color: Colors.white,
  503. padding: EdgeInsets.only(left: wsp(60),right: wsp(60)),
  504. child: Row(
  505. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  506. children: [
  507. GestureDetector(
  508. onTap: (){
  509. showDialog(
  510. context: context,
  511. builder: (context) {
  512. return AlertDialog(
  513. actionsPadding: EdgeInsets.all(0),
  514. title: Text('提示',style: TextStyle(fontWeight: FontWeight.bold,fontSize: zsp(36)),),
  515. content: Text('确认取消订单吗?',style: TextStyle(fontWeight: FontWeight.bold,fontSize: zsp(30))),
  516. actions: <Widget>[
  517. FlatButton(child: Text('取消',style: TextStyle(fontWeight: FontWeight.bold,fontSize: zsp(30))),onPressed: (){
  518. Navigator.pop(context);
  519. },),
  520. FlatButton(child: Text('确认',style: TextStyle(fontWeight: FontWeight.bold,fontSize: zsp(30))),onPressed: (){
  521. Navigator.pop(context);
  522. _postCancelOrderData();
  523. },),
  524. ],
  525. );
  526. }
  527. );
  528. },
  529. child: Container(
  530. height: hsp(88),
  531. width: wsp(300),
  532. decoration: BoxDecoration(
  533. borderRadius: BorderRadius.all(Radius.circular(50)),
  534. border: Border.all(color: Color(0xFFD9D9D9),width: 1)
  535. ),
  536. alignment: Alignment.center,
  537. child: Text('取消订单',style: TextStyle(fontSize: zsp(34),color: Color(0xFF343434)),),
  538. ),
  539. ),
  540. GestureDetector(
  541. onTap: (){
  542. _showPayTypeAlert();
  543. },
  544. child: Container(
  545. height: hsp(88),
  546. width: wsp(300),
  547. decoration: BoxDecoration(
  548. borderRadius: BorderRadius.all(Radius.circular(50)),
  549. color: Color(0xFF007EFF)
  550. ),
  551. alignment: Alignment.center,
  552. child: Text('去付款',style: TextStyle(fontSize: zsp(34),color: Colors.white),),
  553. ),
  554. )
  555. ],
  556. ),
  557. )
  558. ],
  559. ):Container(),
  560. );
  561. }
  562. _getCourseDetailData() async{
  563. Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneorder/orderDetails',parameter: {'orderSn':widget.orderStr},isLoading: true,isToken: true);
  564. if(dict!=null){
  565. setState(() {
  566. _courseDict = dict['data'];
  567. });
  568. }
  569. }
  570. _postCancelOrderData() async{
  571. Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneorder/cancelOrder',parameter: {'orderSn':widget.orderStr},isLoading: false,isToken: true);
  572. if(dict!=null){
  573. Navigator.pop(context);
  574. }
  575. }
  576. _postPayData(String pass) async{
  577. var dict = await ysRequestHttpEncrypt(context,type: requestType.post,api: '/app/applets/balance/balancePay',
  578. parameter: {'orderSn':widget.orderStr,'price':_courseDict['payPrice']!=null?_courseDict['payPrice']:_courseDict['price'],'password': pass},isLoading: true,isToken: true);
  579. if(dict!=null){
  580. if(dict==''){
  581. _getCourseDetailData();
  582. }else if(dict['code']==804){
  583. _showAlertView(1);
  584. }else if(dict['code']==801){
  585. _showAlertView(2);
  586. }
  587. }
  588. }
  589. _showAlertView (int type) async{
  590. showCupertinoDialog(
  591. context: context,
  592. builder: (context) {
  593. return CupertinoAlertDialog(
  594. title: Text('提示\n'),
  595. content: Text(type==1?'未设置支付密码':'余额不足请充值'),
  596. actions: <Widget>[
  597. CupertinoDialogAction(child: Text('取消'),onPressed: (){Navigator.pop(context);},),
  598. CupertinoDialogAction(child: Text(type==1?'去设置':'去充值'),onPressed: (){
  599. Navigator.pop(context);
  600. Navigator.of(context,rootNavigator: true).push(
  601. CupertinoPageRoute(
  602. builder: (context){
  603. return type==1?YSSetPayPass():YSMoney();
  604. }
  605. )
  606. );
  607. },),
  608. ],
  609. );
  610. }
  611. );
  612. }
  613. _showPayTypeAlert(){
  614. int _selected = 0;
  615. showModalBottomSheet(
  616. context: context,
  617. backgroundColor: Colors.transparent,
  618. isScrollControlled: true,
  619. builder: (context){
  620. return StatefulBuilder(
  621. builder: (BuildContext context, StateSetter setState){
  622. return Container(
  623. height: MediaQuery.of(context).size.height*0.4,
  624. decoration: BoxDecoration(
  625. color: Colors.white,
  626. borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10))
  627. ),
  628. child: Column(
  629. children: [
  630. Column(
  631. children: [
  632. Container(
  633. height: hsp(100),
  634. padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  635. child: Row(
  636. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  637. children: [
  638. Container(width: hsp(50),),
  639. Text('支付方式',style: TextStyle(fontSize: zsp(32),fontWeight: FontWeight.bold,color: Colors.black),),
  640. Icon(Icons.close,size: hsp(50),color: Colors.black,)
  641. ],
  642. ),
  643. ),
  644. Divider(height: 1,thickness: 1,color: Color(0xFFF5F5F5),),
  645. ListView.separated(
  646. itemBuilder: (context,index){
  647. return GestureDetector(
  648. onTap: (){
  649. setState(() {
  650. _selected = index;
  651. });
  652. },
  653. behavior: HitTestBehavior.opaque,
  654. child: Container(
  655. height: hsp(92),
  656. color: Colors.white,
  657. padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  658. child: Row(
  659. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  660. children: [
  661. Row(
  662. children: [
  663. Container(
  664. height: hsp(50),
  665. width: hsp(50),
  666. margin: EdgeInsets.only(right: hsp(25)),
  667. child: Image.asset(index==0?'lib/images/wexinLogo.png':index==1?'lib/images/aliLogo.png':'lib/images/wexinLogo.png'),
  668. ),
  669. Text(index==0?'余额':index==1?'微信支付':'支付宝',style: TextStyle(fontSize: zsp(30),color: Color(0xFF343434),)),
  670. ],
  671. ),
  672. Icon(Icons.check_circle,color:index==_selected?Color(0xFF007EFF):Colors.transparent,size: hsp(40),),
  673. ],
  674. ),
  675. ),
  676. );
  677. },
  678. separatorBuilder: (context,index){
  679. return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF1F2F3),);
  680. },
  681. itemCount: 3,
  682. padding: EdgeInsets.all(hsp(30)),
  683. physics: NeverScrollableScrollPhysics(),
  684. shrinkWrap: true,
  685. )
  686. ],
  687. ),
  688. GestureDetector(
  689. onTap: (){
  690. Navigator.pop(context);
  691. showDialog(context: context,builder: (context){
  692. return AlertDialog(
  693. contentPadding: EdgeInsets.all(0),
  694. actionsPadding: EdgeInsets.all(0),
  695. buttonPadding: EdgeInsets.all(0),
  696. insetPadding: EdgeInsets.all(0),
  697. titlePadding: EdgeInsets.all(0),
  698. backgroundColor: Colors.transparent,
  699. content: ysPayKeybord(context,(value){
  700. _postPayData(value);
  701. },_courseDict['title']!=null?'${_courseDict['title']}':'${_courseDict['setoutCity']} - ${_courseDict['arriveCity']} ${_courseDict['name']}','${_courseDict['payPrice']!=null?_courseDict['payPrice']:_courseDict['price']}')
  702. );
  703. });
  704. },
  705. child: Container(
  706. height: hsp(100),
  707. decoration: BoxDecoration(
  708. color: Color(0xFF007EFF),
  709. borderRadius: BorderRadius.all(Radius.circular(5))
  710. ),
  711. width: MediaQuery.of(context).size.width-hsp(60),
  712. margin: EdgeInsets.only(top: hsp(50)),
  713. alignment: Alignment.center,
  714. child: Text('确认支付',style: TextStyle(color: Colors.white,fontSize: zsp(34),fontWeight: FontWeight.bold),),
  715. ),
  716. ),
  717. ],
  718. ),
  719. );
  720. },
  721. );
  722. }
  723. );
  724. }
  725. }