YSSearchResult.dart 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_easyrefresh/easy_refresh.dart';
  4. import 'package:shared_preferences/shared_preferences.dart';
  5. import 'package:ysairplane2/code/YSPay.dart';
  6. import 'package:ysairplane2/code/YSShortDetail.dart';
  7. import 'package:ysairplane2/tools/YSNetWorking.dart';
  8. import 'package:ysairplane2/tools/YSTools.dart';
  9. import 'YSMarryPlane.dart';
  10. class YSSearchResult extends StatefulWidget {
  11. final searchStr;
  12. final type;
  13. final siftValue;
  14. const YSSearchResult({Key key, this.searchStr, this.type, this.siftValue}) : super(key: key);
  15. @override
  16. _YSSearchResultState createState() => _YSSearchResultState();
  17. }
  18. class _YSSearchResultState extends State<YSSearchResult> {
  19. TextEditingController _searchStr = TextEditingController();
  20. List _tabValues = [{'name':'空中浏览','type':9},{'name':'短途客运','type':6},{'name':'短途货运','type':33},{'name':'航空运动','type':5},
  21. {'name':'婚庆典礼','type':4}];
  22. int _page = 1;
  23. List _dataArray = [];
  24. int _index = 0;
  25. int _typeIndex = 0;
  26. List _priceList = [];
  27. List _kinds = [];
  28. bool _isOrder = false;
  29. int _selected = 0;
  30. Map _kind;
  31. String _timeStr;
  32. List<String> _historyList = [];
  33. TextEditingController _name = TextEditingController();
  34. TextEditingController _volume = TextEditingController();
  35. TextEditingController _weight = TextEditingController();
  36. @override
  37. void initState() {
  38. if(widget.type!=null){
  39. _tabValues.add({'name':'短途货运','type':3});
  40. for(int i = 0;i<_tabValues.length;i++){
  41. if(_tabValues[i]['type']==int.parse('${widget.type}')){
  42. _typeIndex = i;
  43. }
  44. }
  45. }
  46. if(widget.searchStr!=null){
  47. _searchStr.text = widget.searchStr;
  48. }
  49. _timeStr = DateTime.now().year.toString()+'-'+DateTime.now().month.toString().padLeft(2,'0')+'-'
  50. +DateTime.now().day.toString().padLeft(2,'0')+' '+DateTime.now().hour.toString().padLeft(2,'0')+':'
  51. +DateTime.now().minute.toString().padLeft(2,'0');
  52. SharedPreferences.getInstance().then((value){
  53. setState(() {
  54. _historyList = value.getStringList('history')??[];
  55. });
  56. });
  57. Future.delayed(Duration(seconds: 0)).then((value){
  58. _refreshData();
  59. });
  60. super.initState();
  61. }
  62. @override
  63. Widget build(BuildContext context) {
  64. return Scaffold(
  65. body: SingleChildScrollView(
  66. child: Stack(
  67. children: [
  68. SingleChildScrollView(
  69. child: Column(
  70. children: [
  71. Container(
  72. margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+hsp(42),left: wsp(32),right: wsp(32)),
  73. child: Row(
  74. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  75. children: [
  76. GestureDetector(child: Icon(Icons.arrow_back_ios,size: hsp(40),color: Color(0xFF000000),),onTap: (){Navigator.pop(context);},),
  77. Container(
  78. width: MediaQuery.of(context).size.width-wsp(140),
  79. margin: EdgeInsets.only(left: wsp(34)),
  80. padding: EdgeInsets.only(left: wsp(26),right: wsp(26)),
  81. height: hsp(66),
  82. decoration: BoxDecoration(
  83. border: Border.all(color: Color(0xFF007AFF),width: 1),
  84. borderRadius: BorderRadius.all(Radius.circular(5))
  85. ),
  86. child: CupertinoTextField(
  87. placeholder: '',
  88. placeholderStyle: TextStyle(fontSize: zsp(25),color: Color(0xFF545454)),
  89. style: TextStyle(fontSize: zsp(25),color: Color(0xFF545454)),
  90. prefix: Icon(Icons.search,size: hsp(40),color: Color(0xFF8E8E93),),
  91. suffix: GestureDetector(child: Icon(Icons.close,size: hsp(40),color: Color(0xFF8E8E93),),onTap: (){_searchStr.text = '';},),
  92. suffixMode: OverlayVisibilityMode.editing,
  93. controller: _searchStr,
  94. padding: EdgeInsets.all(0),
  95. decoration: BoxDecoration(),
  96. onSubmitted: (value){
  97. if(value.isNotEmpty){
  98. if(_historyList.contains(value)){
  99. _historyList.remove(value);
  100. }
  101. _historyList.insert(0, value);
  102. SharedPreferences.getInstance().then((prefer){
  103. prefer.setStringList('history', _historyList);
  104. _refreshData();
  105. });
  106. }else{
  107. _refreshData();
  108. }
  109. },
  110. textInputAction: TextInputAction.search,
  111. ),
  112. ),
  113. ],
  114. ),
  115. ),
  116. if(widget.type==null)Container(
  117. height: hsp(100),
  118. width: MediaQuery.of(context).size.width,
  119. child: ListView.builder(
  120. itemBuilder: (context,index){
  121. return GestureDetector(
  122. onTap: (){
  123. _typeIndex = index;
  124. _refreshData();
  125. },
  126. child: Container(
  127. width: MediaQuery.of(context).size.width/4,
  128. padding: EdgeInsets.only(top: hsp(20)),
  129. child: Column(
  130. children: [
  131. Text('${_tabValues[index]['name']}',style: TextStyle(color: index==_typeIndex?Color(0xFF007AFF):Colors.black,
  132. fontWeight: _typeIndex==index?FontWeight.bold:FontWeight.normal),),
  133. Container(height: 2,color: index==_typeIndex?Color(0xFF007AFF):Colors.transparent,width: MediaQuery.of(context).size.width/8,
  134. margin: EdgeInsets.only(top: hsp(10)),)
  135. ],
  136. ),
  137. ),
  138. );
  139. },
  140. padding: EdgeInsets.all(0),
  141. itemCount: _tabValues.length,
  142. scrollDirection: Axis.horizontal,
  143. ),
  144. ),
  145. Container(
  146. height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-hsp(widget.type==null?208:108),
  147. color: Color(0xFFF1F2F3),
  148. child: widget.type==null?PageView(
  149. children: [
  150. Container(
  151. height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-hsp(208),
  152. color: Color(0xFFF1F2F3),
  153. child: EasyRefresh(
  154. onRefresh: _refreshData,
  155. onLoad: _loadMoreData,
  156. header: TaurusHeader(
  157. ),
  158. footer: TaurusFooter(
  159. ),
  160. child: ListView.separated(
  161. itemBuilder: (context,index){
  162. return GestureDetector(
  163. behavior: HitTestBehavior.opaque,
  164. onTap: (){
  165. if(_typeIndex==2){
  166. _index = index;
  167. _getPriceData();
  168. }else{
  169. Navigator.of(context).push(
  170. CupertinoPageRoute(
  171. builder: (context){
  172. return _typeIndex==1?YSShortDetail(shortId: _dataArray[index]['id'],):
  173. YSMarryPlane(marryId: _dataArray[index]['id'],type: _typeIndex==0?9:_typeIndex==3?5:4);
  174. }
  175. )
  176. );
  177. }
  178. },
  179. child: Container(
  180. padding: EdgeInsets.all(hsp(30)),
  181. child: _typeIndex==1?Row(
  182. children: [
  183. Container(
  184. height: hsp(200),
  185. width: hsp(250),
  186. margin: EdgeInsets.only(right: hsp(30)),
  187. child: ysImageLoad(
  188. imageUrl: '${_dataArray[index]['cover']}',
  189. fit: BoxFit.fill,
  190. height: hsp(200),
  191. width: hsp(250),
  192. ),
  193. ),
  194. Container(
  195. width: MediaQuery.of(context).size.width-hsp(340),
  196. height: hsp(200),
  197. child: Column(
  198. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  199. crossAxisAlignment: CrossAxisAlignment.start,
  200. children: [
  201. Container(
  202. width: MediaQuery.of(context).size.width-hsp(340),
  203. child: SingleChildScrollView(
  204. scrollDirection: Axis.horizontal,
  205. child: Row(
  206. children: [
  207. Text('${_dataArray[index]['setoutInfo']['display']}',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),),
  208. Container(
  209. height: 2,
  210. width: wsp(40),
  211. margin: EdgeInsets.only(left: wsp(10),right: wsp(10)),
  212. color: Color(0xFFCCCCCC),
  213. ),
  214. Text('${_dataArray[index]['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),)
  215. ],
  216. ),
  217. ),
  218. ),
  219. Text('${_dataArray[index]['dtFlightInformation']['partnerName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
  220. Row(
  221. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  222. children: [
  223. Text('${_dataArray[index]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
  224. RichText(
  225. text: TextSpan(
  226. text: '¥',
  227. style: TextStyle(fontSize: zsp(24),color: Color(0xFFEB423B)),
  228. children: [
  229. TextSpan(
  230. text: '${_dataArray[index]['discountPrice']}',
  231. style: TextStyle(fontSize: zsp(42),fontWeight: FontWeight.bold),
  232. ),
  233. TextSpan(
  234. text: '元起',
  235. style: TextStyle(fontSize: zsp(20)),
  236. )
  237. ]
  238. ),
  239. )
  240. ],
  241. )
  242. ],
  243. ),
  244. )
  245. ],
  246. ):_typeIndex==2?Column(
  247. children: [
  248. Container(
  249. padding: EdgeInsets.only(bottom: hsp(30)),
  250. child: Column(
  251. children: [
  252. Row(
  253. children: [
  254. Container(
  255. width: (MediaQuery.of(context).size.width-hsp(200))/2,
  256. child: SingleChildScrollView(
  257. child: Text('${_dataArray[index]['setoutInfo']['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
  258. scrollDirection: Axis.horizontal,
  259. )
  260. ),
  261. Image(height: hsp(60),width: hsp(60),image: AssetImage('lib/images/plane.png'),),
  262. Container(
  263. width: (MediaQuery.of(context).size.width-hsp(200))/2,
  264. child: SingleChildScrollView(
  265. child: Text('${_dataArray[index]['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
  266. scrollDirection: Axis.horizontal,
  267. ),
  268. alignment: Alignment.centerRight,
  269. ),
  270. ],
  271. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  272. ),
  273. Row(
  274. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  275. children: [
  276. Container(
  277. width: (MediaQuery.of(context).size.width-hsp(250))/2,
  278. child: SingleChildScrollView(
  279. child: Text('${_dataArray[index]['setoutInfo']['airplaneName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  280. scrollDirection: Axis.horizontal,
  281. )
  282. ),
  283. Text('${_dataArray[index]['hour']}',style: TextStyle(fontSize: zsp(20),color: Color(0xFF343434)),),
  284. Container(
  285. width: (MediaQuery.of(context).size.width-hsp(250))/2,
  286. child: SingleChildScrollView(
  287. child: Text('${_dataArray[index]['arriveInfo']['airplaneName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  288. scrollDirection: Axis.horizontal,
  289. ),
  290. alignment: Alignment.centerRight,
  291. ),
  292. ],
  293. )
  294. ],
  295. ),
  296. ),
  297. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
  298. Container(
  299. height: hsp(70),
  300. child: Row(
  301. children: [
  302. Text('${_dataArray[index]['flightTime']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF333333)),),
  303. Text('机型: ${_dataArray[index]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF333333)),),
  304. ],
  305. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  306. ),
  307. ),
  308. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
  309. Container(
  310. height: hsp(70),
  311. child: Row(
  312. children: [
  313. RichText(
  314. text: TextSpan(
  315. style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),
  316. children: [
  317. TextSpan(
  318. text: '类型: '
  319. ),
  320. TextSpan(
  321. text: '${_dataArray[index]['type']==1?'整机':'拼机'}',
  322. style: TextStyle(color: Color(0xFF333333))
  323. ),
  324. TextSpan(
  325. text: '体积: '
  326. ),
  327. TextSpan(
  328. text: '${_dataArray[index]['totalVolume']}立方米',
  329. style: TextStyle(color: Color(0xFF333333))
  330. ),
  331. TextSpan(
  332. text: '重量: '
  333. ),
  334. TextSpan(
  335. text: '${_dataArray[index]['totalWeight']}吨',
  336. style: TextStyle(color: Color(0xFF333333))
  337. )
  338. ]
  339. ),
  340. ),
  341. Text('¥${_dataArray[index]['discountPrice']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFFEA413A),fontWeight: FontWeight.bold),),
  342. ],
  343. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  344. ),
  345. margin: EdgeInsets.only(top: hsp(20)),
  346. ),
  347. ],
  348. ):Row(
  349. children: [
  350. Container(
  351. height: hsp(200),
  352. width: hsp(250),
  353. child: ysImageLoad(
  354. imageUrl: '${_dataArray[index]['cover']}',
  355. fit: BoxFit.fill,
  356. height: hsp(200),
  357. width: hsp(250),
  358. ),
  359. margin: EdgeInsets.only(right: hsp(30)),
  360. ),
  361. Container(
  362. width: MediaQuery.of(context).size.width-hsp(340),
  363. height: hsp(200),
  364. child: Column(
  365. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  366. crossAxisAlignment: CrossAxisAlignment.start,
  367. children: [
  368. Text('${_dataArray[index]['title']}',style: TextStyle(fontSize: zsp(30),color: Color(0xFF343434)),maxLines: 2,),
  369. Text('${_dataArray[index]['dtFlightInformation']['partnerName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
  370. Row(
  371. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  372. children: [
  373. Text('${_dataArray[index]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
  374. RichText(
  375. text: TextSpan(
  376. text: '¥',
  377. style: TextStyle(fontSize: zsp(24),color: Color(0xFFEB423B)),
  378. children: [
  379. TextSpan(
  380. text: '${_dataArray[index]['discountPrice']}',
  381. style: TextStyle(fontSize: zsp(42),fontWeight: FontWeight.bold),
  382. ),
  383. TextSpan(
  384. text: '元起',
  385. style: TextStyle(fontSize: zsp(20)),
  386. )
  387. ]
  388. ),
  389. )
  390. ],
  391. )
  392. ],
  393. ),
  394. )
  395. ],
  396. ),
  397. ),
  398. );
  399. },
  400. separatorBuilder: (context,index){
  401. return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEEEEEE),);
  402. },
  403. itemCount: _dataArray.length,
  404. padding: EdgeInsets.all(0),
  405. ),
  406. ),
  407. )
  408. ],
  409. ): Container(
  410. margin: EdgeInsets.only(top: hsp(20)),
  411. height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-hsp(108),
  412. color: Color(0xFFF1F2F3),
  413. child: EasyRefresh(
  414. onRefresh: _refreshData,
  415. onLoad: _loadMoreData,
  416. header: TaurusHeader(
  417. ),
  418. footer: TaurusFooter(
  419. ),
  420. child: ListView.separated(
  421. itemBuilder: (context,index){
  422. return GestureDetector(
  423. behavior: HitTestBehavior.opaque,
  424. onTap: (){
  425. if(_typeIndex==2){
  426. _index = index;
  427. _getPriceData();
  428. }else{
  429. Navigator.of(context).push(
  430. CupertinoPageRoute(
  431. builder: (context){
  432. return _typeIndex==1?YSShortDetail(shortId: _dataArray[index]['id'],):
  433. YSMarryPlane(marryId: _dataArray[index]['id'],type: _typeIndex==0?9:_typeIndex==3?5:4);
  434. }
  435. )
  436. );
  437. }
  438. },
  439. child: Container(
  440. padding: EdgeInsets.all(hsp(30)),
  441. child: _typeIndex==1?Row(
  442. children: [
  443. Container(
  444. height: hsp(200),
  445. width: hsp(250),
  446. margin: EdgeInsets.only(right: hsp(30)),
  447. child: ysImageLoad(
  448. imageUrl: '${_dataArray[index]['cover']}',
  449. fit: BoxFit.fill,
  450. height: hsp(200),
  451. width: hsp(250),
  452. ),
  453. ),
  454. Container(
  455. width: MediaQuery.of(context).size.width-hsp(340),
  456. height: hsp(200),
  457. child: Column(
  458. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  459. crossAxisAlignment: CrossAxisAlignment.start,
  460. children: [
  461. Container(
  462. width: MediaQuery.of(context).size.width-hsp(340),
  463. child: SingleChildScrollView(
  464. scrollDirection: Axis.horizontal,
  465. child: Row(
  466. children: [
  467. Text('${_dataArray[index]['setoutInfo']['display']}',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),),
  468. Container(
  469. height: 2,
  470. width: wsp(40),
  471. margin: EdgeInsets.only(left: wsp(10),right: wsp(10)),
  472. color: Color(0xFFCCCCCC),
  473. ),
  474. Text('${_dataArray[index]['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),)
  475. ],
  476. ),
  477. ),
  478. ),
  479. Text('${_dataArray[index]['dtFlightInformation']['partnerName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
  480. Row(
  481. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  482. children: [
  483. Text('${_dataArray[index]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
  484. RichText(
  485. text: TextSpan(
  486. text: '¥',
  487. style: TextStyle(fontSize: zsp(24),color: Color(0xFFEB423B)),
  488. children: [
  489. TextSpan(
  490. text: '${_dataArray[index]['discountPrice']}',
  491. style: TextStyle(fontSize: zsp(42),fontWeight: FontWeight.bold),
  492. ),
  493. TextSpan(
  494. text: '元起',
  495. style: TextStyle(fontSize: zsp(20)),
  496. )
  497. ]
  498. ),
  499. )
  500. ],
  501. )
  502. ],
  503. ),
  504. )
  505. ],
  506. ):_typeIndex==2?Column(
  507. children: [
  508. Container(
  509. padding: EdgeInsets.only(bottom: hsp(30)),
  510. child: Column(
  511. children: [
  512. Row(
  513. children: [
  514. Text('${_dataArray[index]['setoutInfo']['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
  515. Image(height: hsp(60),width: hsp(60),image: AssetImage('lib/images/plane.png'),),
  516. Text('${_dataArray[index]['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
  517. ],
  518. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  519. ),
  520. Row(
  521. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  522. children: [
  523. Text('${_dataArray[index]['setoutInfo']['airplaneName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  524. Text('${_dataArray[index]['hour']}',style: TextStyle(fontSize: zsp(20),color: Color(0xFF343434)),),
  525. Text('${_dataArray[index]['arriveInfo']['airplaneName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  526. ],
  527. )
  528. ],
  529. ),
  530. ),
  531. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
  532. Container(
  533. height: hsp(70),
  534. child: Row(
  535. children: [
  536. Text('${_dataArray[index]['flightTime']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF333333)),),
  537. Text('机型: ${_dataArray[index]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF333333)),),
  538. ],
  539. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  540. ),
  541. ),
  542. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
  543. Container(
  544. height: hsp(70),
  545. child: Row(
  546. children: [
  547. RichText(
  548. text: TextSpan(
  549. style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),
  550. children: [
  551. TextSpan(
  552. text: '类型: '
  553. ),
  554. TextSpan(
  555. text: '${_dataArray[index]['type']==1?'整机':'拼机'}',
  556. style: TextStyle(color: Color(0xFF333333))
  557. ),
  558. TextSpan(
  559. text: '体积: '
  560. ),
  561. TextSpan(
  562. text: '${_dataArray[index]['totalVolume']}立方米',
  563. style: TextStyle(color: Color(0xFF333333))
  564. ),
  565. TextSpan(
  566. text: '重量: '
  567. ),
  568. TextSpan(
  569. text: '${_dataArray[index]['totalWeight']}吨',
  570. style: TextStyle(color: Color(0xFF333333))
  571. )
  572. ]
  573. ),
  574. ),
  575. Text('¥${_dataArray[index]['discountPrice']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFFEA413A),fontWeight: FontWeight.bold),),
  576. ],
  577. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  578. ),
  579. margin: EdgeInsets.only(top: hsp(20)),
  580. ),
  581. ],
  582. ):Row(
  583. children: [
  584. Container(
  585. height: hsp(200),
  586. width: hsp(250),
  587. child: ysImageLoad(
  588. imageUrl: '${_dataArray[index]['cover']}',
  589. fit: BoxFit.fill,
  590. height: hsp(200),
  591. width: hsp(250),
  592. ),
  593. margin: EdgeInsets.only(right: hsp(30)),
  594. ),
  595. Container(
  596. width: MediaQuery.of(context).size.width-hsp(340),
  597. height: hsp(200),
  598. child: Column(
  599. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  600. crossAxisAlignment: CrossAxisAlignment.start,
  601. children: [
  602. Text('${_dataArray[index]['title']}',style: TextStyle(fontSize: zsp(30),color: Color(0xFF343434)),maxLines: 2,),
  603. Text('${_dataArray[index]['dtFlightInformation']['partnerName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
  604. Row(
  605. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  606. children: [
  607. Text('${_dataArray[index]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
  608. RichText(
  609. text: TextSpan(
  610. text: '¥',
  611. style: TextStyle(fontSize: zsp(24),color: Color(0xFFEB423B)),
  612. children: [
  613. TextSpan(
  614. text: '${_dataArray[index]['discountPrice']}',
  615. style: TextStyle(fontSize: zsp(42),fontWeight: FontWeight.bold),
  616. ),
  617. TextSpan(
  618. text: '元起',
  619. style: TextStyle(fontSize: zsp(20)),
  620. )
  621. ]
  622. ),
  623. )
  624. ],
  625. )
  626. ],
  627. ),
  628. )
  629. ],
  630. ),
  631. ),
  632. );
  633. },
  634. separatorBuilder: (context,index){
  635. return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEEEEEE),);
  636. },
  637. itemCount: _dataArray.length,
  638. padding: EdgeInsets.all(0),
  639. ),
  640. ),
  641. ),
  642. )
  643. ],
  644. ),
  645. ),
  646. if(_isOrder==true)GestureDetector(
  647. onTap: (){
  648. setState(() {
  649. _isOrder = false;
  650. });
  651. },
  652. child: Container(
  653. height: MediaQuery.of(context).size.height,
  654. width: MediaQuery.of(context).size.width,
  655. color: Colors.black54,
  656. child: GestureDetector(
  657. onTap: (){},
  658. child: Column(
  659. children: [
  660. Container(
  661. height: MediaQuery.of(context).size.height*0.8-hsp(120),
  662. width: MediaQuery.of(context).size.width,
  663. margin: EdgeInsets.only(top: MediaQuery.of(context).size.height*0.2),
  664. decoration: BoxDecoration(
  665. color: Color(0xFFF1F2F3),
  666. borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10))
  667. ),
  668. child: Column(
  669. crossAxisAlignment: CrossAxisAlignment.start,
  670. children: [
  671. Container(
  672. height: hsp(100),
  673. decoration: BoxDecoration(
  674. color: Colors.white,
  675. borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10))
  676. ),
  677. padding: EdgeInsets.only(left: 15,right: 15),
  678. child: Row(
  679. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  680. children: [
  681. Container(width: wsp(50),),
  682. Text('订单确认',style: TextStyle(fontSize: 15,color: Color(0xFF000000),decoration: TextDecoration.none,fontWeight: FontWeight.bold),),
  683. GestureDetector(
  684. child: Text('关闭',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none,fontWeight: FontWeight.bold),),
  685. onTap: (){
  686. setState(() {
  687. _isOrder = false;
  688. });
  689. },
  690. ),
  691. ],
  692. ),
  693. ),
  694. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE5E5E5),),
  695. Container(
  696. height: MediaQuery.of(context).size.height*0.8-hsp(220)-0.5,
  697. child: SingleChildScrollView(
  698. padding: EdgeInsets.all(0),
  699. child: Column(
  700. children: [
  701. Container(
  702. padding: EdgeInsets.all(hsp(30)),
  703. color: Colors.white,
  704. width: MediaQuery.of(context).size.width,
  705. child: Column(
  706. crossAxisAlignment: CrossAxisAlignment.start,
  707. children: [
  708. Text('使用日期',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
  709. Container(
  710. margin: EdgeInsets.only(top: hsp(20)),
  711. child: Row(
  712. children: [
  713. Container(
  714. height: hsp(120),
  715. width: MediaQuery.of(context).size.width-hsp(200),
  716. child: ListView.separated(
  717. itemBuilder: (context,index){
  718. return GestureDetector(
  719. behavior: HitTestBehavior.opaque,
  720. onTap: (){
  721. setState(() {
  722. _selected = index;
  723. });
  724. },
  725. child: Stack(
  726. children: [
  727. Container(
  728. height: hsp(120),
  729. width: (MediaQuery.of(context).size.width-hsp(230))/3,
  730. decoration: BoxDecoration(
  731. color: index==_selected?Color(0xFF007EFF):Color(0xFFF0EEEE),
  732. borderRadius: BorderRadius.all(Radius.circular(5))
  733. ),
  734. alignment: Alignment.center,
  735. child: Text('${_priceList[index]['time']} \n¥${_priceList[index]['price']}',
  736. style: TextStyle(fontSize: zsp(20),color: index==_selected?Colors.white:Color(0xFF8B8B8B)),textAlign: TextAlign.center,),
  737. ),
  738. if(_selected==index)Container(
  739. child: Text(timeTag('${_priceList[index]['time']}'),style: TextStyle(fontSize: zsp(16),color: Color(0xFF007EFF)),),
  740. height: hsp(30),
  741. padding: EdgeInsets.only(left: wsp(3),right: wsp(3)),
  742. decoration: BoxDecoration(
  743. color: Color(0xFFF7F7F7),
  744. borderRadius: BorderRadius.only(topLeft: Radius.circular(3),bottomRight: Radius.circular(5))
  745. ),
  746. alignment: Alignment.center,
  747. ),
  748. ],
  749. ),
  750. );
  751. },
  752. separatorBuilder: (context,index){
  753. return Container(width: hsp(15),color: Colors.white,);
  754. },
  755. itemCount: _priceList.length,
  756. padding: EdgeInsets.all(0),
  757. scrollDirection: Axis.horizontal,
  758. ),
  759. ),
  760. GestureDetector(
  761. onTap: (){
  762. dateChooseAlert(context,dateValue: (dateValue){
  763. Map time = {'time':dateValue,'price':_priceList[0]['price'],'discountprice':_priceList[0]['discountprice']};
  764. int index;
  765. for(int i=0;i<_priceList.length;i++){
  766. if(_priceList[i]['time']==time['time']){
  767. index = i;
  768. }
  769. }
  770. if(index!=null){
  771. _priceList.removeAt(index);
  772. }
  773. setState(() {
  774. _priceList.insert(0, time);
  775. });
  776. });
  777. },
  778. behavior: HitTestBehavior.opaque,
  779. child: Container(
  780. height: hsp(120),
  781. width: hsp(140),
  782. alignment: Alignment.center,
  783. child: Text('更多\n日期',style: TextStyle(fontSize: zsp(26),color: Color(0xFF007EFF)),),
  784. ),
  785. )
  786. ],
  787. ),
  788. ),
  789. ],
  790. ),
  791. ),
  792. if(_dataArray[_index]['type']==2)Container(
  793. padding: EdgeInsets.all(hsp(30)),
  794. margin: EdgeInsets.only(top: hsp(10)),
  795. width: MediaQuery.of(context).size.width,
  796. color: Colors.white,
  797. child: Column(
  798. crossAxisAlignment: CrossAxisAlignment.start,
  799. children: [
  800. Text('本次拼机截止时间:${_dataArray[_index]['deadlineTime']}',style: TextStyle(fontSize: zsp(26),color: Color(0xFF999999)),),
  801. Row(
  802. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  803. children: [
  804. Text('0吨',style: TextStyle(fontSize: zsp(22),color: Color(0xFF656565)),),
  805. Container(
  806. height: hsp(100),
  807. width: MediaQuery.of(context).size.width-hsp(200),
  808. child: Slider(
  809. value: double.parse('${_dataArray[_index]['nowWeight']}'),
  810. onChanged: (value){
  811. },
  812. activeColor: Color(0xFF0079FF),
  813. min: 0,
  814. max: 10,
  815. divisions: 4,
  816. ),
  817. ),
  818. Text('${_dataArray[_index]['totalWeight']}吨',style: TextStyle(fontSize: zsp(22),color: Color(0xFF656565)),),
  819. ],
  820. ),
  821. Container(
  822. width: MediaQuery.of(context).size.width,
  823. child: Text('目标${_dataArray[_index]['nowWeight']}吨',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  824. alignment: Alignment.center,
  825. ),
  826. ],
  827. ),
  828. ),
  829. Container(
  830. padding: EdgeInsets.all(hsp(30)),
  831. margin: EdgeInsets.only(top: hsp(10)),
  832. color: Colors.white,
  833. child: Column(
  834. children: [
  835. Container(
  836. padding: EdgeInsets.only(bottom: hsp(30)),
  837. child: Column(
  838. children: [
  839. Row(
  840. children: [
  841. Text('${_dataArray[_index]['setoutInfo']['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
  842. Image(height: hsp(60),width: hsp(60),image: AssetImage('lib/images/plane.png'),),
  843. Text('${_dataArray[_index]['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
  844. ],
  845. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  846. ),
  847. Row(
  848. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  849. children: [
  850. Text('${_dataArray[_index]['setoutInfo']['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  851. Text('${_dataArray[_index]['hour']}',style: TextStyle(fontSize: zsp(20),color: Color(0xFF343434)),),
  852. Text('${_dataArray[_index]['arriveInfo']['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  853. ],
  854. )
  855. ],
  856. ),
  857. ),
  858. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
  859. Container(
  860. height: hsp(70),
  861. child: Row(
  862. children: [
  863. Text('${_dataArray[_index]['flightTime']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF333333)),),
  864. Text('机型: ${_dataArray[_index]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF333333)),),
  865. ],
  866. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  867. ),
  868. ),
  869. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
  870. Container(
  871. height: hsp(90),
  872. alignment: Alignment.centerLeft,
  873. child: Row(
  874. children: [
  875. RichText(
  876. text: TextSpan(
  877. style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),
  878. children: [
  879. TextSpan(
  880. text: '类型: '
  881. ),
  882. TextSpan(
  883. text: '${_dataArray[_index]['type']==1?'整机':'拼机'}',
  884. style: TextStyle(color: Color(0xFF333333))
  885. ),
  886. TextSpan(
  887. text: '体积: '
  888. ),
  889. TextSpan(
  890. text: '${_dataArray[_index]['totalVolume']}立方米',
  891. style: TextStyle(color: Color(0xFF333333))
  892. ),
  893. TextSpan(
  894. text: '重量: '
  895. ),
  896. TextSpan(
  897. text: '${_dataArray[_index]['totalWeight']}吨',
  898. style: TextStyle(color: Color(0xFF333333))
  899. )
  900. ]
  901. ),
  902. ),
  903. Text('¥${_dataArray[_index]['discountPrice']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFFEA413A),fontWeight: FontWeight.bold),),
  904. ],
  905. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  906. ),
  907. ),
  908. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
  909. Container(
  910. height: hsp(90),
  911. alignment: Alignment.centerLeft,
  912. child: RichText(
  913. text: TextSpan(
  914. style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),
  915. children: [
  916. TextSpan(
  917. text: '说明: '
  918. ),
  919. TextSpan(
  920. text: '${_dataArray[_index]['explain']}',style: TextStyle(color: Color(0xFF333333))
  921. ),
  922. ]
  923. ),
  924. ),
  925. )
  926. ],
  927. ),
  928. ),
  929. ListView.separated(
  930. itemBuilder: (context,index){
  931. return Container(
  932. height: hsp(90),
  933. color: Colors.white,
  934. width: MediaQuery.of(context).size.width,
  935. padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  936. alignment: Alignment.centerLeft,
  937. child: index==0?Text(
  938. '货物信息',style: TextStyle(fontSize: zsp(30),color: Color(0xFF333333),fontWeight: FontWeight.bold),
  939. ):Row(
  940. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  941. children: [
  942. Text(index==1?'名称':index==2?'类型':index==3?'体积':'重量',style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),),
  943. Container(
  944. height: hsp(90),
  945. width: MediaQuery.of(context).size.width*0.7,
  946. alignment: Alignment.centerRight,
  947. child: index==2?GestureDetector(
  948. onTap: (){
  949. FocusScope.of(context).unfocus();
  950. showModalBottomSheet(
  951. context: context,
  952. builder: (context){
  953. return YSPicker(
  954. dataArray: _kinds,
  955. title: 'name',
  956. choose: (value){
  957. setState(() {
  958. _kind = value;
  959. });
  960. },
  961. );
  962. }
  963. );
  964. },
  965. child: Row(
  966. mainAxisSize: MainAxisSize.min,
  967. children: [
  968. Text(_kind==null?'请选择类型':'${_kind['name']}',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
  969. Icon(Icons.keyboard_arrow_down,size: hsp(40),color: Color(0xFF9A9A9A))
  970. ],
  971. ),
  972. ):CupertinoTextField(
  973. placeholder: index==1?'请输入名称':index==3?'请输入体积':'请输入重量',
  974. placeholderStyle: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),
  975. style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),
  976. decoration: BoxDecoration(),
  977. textAlign: TextAlign.right,
  978. suffix: Text(index==1?'':index==3?'立方米':'吨',style: TextStyle(fontSize: zsp(30),color: Colors.black)),
  979. controller: index==1?_name:index==3?_volume:_weight,
  980. keyboardType: index==1?TextInputType.text:TextInputType.numberWithOptions(),
  981. ),
  982. ),
  983. ],
  984. ),
  985. );
  986. },
  987. separatorBuilder: (context,index){
  988. return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),);
  989. },
  990. itemCount: 5,
  991. padding: EdgeInsets.only(top: hsp(10)),
  992. shrinkWrap: true,
  993. physics: NeverScrollableScrollPhysics(),
  994. ),
  995. if(_dataArray[_index]['type']==2)Container(
  996. padding: EdgeInsets.all(hsp(30)),
  997. margin: EdgeInsets.only(top: hsp(10),bottom: hsp(30)),
  998. color: Colors.white,
  999. child: Row(
  1000. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1001. children: [
  1002. Container(
  1003. width: (MediaQuery.of(context).size.width-hsp(60))*0.6,
  1004. child: SingleChildScrollView(
  1005. child: Stack(
  1006. children: [
  1007. for(int i = 0;i<(_dataArray[_index]['dtAirplaneGoods']).length;i++)Container(
  1008. height: hsp(70),
  1009. width: hsp(70),
  1010. margin: EdgeInsets.only(left: hsp(60)*i),
  1011. decoration: BoxDecoration(
  1012. color: Color(0xFFED5D57),
  1013. borderRadius: BorderRadius.all(Radius.circular(50)),
  1014. border: Border.all(color: Colors.white,width: 1),
  1015. image: DecorationImage(
  1016. image: NetworkImage('${_dataArray[_index]['dtAirplaneGoods'][i]['dtUsers']['avatar']}'),
  1017. fit: BoxFit.fill,
  1018. )
  1019. ),
  1020. )
  1021. ],
  1022. ),
  1023. scrollDirection: Axis.horizontal,
  1024. ),
  1025. ),
  1026. RichText(
  1027. text: TextSpan(
  1028. text: '已有',
  1029. style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
  1030. children: [
  1031. TextSpan(
  1032. text: '4',
  1033. style: TextStyle(color: Color(0xFF007DFF))
  1034. ),
  1035. TextSpan(
  1036. text: '个人在拼该机'
  1037. )
  1038. ]
  1039. ),
  1040. )
  1041. ],
  1042. ),
  1043. )
  1044. ],
  1045. ),
  1046. ),
  1047. ),
  1048. ],
  1049. ),
  1050. ),
  1051. Container(
  1052. height: hsp(120),
  1053. width: MediaQuery.of(context).size.width,
  1054. color: Colors.white,
  1055. padding: EdgeInsets.only(left: wsp(30),right: wsp(30)),
  1056. child: Row(
  1057. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1058. children: [
  1059. RichText(
  1060. text: TextSpan(
  1061. text: '参考价(¥)',
  1062. style: TextStyle(fontSize: zsp(22),color: Color(0xFF181818)),
  1063. children: [
  1064. TextSpan(
  1065. text: ' ${_dataArray[_index]['discountPrice']}',
  1066. style: TextStyle(fontSize: zsp(40),color: Color(0xFFFF6600)),
  1067. ),
  1068. TextSpan(
  1069. text: ' 元',
  1070. )
  1071. ]
  1072. ),
  1073. ),
  1074. // GestureDetector(
  1075. // child: Row(
  1076. // children: [
  1077. // Text('明细',style: TextStyle(fontSize: zsp(22),color: Color(0xFF181818)),),
  1078. // Icon(Icons.keyboard_arrow_up,size: hsp(30),color: Color(0xFF007EFF),),
  1079. // ],
  1080. // ),
  1081. // onTap: (){
  1082. // setState(() {
  1083. // _isDetail = !_isDetail;
  1084. // });
  1085. // },
  1086. // ),
  1087. GestureDetector(
  1088. onTap: (){
  1089. FocusScope.of(context).unfocus();
  1090. _postOrderData();
  1091. },
  1092. child: Container(
  1093. height: hsp(70),
  1094. padding: EdgeInsets.only(left: wsp(50),right: wsp(50)),
  1095. decoration: BoxDecoration(
  1096. color: Color(0xFF007EFF),
  1097. borderRadius: BorderRadius.all(Radius.circular(50))
  1098. ),
  1099. alignment: Alignment.center,
  1100. child: Text('立即预约',style: TextStyle(fontSize: zsp(30),color: Colors.white,fontWeight: FontWeight.bold),),
  1101. ),
  1102. )
  1103. ],
  1104. ),
  1105. )
  1106. ],
  1107. ),
  1108. ),
  1109. ),
  1110. )
  1111. ],
  1112. ),
  1113. ),
  1114. );
  1115. }
  1116. Future<void> _refreshData() async{
  1117. _page = 1;
  1118. Map request = {};
  1119. request['category'] = _tabValues[_typeIndex]['type'];
  1120. request['pageNo'] = _page;
  1121. request['pageSize'] = 10;
  1122. String url = '/app/applets/AirTour/list';
  1123. if(_searchStr.text.isNotEmpty){
  1124. request['name'] = _searchStr.text;
  1125. url = '/app/applets/AirTour/search';
  1126. }
  1127. Map dict = await ysRequestHttp(context,type: requestType.get,api: url,parameter: request,isLoading: false,isToken: false);
  1128. if(dict!=null){
  1129. setState(() {
  1130. _dataArray = dict['data']['resultList'];
  1131. });
  1132. }
  1133. }
  1134. Future<void> _loadMoreData() async{
  1135. _page++;
  1136. Map request = {};
  1137. request['category'] = _tabValues[_typeIndex]['type'];
  1138. request['pageNo'] = _page;
  1139. request['pageSize'] = 10;
  1140. String url = '/app/applets/AirTour/list';
  1141. if(_searchStr.text.isNotEmpty){
  1142. request['name'] = _searchStr.text;
  1143. url = '/app/applets/AirTour/search';
  1144. }
  1145. Map dict = await ysRequestHttp(context,type: requestType.get,api: url,parameter: request,isLoading: false,isToken: false);
  1146. if(dict!=null){
  1147. setState(() {
  1148. _dataArray.addAll(dict['data']['resultList']);
  1149. });
  1150. }
  1151. }
  1152. _getPriceData() async{
  1153. Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneorder/getDateAndTime',
  1154. parameter: {'time':_timeStr,'type':3,'id':_dataArray[_index]['id']},isLoading: true,isToken: true);
  1155. if(dict!=null){
  1156. _isOrder = true;
  1157. _priceList = dict['data'];
  1158. _getTypeData();
  1159. }
  1160. }
  1161. _getTypeData() async{
  1162. Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplanegoods/type/get',parameter: {},isLoading: true,isToken: false);
  1163. if(dict!=null){
  1164. setState(() {
  1165. _kinds = dict['data'];
  1166. _kind = _kinds[0];
  1167. });
  1168. }
  1169. }
  1170. _postOrderData() async{
  1171. if(_name.text.isEmpty){
  1172. ysFlutterToast(context, '货物名称不能为空');
  1173. return;
  1174. }
  1175. if(_volume.text.isEmpty){
  1176. ysFlutterToast(context, '货物体积不能为空');
  1177. return;
  1178. }
  1179. if(_weight.text.isEmpty){
  1180. ysFlutterToast(context, '货物重量不能为空');
  1181. return;
  1182. }
  1183. Map request = {};
  1184. request['flightTime'] = '2020-10-07 17:59:27';
  1185. request['type'] = 3;
  1186. request['airplaneid'] = _dataArray[_index]['id'];
  1187. request['airportidSetout'] = _dataArray[_index]['airportidSetout'];
  1188. request['airportidArrive'] = _dataArray[_index]['airportidArrive'];
  1189. request['airportidArrive'] = _dataArray[_index]['airportidArrive'];
  1190. Map value = {};
  1191. value['goodsName'] = _name.text;
  1192. value['goodsNatureId'] = _kind['id'];
  1193. value['goodsVolume'] = _volume.text;
  1194. value['goodsWeight'] = _weight.text;
  1195. value['contactPerson'] = '111';
  1196. value['phone'] = '15829646496';
  1197. value['goodsPlace'] = '西安小寨A座国际商务酒店';
  1198. value['goodsLocation'] = '108.985463,34.30501';
  1199. value['goodsUnloadingPlace'] = '上海酒店';
  1200. value['goodsUnloadingLocation'] = '108.985463,34.30501';
  1201. request['dtAirplaneGoods'] = value;
  1202. request['sourceType'] = _dataArray[_index]['type'];
  1203. Map dict = await ysRequestHttp(context,type: requestType.post,api: '/app/applets/airplaneorder/createOrder',parameter: request,isLoading: true,isToken: true);
  1204. if(dict!=null){
  1205. Navigator.of(context).push(
  1206. CupertinoPageRoute(
  1207. builder: (context){
  1208. return YSPay(orderDict: dict['data'],type: payType.goods,);
  1209. }
  1210. )
  1211. );
  1212. }
  1213. }
  1214. }