YSShortDetail.dart 62 KB

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