YSMarryPlane.dart 52 KB

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