12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334 |
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:url_launcher/url_launcher.dart';
- import 'package:ysairplane2/code/YSChooseLocation.dart';
- import 'package:ysairplane2/tools/YSNetWorking.dart';
- import 'package:ysairplane2/tools/YSTools.dart';
- import 'YSComment.dart';
- import 'YSContact.dart';
- import 'YSPay.dart';
- class YSMarryPlane extends StatefulWidget {
- final marryId,type;
- const YSMarryPlane({Key key, this.marryId, this.type}) : super(key: key);
- @override
- _YSMarryPlaneState createState() => _YSMarryPlaneState();
- }
- class _YSMarryPlaneState extends State<YSMarryPlane> {
- bool _isDetail = false;
- bool _isOrder = false;
- bool _isShow = false;
- List _chooses = [];
- List _packages = [];
- Map _msgDict;
- String _timeStr;
- int _selected = 0;
- List _priceList = [];
- List _allPrices = [];
- List _packList = [];
- int _index = 9999;
- List _customer = [];
- Map _city;
- String _noticeStr = '';
- String _timeValue;
- TextEditingController _bless = TextEditingController();
- @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');
- _getMarryDetailData();
- _getPackageData();
- _getNoticeData();
- });
- super.initState();
- }
- @override
- void dispose() {
- _bless.dispose();
- _msgDict = null;
- _timeStr = null;
- _chooses = null;
- _packages = null;
- _priceList = null;
- _packList = null;
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Color(0xFFF1F2F4),
- body: Stack(
- children: [
- 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['background']}'),
- 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)),
- height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-hsp(410),
- width: MediaQuery.of(context).size.width,
- decoration: BoxDecoration(
- color: Color(0xFFF1F2F4),
- borderRadius: BorderRadius.only(topRight: Radius.circular(10),topLeft: Radius.circular(10))
- ),
- child: SingleChildScrollView(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- padding: EdgeInsets.only(left: hsp(30),top: hsp(30),bottom: hsp(20),right: hsp(30)),
- child: Text('${_msgDict['title']}',style: TextStyle(fontSize: zsp(36),color: Color(0xFF343434),fontWeight: FontWeight.bold),),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.only(topRight: Radius.circular(10),topLeft: Radius.circular(10))
- ),
- width: MediaQuery.of(context).size.width,
- ),
- // Container(
- // color: Colors.white,
- // width: MediaQuery.of(context).size.width,
- // child: Row(
- // children: [
- // Container(
- // width: wsp(70),
- // height: hsp(40),
- // margin: EdgeInsets.only(left: hsp(30)),
- // child: Text('${_msgDict['averageRating']}',style: TextStyle(fontSize: zsp(25),color: Colors.white),),
- // alignment: Alignment.center,
- // decoration: BoxDecoration(
- // color: Color(0xFFED5E58),
- // borderRadius: BorderRadius.only(topLeft: Radius.circular(50),bottomLeft: Radius.circular(50))
- // ),
- // ),
- // GestureDetector(
- // onTap: (){
- // Navigator.of(context).push(
- // CupertinoPageRoute(
- // builder: (context){
- // return YSComment();
- // }
- // )
- // );
- // },
- // child: Container(
- // width: wsp(150),
- // height: hsp(40),
- // child: Text('${_msgDict['dtOrderScoringNum']}条点评 >',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
- // alignment: Alignment.center,
- // decoration: BoxDecoration(
- // color: Color(0xFFFD8B86),
- // borderRadius: BorderRadius.only(bottomRight: Radius.circular(50),topRight: Radius.circular(50))
- // ),
- // ),
- // )
- // ],
- // ),
- // ),
- if(widget.type!=4&&_msgDict['attractions']!=null)GestureDetector(
- onTap: (){
- showInformAlert(context,title: '${_msgDict['attractions']}',content: '${_msgDict['attractionsContent']}');
- },
- child: Container(
- padding: EdgeInsets.only(left: hsp(30),bottom: hsp(20),top: hsp(0)),
- color: Colors.white,
- width: MediaQuery.of(context).size.width,
- child: Row(
- children: [
- Icon(Icons.location_on,color: Color(0xFF5E5E5E),size: hsp(35),),
- Text(' ${_msgDict['attractions']}',style: TextStyle(fontSize: zsp(23),color: Color(0xFF5E5E5E)),),
- ],
- ),
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE4E6E7),indent: hsp(30),endIndent: hsp(30),),
- Container(
- padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
- color: Colors.white,
- width: MediaQuery.of(context).size.width,
- height: hsp(80),
- child: SingleChildScrollView(
- scrollDirection: Axis.horizontal,
- 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(26),color: Color(0xFF3283D9),height: 1),
- children: [
- TextSpan(
- text: ' >',
- style: TextStyle(color: Color(0xFFC1C1C1)),
- )
- ]
- ),
- ),
- ),
- Container(width: wsp(40),),
- GestureDetector(
- onTap: (){
- showInformAlert(context,title: '${_msgDict['dtFlightInformation']['model']}',
- content: _msgDict['dtFlightInformation']['content']);
- },
- child: RichText(
- text: TextSpan(
- text: '${_msgDict['dtFlightInformation']['model']} ',
- style: TextStyle(fontSize: zsp(26),color: Color(0xFF3283D9),height: 1),
- children: [
- TextSpan(
- text: '>',
- style: TextStyle(color: Color(0xFFC1C1C1)),
- )
- ]
- ),
- ),
- ),
- Container(width: wsp(40),),
- RichText(
- text: TextSpan(
- text: '可乘人数${_msgDict['dtFlightInformation']['seatNum']}人 ',
- style: TextStyle(fontSize: zsp(26),color: Color(0xFF3283D9),height: 1),
- ),
- )
- ],
- ),
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE4E6E7),indent: hsp(30),endIndent: hsp(30),),
- 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(28),color: Color(0xFF333333)),),
- Container(height: hsp(10),),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- RichText(
- text: TextSpan(
- children: [
- TextSpan(
- text: '¥${_packages[index]['discountPrice']}',
- style: TextStyle(fontSize: zsp(32),color: Color(0xFFEB423B),fontWeight: FontWeight.bold)
- )
- ]
- ),
- ),
- GestureDetector(
- onTap: (){
- _index = index;
- _getPriceData();
- },
- child: Container(
- height: hsp(50),
- width: hsp(150),
- decoration: BoxDecoration(
- color: Color(0xFFEA4D45),
- borderRadius: BorderRadius.all(Radius.circular(3))
- ),
- alignment: Alignment.center,
- child: Text('立即预订',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
- ),
- )
- ],
- )
- ],
- ),
- );
- },
- itemCount: _packages.length,
- padding: EdgeInsets.all(0),
- physics: NeverScrollableScrollPhysics(),
- shrinkWrap: true,
- ),
- GestureDetector(
- onTap: (){
- showInformAlert(context,title: '预定须知',content: _noticeStr);
- },
- child: Container(
- height: hsp(88),
- color: Colors.white,
- margin: EdgeInsets.only(top: hsp(10)),
- padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('预订须知',style: TextStyle(fontSize: zsp(30),color: Color(0xFF333333)),),
- Icon(Icons.keyboard_arrow_right,color: Color(0xFFC0C0C0),size: hsp(50),)
- ],
- ),
- ),
- ),
- if(widget.type==4)Container(
- height: hsp(88),
- color: Colors.white,
- margin: EdgeInsets.only(top: hsp(10)),
- padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('飞行时长: ${_msgDict['hour']}',style: TextStyle(fontSize: zsp(30),color: Color(0xFF333333)),),
- ],
- ),
- ),
- 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),),
- ),
- Container(
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: ysHtml('${_msgDict['content']}')
- ),
- Container(
- margin: EdgeInsets.only(top: hsp(10)),
- 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,
- decoration: BoxDecoration(
- color: Color(0xFFF1F2F4),
- borderRadius: BorderRadius.only(topLeft: Radius.circular(8),topRight: Radius.circular(8)),
- ),
- 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 YSMarryPlane(type: widget.type,marryId: _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.6,
- decoration: BoxDecoration(
- color: Colors.lightGreen,
- borderRadius: BorderRadius.only(topLeft: Radius.circular(8),topRight: Radius.circular(8)),
- ),
- child: ClipRRect(
- child: ysImageLoad(
- imageUrl: '${_msgDict['recommendAirTourList'][index]['background']}',
- fit: BoxFit.fill,
- width: (MediaQuery.of(context).size.width-hsp(80))/2,
- height: (MediaQuery.of(context).size.width-hsp(80))/2/(345/381)*0.6,
- ),
- borderRadius: BorderRadius.only(topLeft: Radius.circular(8),topRight: Radius.circular(8)),
- ),
- ),
- 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: [
- Container(
- child: Text(' ${_msgDict['recommendAirTourList'][index]['title']}',
- style: TextStyle(fontSize: zsp(26),color: Color(0xFF333333)),maxLines: 1,overflow: TextOverflow.ellipsis,),
- height: hsp(40),
- ),
- 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(),
- )
- )
- ],
- ),
- ),
- ),
- 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: [
- 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: (){
- _index = 9999;
- _getPriceData();
- },
- child: Container(
- height: hsp(80),
- width: MediaQuery.of(context).size.width*0.8,
- 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: SingleChildScrollView(
- child: GestureDetector(
- onTap: (){},
- child: Column(
- children: [
- GestureDetector(
- onTap: (){
- FocusScope.of(context).unfocus();
- },
- child: 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)),
- color: Colors.white,
- width: MediaQuery.of(context).size.width,
- margin: EdgeInsets.only(top: hsp(10),bottom: hsp(10)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- if(_index!=9999)Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('${_msgDict['title']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFF000000),fontWeight: FontWeight.bold),),
- Text('¥${_packages[_index]['discountPrice']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFFEA413A)),)
- ],
- ),
- if(_index!=9999)Container(
- child: Text('${_packages[_index]['name']}',style: TextStyle(fontSize: zsp(32),color: Color(0xFF000000),fontWeight: FontWeight.bold),),
- margin: EdgeInsets.only(top: hsp(20),bottom: hsp(20)),
- ),
- GestureDetector(
- onTap: (){
- showInformAlert(context,title: '预订须知',content: _noticeStr);
- },
- child: RichText(
- text: TextSpan(
- text: '预订须知 ',
- style: TextStyle(fontSize: zsp(24),color: Color(0xFF017EFF)),
- children: [
- TextSpan(
- text: '>',
- style: TextStyle(color: Color(0xFF000000)),
- )
- ]
- ),
- ),
- )
- ],
- ),
- ),
- if(widget.type==4)GestureDetector(
- onTap: (){
- Navigator.of(context).push(
- CupertinoPageRoute(
- builder: (context){
- return YSChooseLocation();
- }
- )
- ).then((value){
- if(value!=null){
- setState(() {
- _city = value;
- });
- }
- });
- },
- child: Container(
- height: hsp(100),
- color: Colors.white,
- padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
- child: Row(
- children: [
- Text('婚礼地点',style: TextStyle(fontSize: zsp(30),color: Color(0xFF333333)),),
- Container(
- margin: EdgeInsets.only(left: hsp(15),right: hsp(15)),
- width: MediaQuery.of(context).size.width-hsp(300),
- child: SingleChildScrollView(
- child: Text(_city==null?'请选择婚礼地点':'${_city['title']}',style: TextStyle(fontSize: zsp(27),
- color: Color(0xFF999999)),),
- scrollDirection: Axis.horizontal,
- ),
- alignment: Alignment.centerLeft,
- ),
- Icon(Icons.chevron_right,size: hsp(50),color: Color(0xFF999999),)
- ],
- ),
- ),
- ),
- if(widget.type==4)Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF1F2F3),),
- if(widget.type==4)GestureDetector(
- onTap: (){
- timeChooseAlert(context,timeValue: (value){
- setState(() {
- _timeValue = value;
- });
- });
- },
- child: Container(
- height: hsp(100),
- color: Colors.white,
- padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
- child: Row(
- children: [
- Text('婚礼时间',style: TextStyle(fontSize: zsp(30),color: Color(0xFF333333)),),
- Container(
- margin: EdgeInsets.only(left: hsp(15),right: hsp(15)),
- width: MediaQuery.of(context).size.width-hsp(300),
- child: SingleChildScrollView(
- child: Text(_timeValue==null?'请选择婚礼时间':_timeValue,style: TextStyle(fontSize: zsp(27),
- color: Color(0xFF999999)),),
- scrollDirection: Axis.horizontal,
- ),
- alignment: Alignment.centerLeft,
- ),
- Icon(Icons.chevron_right,size: hsp(50),color: Color(0xFF999999),)
- ],
- ),
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF1F2F3),),
- if(widget.type==4)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,
- ),
- )
- ,
- ),
- ],
- ),
- ),
- if(widget.type==4)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(),
- ),
- ),
- if(widget.type==4)Container(
- height: hsp(80),
- padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
- color: Colors.white,
- alignment: Alignment.centerLeft,
- width: MediaQuery.of(context).size.width,
- child: Text('贺卡服务',style: TextStyle(fontSize: zsp(30),color: Color(0xFF333333)),),
- ),
- if(widget.type==4)Container(
- height: hsp(130),
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20)),
- margin: EdgeInsets.only(top: 0.5),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: CupertinoTextField(
- placeholder: '请输入备注信息或祝福语',
- placeholderStyle: TextStyle(fontSize: zsp(27),color: Color(0xFF999999)),
- style: TextStyle(fontSize: zsp(27),color: Color(0xFF999999)),
- maxLines: 10,
- decoration: BoxDecoration(),
- controller: _bless,
- ),
- ),
- if(widget.type!=4)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,
- ),
- if(widget.type!=4)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,
- ),
- )
- ,
- ),
- ],
- ),
- ),
- if(widget.type!=4)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: (){
- _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]['price']}x${widget.type==4?1:_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,
- ),
- )
- ],
- ),
- ),
- ),
- ),
- )
- ],
- ),
- );
- }
- _getMarryDetailData() async{
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/AirTour/getTour',parameter: {'id':widget.marryId,'type':widget.type},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':widget.type,'tourId':widget.marryId},isLoading: true,isToken: false);
- if(dict!=null){
- setState(() {
- _packages = dict['data'];
- });
- }
- }
- showAlert(){
- showModalBottomSheet(
- isScrollControlled: true,
- context: context,
- backgroundColor: Colors.transparent,
- builder: (context){
- return Container(
- height: MediaQuery.of(context).size.height*0.85,
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.only(topRight: Radius.circular(10),topLeft: Radius.circular(10))
- ),
- child: Column(
- children: [
- Container(
- height: hsp(100),
- padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
- 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: (){
- Navigator.pop(context);
- },
- ),
- ],
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE5E5E5),),
- Container(
- height: MediaQuery.of(context).size.height*0.85-0.5-hsp(100),
- color: Colors.white,
- ),
- ],
- ),
- );
- }
- );
- }
- _getPackData() async{
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneservice/get',parameter: {'type':widget.type,'tourId':widget.marryId},
- 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(() {});
- }
- }
- _getPriceData() async{
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneorder/getDateAndTime',
- parameter: {'type':widget.type,'id':_msgDict['id'],'time':_timeStr},isLoading: true,isToken: true);
- if(dict!=null){
- _isOrder = true;
- _priceList = dict['data'];
- _allPrices.clear();
- _allPrices.addAll(_priceList);
- _getPackData();
- }
- }
- _getPrice(){
- double price;
- if(widget.type!=4){
- price = double.parse('${_priceList[_selected]['discountprice']}')*(_customer.length==0?1:_customer.length);
- }else{
- price = double.parse('${_priceList[_selected]['discountprice']}');
- }
- // _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 = {};
- if(_city==null&&widget.type==4){
- ysFlutterToast(context, '请选择婚礼地点');
- return;
- }
- if(_timeValue==null&&widget.type==4){
- ysFlutterToast(context, '请选择婚礼时间');
- return;
- }
- if(_city!=null)request['citySetout'] = _city['title'];
- request['flightTime'] = _timeStr+' $_timeValue';
- request['type'] = widget.type;
- request['airplaneid'] = _msgDict['dtFlightInformation']['id'];
- 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(_bless.text.isNotEmpty){
- request['des'] = _bless.text;
- }
- if(_index!=9999)request['setmealIds'] = _packages[_index]['id'];
- request['tourId'] = widget.marryId;
- showNegotiateAlertDio(
- context,
- content: _noticeStr,
- sure: () async{
- 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: widget.type==4?payType.marry:widget.type==5?payType.sport:payType.sightseeing,);
- }
- )
- );
- }
- }
- );
- }
- _getNoticeData() async{
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneservice/ctrip',parameter: {'type':widget.type,'tourId':widget.marryId});
- if(dict!=null){
- _noticeStr = dict['data']['value'];
- }
- }
- }
|