YSMarryPlane.dart 60 KB

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