12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265 |
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_easyrefresh/easy_refresh.dart';
- import 'package:shared_preferences/shared_preferences.dart';
- import 'package:ysairplane2/code/YSPay.dart';
- import 'package:ysairplane2/code/YSShortDetail.dart';
- import 'package:ysairplane2/tools/YSNetWorking.dart';
- import 'package:ysairplane2/tools/YSTools.dart';
- import 'YSMarryPlane.dart';
- import 'YSSearch.dart';
- class YSSearchResult extends StatefulWidget {
- final searchStr;
- final type;
- final siftValue;
- final Map searchMap;
- const YSSearchResult({Key key, this.searchStr, this.type, this.siftValue, this.searchMap}) : super(key: key);
- @override
- _YSSearchResultState createState() => _YSSearchResultState();
- }
- class _YSSearchResultState extends State<YSSearchResult> {
- TextEditingController _searchStr = TextEditingController();
- List _tabValues = [{'name':'空中游览','type':9},{'name':'短途客运','type':6},{'name':'短途货运','type':33},{'name':'航空运动','type':5},
- {'name':'婚庆典礼','type':4}];
- int _page = 1;
- List _dataArray = [];
- int _index = 0;
- int _typeIndex = 0;
- List _priceList = [];
- List _kinds = [];
- bool _isOrder = false;
- int _selected = 0;
- Map _kind;
- String _timeStr;
- List<String> _historyList = [];
- TextEditingController _name = TextEditingController();
- TextEditingController _volume = TextEditingController();
- TextEditingController _weight = TextEditingController();
- ScrollController _typeController = ScrollController();
- @override
- void initState() {
- if(widget.searchMap!=null){
- _searchStr.text = widget.searchMap['name'];
- _tabValues.add({'name':'短途货运','type':3});
- for(int i = 0;i<_tabValues.length;i++){
- if(_tabValues[i]['type']==int.parse('${widget.searchMap['type']}')){
- _typeIndex = i;
- }
- }
- }
- if(widget.type!=null){
- _tabValues.add({'name':'短途货运','type':3});
- for(int i = 0;i<_tabValues.length;i++){
- if(_tabValues[i]['type']==int.parse('${widget.type}')){
- _typeIndex = i;
- }
- }
- }
- if(widget.searchStr!=null){
- _searchStr.text = widget.searchStr;
- }
- _timeStr = DateTime.now().year.toString()+'-'+DateTime.now().month.toString().padLeft(2,'0')+'-'
- +DateTime.now().day.toString().padLeft(2,'0')+' '+DateTime.now().hour.toString().padLeft(2,'0')+':'
- +DateTime.now().minute.toString().padLeft(2,'0');
- SharedPreferences.getInstance().then((value){
- setState(() {
- _historyList = value.getStringList('history')??[];
- });
- });
- Future.delayed(Duration(seconds: 0)).then((value){
- _refreshData();
- if(widget.searchMap!=null){
- _typeController.jumpTo(_typeIndex*(MediaQuery.of(context).size.width/4));
- }
- });
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: SingleChildScrollView(
- child: Stack(
- children: [
- SingleChildScrollView(
- child: Column(
- children: [
- Container(
- margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+hsp(42),left: wsp(32),right: wsp(32)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- GestureDetector(child: Icon(Icons.arrow_back_ios,size: hsp(40),color: Color(0xFF000000),),onTap: (){Navigator.pop(context);},),
- Container(
- width: MediaQuery.of(context).size.width-wsp(140),
- margin: EdgeInsets.only(left: wsp(34)),
- padding: EdgeInsets.only(left: wsp(26),right: wsp(26)),
- height: hsp(66),
- decoration: BoxDecoration(
- border: Border.all(color: Color(0xFF007AFF),width: 1),
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- child: CupertinoTextField(
- placeholder: '',
- placeholderStyle: TextStyle(fontSize: zsp(25),color: Color(0xFF545454)),
- style: TextStyle(fontSize: zsp(25),color: Color(0xFF545454)),
- prefix: Icon(Icons.search,size: hsp(40),color: Color(0xFF8E8E93),),
- suffix: GestureDetector(child: Icon(Icons.close,size: hsp(40),color: Color(0xFF8E8E93),),onTap: (){_searchStr.text = '';},),
- suffixMode: OverlayVisibilityMode.editing,
- controller: _searchStr,
- padding: EdgeInsets.all(0),
- decoration: BoxDecoration(),
- onChanged: (value){
- searchKey2.currentState.getSearchWordData(value);
- if(value.isEmpty){
- _refreshData();
- }
- },
- onSubmitted: (value){
- if(value.isNotEmpty){
- if(_historyList.contains(value)){
- _historyList.remove(value);
- }
- _historyList.insert(0, value);
- SharedPreferences.getInstance().then((prefer){
- prefer.setStringList('history', _historyList);
- _refreshData();
- });
- }else{
- _refreshData();
- }
- },
- textInputAction: TextInputAction.search,
- ),
- ),
- ],
- ),
- ),
- Stack(
- children: [
- Column(
- children: [
- if(widget.type==null)Container(
- height: hsp(100),
- width: MediaQuery.of(context).size.width,
- child: ListView.builder(
- itemBuilder: (context,index){
- return GestureDetector(
- onTap: (){
- _typeIndex = index;
- _refreshData();
- },
- child: Container(
- width: MediaQuery.of(context).size.width/4,
- padding: EdgeInsets.only(top: hsp(20)),
- child: Column(
- children: [
- Text('${_tabValues[index]['name']}',style: TextStyle(color: index==_typeIndex?Color(0xFF007AFF):Colors.black,
- fontWeight: _typeIndex==index?FontWeight.bold:FontWeight.normal),),
- Container(height: 2,color: index==_typeIndex?Color(0xFF007AFF):Colors.transparent,width: MediaQuery.of(context).size.width/8,
- margin: EdgeInsets.only(top: hsp(10)),)
- ],
- ),
- ),
- );
- },
- padding: EdgeInsets.all(0),
- itemCount: _tabValues.length,
- scrollDirection: Axis.horizontal,
- controller: _typeController,
- ),
- ),
- Container(
- height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-hsp(widget.type==null?208:108),
- color: Color(0xFFF1F2F3),
- child: widget.type==null?PageView(
- children: [
- Container(
- height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-hsp(208),
- color: Color(0xFFF1F2F3),
- child: EasyRefresh(
- onRefresh: _refreshData,
- onLoad: _loadMoreData,
- header: TaurusHeader(
- ),
- footer: TaurusFooter(
- ),
- child: ListView.separated(
- itemBuilder: (context,index){
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: (){
- if(_typeIndex==2){
- _index = index;
- _getPriceData();
- }else{
- Navigator.of(context).push(
- CupertinoPageRoute(
- builder: (context){
- return _typeIndex==1?YSShortDetail(shortId: _dataArray[index]['id'],):
- YSMarryPlane(marryId: _dataArray[index]['id'],type: _typeIndex==0?9:_typeIndex==3?5:4);
- }
- )
- );
- }
- },
- child: Container(
- padding: EdgeInsets.all(hsp(30)),
- child: _typeIndex==1?Row(
- children: [
- Container(
- height: hsp(200),
- width: hsp(250),
- margin: EdgeInsets.only(right: hsp(30)),
- child: ysImageLoad(
- imageUrl: '${_dataArray[index]['cover']}',
- fit: BoxFit.fill,
- height: hsp(200),
- width: hsp(250),
- ),
- ),
- Container(
- width: MediaQuery.of(context).size.width-hsp(340),
- height: hsp(200),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- width: MediaQuery.of(context).size.width-hsp(340),
- child: SingleChildScrollView(
- scrollDirection: Axis.horizontal,
- child: Row(
- children: [
- Text('${_dataArray[index]['setoutInfo']['display']}',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),),
- Container(
- height: 2,
- width: wsp(40),
- margin: EdgeInsets.only(left: wsp(10),right: wsp(10)),
- color: Color(0xFFCCCCCC),
- ),
- Text('${_dataArray[index]['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),)
- ],
- ),
- ),
- ),
- Text('${_dataArray[index]['dtFlightInformation']['partnerName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('${_dataArray[index]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
- RichText(
- text: TextSpan(
- text: '¥',
- style: TextStyle(fontSize: zsp(24),color: Color(0xFFEB423B)),
- children: [
- TextSpan(
- text: '${_dataArray[index]['discountPrice']}',
- style: TextStyle(fontSize: zsp(42),fontWeight: FontWeight.bold),
- ),
- TextSpan(
- text: '元起',
- style: TextStyle(fontSize: zsp(20)),
- )
- ]
- ),
- )
- ],
- )
- ],
- ),
- )
- ],
- ):_typeIndex==2?Column(
- children: [
- Container(
- padding: EdgeInsets.only(bottom: hsp(30)),
- child: Column(
- children: [
- Row(
- children: [
- Container(
- width: (MediaQuery.of(context).size.width-hsp(200))/2,
- child: SingleChildScrollView(
- child: Text('${_dataArray[index]['setoutInfo']['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
- scrollDirection: Axis.horizontal,
- )
- ),
- Image(height: hsp(60),width: hsp(60),image: AssetImage('lib/images/plane.png'),),
- Container(
- width: (MediaQuery.of(context).size.width-hsp(200))/2,
- child: SingleChildScrollView(
- child: Text('${_dataArray[index]['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
- scrollDirection: Axis.horizontal,
- ),
- alignment: Alignment.centerRight,
- ),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- width: (MediaQuery.of(context).size.width-hsp(250))/2,
- child: SingleChildScrollView(
- child: Text('${_dataArray[index]['setoutInfo']['airplaneName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
- scrollDirection: Axis.horizontal,
- )
- ),
- Text('${_dataArray[index]['hour']}',style: TextStyle(fontSize: zsp(20),color: Color(0xFF343434)),),
- Container(
- width: (MediaQuery.of(context).size.width-hsp(250))/2,
- child: SingleChildScrollView(
- child: Text('${_dataArray[index]['arriveInfo']['airplaneName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
- scrollDirection: Axis.horizontal,
- ),
- alignment: Alignment.centerRight,
- ),
- ],
- )
- ],
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
- Container(
- height: hsp(70),
- child: Row(
- children: [
- Text('${_dataArray[index]['flightTime']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF333333)),),
- Text('机型: ${_dataArray[index]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF333333)),),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
- Container(
- height: hsp(70),
- child: Row(
- children: [
- RichText(
- text: TextSpan(
- style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '类型: '
- ),
- TextSpan(
- text: '${_dataArray[index]['type']==1?'整机':'拼机'}',
- style: TextStyle(color: Color(0xFF333333))
- ),
- TextSpan(
- text: '体积: '
- ),
- TextSpan(
- text: '${_dataArray[index]['totalVolume']}立方米',
- style: TextStyle(color: Color(0xFF333333))
- ),
- TextSpan(
- text: '重量: '
- ),
- TextSpan(
- text: '${_dataArray[index]['totalWeight']}吨',
- style: TextStyle(color: Color(0xFF333333))
- )
- ]
- ),
- ),
- Text('¥${_dataArray[index]['discountPrice']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFFEA413A),fontWeight: FontWeight.bold),),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- margin: EdgeInsets.only(top: hsp(20)),
- ),
- ],
- ):Row(
- children: [
- Container(
- height: hsp(200),
- width: hsp(250),
- child: ysImageLoad(
- imageUrl: '${_dataArray[index]['cover']}',
- fit: BoxFit.fill,
- height: hsp(200),
- width: hsp(250),
- ),
- margin: EdgeInsets.only(right: hsp(30)),
- ),
- Container(
- width: MediaQuery.of(context).size.width-hsp(340),
- height: hsp(200),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('${_dataArray[index]['title']}',style: TextStyle(fontSize: zsp(30),color: Color(0xFF343434)),maxLines: 2,),
- Text('${_dataArray[index]['dtFlightInformation']['partnerName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('${_dataArray[index]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
- RichText(
- text: TextSpan(
- text: '¥',
- style: TextStyle(fontSize: zsp(24),color: Color(0xFFEB423B)),
- children: [
- TextSpan(
- text: '${_dataArray[index]['discountPrice']}',
- style: TextStyle(fontSize: zsp(42),fontWeight: FontWeight.bold),
- ),
- TextSpan(
- text: '元起',
- style: TextStyle(fontSize: zsp(20)),
- )
- ]
- ),
- )
- ],
- )
- ],
- ),
- )
- ],
- ),
- ),
- );
- },
- separatorBuilder: (context,index){
- return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEEEEEE),);
- },
- itemCount: _dataArray.length,
- padding: EdgeInsets.all(0),
- ),
- ),
- )
- ],
- ): Container(
- margin: EdgeInsets.only(top: hsp(20)),
- height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-hsp(108),
- color: Color(0xFFF1F2F3),
- child: EasyRefresh(
- onRefresh: _refreshData,
- onLoad: _loadMoreData,
- header: TaurusHeader(
- ),
- footer: TaurusFooter(
- ),
- child: ListView.separated(
- itemBuilder: (context,index){
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: (){
- if(_typeIndex==2){
- _index = index;
- _getPriceData();
- }else{
- Navigator.of(context).push(
- CupertinoPageRoute(
- builder: (context){
- return _typeIndex==1?YSShortDetail(shortId: _dataArray[index]['id'],):
- YSMarryPlane(marryId: _dataArray[index]['id'],type: _typeIndex==0?9:_typeIndex==3?5:4);
- }
- )
- );
- }
- },
- child: Container(
- padding: EdgeInsets.all(hsp(30)),
- child: _typeIndex==1?Row(
- children: [
- Container(
- height: hsp(200),
- width: hsp(250),
- margin: EdgeInsets.only(right: hsp(30)),
- child: ysImageLoad(
- imageUrl: '${_dataArray[index]['cover']}',
- fit: BoxFit.fill,
- height: hsp(200),
- width: hsp(250),
- ),
- ),
- Container(
- width: MediaQuery.of(context).size.width-hsp(340),
- height: hsp(200),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- width: MediaQuery.of(context).size.width-hsp(340),
- child: SingleChildScrollView(
- scrollDirection: Axis.horizontal,
- child: Row(
- children: [
- Text('${_dataArray[index]['setoutInfo']['display']}',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),),
- Container(
- height: 2,
- width: wsp(40),
- margin: EdgeInsets.only(left: wsp(10),right: wsp(10)),
- color: Color(0xFFCCCCCC),
- ),
- Text('${_dataArray[index]['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),)
- ],
- ),
- ),
- ),
- Text('${_dataArray[index]['dtFlightInformation']['partnerName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('${_dataArray[index]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
- RichText(
- text: TextSpan(
- text: '¥',
- style: TextStyle(fontSize: zsp(24),color: Color(0xFFEB423B)),
- children: [
- TextSpan(
- text: '${_dataArray[index]['discountPrice']}',
- style: TextStyle(fontSize: zsp(42),fontWeight: FontWeight.bold),
- ),
- TextSpan(
- text: '元起',
- style: TextStyle(fontSize: zsp(20)),
- )
- ]
- ),
- )
- ],
- )
- ],
- ),
- )
- ],
- ):_typeIndex==2?Column(
- children: [
- Container(
- padding: EdgeInsets.only(bottom: hsp(30)),
- child: Column(
- children: [
- Row(
- children: [
- Text('${_dataArray[index]['setoutInfo']['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
- Image(height: hsp(60),width: hsp(60),image: AssetImage('lib/images/plane.png'),),
- Text('${_dataArray[index]['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('${_dataArray[index]['setoutInfo']['airplaneName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
- Text('${_dataArray[index]['hour']}',style: TextStyle(fontSize: zsp(20),color: Color(0xFF343434)),),
- Text('${_dataArray[index]['arriveInfo']['airplaneName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
- ],
- )
- ],
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
- Container(
- height: hsp(70),
- child: Row(
- children: [
- Text('${_dataArray[index]['flightTime']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF333333)),),
- Text('机型: ${_dataArray[index]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF333333)),),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
- Container(
- height: hsp(70),
- child: Row(
- children: [
- RichText(
- text: TextSpan(
- style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '类型: '
- ),
- TextSpan(
- text: '${_dataArray[index]['type']==1?'整机':'拼机'}',
- style: TextStyle(color: Color(0xFF333333))
- ),
- TextSpan(
- text: '体积: '
- ),
- TextSpan(
- text: '${_dataArray[index]['totalVolume']}立方米',
- style: TextStyle(color: Color(0xFF333333))
- ),
- TextSpan(
- text: '重量: '
- ),
- TextSpan(
- text: '${_dataArray[index]['totalWeight']}吨',
- style: TextStyle(color: Color(0xFF333333))
- )
- ]
- ),
- ),
- Text('¥${_dataArray[index]['discountPrice']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFFEA413A),fontWeight: FontWeight.bold),),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- margin: EdgeInsets.only(top: hsp(20)),
- ),
- ],
- ):Row(
- children: [
- Container(
- height: hsp(200),
- width: hsp(250),
- child: ysImageLoad(
- imageUrl: '${_dataArray[index]['cover']}',
- fit: BoxFit.fill,
- height: hsp(200),
- width: hsp(250),
- ),
- margin: EdgeInsets.only(right: hsp(30)),
- ),
- Container(
- width: MediaQuery.of(context).size.width-hsp(340),
- height: hsp(200),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('${_dataArray[index]['title']}',style: TextStyle(fontSize: zsp(30),color: Color(0xFF343434)),maxLines: 2,),
- Text('${_dataArray[index]['dtFlightInformation']['partnerName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('${_dataArray[index]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
- RichText(
- text: TextSpan(
- text: '¥',
- style: TextStyle(fontSize: zsp(24),color: Color(0xFFEB423B)),
- children: [
- TextSpan(
- text: '${_dataArray[index]['discountPrice']}',
- style: TextStyle(fontSize: zsp(42),fontWeight: FontWeight.bold),
- ),
- TextSpan(
- text: '元起',
- style: TextStyle(fontSize: zsp(20)),
- )
- ]
- ),
- )
- ],
- )
- ],
- ),
- )
- ],
- ),
- ),
- );
- },
- separatorBuilder: (context,index){
- return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEEEEEE),);
- },
- itemCount: _dataArray.length,
- padding: EdgeInsets.all(0),
- ),
- ),
- ),
- )
- ],
- ),
- YSSearchWordView(key: searchKey2, historyList: _historyList,wordSetter: (value){
- _searchStr.text = value;
- _refreshData();
- searchKey2.currentState.getSearchWordData('');
- },)
- ],
- )
- ],
- ),
- ),
- if(_isOrder==true)GestureDetector(
- onTap: (){
- setState(() {
- _isOrder = false;
- });
- },
- child: Container(
- height: MediaQuery.of(context).size.height,
- width: MediaQuery.of(context).size.width,
- color: Colors.black54,
- child: GestureDetector(
- onTap: (){},
- child: Column(
- children: [
- Container(
- height: MediaQuery.of(context).size.height*0.8-hsp(120),
- width: MediaQuery.of(context).size.width,
- margin: EdgeInsets.only(top: MediaQuery.of(context).size.height*0.2),
- decoration: BoxDecoration(
- color: Color(0xFFF1F2F3),
- borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10))
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- height: hsp(100),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10))
- ),
- padding: EdgeInsets.only(left: 15,right: 15),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(width: wsp(50),),
- Text('订单确认',style: TextStyle(fontSize: 15,color: Color(0xFF000000),decoration: TextDecoration.none,fontWeight: FontWeight.bold),),
- GestureDetector(
- child: Text('关闭',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none,fontWeight: FontWeight.bold),),
- onTap: (){
- setState(() {
- _isOrder = false;
- });
- },
- ),
- ],
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE5E5E5),),
- Container(
- height: MediaQuery.of(context).size.height*0.8-hsp(220)-0.5,
- child: SingleChildScrollView(
- padding: EdgeInsets.all(0),
- child: Column(
- children: [
- Container(
- padding: EdgeInsets.all(hsp(30)),
- color: Colors.white,
- width: MediaQuery.of(context).size.width,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('使用日期',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
- Container(
- margin: EdgeInsets.only(top: hsp(20)),
- child: Row(
- children: [
- Container(
- height: hsp(120),
- width: MediaQuery.of(context).size.width-hsp(200),
- child: ListView.separated(
- itemBuilder: (context,index){
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: (){
- setState(() {
- _selected = index;
- });
- },
- child: Stack(
- children: [
- Container(
- height: hsp(120),
- width: (MediaQuery.of(context).size.width-hsp(230))/3,
- decoration: BoxDecoration(
- color: index==_selected?Color(0xFF007EFF):Color(0xFFF0EEEE),
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- alignment: Alignment.center,
- child: Text('${_priceList[index]['time']} \n¥${_priceList[index]['price']}',
- style: TextStyle(fontSize: zsp(20),color: index==_selected?Colors.white:Color(0xFF8B8B8B)),textAlign: TextAlign.center,),
- ),
- if(_selected==index)Container(
- child: Text(timeTag('${_priceList[index]['time']}'),style: TextStyle(fontSize: zsp(16),color: Color(0xFF007EFF)),),
- height: hsp(30),
- padding: EdgeInsets.only(left: wsp(3),right: wsp(3)),
- decoration: BoxDecoration(
- color: Color(0xFFF7F7F7),
- borderRadius: BorderRadius.only(topLeft: Radius.circular(3),bottomRight: Radius.circular(5))
- ),
- alignment: Alignment.center,
- ),
- ],
- ),
- );
- },
- separatorBuilder: (context,index){
- return Container(width: hsp(15),color: Colors.white,);
- },
- itemCount: _priceList.length,
- padding: EdgeInsets.all(0),
- scrollDirection: Axis.horizontal,
- ),
- ),
- GestureDetector(
- onTap: (){
- dateChooseAlert(context,dateValue: (dateValue){
- Map time = {'time':dateValue,'price':_priceList[0]['price'],'discountprice':_priceList[0]['discountprice']};
- int index;
- for(int i=0;i<_priceList.length;i++){
- if(_priceList[i]['time']==time['time']){
- index = i;
- }
- }
- if(index!=null){
- _priceList.removeAt(index);
- }
- setState(() {
- _priceList.insert(0, time);
- });
- });
- },
- behavior: HitTestBehavior.opaque,
- child: Container(
- height: hsp(120),
- width: hsp(140),
- alignment: Alignment.center,
- child: Text('更多\n日期',style: TextStyle(fontSize: zsp(26),color: Color(0xFF007EFF)),),
- ),
- )
- ],
- ),
- ),
- ],
- ),
- ),
- if(_dataArray[_index]['type']==2)Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(10)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('本次拼机截止时间:${_dataArray[_index]['deadlineTime']}',style: TextStyle(fontSize: zsp(26),color: Color(0xFF999999)),),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('0吨',style: TextStyle(fontSize: zsp(22),color: Color(0xFF656565)),),
- Container(
- height: hsp(100),
- width: MediaQuery.of(context).size.width-hsp(200),
- child: Slider(
- value: double.parse('${_dataArray[_index]['nowWeight']}'),
- onChanged: (value){
- },
- activeColor: Color(0xFF0079FF),
- min: 0,
- max: 10,
- divisions: 4,
- ),
- ),
- Text('${_dataArray[_index]['totalWeight']}吨',style: TextStyle(fontSize: zsp(22),color: Color(0xFF656565)),),
- ],
- ),
- Container(
- width: MediaQuery.of(context).size.width,
- child: Text('目标${_dataArray[_index]['nowWeight']}吨',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
- alignment: Alignment.center,
- ),
- ],
- ),
- ),
- Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(10)),
- color: Colors.white,
- child: Column(
- children: [
- Container(
- padding: EdgeInsets.only(bottom: hsp(30)),
- child: Column(
- children: [
- Row(
- children: [
- Text('${_dataArray[_index]['setoutInfo']['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
- Image(height: hsp(60),width: hsp(60),image: AssetImage('lib/images/plane.png'),),
- Text('${_dataArray[_index]['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('${_dataArray[_index]['setoutInfo']['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
- Text('${_dataArray[_index]['hour']}',style: TextStyle(fontSize: zsp(20),color: Color(0xFF343434)),),
- Text('${_dataArray[_index]['arriveInfo']['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
- ],
- )
- ],
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
- Container(
- height: hsp(70),
- child: Row(
- children: [
- Text('${_dataArray[_index]['flightTime']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF333333)),),
- Text('机型: ${_dataArray[_index]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF333333)),),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
- Container(
- height: hsp(90),
- alignment: Alignment.centerLeft,
- child: Row(
- children: [
- RichText(
- text: TextSpan(
- style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '类型: '
- ),
- TextSpan(
- text: '${_dataArray[_index]['type']==1?'整机':'拼机'}',
- style: TextStyle(color: Color(0xFF333333))
- ),
- TextSpan(
- text: '体积: '
- ),
- TextSpan(
- text: '${_dataArray[_index]['totalVolume']}立方米',
- style: TextStyle(color: Color(0xFF333333))
- ),
- TextSpan(
- text: '重量: '
- ),
- TextSpan(
- text: '${_dataArray[_index]['totalWeight']}吨',
- style: TextStyle(color: Color(0xFF333333))
- )
- ]
- ),
- ),
- Text('¥${_dataArray[_index]['discountPrice']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFFEA413A),fontWeight: FontWeight.bold),),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
- Container(
- height: hsp(90),
- alignment: Alignment.centerLeft,
- child: RichText(
- text: TextSpan(
- style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '说明: '
- ),
- TextSpan(
- text: '${_dataArray[_index]['explain']}',style: TextStyle(color: Color(0xFF333333))
- ),
- ]
- ),
- ),
- )
- ],
- ),
- ),
- ListView.separated(
- itemBuilder: (context,index){
- return Container(
- height: hsp(90),
- color: Colors.white,
- width: MediaQuery.of(context).size.width,
- padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
- alignment: Alignment.centerLeft,
- child: index==0?Text(
- '货物信息',style: TextStyle(fontSize: zsp(30),color: Color(0xFF333333),fontWeight: FontWeight.bold),
- ):Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(index==1?'名称':index==2?'类型':index==3?'体积':'重量',style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),),
- Container(
- height: hsp(90),
- width: MediaQuery.of(context).size.width*0.7,
- alignment: Alignment.centerRight,
- child: index==2?GestureDetector(
- onTap: (){
- FocusScope.of(context).unfocus();
- showModalBottomSheet(
- context: context,
- builder: (context){
- return YSPicker(
- dataArray: _kinds,
- title: 'name',
- choose: (value){
- setState(() {
- _kind = value;
- });
- },
- );
- }
- );
- },
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(_kind==null?'请选择类型':'${_kind['name']}',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
- Icon(Icons.keyboard_arrow_down,size: hsp(40),color: Color(0xFF9A9A9A))
- ],
- ),
- ):CupertinoTextField(
- placeholder: index==1?'请输入名称':index==3?'请输入体积':'请输入重量',
- placeholderStyle: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),
- decoration: BoxDecoration(),
- textAlign: TextAlign.right,
- suffix: Text(index==1?'':index==3?'立方米':'吨',style: TextStyle(fontSize: zsp(30),color: Colors.black)),
- controller: index==1?_name:index==3?_volume:_weight,
- keyboardType: index==1?TextInputType.text:TextInputType.numberWithOptions(),
- ),
- ),
- ],
- ),
- );
- },
- separatorBuilder: (context,index){
- return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),);
- },
- itemCount: 5,
- padding: EdgeInsets.only(top: hsp(10)),
- shrinkWrap: true,
- physics: NeverScrollableScrollPhysics(),
- ),
- if(_dataArray[_index]['type']==2)Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(10),bottom: hsp(30)),
- color: Colors.white,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- width: (MediaQuery.of(context).size.width-hsp(60))*0.6,
- child: SingleChildScrollView(
- child: Stack(
- children: [
- for(int i = 0;i<(_dataArray[_index]['dtAirplaneGoods']).length;i++)Container(
- height: hsp(70),
- width: hsp(70),
- margin: EdgeInsets.only(left: hsp(60)*i),
- decoration: BoxDecoration(
- color: Color(0xFFED5D57),
- borderRadius: BorderRadius.all(Radius.circular(50)),
- border: Border.all(color: Colors.white,width: 1),
- image: DecorationImage(
- image: NetworkImage('${_dataArray[_index]['dtAirplaneGoods'][i]['dtUsers']['avatar']}'),
- fit: BoxFit.fill,
- )
- ),
- )
- ],
- ),
- scrollDirection: Axis.horizontal,
- ),
- ),
- RichText(
- text: TextSpan(
- text: '已有',
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '4',
- style: TextStyle(color: Color(0xFF007DFF))
- ),
- TextSpan(
- text: '个人在拼该机'
- )
- ]
- ),
- )
- ],
- ),
- )
- ],
- ),
- ),
- ),
- ],
- ),
- ),
- Container(
- height: hsp(120),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- padding: EdgeInsets.only(left: wsp(30),right: wsp(30)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- RichText(
- text: TextSpan(
- text: '参考价(¥)',
- style: TextStyle(fontSize: zsp(22),color: Color(0xFF181818)),
- children: [
- TextSpan(
- text: ' ${_dataArray[_index]['discountPrice']}',
- style: TextStyle(fontSize: zsp(40),color: Color(0xFFFF6600)),
- ),
- TextSpan(
- text: ' 元',
- )
- ]
- ),
- ),
- // GestureDetector(
- // child: Row(
- // children: [
- // Text('明细',style: TextStyle(fontSize: zsp(22),color: Color(0xFF181818)),),
- // Icon(Icons.keyboard_arrow_up,size: hsp(30),color: Color(0xFF007EFF),),
- // ],
- // ),
- // onTap: (){
- // setState(() {
- // _isDetail = !_isDetail;
- // });
- // },
- // ),
- GestureDetector(
- onTap: (){
- FocusScope.of(context).unfocus();
- _postOrderData();
- },
- child: Container(
- height: hsp(70),
- padding: EdgeInsets.only(left: wsp(50),right: wsp(50)),
- decoration: BoxDecoration(
- color: Color(0xFF007EFF),
- borderRadius: BorderRadius.all(Radius.circular(50))
- ),
- alignment: Alignment.center,
- child: Text('立即预约',style: TextStyle(fontSize: zsp(30),color: Colors.white,fontWeight: FontWeight.bold),),
- ),
- )
- ],
- ),
- )
- ],
- ),
- ),
- ),
- )
- ],
- ),
- ),
- );
- }
- Future<void> _refreshData() async{
- _page = 1;
- Map request = {};
- request['category'] = _tabValues[_typeIndex]['type'];
- request['pageNo'] = _page;
- request['pageSize'] = 10;
- String url = '/app/applets/AirTour/list';
- if(_searchStr.text.isNotEmpty){
- request['name'] = _searchStr.text;
- url = '/app/applets/AirTour/search';
- }
- if(widget.searchMap!=null){
- request['city'] = widget.searchMap['city'];
- }
- Map dict = await ysRequestHttp(context,type: requestType.get,api: url,parameter: request,isLoading: false,isToken: false);
- if(dict!=null){
- setState(() {
- _dataArray = dict['data']['resultList'];
- });
- }
- }
- Future<void> _loadMoreData() async{
- _page++;
- Map request = {};
- request['category'] = _tabValues[_typeIndex]['type'];
- request['pageNo'] = _page;
- request['pageSize'] = 10;
- String url = '/app/applets/AirTour/list';
- if(_searchStr.text.isNotEmpty){
- request['name'] = _searchStr.text;
- url = '/app/applets/AirTour/search';
- }
- Map dict = await ysRequestHttp(context,type: requestType.get,api: url,parameter: request,isLoading: false,isToken: false);
- if(dict!=null){
- setState(() {
- _dataArray.addAll(dict['data']['resultList']);
- });
- }
- }
- _getPriceData() async{
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneorder/getDateAndTime',
- parameter: {'time':_timeStr,'type':3,'id':_dataArray[_index]['id']},isLoading: true,isToken: true);
- if(dict!=null){
- _isOrder = true;
- _priceList = dict['data'];
- _getTypeData();
- }
- }
- _getTypeData() async{
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplanegoods/type/get',parameter: {},isLoading: true,isToken: false);
- if(dict!=null){
- setState(() {
- _kinds = dict['data'];
- _kind = _kinds[0];
- });
- }
- }
- _postOrderData() async{
- if(_name.text.isEmpty){
- ysFlutterToast(context, '货物名称不能为空');
- return;
- }
- if(_volume.text.isEmpty){
- ysFlutterToast(context, '货物体积不能为空');
- return;
- }
- if(_weight.text.isEmpty){
- ysFlutterToast(context, '货物重量不能为空');
- return;
- }
- Map request = {};
- request['flightTime'] = '2020-10-07 17:59:27';
- request['type'] = 3;
- request['airplaneid'] = _dataArray[_index]['id'];
- request['airportidSetout'] = _dataArray[_index]['airportidSetout'];
- request['airportidArrive'] = _dataArray[_index]['airportidArrive'];
- request['airportidArrive'] = _dataArray[_index]['airportidArrive'];
- Map value = {};
- value['goodsName'] = _name.text;
- value['goodsNatureId'] = _kind['id'];
- value['goodsVolume'] = _volume.text;
- value['goodsWeight'] = _weight.text;
- value['contactPerson'] = '111';
- value['phone'] = '15829646496';
- value['goodsPlace'] = '西安小寨A座国际商务酒店';
- value['goodsLocation'] = '108.985463,34.30501';
- value['goodsUnloadingPlace'] = '上海酒店';
- value['goodsUnloadingLocation'] = '108.985463,34.30501';
- request['dtAirplaneGoods'] = value;
- request['sourceType'] = _dataArray[_index]['type'];
- Map dict = await ysRequestHttp(context,type: requestType.post,api: '/app/applets/airplaneorder/createOrder',parameter: request,isLoading: true,isToken: true);
- if(dict!=null){
- Navigator.of(context).push(
- CupertinoPageRoute(
- builder: (context){
- return YSPay(orderDict: dict['data'],type: payType.goods,);
- }
- )
- );
- }
- }
- }
|