YSShortDetail.dart 62 KB

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