YSSearchResult.dart 81 KB

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