YSSearchResult.dart 80 KB

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