YSShortDetail.dart 60 KB

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