YSShortDetail.dart 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:ysairplane/tools/YSNetWorking.dart';
  4. import 'package:ysairplane/tools/YSTools.dart';
  5. import 'YSContact.dart';
  6. import 'YSPay.dart';
  7. class YSShortDetail extends StatefulWidget {
  8. final shortId;
  9. const YSShortDetail({Key key, this.shortId}) : super(key: key);
  10. @override
  11. _YSShortDetailState createState() => _YSShortDetailState();
  12. }
  13. class _YSShortDetailState extends State<YSShortDetail> {
  14. bool _isDetail = false;
  15. bool _isOrder = false;
  16. Map _msgDict;
  17. List _chooses = [];
  18. List _packages = [];
  19. String _timeStr;
  20. int _selected = 0;
  21. List _priceList = [];
  22. List _packList = [];
  23. int _index = 9999;
  24. int _number = 1;
  25. bool _isShow = false;
  26. @override
  27. void initState() {
  28. Future.delayed(Duration(seconds: 0)).then((value){
  29. _timeStr = DateTime.now().year.toString()+'-'+DateTime.now().month.toString().padLeft(2,'0')+'-'
  30. +DateTime.now().day.toString().padLeft(2,'0')+' '+DateTime.now().hour.toString().padLeft(2,'0')+':'+DateTime.now().minute.toString().padLeft(2,'0');
  31. _getShortDetailData();
  32. _getPackageData();
  33. });
  34. super.initState();
  35. }
  36. @override
  37. Widget build(BuildContext context) {
  38. return Scaffold(
  39. backgroundColor: Color(0xFFF1F2F4),
  40. body: Stack(
  41. children: [
  42. SingleChildScrollView(
  43. child: Container(
  44. height: MediaQuery.of(context).size.height-hsp(110),
  45. child: SingleChildScrollView(
  46. child: Stack(
  47. children: [
  48. Container(
  49. height: MediaQuery.of(context).padding.top+hsp(380),
  50. width: MediaQuery.of(context).size.width,
  51. child: Image(
  52. image: _msgDict==null?AssetImage('lib/images/home3.png'):NetworkImage('${_msgDict['cover']}'),
  53. fit: BoxFit.fill,
  54. ),
  55. ),
  56. GestureDetector(
  57. onTap: (){Navigator.pop(context);},
  58. child: Container(
  59. margin: EdgeInsets.only(left: wsp(32),top: MediaQuery.of(context).padding.top+hsp(30)),
  60. child: Icon(Icons.arrow_back_ios,size: hsp(40),color: Colors.white,),
  61. ),
  62. ),
  63. if(_msgDict!=null)Container(
  64. margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+hsp(300)),
  65. child: Column(
  66. children: [
  67. Container(
  68. width: MediaQuery.of(context).size.width-wsp(60),
  69. margin: EdgeInsets.only(bottom: hsp(20)),
  70. padding: EdgeInsets.all(hsp(30)),
  71. decoration: BoxDecoration(
  72. borderRadius: BorderRadius.all(Radius.circular(10)),
  73. color: Colors.white,
  74. ),
  75. child: Column(
  76. crossAxisAlignment: CrossAxisAlignment.start,
  77. children: [
  78. Container(
  79. margin: EdgeInsets.only(bottom: hsp(30)),
  80. child: Row(
  81. children: [
  82. RichText(
  83. text: TextSpan(
  84. text: '${_msgDict['dtFlightInformation']['partnerName']}',
  85. style: TextStyle(fontSize: zsp(28),color: Color(0xFF444444)),
  86. children: [
  87. TextSpan(
  88. text: ' >',
  89. style: TextStyle(color: Color(0xFF2C7CF6))
  90. )
  91. ]
  92. ),
  93. ),
  94. Container(
  95. margin: EdgeInsets.only(left: wsp(40)),
  96. child: RichText(
  97. text: TextSpan(
  98. text: '${_msgDict['dtFlightInformation']['model']}',
  99. style: TextStyle(fontSize: zsp(28),color: Color(0xFF444444)),
  100. children: [
  101. TextSpan(
  102. text: ' >',
  103. style: TextStyle(color: Color(0xFF2C7CF6))
  104. )
  105. ]
  106. ),
  107. ),
  108. )
  109. ],
  110. ),
  111. ),
  112. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
  113. Container(
  114. padding: EdgeInsets.only(top: hsp(30),bottom: hsp(30)),
  115. child: Column(
  116. children: [
  117. Row(
  118. children: [
  119. Text('${_msgDict['setoutInfo']['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
  120. Image(height: hsp(60),width: hsp(60),image: AssetImage('lib/images/plane.png'),),
  121. Text('${_msgDict['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
  122. ],
  123. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  124. ),
  125. Row(
  126. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  127. children: [
  128. Text('${_msgDict['setoutInfo']['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  129. Text('${_msgDict['dtFlightInformation']['hour']}',style: TextStyle(fontSize: zsp(20),color: Color(0xFF343434)),),
  130. Text('${_msgDict['arriveInfo']['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  131. ],
  132. )
  133. ],
  134. ),
  135. ),
  136. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
  137. Container(
  138. padding: EdgeInsets.only(top: hsp(20)),
  139. child: Row(
  140. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  141. children: [
  142. Column(
  143. children: [
  144. Text('出发',style: TextStyle(fontSize: zsp(24),color: Color(0xFF666666)),),
  145. RichText(
  146. text: TextSpan(
  147. text: '${_msgDict['flightTime']}',
  148. style: TextStyle(fontSize: zsp(36),fontWeight: FontWeight.bold,color: Colors.black),
  149. // children: [
  150. // TextSpan(
  151. // text: '今天',
  152. // style: TextStyle(fontSize: zsp(24),fontWeight: FontWeight.normal),
  153. // )
  154. // ]
  155. ),
  156. )
  157. ],
  158. crossAxisAlignment: CrossAxisAlignment.start,
  159. ),
  160. Icon(Icons.keyboard_arrow_right,size: hsp(50),color: Color(0xFFC1C1C1),)
  161. ],
  162. ),
  163. )
  164. ],
  165. ),
  166. ),
  167. Container(
  168. width: MediaQuery.of(context).size.width,
  169. margin: EdgeInsets.only(bottom: hsp(30)),
  170. padding: EdgeInsets.all(hsp(30)),
  171. color: Color(0xFFF1F2F4),
  172. child: Column(
  173. children: [
  174. Container(
  175. padding: EdgeInsets.only(left: hsp(30),bottom: hsp(20),top: hsp(20),right: hsp(30)),
  176. child: Text('选择套餐',style: TextStyle(fontSize: zsp(30),color: Color(0xFF222222)),),
  177. color: Colors.white,
  178. width: MediaQuery.of(context).size.width,
  179. ),
  180. ListView.builder(
  181. itemBuilder: (context,index){
  182. return Container(
  183. padding: EdgeInsets.only(left: hsp(30),bottom: hsp(20),top: hsp(20),right: hsp(30)),
  184. width: MediaQuery.of(context).size.width,
  185. color: Colors.white,
  186. child: Column(
  187. crossAxisAlignment: CrossAxisAlignment.start,
  188. children: [
  189. Text('${_packages[index]['name']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF888888)),),
  190. Container(height: hsp(10),),
  191. Row(
  192. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  193. children: [
  194. RichText(
  195. text: TextSpan(
  196. text: '今日票价 ',
  197. style: TextStyle(fontSize: zsp(26),color: Color(0xFF999999)),
  198. children: [
  199. TextSpan(
  200. text: '¥${_packages[index]['discountPrice']}',
  201. style: TextStyle(fontSize: zsp(32),color: Color(0xFFEB423B),fontWeight: FontWeight.bold)
  202. )
  203. ]
  204. ),
  205. ),
  206. GestureDetector(
  207. onTap: (){
  208. setState(() {
  209. _isOrder = true;
  210. });
  211. },
  212. child: GestureDetector(
  213. child: Container(
  214. height: hsp(50),
  215. width: hsp(100),
  216. decoration: BoxDecoration(
  217. color: Color(0xFFEA4D45),
  218. borderRadius: BorderRadius.all(Radius.circular(3))
  219. ),
  220. alignment: Alignment.center,
  221. child: Text('预订',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
  222. ),
  223. onTap: (){
  224. _index = index;
  225. _getPriceData();
  226. },
  227. ),
  228. )
  229. ],
  230. )
  231. ],
  232. ),
  233. );
  234. },
  235. itemCount: _packages.length,
  236. padding: EdgeInsets.all(0),
  237. physics: NeverScrollableScrollPhysics(),
  238. shrinkWrap: true,
  239. ),
  240. Container(
  241. margin: EdgeInsets.only(top: hsp(10)),
  242. width: MediaQuery.of(context).size.width,
  243. color: Colors.white,
  244. padding: EdgeInsets.only(left: hsp(30),top: hsp(20),right: hsp(30)),
  245. child: Text('详情',style: TextStyle(fontSize: zsp(30),color: Color(0xFF343434),fontWeight: FontWeight.bold),),
  246. ),
  247. Container(
  248. padding: EdgeInsets.all(hsp(30)),
  249. width: MediaQuery.of(context).size.width,
  250. color: Colors.white,
  251. child: Text('${_msgDict['dtPartner']['content']}',style: TextStyle(fontSize: zsp(30),color: Color(0xFF343434)),),
  252. ),
  253. Container(
  254. width: MediaQuery.of(context).size.width,
  255. color: Colors.white,
  256. padding: EdgeInsets.only(left: hsp(30),bottom: hsp(20),top: hsp(20),right: hsp(30)),
  257. child: Text('相关推荐',style: TextStyle(fontSize: zsp(30),color: Color(0xFF343434),fontWeight: FontWeight.bold),),
  258. ),
  259. Container(
  260. padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  261. width: MediaQuery.of(context).size.width,
  262. color: Color(0xFFF1F2F4),
  263. child: GridView.builder(
  264. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  265. crossAxisCount: 2,
  266. mainAxisSpacing: hsp(20),
  267. crossAxisSpacing: hsp(20),
  268. childAspectRatio: 345/381
  269. ),
  270. itemBuilder: (context, index) {
  271. return Column(
  272. children: [
  273. Container(
  274. width: (MediaQuery.of(context).size.width-hsp(80))/2,
  275. height: (MediaQuery.of(context).size.width-hsp(80))/2/(345/381)*0.6,
  276. decoration: BoxDecoration(
  277. color: Colors.lightGreen,
  278. borderRadius: BorderRadius.only(topLeft: Radius.circular(8),topRight: Radius.circular(8)),
  279. image: DecorationImage(
  280. image: NetworkImage('${_msgDict['recommendAirTourList'][index]['cover']}'),
  281. fit: BoxFit.fill
  282. )
  283. ),
  284. ),
  285. Container(
  286. width: (MediaQuery.of(context).size.width-hsp(80))/2,
  287. decoration: BoxDecoration(
  288. color: Colors.white,
  289. borderRadius: BorderRadius.only(bottomLeft: Radius.circular(8),bottomRight: Radius.circular(8)),
  290. ),
  291. padding: EdgeInsets.all(hsp(20)),
  292. child: Column(
  293. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  294. children: [
  295. Text(' ${_msgDict['recommendAirTourList'][index]['title']}',style: TextStyle(fontSize: zsp(26),color: Color(0xFF333333)),),
  296. RichText(
  297. text: TextSpan(
  298. text: '¥',
  299. style: TextStyle(fontSize: zsp(24),color: Color(0xFFEA413A)),
  300. children: [
  301. TextSpan(
  302. text: '${_msgDict['recommendAirTourList'][index]['discountPrice']}',
  303. style: TextStyle(fontSize: zsp(38),fontWeight: FontWeight.bold)
  304. ),
  305. TextSpan(
  306. text: '元起'
  307. )
  308. ]
  309. ),
  310. ),
  311. ],
  312. crossAxisAlignment: CrossAxisAlignment.start,
  313. ),
  314. )
  315. ],
  316. );
  317. },
  318. itemCount: (_msgDict['recommendAirTourList']).length,
  319. shrinkWrap: true,
  320. padding: EdgeInsets.only(top: hsp(20),bottom: hsp(20)),
  321. physics: NeverScrollableScrollPhysics(),
  322. )
  323. )
  324. ],
  325. ),
  326. ),
  327. ],
  328. ),
  329. ),
  330. ],
  331. ),
  332. ),
  333. ),
  334. ),
  335. Container(
  336. margin: EdgeInsets.only(top: MediaQuery.of(context).size.height-hsp(110)),
  337. height: hsp(110),
  338. color: Colors.white,
  339. padding: EdgeInsets.only(left: wsp(40),right: wsp(40)),
  340. alignment: Alignment.center,
  341. child: Row(
  342. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  343. children: [
  344. Column(
  345. mainAxisSize: MainAxisSize.min,
  346. children: [
  347. Icon(Icons.headset,color: Color(0xFF666666),size: zsp(40),),
  348. Text('咨询',style: TextStyle(fontSize: zsp(22),color: Color(0xFF767676)),)
  349. ],
  350. ),
  351. Column(
  352. mainAxisSize: MainAxisSize.min,
  353. children: [
  354. Icon(Icons.star_border,color: Color(0xFF666666),size: zsp(40),),
  355. Text('加入收藏',style: TextStyle(fontSize: zsp(22),color: Color(0xFF767676)),)
  356. ],
  357. ),
  358. GestureDetector(
  359. onTap: (){
  360. _index = 9999;
  361. _postOrderData();
  362. },
  363. child: Container(
  364. height: hsp(80),
  365. width: MediaQuery.of(context).size.width*0.6,
  366. decoration: BoxDecoration(
  367. color: Color(0xFF007EFF),
  368. borderRadius: BorderRadius.all(Radius.circular(50))
  369. ),
  370. alignment: Alignment.center,
  371. child: Text('立即预订',style: TextStyle(fontSize: zsp(36),color: Colors.white,fontWeight: FontWeight.bold),),
  372. ),
  373. )
  374. ],
  375. ),
  376. ),
  377. if(_isOrder==true)GestureDetector(
  378. onTap: (){
  379. setState(() {
  380. _isOrder = false;
  381. });
  382. },
  383. child: Container(
  384. height: MediaQuery.of(context).size.height,
  385. width: MediaQuery.of(context).size.width,
  386. color: Colors.black54,
  387. child: GestureDetector(
  388. onTap: (){},
  389. child: Column(
  390. children: [
  391. Container(
  392. height: MediaQuery.of(context).size.height*0.8-hsp(120),
  393. width: MediaQuery.of(context).size.width,
  394. margin: EdgeInsets.only(top: MediaQuery.of(context).size.height*0.2),
  395. decoration: BoxDecoration(
  396. color: Color(0xFFF1F2F3),
  397. borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10))
  398. ),
  399. child: Column(
  400. crossAxisAlignment: CrossAxisAlignment.start,
  401. children: [
  402. Container(
  403. height: hsp(100),
  404. decoration: BoxDecoration(
  405. color: Colors.white,
  406. borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10))
  407. ),
  408. padding: EdgeInsets.only(left: 15,right: 15),
  409. child: Row(
  410. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  411. children: [
  412. Container(width: wsp(50),),
  413. Text('订单确认',style: TextStyle(fontSize: 15,color: Color(0xFF000000),decoration: TextDecoration.none,fontWeight: FontWeight.bold),),
  414. GestureDetector(
  415. child: Text('关闭',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none,fontWeight: FontWeight.bold),),
  416. onTap: (){
  417. setState(() {
  418. _isOrder = false;
  419. });
  420. },
  421. ),
  422. ],
  423. ),
  424. ),
  425. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE5E5E5),),
  426. Container(
  427. height: MediaQuery.of(context).size.height*0.8-hsp(220)-0.5,
  428. child: SingleChildScrollView(
  429. padding: EdgeInsets.all(0),
  430. child: Column(
  431. children: [
  432. Container(
  433. padding: EdgeInsets.all(hsp(30)),
  434. color: Colors.white,
  435. width: MediaQuery.of(context).size.width,
  436. child: Column(
  437. crossAxisAlignment: CrossAxisAlignment.start,
  438. children: [
  439. Text('使用日期',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
  440. Container(
  441. margin: EdgeInsets.only(top: hsp(20)),
  442. child: Row(
  443. children: [
  444. Container(
  445. height: hsp(120),
  446. width: MediaQuery.of(context).size.width-hsp(200),
  447. child: ListView.separated(
  448. itemBuilder: (context,index){
  449. return GestureDetector(
  450. behavior: HitTestBehavior.opaque,
  451. onTap: (){
  452. setState(() {
  453. _selected = index;
  454. });
  455. },
  456. child: Stack(
  457. children: [
  458. Container(
  459. height: hsp(120),
  460. width: (MediaQuery.of(context).size.width-hsp(230))/3,
  461. decoration: BoxDecoration(
  462. color: index==_selected?Color(0xFF007EFF):Color(0xFFF0EEEE),
  463. borderRadius: BorderRadius.all(Radius.circular(5))
  464. ),
  465. alignment: Alignment.center,
  466. child: Text('${_priceList[index]['time']} \n¥${_priceList[index]['price']}',
  467. style: TextStyle(fontSize: zsp(20),color: index==_selected?Colors.white:Color(0xFF8B8B8B)),textAlign: TextAlign.center,),
  468. ),
  469. if(_selected==index)Container(
  470. child: Text(timeTag('${_priceList[index]['time']}'),style: TextStyle(fontSize: zsp(16),color: Color(0xFF007EFF)),),
  471. height: hsp(30),
  472. padding: EdgeInsets.only(left: wsp(3),right: wsp(3)),
  473. decoration: BoxDecoration(
  474. color: Color(0xFFF7F7F7),
  475. borderRadius: BorderRadius.only(topLeft: Radius.circular(3),bottomRight: Radius.circular(5))
  476. ),
  477. alignment: Alignment.center,
  478. ),
  479. ],
  480. ),
  481. );
  482. },
  483. separatorBuilder: (context,index){
  484. return Container(width: hsp(15),color: Colors.white,);
  485. },
  486. itemCount: _priceList.length,
  487. padding: EdgeInsets.all(0),
  488. scrollDirection: Axis.horizontal,
  489. ),
  490. ),
  491. GestureDetector(
  492. onTap: (){
  493. showModalBottomSheet(
  494. context: context,
  495. builder: (context){
  496. return YSDatePicker(
  497. choose: (value){
  498. Map time = {'time':value.split(' ')[0],'price':_priceList[0]['price']};
  499. int index;
  500. for(int i=0;i<_priceList.length;i++){
  501. if(_priceList[i]['time']==time['time']){
  502. index = i;
  503. }
  504. }
  505. if(index!=null){
  506. _priceList.removeAt(index);
  507. }
  508. setState(() {
  509. _priceList.insert(0, time);
  510. });
  511. },
  512. );
  513. }
  514. );
  515. },
  516. behavior: HitTestBehavior.opaque,
  517. child: Container(
  518. height: hsp(120),
  519. width: hsp(140),
  520. alignment: Alignment.center,
  521. child: Text('更多\n日期',style: TextStyle(fontSize: zsp(26),color: Color(0xFF007EFF)),),
  522. ),
  523. )
  524. ],
  525. ),
  526. ),
  527. ],
  528. ),
  529. ),
  530. Container(
  531. padding: EdgeInsets.all(hsp(30)),
  532. margin: EdgeInsets.only(top: hsp(10)),
  533. color: Colors.white,
  534. child: Column(
  535. crossAxisAlignment: CrossAxisAlignment.start,
  536. children: [
  537. Row(
  538. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  539. children: [
  540. Text('${_packages[_index]['name']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFF000000),fontWeight: FontWeight.bold),),
  541. Text('¥${_packages[_index]['discountPrice']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFFEB423B)),),
  542. ],
  543. ),
  544. Container(
  545. margin: EdgeInsets.only(top: hsp(20),bottom: hsp(20)),
  546. child: Row(
  547. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  548. children: [
  549. Text('${_msgDict['setoutInfo']['display']} - ${_msgDict['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(32),color: Color(0xFF000000),fontWeight: FontWeight.bold),),
  550. Row(
  551. children: [
  552. Text('购买数量 ',style: TextStyle(fontSize: zsp(26),color: Color(0xFF9A9A9A)),),
  553. GestureDetector(
  554. onTap: (){
  555. if(_number>1){
  556. setState(() {
  557. _number--;
  558. });
  559. }
  560. },
  561. child: Icon(Icons.remove_circle_outline,color: _number>1?Color(0xFF007AFF):Color(0xFF9A9A9A),size: hsp(40),),
  562. ),
  563. Text(' $_number ',style: TextStyle(fontSize: zsp(45),color: Color(0xFF000000)),),
  564. GestureDetector(
  565. onTap: (){
  566. setState(() {
  567. _number++;
  568. });
  569. },
  570. child: Icon(Icons.add_circle_outline,color: Color(0xFF007AFF),size: hsp(40),)
  571. ),
  572. ],
  573. )
  574. ],
  575. ),
  576. ),
  577. GestureDetector(
  578. onTap: (){
  579. showModalBottomSheet(
  580. isScrollControlled: true,
  581. backgroundColor: Colors.transparent,
  582. context: context,
  583. builder: (context){
  584. return Container(
  585. height: MediaQuery.of(context).size.height*0.8,
  586. width: MediaQuery.of(context).size.width,
  587. decoration: BoxDecoration(
  588. color: Colors.white,
  589. borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10)),
  590. ),
  591. child: Column(
  592. children: [
  593. Container(
  594. height: hsp(100),
  595. padding: EdgeInsets.only(left: 15,right: 15),
  596. child: Row(
  597. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  598. children: [
  599. Container(width: wsp(50),),
  600. Text('预订须知',style: TextStyle(fontSize: 15,color: Color(0xFF000000),decoration: TextDecoration.none,fontWeight: FontWeight.bold),),
  601. GestureDetector(
  602. child: Text('关闭',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none),),
  603. onTap: (){
  604. Navigator.pop(context);
  605. },
  606. ),
  607. ],
  608. ),
  609. ),
  610. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE5E5E5),),
  611. Container(
  612. height: MediaQuery.of(context).size.height*0.8-hsp(100)-0.5,
  613. )
  614. ],
  615. ),
  616. );
  617. }
  618. );
  619. },
  620. child: RichText(
  621. text: TextSpan(
  622. text: '预订须知',
  623. style: TextStyle(fontSize: zsp(24),color: Color(0xFF027FFF)),
  624. children: [
  625. TextSpan(
  626. text: ' >',
  627. style: TextStyle(color: Color(0xFF000000))
  628. )
  629. ]
  630. ),
  631. ),
  632. )
  633. ],
  634. ),
  635. ),
  636. // Container(
  637. // child: Text('出行人',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
  638. // alignment: Alignment.centerLeft,
  639. // height: hsp(80),
  640. // padding: EdgeInsets.only(left: hsp(30)),
  641. // margin: EdgeInsets.only(top: hsp(10)),
  642. // width: MediaQuery.of(context).size.width,
  643. // color: Colors.white,
  644. // ),
  645. // Container(
  646. // padding: EdgeInsets.only(left: hsp(30),right: hsp(30),top: hsp(20)),
  647. // margin: EdgeInsets.only(top: hsp(1)),
  648. // color: Colors.white,
  649. // width: MediaQuery.of(context).size.width,
  650. // child: Column(
  651. // crossAxisAlignment: CrossAxisAlignment.start,
  652. // children: [
  653. // Container(
  654. // padding: EdgeInsets.only(left: hsp(30),right: hsp(30),bottom: hsp(20)),
  655. // child: Row(
  656. // children: [
  657. // Container(
  658. // height: hsp(60),
  659. // width: MediaQuery.of(context).size.width-hsp(300),
  660. // margin: EdgeInsets.only(right: hsp(20)),
  661. // child: ListView.separated(
  662. // itemBuilder: (context,index){
  663. // return Container(
  664. // height: hsp(60),
  665. // width: (MediaQuery.of(context).size.width-hsp(340))/3,
  666. // decoration: BoxDecoration(
  667. // color: Colors.white,
  668. // border: Border.all(color: Color(0xFFD8D8D8),width: 1),
  669. // borderRadius: BorderRadius.all(Radius.circular(5))
  670. // ),
  671. // child: Text('周星星',style: TextStyle(fontSize: zsp(28),color: Color(0xFF343434)),),
  672. // alignment: Alignment.center,
  673. // );
  674. // },
  675. // separatorBuilder: (context,index){
  676. // return Container(width: hsp(20),color: Colors.white,);
  677. // },
  678. // itemCount: 3,
  679. // padding: EdgeInsets.all(0),
  680. // scrollDirection: Axis.horizontal,
  681. // ),
  682. // ),
  683. // GestureDetector(
  684. // onTap: (){
  685. // Navigator.of(context).push(
  686. // CupertinoPageRoute(
  687. // builder: (context){
  688. // return YSContact();
  689. // }
  690. // )
  691. // );
  692. // },
  693. // child: Container(
  694. // height: hsp(60),
  695. // width: hsp(160),
  696. // decoration: BoxDecoration(
  697. // color: Color(0xFF007EFF),
  698. // borderRadius: BorderRadius.all(Radius.circular(5))
  699. // ),
  700. // child: Row(
  701. // mainAxisSize: MainAxisSize.min,
  702. // children: [
  703. // Icon(Icons.add_circle,color: Colors.white,size: hsp(30),),
  704. // Text(' 新增',style: TextStyle(fontSize: zsp(28),color: Colors.white),),
  705. // ],
  706. // ),
  707. // alignment: Alignment.center,
  708. // ),
  709. // )
  710. // ],
  711. // ),
  712. // ),
  713. // ],
  714. // ),
  715. // ),
  716. // Container(
  717. // color: Colors.white,
  718. // child: ListView.separated(
  719. // itemBuilder: (context,index){
  720. // return Container(
  721. // color: Colors.white,
  722. // padding: EdgeInsets.only(top: hsp(20),bottom: hsp(20),left: hsp(50),right: hsp(50)),
  723. // child: Row(
  724. // mainAxisAlignment: MainAxisAlignment.spaceBetween,
  725. // children: [
  726. // Icon(Icons.remove_circle,color: Colors.red,size: hsp(50),),
  727. // Container(
  728. // width: MediaQuery.of(context).size.width-hsp(250),
  729. // child: Column(
  730. // crossAxisAlignment: CrossAxisAlignment.start,
  731. // children: [
  732. // Text('周星星',style: TextStyle(fontSize: zsp(34),color: Color(0xFF343434),fontWeight: FontWeight.bold),),
  733. // Text('身份证 610524199909086543',style: TextStyle(fontSize: zsp(25),color: Color(0xFF666666)),)
  734. // ],
  735. // ),
  736. // ),
  737. // Icon(Icons.mode_edit,color: Color(0xFF9A9A9A),size: hsp(50),),
  738. // ],
  739. // ),
  740. // );
  741. // },
  742. // separatorBuilder: (context,index){
  743. // return Divider(height: 0.5,thickness: 0.5,indent: hsp(100),);
  744. // },
  745. // itemCount: 2,
  746. // shrinkWrap: true,
  747. // padding: EdgeInsets.all(0),
  748. // physics: NeverScrollableScrollPhysics(),
  749. // ),
  750. // )
  751. GestureDetector(
  752. onTap: (){
  753. setState(() {
  754. _isShow = !_isShow;
  755. });
  756. },
  757. behavior: HitTestBehavior.opaque,
  758. child: Container(
  759. padding: EdgeInsets.only(left: wsp(40),right: wsp(40),top: hsp(20),bottom: hsp(20)),
  760. margin: EdgeInsets.only(top: hsp(10)),
  761. color: Colors.white,
  762. child: Row(
  763. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  764. children: [
  765. Text('更多服务',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
  766. Icon(Icons.keyboard_arrow_down,size: hsp(50),color: Color(0xFFC1C1C1),)
  767. ],
  768. )
  769. ),
  770. ),
  771. if(_isShow==true)Container(
  772. padding: EdgeInsets.only(left: wsp(32),right: wsp(32),top: hsp(20),bottom: hsp(10)),
  773. decoration: BoxDecoration(
  774. color: Color(0xFFFAFAFA),
  775. borderRadius: BorderRadius.only(bottomRight: Radius.circular(10),bottomLeft: Radius.circular(10))
  776. ),
  777. child: ListView.builder(
  778. shrinkWrap: true,
  779. itemBuilder: (context,index){
  780. return Container(
  781. padding: EdgeInsets.only(bottom: wsp(20)),
  782. child: Row(
  783. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  784. children: [
  785. Row(
  786. children: [
  787. Text('${_packList[index]['name']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF999999)),),
  788. Container(
  789. width: wsp(50),
  790. child: GestureDetector(
  791. child: Icon(Icons.error_outline,size: hsp(40),color: Color(0xFF999999)),
  792. ),
  793. ),
  794. Text('${_packList[index]['price']}元',style: TextStyle(fontSize: zsp(28),color: Colors.black),),
  795. ],
  796. ),
  797. GestureDetector(
  798. child: Container(
  799. height: hsp(60),
  800. width: hsp(100),
  801. child: Image.asset(_chooses.contains(_packList[index])==true?'lib/images/kaiguankai.png':'lib/images/kaiguanguan.png'),
  802. ),
  803. onTap: (){
  804. setState(() {
  805. if(_chooses.contains(_packList[index])==true){
  806. _chooses.remove(_packList[index]);
  807. }else{
  808. _chooses.add(_packList[index]);
  809. }
  810. });
  811. },
  812. )
  813. ],
  814. ),
  815. );
  816. },
  817. itemCount: _packList.length,
  818. padding: EdgeInsets.all(0),
  819. physics: NeverScrollableScrollPhysics(),
  820. ),
  821. )
  822. ],
  823. ),
  824. ),
  825. ),
  826. ],
  827. ),
  828. ),
  829. Container(
  830. height: hsp(120),
  831. width: MediaQuery.of(context).size.width,
  832. color: Colors.white,
  833. padding: EdgeInsets.only(left: wsp(30),right: wsp(30)),
  834. child: Row(
  835. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  836. children: [
  837. RichText(
  838. text: TextSpan(
  839. text: '参考价(¥)',
  840. style: TextStyle(fontSize: zsp(22),color: Color(0xFF181818)),
  841. children: [
  842. TextSpan(
  843. text: ' ${_getPrice()}',
  844. style: TextStyle(fontSize: zsp(40),color: Color(0xFFFF6600)),
  845. )
  846. ]
  847. ),
  848. ),
  849. GestureDetector(
  850. child: Row(
  851. children: [
  852. Text('明细',style: TextStyle(fontSize: zsp(22),color: Color(0xFF181818)),),
  853. Icon(Icons.keyboard_arrow_up,size: hsp(30),color: Color(0xFF007EFF),),
  854. ],
  855. ),
  856. onTap: (){
  857. setState(() {
  858. _isDetail = !_isDetail;
  859. });
  860. },
  861. ),
  862. GestureDetector(
  863. onTap: (){
  864. _postOrderData();
  865. },
  866. child: Container(
  867. height: hsp(70),
  868. padding: EdgeInsets.only(left: wsp(50),right: wsp(50)),
  869. decoration: BoxDecoration(
  870. color: Color(0xFF007EFF),
  871. borderRadius: BorderRadius.all(Radius.circular(50))
  872. ),
  873. alignment: Alignment.center,
  874. child: Text('立即预约',style: TextStyle(fontSize: zsp(30),color: Colors.white,fontWeight: FontWeight.bold),),
  875. ),
  876. )
  877. ],
  878. ),
  879. )
  880. ],
  881. ),
  882. ),
  883. ),
  884. ),
  885. if(_isDetail==true)GestureDetector(
  886. onTap: (){
  887. setState(() {
  888. _isDetail = false;
  889. });
  890. },
  891. child: Container(
  892. height: MediaQuery.of(context).size.height-hsp(120),
  893. color: Colors.black45,
  894. child: Container(
  895. margin: EdgeInsets.only(top: MediaQuery.of(context).size.height-hsp(120)-hsp(370)),
  896. height: hsp(370),
  897. decoration: BoxDecoration(
  898. color: Colors.white,
  899. borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10))
  900. ),
  901. child: GestureDetector(
  902. onTap: (){},
  903. behavior: HitTestBehavior.opaque,
  904. child: Column(
  905. children: [
  906. Container(
  907. height: hsp(100),
  908. padding: EdgeInsets.only(left: 15,right: 15),
  909. child: Row(
  910. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  911. children: [
  912. GestureDetector(
  913. child: Text('关闭',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none),),
  914. onTap: (){
  915. setState(() {
  916. _isDetail = false;
  917. });
  918. },
  919. ),
  920. Text('明细',style: TextStyle(fontSize: 15,color: Color(0xFF000000),decoration: TextDecoration.none,fontWeight: FontWeight.bold),),
  921. Container(width: wsp(50),),
  922. ],
  923. ),
  924. ),
  925. Container(
  926. height: hsp(100),
  927. color: Color(0xFFF7F8F9),
  928. padding: EdgeInsets.only(left: wsp(40),right: wsp(40),bottom: hsp(20),top: hsp(20)),
  929. child: Row(
  930. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  931. children: [
  932. Text('座位',style: TextStyle(fontSize: zsp(32),color: Color(0xFF000000),decoration: TextDecoration.none),),
  933. Text('¥ ${_priceList[_selected]['price']}',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none),),
  934. ],
  935. ),
  936. ),
  937. Container(
  938. color: Color(0xFFF7F8F9),
  939. height: hsp(170),
  940. child: ListView.builder(
  941. padding: EdgeInsets.all(0),
  942. itemBuilder: (context,index){
  943. return Container(
  944. padding: EdgeInsets.only(left: wsp(40),right: wsp(40),bottom: hsp(10)),
  945. child: Row(
  946. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  947. children: [
  948. Text('${_chooses[index]['name']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF9A9A9A)),),
  949. Text('¥ ${_chooses[index]['price']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF9A9A9A)),),
  950. ],
  951. ),
  952. );
  953. },
  954. itemCount: _chooses.length,
  955. ),
  956. )
  957. ],
  958. ),
  959. ),
  960. ),
  961. ),
  962. )
  963. ],
  964. ),
  965. );
  966. }
  967. _getShortDetailData() async{
  968. Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/AirTour/getTour',parameter: {'id':widget.shortId,'type':6},isLoading: true,isToken: false);
  969. if(dict!=null){
  970. setState(() {
  971. _msgDict = dict['data'];
  972. });
  973. }
  974. }
  975. _getPackageData() async{
  976. var dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneservice/get',parameter: {'type':6},isLoading: true,isToken: false);
  977. if(dict!=null){
  978. setState(() {
  979. _packages = dict['data'];
  980. });
  981. }
  982. }
  983. _getPriceData() async{
  984. Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneorder/getDateAndTime',
  985. parameter: {'type':6,'time':_timeStr,'id':_msgDict['id']},isLoading: true,isToken: true);
  986. if(dict!=null){
  987. _isOrder = true;
  988. _priceList = dict['data'];
  989. _getPackData();
  990. }
  991. }
  992. _getPackData() async{
  993. Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneservice/get',parameter: {'type':6},isLoading: true,isToken: false);
  994. if(dict!=null){
  995. setState(() {
  996. _packList = dict['data'];
  997. });
  998. }
  999. }
  1000. _getPrice(){
  1001. double price = double.parse('${_priceList[_selected]['discountprice']}')*_number;
  1002. _chooses.forEach((element) {
  1003. price+=double.parse('${element['price']}');
  1004. });
  1005. return price.toStringAsFixed(2);
  1006. }
  1007. _postOrderData() async{
  1008. FocusScope.of(context).unfocus();
  1009. Map request = {};
  1010. request['flightTime'] = _timeStr;
  1011. request['type'] = 6;
  1012. request['airlaneId'] = _msgDict['dtFlightInformation']['id'];
  1013. request['airportidSetout'] = _msgDict['setoutInfo']['id'];
  1014. request['airportidArrive'] = _msgDict['arriveInfo']['id'];
  1015. request['travelersNumber'] = _number;
  1016. List array = [];
  1017. _chooses.forEach((element) {
  1018. array.add(element['id']);
  1019. });
  1020. if(array.length>0){
  1021. request['serviceIds'] = array.join(',');
  1022. }
  1023. if(_index!=9999){
  1024. request['setmealIds'] = _packages[_index]['id'];
  1025. }
  1026. Map dict = await ysRequestHttp(context,type: requestType.post,api: '/app/applets/airplaneorder/createOrder',parameter: request,isLoading: true,isToken: true);
  1027. if(dict!=null){
  1028. Navigator.of(context).push(
  1029. CupertinoPageRoute(
  1030. builder: (context){
  1031. return YSPay(orderDict: dict['data'],type: payType.short,);
  1032. }
  1033. )
  1034. );
  1035. }
  1036. }
  1037. }