YSCourseDetail.dart 33 KB

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