1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096 |
- import 'package:flutter/material.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:ysairplane2/tools/YSNetWorking.dart';
- import 'package:ysairplane2/tools/YSTools.dart';
- import 'YSContact.dart';
- import 'YSPay.dart';
- class YSShortDetail extends StatefulWidget {
- final shortId;
- const YSShortDetail({Key key, this.shortId}) : super(key: key);
- @override
- _YSShortDetailState createState() => _YSShortDetailState();
- }
- class _YSShortDetailState extends State<YSShortDetail> {
- bool _isDetail = false;
- bool _isOrder = false;
- Map _msgDict;
- List _chooses = [];
- List _packages = [];
- String _timeStr;
- int _selected = 0;
- List _priceList = [];
- List _packList = [];
- int _index = 9999;
- bool _isShow = false;
- List _customer = [];
- String _noticeStr = '';
- List _allPrices = [];
- @override
- void initState() {
- Future.delayed(Duration(seconds: 0)).then((value){
- _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');
- _getShortDetailData();
- _getPackageData();
- _getNoticeData();
- });
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Color(0xFFF1F2F4),
- body: Stack(
- children: [
- SingleChildScrollView(
- child: Container(
- height: MediaQuery.of(context).size.height-hsp(123),
- child: SingleChildScrollView(
- child: Stack(
- children: [
- Container(
- height: MediaQuery.of(context).padding.top+hsp(380),
- width: MediaQuery.of(context).size.width,
- child: Image(
- image: _msgDict==null?AssetImage('lib/images/home3.png'):NetworkImage('${_msgDict['cover']}'),
- fit: BoxFit.fill,
- ),
- ),
- GestureDetector(
- onTap: (){Navigator.pop(context);},
- child: Container(
- margin: EdgeInsets.only(left: wsp(32),top: MediaQuery.of(context).padding.top+hsp(30)),
- child: Icon(Icons.arrow_back_ios,size: hsp(40),color: Colors.white,),
- ),
- ),
- if(_msgDict!=null)Container(
- margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+hsp(300)),
- child: Column(
- children: [
- Container(
- width: MediaQuery.of(context).size.width-wsp(60),
- margin: EdgeInsets.only(bottom: hsp(20)),
- padding: EdgeInsets.all(hsp(30)),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(10)),
- color: Colors.white,
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- margin: EdgeInsets.only(bottom: hsp(30)),
- child: Row(
- children: [
- GestureDetector(
- onTap: (){
- showInformAlert(context,title: '${_msgDict['dtPartner']['companyName']}',content: _msgDict['dtPartner']['content']);
- },
- child: RichText(
- text: TextSpan(
- text: '${_msgDict['dtPartner']['companyName']}'.length>7?
- '${_msgDict['dtPartner']['companyName']}'.substring(0,7)+'..':'${_msgDict['dtPartner']['companyName']}',
- style: TextStyle(fontSize: zsp(28),color: Color(0xFF444444)),
- children: [
- TextSpan(
- text: ' >',
- style: TextStyle(color: Color(0xFF2C7CF6))
- )
- ]
- ),
- ),
- ),
- GestureDetector(
- onTap: (){
- showInformAlert(context,title: '${_msgDict['dtFlightInformation']['model']}',
- content: '${_msgDict['dtFlightInformation']['content']}');
- },
- child: Container(
- margin: EdgeInsets.only(left: wsp(40)),
- child: RichText(
- text: TextSpan(
- text: '${_msgDict['dtFlightInformation']['model']}',
- style: TextStyle(fontSize: zsp(28),color: Color(0xFF444444)),
- children: [
- TextSpan(
- text: ' >',
- style: TextStyle(color: Color(0xFF2C7CF6))
- )
- ]
- ),
- ),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: wsp(40)),
- child: RichText(
- text: TextSpan(
- text: '可乘坐人数${_msgDict['dtFlightInformation']['seatNum']}人',
- style: TextStyle(fontSize: zsp(28),color: Color(0xFF444444)),
- children: [
- ]
- ),
- ),
- )
- ],
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
- Container(
- padding: EdgeInsets.only(top: hsp(30),bottom: hsp(30)),
- child: Column(
- children: [
- Row(
- children: [
- Container(
- width: (MediaQuery.of(context).size.width-hsp(300))/2,
- child: SingleChildScrollView(
- child: Text('${_msgDict['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(300))/2,
- alignment: Alignment.centerRight,
- child: SingleChildScrollView(
- child: Text('${_msgDict['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
- scrollDirection: Axis.horizontal,
- ),
- ),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- width: (MediaQuery.of(context).size.width-hsp(300))/2,
- child: SingleChildScrollView(
- child: Text('${_msgDict['setoutInfo']['airplaneName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
- scrollDirection: Axis.horizontal,
- ),
- ),
- Text('${_msgDict['hour']}',style: TextStyle(fontSize: zsp(20),color: Color(0xFF343434)),),
- Container(
- width: (MediaQuery.of(context).size.width-hsp(300))/2,
- alignment: Alignment.centerRight,
- child: SingleChildScrollView(
- child: Text('${_msgDict['arriveInfo']['airplaneName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
- scrollDirection: Axis.horizontal,
- ),
- ),
- ],
- )
- ],
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEAEAEA),),
- Container(
- padding: EdgeInsets.only(top: hsp(20)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Column(
- children: [
- Text('出发',style: TextStyle(fontSize: zsp(24),color: Color(0xFF666666)),),
- RichText(
- text: TextSpan(
- text: '${_msgDict['flightTime']}',
- style: TextStyle(fontSize: zsp(36),fontWeight: FontWeight.bold,color: Colors.black),
- // children: [
- // TextSpan(
- // text: '今天',
- // style: TextStyle(fontSize: zsp(24),fontWeight: FontWeight.normal),
- // )
- // ]
- ),
- )
- ],
- crossAxisAlignment: CrossAxisAlignment.start,
- ),
- // Icon(Icons.keyboard_arrow_right,size: hsp(50),color: Color(0xFFC1C1C1),)
- ],
- ),
- )
- ],
- ),
- ),
- Container(
- width: MediaQuery.of(context).size.width,
- margin: EdgeInsets.only(bottom: hsp(30)),
- padding: EdgeInsets.all(hsp(30)),
- color: Color(0xFFF1F2F4),
- child: Column(
- children: [
- Container(
- padding: EdgeInsets.only(left: hsp(30),bottom: hsp(20),top: hsp(20),right: hsp(30)),
- child: Text('选择套餐',style: TextStyle(fontSize: zsp(30),color: Color(0xFF222222)),),
- color: Colors.white,
- width: MediaQuery.of(context).size.width,
- ),
- ListView.builder(
- itemBuilder: (context,index){
- return Container(
- padding: EdgeInsets.only(left: hsp(30),bottom: hsp(20),top: hsp(20),right: hsp(30)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('${_packages[index]['name']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF888888)),),
- Container(height: hsp(10),),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- RichText(
- text: TextSpan(
- text: '${_packages[index]['remark']} ',
- style: TextStyle(fontSize: zsp(26),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '¥${_packages[index]['discountPrice']}',
- style: TextStyle(fontSize: zsp(32),color: Color(0xFFEB423B),fontWeight: FontWeight.bold)
- )
- ]
- ),
- ),
- GestureDetector(
- onTap: (){
- setState(() {
- _isOrder = true;
- });
- },
- child: GestureDetector(
- child: Container(
- height: hsp(50),
- width: hsp(100),
- decoration: BoxDecoration(
- color: Color(0xFFEA4D45),
- borderRadius: BorderRadius.all(Radius.circular(3))
- ),
- alignment: Alignment.center,
- child: Text('预订',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
- ),
- onTap: (){
- _index = index;
- _getPriceData();
- },
- ),
- )
- ],
- )
- ],
- ),
- );
- },
- itemCount: _packages.length,
- padding: EdgeInsets.all(0),
- physics: NeverScrollableScrollPhysics(),
- shrinkWrap: true,
- ),
- if(_msgDict['content']!=null)Container(
- margin: EdgeInsets.only(top: hsp(10)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- padding: EdgeInsets.only(left: hsp(30),top: hsp(20),right: hsp(30)),
- child: Text('详情',style: TextStyle(fontSize: zsp(30),color: Color(0xFF343434),fontWeight: FontWeight.bold),),
- ),
- if(_msgDict['content']!=null)Container(
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: ysHtml('${_msgDict['content']}')
- ),
- Container(
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- padding: EdgeInsets.only(left: hsp(30),bottom: hsp(20),top: hsp(20),right: hsp(30)),
- child: Text('相关推荐',style: TextStyle(fontSize: zsp(30),color: Color(0xFF343434),fontWeight: FontWeight.bold),),
- ),
- Container(
- padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
- width: MediaQuery.of(context).size.width,
- color: Color(0xFFF1F2F4),
- child: GridView.builder(
- gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
- crossAxisCount: 2,
- mainAxisSpacing: hsp(20),
- crossAxisSpacing: hsp(20),
- childAspectRatio: 345/381
- ),
- itemBuilder: (context, index) {
- return GestureDetector(
- onTap: (){
- Navigator.of(context).push(
- CupertinoPageRoute(
- builder: (context){
- return YSShortDetail(shortId: _msgDict['recommendAirTourList'][index]['id'],);
- }
- )
- );
- },
- child: Column(
- children: [
- Container(
- width: (MediaQuery.of(context).size.width-hsp(80))/2,
- height: (MediaQuery.of(context).size.width-hsp(80))/2/(345/381)*0.55,
- decoration: BoxDecoration(
- color: Colors.lightGreen,
- borderRadius: BorderRadius.only(topLeft: Radius.circular(8),topRight: Radius.circular(8)),
- image: DecorationImage(
- image: NetworkImage('${_msgDict['recommendAirTourList'][index]['cover']}'),
- fit: BoxFit.fill
- )
- ),
- ),
- Container(
- width: (MediaQuery.of(context).size.width-hsp(80))/2,
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.only(bottomLeft: Radius.circular(8),bottomRight: Radius.circular(8)),
- ),
- padding: EdgeInsets.all(hsp(20)),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(' ${_msgDict['recommendAirTourList'][index]['title']}',style: TextStyle(fontSize: zsp(26),color: Color(0xFF333333)),),
- RichText(
- text: TextSpan(
- text: '¥',
- style: TextStyle(fontSize: zsp(24),color: Color(0xFFEA413A)),
- children: [
- TextSpan(
- text: '${_msgDict['recommendAirTourList'][index]['discountPrice']}',
- style: TextStyle(fontSize: zsp(38),fontWeight: FontWeight.bold)
- ),
- TextSpan(
- text: '元起'
- )
- ]
- ),
- ),
- ],
- crossAxisAlignment: CrossAxisAlignment.start,
- ),
- )
- ],
- ),
- );
- },
- itemCount: (_msgDict['recommendAirTourList']).length,
- shrinkWrap: true,
- padding: EdgeInsets.only(top: hsp(20),bottom: hsp(20)),
- physics: NeverScrollableScrollPhysics(),
- )
- )
- ],
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- if(_msgDict!=null)Container(
- margin: EdgeInsets.only(top: MediaQuery.of(context).size.height-hsp(110)),
- height: hsp(110),
- color: Colors.white,
- padding: EdgeInsets.only(left: wsp(40),right: wsp(40)),
- alignment: Alignment.center,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- if(_msgDict['telphone']!=null)GestureDetector(
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(Icons.headset,color: Color(0xFF666666),size: zsp(40),),
- Text('咨询',style: TextStyle(fontSize: zsp(22),color: Color(0xFF767676)),)
- ],
- ),
- onTap: (){
- alertPhone(context, '${_msgDict['telphone']}');
- },
- ),
- // Column(
- // mainAxisSize: MainAxisSize.min,
- // children: [
- // Icon(Icons.star_border,color: Color(0xFF666666),size: zsp(40),),
- // Text('加入收藏',style: TextStyle(fontSize: zsp(22),color: Color(0xFF767676)),)
- // ],
- // ),
- GestureDetector(
- onTap: (){
- // _postOrderData();
- _index = 9999;
- _getPriceData();
- },
- child: Container(
- height: hsp(80),
- width: _msgDict['telphone']!=null?MediaQuery.of(context).size.width*0.8:MediaQuery.of(context).size.width-hsp(100),
- decoration: BoxDecoration(
- color: Color(0xFF007EFF),
- borderRadius: BorderRadius.all(Radius.circular(50))
- ),
- alignment: Alignment.center,
- child: Text('立即预订',style: TextStyle(fontSize: zsp(36),color: Colors.white,fontWeight: FontWeight.bold),),
- ),
- )
- ],
- ),
- ),
- 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: (){
- _timeStr = '${_priceList[index]['time']}';
- 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]['discountprice']}',
- 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){
- int index = 0;
- _priceList.clear();
- _priceList.addAll(_allPrices);
- for(int i=0;i<_priceList.length;i++){
- DateTime date1 = DateTime.parse('${_priceList[i]['time']}');
- DateTime date2 = DateTime.parse('$dateValue 00:00:00');
- if(date1.year==date2.year&&date1.month==date2.month&&date1.day==date2.day){
- index = i;
- }
- }
- _priceList.removeRange(0, index);
- _selected = 0;
- _timeStr = _priceList[_selected]['time'];
- setState(() {});
- },
- count: 45,
- startStr: _allPrices[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)),),
- ),
- )
- ],
- ),
- ),
- ],
- ),
- ),
- Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(10)),
- color: Colors.white,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- if(_index!=9999)Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('${_packages[_index]['name']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFF000000),fontWeight: FontWeight.bold),),
- Text('¥${_packages[_index]['discountPrice']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFFEB423B)),),
- ],
- ),
- Container(
- margin: EdgeInsets.only(top: hsp(20),bottom: hsp(20)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('${_msgDict['setoutInfo']['display']} - ${_msgDict['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(32),color: Color(0xFF000000),fontWeight: FontWeight.bold),),
- // Row(
- // children: [
- // Text('购买数量 ',style: TextStyle(fontSize: zsp(26),color: Color(0xFF9A9A9A)),),
- // GestureDetector(
- // onTap: (){
- // if(_number>1){
- // setState(() {
- // _number--;
- // });
- // }
- // },
- // child: Icon(Icons.remove_circle_outline,color: _number>1?Color(0xFF007AFF):Color(0xFF9A9A9A),size: hsp(40),),
- // ),
- // Text(' $_number ',style: TextStyle(fontSize: zsp(45),color: Color(0xFF000000)),),
- // GestureDetector(
- // onTap: (){
- // setState(() {
- // _number++;
- // });
- // },
- // child: Icon(Icons.add_circle_outline,color: Color(0xFF007AFF),size: hsp(40),)
- // ),
- // ],
- // )
- ],
- ),
- ),
- GestureDetector(
- onTap: (){
- showInformAlert(context,title: '预定须知',content: _noticeStr);
- },
- child: RichText(
- text: TextSpan(
- text: '预订须知',
- style: TextStyle(fontSize: zsp(24),color: Color(0xFF027FFF)),
- children: [
- TextSpan(
- text: ' >',
- style: TextStyle(color: Color(0xFF000000))
- )
- ]
- ),
- ),
- )
- ],
- ),
- ),
- Container(
- child: Text('出行人',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
- alignment: Alignment.centerLeft,
- height: hsp(80),
- padding: EdgeInsets.only(left: hsp(30)),
- margin: EdgeInsets.only(top: hsp(10)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- ),
- Container(
- padding: EdgeInsets.only(left: hsp(30),right: hsp(30),top: hsp(20)),
- margin: EdgeInsets.only(top: hsp(1)),
- color: Colors.white,
- width: MediaQuery.of(context).size.width,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- padding: EdgeInsets.only(left: hsp(30),right: hsp(30),bottom: hsp(20)),
- child: GestureDetector(
- onTap: (){
- Navigator.of(context).push(
- CupertinoPageRoute(
- builder: (context){
- return YSContact();
- }
- )
- ).then((value){
- if(value!=null){
- if(_customer.contains(value)){
- _customer.remove(value);
- }
- setState(() {
- _customer.insert(0, value);
- });
- }
- });
- },
- child: Container(
- height: hsp(60),
- width: hsp(160),
- decoration: BoxDecoration(
- color: Color(0xFF007EFF),
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(Icons.add_circle,color: Colors.white,size: hsp(30),),
- Text(' 新增',style: TextStyle(fontSize: zsp(28),color: Colors.white),),
- ],
- ),
- alignment: Alignment.center,
- ),
- )
- ,
- ),
- ],
- ),
- ),
- Container(
- color: Colors.white,
- child: ListView.separated(
- itemBuilder: (context,index){
- return Container(
- color: Colors.white,
- padding: EdgeInsets.only(top: hsp(20),bottom: hsp(20),left: hsp(50),right: hsp(50)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- GestureDetector(
- child: Icon(Icons.remove_circle,color: Colors.red,size: hsp(50),),
- onTap: (){
- setState(() {
- _customer.removeAt(index);
- });
- },
- ),
- Container(
- width: MediaQuery.of(context).size.width-hsp(180),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('${_customer[index]['username']} ${_customer[index]['phone']}',style: TextStyle(fontSize: zsp(34),color: Color(0xFF343434),fontWeight: FontWeight.bold),),
- Text('身份证 ${_customer[index]['cardid']}',style: TextStyle(fontSize: zsp(25),color: Color(0xFF666666)),)
- ],
- ),
- ),
- //Icon(Icons.mode_edit,color: Color(0xFF9A9A9A),size: hsp(50),),
- ],
- ),
- );
- },
- separatorBuilder: (context,index){
- return Divider(height: 0.5,thickness: 0.5,indent: hsp(100),);
- },
- itemCount: _customer.length,
- shrinkWrap: true,
- padding: EdgeInsets.all(0),
- physics: NeverScrollableScrollPhysics(),
- ),
- ),
- // GestureDetector(
- // onTap: (){
- // setState(() {
- // _isShow = !_isShow;
- // });
- // },
- // behavior: HitTestBehavior.opaque,
- // child: Container(
- // padding: EdgeInsets.only(left: wsp(40),right: wsp(40),top: hsp(20),bottom: hsp(20)),
- // margin: EdgeInsets.only(top: hsp(10)),
- // color: Colors.white,
- // child: Row(
- // mainAxisAlignment: MainAxisAlignment.spaceBetween,
- // children: [
- // Text('更多服务',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
- // Icon(Icons.keyboard_arrow_down,size: hsp(50),color: Color(0xFFC1C1C1),)
- // ],
- // )
- // ),
- // ),
- // if(_isShow==true)Container(
- // padding: EdgeInsets.only(left: wsp(32),right: wsp(32),top: hsp(20),bottom: hsp(10)),
- // decoration: BoxDecoration(
- // color: Color(0xFFFAFAFA),
- // borderRadius: BorderRadius.only(bottomRight: Radius.circular(10),bottomLeft: Radius.circular(10))
- // ),
- // child: ListView.builder(
- // shrinkWrap: true,
- // itemBuilder: (context,index){
- // return Container(
- // padding: EdgeInsets.only(bottom: wsp(20)),
- // child: Row(
- // mainAxisAlignment: MainAxisAlignment.spaceBetween,
- // children: [
- // Row(
- // children: [
- // Text('${_packList[index]['name']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF999999)),),
- // Container(
- // width: wsp(50),
- // child: GestureDetector(
- // child: Icon(Icons.error_outline,size: hsp(40),color: Color(0xFF999999)),
- // ),
- // ),
- // Text('${_packList[index]['price']}元',style: TextStyle(fontSize: zsp(28),color: Colors.black),),
- // ],
- // ),
- // GestureDetector(
- // child: Container(
- // height: hsp(60),
- // width: hsp(100),
- // child: Image.asset(_chooses.contains(_packList[index])==true?'lib/images/kaiguankai.png':'lib/images/kaiguanguan.png'),
- // ),
- // onTap: (){
- // setState(() {
- // if(_chooses.contains(_packList[index])==true){
- // _chooses.remove(_packList[index]);
- // }else{
- // _chooses.add(_packList[index]);
- // }
- // });
- // },
- // )
- // ],
- // ),
- // );
- // },
- // itemCount: _packList.length,
- // padding: EdgeInsets.all(0),
- // physics: NeverScrollableScrollPhysics(),
- // ),
- // )
- ],
- ),
- ),
- ),
- ],
- ),
- ),
- 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: ' ${_getPrice()}',
- style: TextStyle(fontSize: zsp(40),color: Color(0xFFFF6600)),
- )
- ]
- ),
- ),
- 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: (){
- showNegotiateAlertDio(
- context,
- content: _noticeStr,
- sure: (){
- _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('座位',style: TextStyle(fontSize: zsp(32),color: Color(0xFF000000),decoration: TextDecoration.none),),
- Text('¥ ${_priceList[_selected]['discountprice']}x${_customer.length==0?1:_customer.length}',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('${_chooses[index]['name']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF9A9A9A)),),
- Text('¥ ${_chooses[index]['discountPrice']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF9A9A9A)),),
- ],
- ),
- );
- },
- itemCount: _chooses.length,
- ),
- )
- ],
- ),
- ),
- ),
- ),
- )
- ],
- ),
- );
- }
- _getShortDetailData() async{
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/AirTour/getTour',parameter: {'id':widget.shortId,'type':6},isLoading: true,isToken: false);
- if(dict!=null){
- setState(() {
- _msgDict = dict['data'];
- });
- }
- }
- _getPackageData() async{
- var dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneservice/get',parameter: {'type':6,'tourId':widget.shortId},isLoading: true,isToken: false);
- if(dict!=null){
- setState(() {
- _packages = dict['data'];
- });
- }
- }
- _getPriceData() async{
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneorder/getDateAndTime',
- parameter: {'type':6,'time':_timeStr,'id':_msgDict['id']},isLoading: true,isToken: true);
- if(dict!=null){
- _isOrder = true;
- _priceList = dict['data'];
- _allPrices.clear();
- _allPrices.addAll(_priceList);
- _getPackData();
- }
- }
- _getPackData() async{
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneservice/get',parameter: {'type':6,'tourId':widget.shortId},isLoading: true,isToken: false);
- if(dict!=null){
- _packList = dict['data'];
- _chooses.clear();
- if(_index!=9999){
- _chooses.add(_packages[_index]);
- }
- // _packList.forEach((element) {
- // if('${element['id']}'=='${_packages[_index]['id']}'){
- // _chooses.clear();
- // _isShow = true;
- // _chooses.add(element);
- // }
- // });
- setState(() {
- });
- }
- }
- _getPrice(){
- double price = double.parse('${_priceList[_selected]['discountprice']}')*(_customer.length==0?1:_customer.length);
- // _chooses.forEach((element) {
- // price+=double.parse('${element['price']}');
- // });
- if(_index!=9999){
- price+=double.parse('${_chooses[0]['discountPrice']}');
- }
- return price.toStringAsFixed(2);
- }
- _postOrderData() async{
- FocusScope.of(context).unfocus();
- Map request = {};
- request['tourId'] = widget.shortId;
- request['flightTime'] = _timeStr;
- request['type'] = 6;
- request['airplaneid'] = _msgDict['dtFlightInformation']['id'];
- request['airportidSetout'] = _msgDict['setoutInfo']['id'];
- request['airportidArrive'] = _msgDict['arriveInfo']['id'];
- request['travelersNumber'] = _customer.length==0?1:_customer.length;
- if(_customer.length>0)request['personnelInfo'] = _customer;
- List array = [];
- _chooses.forEach((element) {
- array.add(element['id']);
- });
- if(array.length>0){
- request['serviceIds'] = array.join(',');
- }
- if(_index!=9999)request['setmealIds'] = _packages[_index]['id'];
- 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.short,);
- }
- )
- );
- }
- }
- _getNoticeData() async{
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneservice/ctrip',parameter: {'type':6});
- if(dict!=null){
- _noticeStr = dict['data']['value'];
- }
- }
- }
|