YSShortDetail.dart 63 KB

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