YSDoctorPlane.dart 48 KB

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