123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245 |
- import 'dart:convert';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_easyrefresh/easy_refresh.dart';
- import 'package:ysairplane/code/YSIssue.dart';
- import 'package:ysairplane/tools/YSNetWorking.dart';
- import 'package:ysairplane/tools/YSTools.dart';
- import 'YSPay.dart';
- class YSShortGoods extends StatefulWidget {
- @override
- _YSShortGoodsState createState() => _YSShortGoodsState();
- }
- class _YSShortGoodsState extends State<YSShortGoods> {
- int _type = 1;
- bool _isDetail = false;
- bool _isOrder = false;
- int _index,_selected = 0;
- Map _msgDict,_kind;
- List chooses = ['货源','机源'];
- String choose = '货源';
- int _page = 1;
- List _dataArray = [];
- List _priceList = [];
- List _kinds = [];
- TextEditingController _name = TextEditingController();
- TextEditingController _volume = TextEditingController();
- TextEditingController _weight = TextEditingController();
- @override
- void initState() {
- Future.delayed(Duration(seconds: 0)).then((value){
- _getBackImageData();
- _refreshData();
- });
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Color(0xFFF1F2F4),
- body: SingleChildScrollView(
- child: Stack(
- children: [
- Container(
- height: MediaQuery.of(context).padding.top+hsp(370),
- width: MediaQuery.of(context).size.width,
- child: Image(
- image: _msgDict==null?AssetImage('lib/images/home3.png'):NetworkImage('${_msgDict['background']}'),
- fit: BoxFit.fill,
- ),
- ),
- if(_msgDict!=null)Container(
- margin: EdgeInsets.only(left: wsp(50),top: MediaQuery.of(context).padding.top+hsp(250)),
- child: RichText(
- text: TextSpan(
- text: '${_msgDict['name']} ',
- style: TextStyle(fontSize: zsp(50),color: Colors.white,fontWeight: FontWeight.bold),
- children: [
- TextSpan(
- text: '${_msgDict['subtitle']}',
- style: TextStyle(fontWeight: FontWeight.normal,fontSize: zsp(28),color: Colors.white.withOpacity(0.5))
- )
- ]
- ),
- ),
- ),
- GestureDetector(
- onTap: (){
- Navigator.pop(context);
- },
- child: Container(
- margin: EdgeInsets.only(left: hsp(30),right: wsp(30),top: MediaQuery.of(context).padding.top+hsp(65)),
- child: Icon(Icons.arrow_back_ios,color: Colors.white,size: hsp(50),),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: hsp(110),top: MediaQuery.of(context).padding.top+hsp(60)),
- width: MediaQuery.of(context).size.width-hsp(340),
- height: hsp(60),
- decoration: BoxDecoration(
- color: Colors.black.withOpacity(0.35),
- borderRadius: BorderRadius.all(Radius.circular(50))
- ),
- padding: EdgeInsets.only(left: wsp(30),right: wsp(30)),
- child: Row(
- children: [
- DropdownButton(
- value: choose,
- items: [
- for(int i=0;i<chooses.length;i++)DropdownMenuItem(child: Text('${chooses[i]}'),value: '${chooses[i]}',),
- ],
- onChanged: (value){
- setState(() {
- choose = value;
- });
- },
- underline: Container(),
- icon: Icon(Icons.keyboard_arrow_down,color: Colors.white.withOpacity(0.5),size: hsp(40),),
- style: TextStyle(fontSize: zsp(26),color: Colors.white),
- dropdownColor: Colors.black45,
- ),
- Container(
- height: hsp(30),
- width: 0.5,
- margin: EdgeInsets.only(left: wsp(10),right: wsp(10)),
- color: Colors.white.withOpacity(0.2),
- ),
- Row(
- children: [
- Icon(Icons.search,color: Colors.white.withOpacity(0.5),size: hsp(50),),
- Text(' 搜商机',style: TextStyle(fontSize: zsp(26),color: Colors.white.withOpacity(0.5)),),
- ],
- )
- ],
- ),
- ),
- GestureDetector(
- onTap: (){
- Navigator.of(context).push(
- CupertinoPageRoute(
- builder: (context){
- return YSIssue();
- }
- )
- ).then((value){
- if(value!=null&&_type==1){
- _refreshData();
- }
- });
- },
- child: Container(
- margin: EdgeInsets.only(left: hsp(110)+MediaQuery.of(context).size.width-hsp(340),top: MediaQuery.of(context).padding.top+hsp(60)),
- width: hsp(200),
- alignment: Alignment.center,
- child: Text('我要发布',style: TextStyle(fontSize: zsp(30),color: Colors.white),),
- ),
- ),
- Container(
- margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+hsp(350)),
- width: MediaQuery.of(context).size.width,
- height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-hsp(350),
- decoration: BoxDecoration(
- color: Color(0xFFF1F2F4),
- borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10))
- ),
- child: Column(
- children: [
- Row(
- children: [
- GestureDetector(
- onTap: (){
- _type = 1;
- _refreshData();
- },
- child: Container(
- height: hsp(100),
- width: MediaQuery.of(context).size.width/2,
- padding: EdgeInsets.only(top: hsp(30)),
- decoration: BoxDecoration(
- color: _type==1?Colors.white:Color(0xFFF1F2F3),
- borderRadius: BorderRadius.only(topLeft: Radius.circular(10))
- ),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('货源',style: TextStyle(fontSize: zsp(34),color: Colors.black,fontWeight: FontWeight.bold),),
- Container(
- height: hsp(6),
- width: wsp(66),
- color: _type==1?Color(0xFF007EFF):Colors.transparent,
- )
- ],
- ),
- ),
- ),
- GestureDetector(
- onTap: (){
- _type = 2;
- _refreshData();
- },
- child: Container(
- height: hsp(100),
- width: MediaQuery.of(context).size.width/2,
- padding: EdgeInsets.only(top: hsp(30)),
- decoration: BoxDecoration(
- color: _type==2?Colors.white:Color(0xFFF1F2F3),
- borderRadius: BorderRadius.only(topRight: Radius.circular(10))
- ),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('机源',style: TextStyle(fontSize: zsp(34),color: Colors.black,fontWeight: FontWeight.bold),),
- Container(
- height: hsp(6),
- width: wsp(66),
- color: _type==2?Color(0xFF007EFF):Colors.transparent,
- )
- ],
- ),
- ),
- )
- ],
- ),
- Container(
- height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-hsp(450),
- child: EasyRefresh(
- onRefresh: _refreshData,
- onLoad: _loadMoreData,
- header: TaurusHeader(
- ),
- footer: TaurusFooter(
- ),
- child: ListView.separated(
- itemBuilder: (context,index){
- return _type==1?GestureDetector(
- onTap: (){
- showModalBottomSheet(
- backgroundColor: Colors.transparent,
- isScrollControlled: true,
- context: context,
- builder: (context){
- return Container(
- height: MediaQuery.of(context).size.height*0.5,
- child: Column(
- children: [
- Container(
- height: hsp(100),
- padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.only(topRight: Radius.circular(10),topLeft: Radius.circular(10))
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- GestureDetector(
- child: Text('关闭',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none),),
- onTap: (){
- Navigator.pop(context);
- },
- ),
- Text('货源详情',style: TextStyle(fontSize: 15,color: Color(0xFF000000),decoration: TextDecoration.none,fontWeight: FontWeight.bold),),
- Container(width: wsp(50),),
- ],
- ),
- ),
- Container(
- height: MediaQuery.of(context).size.height*0.5-hsp(100),
- color: Color(0xFFF7F7F7),
- child: ListView.separated(
- itemBuilder: (context,indexSub){
- return Container(
- padding: EdgeInsets.only(left: hsp(40),right: hsp(40),top: hsp(20),bottom: hsp(20)),
- child: indexSub==0?Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- RichText(
- text: TextSpan(
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '货物名称: '
- ),
- TextSpan(
- text: '${_dataArray[index]['goodsName']}',
- style: TextStyle(color: Color(0xFF333333))
- ),
- ]
- ),
- ),
- RichText(
- text: TextSpan(
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '性质: '
- ),
- TextSpan(
- text: '${_dataArray[index]['goodsNatureName']}',
- style: TextStyle(color: Color(0xFF333333))
- ),
- ]
- ),
- ),
- Row(
- children: [
- RichText(
- text: TextSpan(
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '体积: '
- ),
- TextSpan(
- text: '${_dataArray[index]['goodsVolume']}立方米',
- style: TextStyle(color: Color(0xFF333333))
- ),
- ]
- ),
- ),
- RichText(
- text: TextSpan(
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '重量: '
- ),
- TextSpan(
- text: '${_dataArray[index]['goodsWeight']}吨',
- style: TextStyle(color: Color(0xFF333333))
- ),
- ]
- ),
- )
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- )
- ],
- ):indexSub==1?Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- RichText(
- text: TextSpan(
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '出发地: '
- ),
- TextSpan(
- text: '${_dataArray[index]['citySetout']}',
- style: TextStyle(color: Color(0xFF333333))
- ),
- ]
- ),
- ),
- RichText(
- text: TextSpan(
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '运货地点:'
- ),
- TextSpan(
- text: '${_dataArray[index]['goodsPlace']}',
- style: TextStyle(color: Color(0xFF333333))
- ),
- ]
- ),
- ),
- RichText(
- text: TextSpan(
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '到达地:'
- ),
- TextSpan(
- text: '${_dataArray[index]['cityArrive']}',
- style: TextStyle(color: Color(0xFF333333))
- ),
- ]
- ),
- ),
- RichText(
- text: TextSpan(
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '卸货地点:'
- ),
- TextSpan(
- text: '${_dataArray[index]['goodsUnloadingPlace']}',
- style: TextStyle(color: Color(0xFF333333))
- ),
- ]
- ),
- )
- ],
- ):Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- RichText(
- text: TextSpan(
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '联系人:'
- ),
- TextSpan(
- text: '${_dataArray[index]['contactPerson']}',
- style: TextStyle(color: Color(0xFF333333))
- ),
- ]
- ),
- ),
- RichText(
- text: TextSpan(
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '联系电话:'
- ),
- TextSpan(
- text: '${(_dataArray[index]['phone']).toString().substring(0,3)}****${(_dataArray[index]['phone']).toString().substring(7,(_dataArray[index]['phone']).toString().length)}',
- style: TextStyle(color: Color(0xFF333333))
- ),
- ]
- ),
- ),
- ],
- ),
- );
- },
- separatorBuilder: (context,index){
- return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE5E5E5),indent: hsp(30),endIndent: hsp(30),);
- },
- itemCount: 3
- ),
- ),
- ],
- ),
- );
- }
- );
- },
- child: Container(
- padding: EdgeInsets.all(hsp(30)),
- color: Colors.white,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- children: [
- Text('${_dataArray[index]['citySetout']}',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),),
- Container(
- height: 2,
- width: wsp(40),
- margin: EdgeInsets.only(left: wsp(20),right: wsp(20)),
- color: Color(0xFFCCCCCC),
- ),
- Text('${_dataArray[index]['cityArrive']}',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),)
- ],
- ),
- Container(
- child: Text('${_dataArray[index]['setoffTime']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF333333)),),
- margin: EdgeInsets.only(top: hsp(10),bottom: hsp(10)),
- ),
- RichText(
- text: TextSpan(
- style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '货物名称: '
- ),
- TextSpan(
- text: '${_dataArray[index]['goodsName']}',
- style: TextStyle(color: Color(0xFF333333))
- ),
- TextSpan(
- text: '体积: '
- ),
- TextSpan(
- text: '${_dataArray[index]['goodsVolume']}立方米',
- style: TextStyle(color: Color(0xFF333333))
- ),
- TextSpan(
- text: '性质: '
- ),
- TextSpan(
- text: '${_dataArray[index]['goodsNatureName']}',
- style: TextStyle(color: Color(0xFF333333))
- ),
- TextSpan(
- text: '重量: '
- ),
- TextSpan(
- text: '${_dataArray[index]['goodsWeight']}吨',
- style: TextStyle(color: Color(0xFF333333))
- )
- ]
- ),
- )
- ],
- ),
- ),
- ):GestureDetector(
- onTap: (){
- _index = index;
- _getPriceData();
- },
- child: Container(
- padding: EdgeInsets.all(hsp(30)),
- 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(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)),
- ),
- ],
- ),
- ),
- );
- },
- separatorBuilder: (context,index){
- return Divider(color: Color(0xFFF1F2F4),thickness: 0.5,height: 0.5,);
- },
- itemCount: _dataArray.length,
- padding: EdgeInsets.all(0),
- ),
- ),
- ),
- ],
- ),
- ),
- 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: (){
- showModalBottomSheet(
- context: context,
- builder: (context){
- return YSDatePicker(
- choose: (value){
- Map time = {'time':value.split(' ')[0],'price':_priceList[0]['price']};
- 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),),
- ),
- )
- ],
- ),
- )
- ],
- ),
- ),
- ),
- ),
- // if(_isDetail==true)GestureDetector(
- // onTap: (){
- // setState(() {
- // _isDetail = false;
- // });
- // },
- // child: Container(
- // height: MediaQuery.of(context).size.height-hsp(120),
- // color: Colors.black45,
- // child: Container(
- // margin: EdgeInsets.only(top: MediaQuery.of(context).size.height-hsp(120)-hsp(370)),
- // height: hsp(370),
- // decoration: BoxDecoration(
- // color: Colors.white,
- // borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10))
- // ),
- // child: GestureDetector(
- // onTap: (){},
- // behavior: HitTestBehavior.opaque,
- // child: Column(
- // children: [
- // Container(
- // height: hsp(100),
- // padding: EdgeInsets.only(left: 15,right: 15),
- // child: Row(
- // mainAxisAlignment: MainAxisAlignment.spaceBetween,
- // children: [
- // GestureDetector(
- // child: Text('关闭',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none),),
- // onTap: (){
- // setState(() {
- // _isDetail = false;
- // });
- // },
- // ),
- // Text('明细',style: TextStyle(fontSize: 15,color: Color(0xFF000000),decoration: TextDecoration.none,fontWeight: FontWeight.bold),),
- // Container(width: wsp(50),),
- // ],
- // ),
- // ),
- // Container(
- // height: hsp(100),
- // color: Color(0xFFF7F8F9),
- // padding: EdgeInsets.only(left: wsp(40),right: wsp(40),bottom: hsp(20),top: hsp(20)),
- // child: Row(
- // mainAxisAlignment: MainAxisAlignment.spaceBetween,
- // children: [
- // Text('VIP尊享座位',style: TextStyle(fontSize: zsp(32),color: Color(0xFF000000),decoration: TextDecoration.none),),
- // Text('¥ 780x 10人',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none),),
- // ],
- // ),
- // ),
- // Container(
- // color: Color(0xFFF7F8F9),
- // height: hsp(170),
- // child: ListView.builder(
- // padding: EdgeInsets.all(0),
- // itemBuilder: (context,index){
- // return Container(
- // padding: EdgeInsets.only(left: wsp(40),right: wsp(40),bottom: hsp(10)),
- // child: Row(
- // mainAxisAlignment: MainAxisAlignment.spaceBetween,
- // children: [
- // Text('票价',style: TextStyle(fontSize: zsp(28),color: Color(0xFF9A9A9A)),),
- // Text('¥ 770x 10人',style: TextStyle(fontSize: zsp(28),color: Color(0xFF9A9A9A)),),
- // ],
- // ),
- // );
- // },
- // itemCount: 3,
- // ),
- // )
- // ],
- // ),
- // ),
- // ),
- // ),
- // )
- ],
- ),
- ),
- );
- }
- _getBackImageData() async{
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/wallconfigure/get',parameter: {'type':3},isLoading: false,isToken: false);
- if(dict!=null){
- setState(() {
- _msgDict = dict['data'];
- });
- }
- }
- Future<void> _refreshData() async{
- _page = 1;
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/AirTour/list',parameter: {'category':_type==1?3:33,'pageNo':_page,'pageSize':10},isLoading: false,isToken: false);
- if(dict!=null){
- setState(() {
- _dataArray = dict['data']['resultList'];
- });
- }
- }
- Future<void> _loadMoreData() async{
- _page++;
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/AirTour/list',parameter: {'category':_type==1?3:33,'pageNo':_page,'pageSize':10},isLoading: false,isToken: false);
- if(dict!=null){
- setState(() {
- _dataArray.add(dict['data']['resultList']);
- });
- }
- }
- _getPriceData() async{
- String time = 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');
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneorder/getDateAndTime',parameter: {'time':time,'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,);
- }
- )
- );
- }
- }
- }
|