12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133 |
- import 'package:flutter/material.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter_alipay/flutter_alipay.dart';
- import 'package:ysairplane2/base/YSBase.dart';
- import 'package:ysairplane2/code/YSCourseDetail.dart';
- import 'package:ysairplane2/code/YSMoney.dart';
- import 'package:ysairplane2/code/YSSetPayPass.dart';
- import 'package:ysairplane2/tools/YSNetWorking.dart';
- import 'package:ysairplane2/tools/YSPayKeybord.dart';
- import 'package:ysairplane2/tools/YSTools.dart';
- import 'package:fluwx/fluwx.dart' as fluwx;
- import 'YSTabbar.dart';
- enum payType{
- doctor,
- help,
- goods,
- marry,
- sport,
- short,
- business,//商务
- preferential,//特惠
- sightseeing//游览
- }
- class YSPay extends StatefulWidget {
- final orderDict;
- final payType type;
- const YSPay({Key key, this.orderDict, this.type}) : super(key: key);
- @override
- _YSPayState createState() => _YSPayState();
- }
- class _YSPayState extends State<YSPay> {
- int _selected = 0;
- bool _isSucceed = false;
- @override
- void initState() {
- fluwx.weChatResponseEventHandler.listen((res) {
- if (res is fluwx.WeChatPaymentResponse) {
- // print('---------------->${res.isSuccessful}');
- if(res.isSuccessful==true){
- if(mounted){
- setState(() {
- _isSucceed = true;
- });
- }
- }
- }
- });
- if(widget.type==payType.help){
- setState(() {
- _isSucceed = true;
- });
- }
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- return YSBase(
- ystitle: '支付方式',
- yschild: _isSucceed==true?Column(
- children: [
- Container(
- color: Colors.white,
- width: MediaQuery.of(context).size.width,
- padding: EdgeInsets.only(left: wsp(30),right: wsp(30),top: hsp(60),bottom: hsp(60)),
- child: Column(
- children: [
- Image(
- image: AssetImage('lib/images/succeed.png'),
- height: hsp(130),
- width: wsp(130)
- ),
- Container(
- child: Text(widget.type==payType.help?'预约成功':'支付成功',style: TextStyle(fontSize: zsp(40),color: Color(0xFF333333)),),
- margin: EdgeInsets.only(top: hsp(40),bottom: hsp(33)),
- ),
- if(widget.type!=payType.help)Text('本次支付金额${widget.orderDict['price']}元',style: TextStyle(fontSize: zsp(28),color: Color(0xFF878787)),),
- ],
- ),
- ),
- GestureDetector(
- onTap: (){
- // Navigator.popUntil(context, ModalRoute.withName('/'));
- // Navigator.of(context).popUntil(ModalRoute.withName('/home'));
- // Navigator.of(context).pushNamedAndRemoveUntil('/home', (route) => false);
- // Navigator.of(context).pop();
- // Navigator.of(context).pop();
- Navigator.of(context).pushAndRemoveUntil(
- CupertinoPageRoute(
- builder: (context){
- return YSTabbar();
- }
- ),(route) => false);
- },
- child: Container(
- height: hsp(94),
- width: MediaQuery.of(context).size.width-wsp(24)*2,
- alignment: Alignment.center,
- margin: EdgeInsets.only(top: hsp(58)),
- decoration: BoxDecoration(
- color: Color(0xFF0079FF),
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- child: Text('完成',style: TextStyle(color: Colors.white,fontSize: zsp(34)),),
- ),
- ),
- GestureDetector(
- onTap: (){
- Navigator.of(context).push(
- CupertinoPageRoute(
- builder: (context){
- return YSCourseDetail(orderStr: widget.orderDict['orderSn'],);
- }
- ));
- },
- child: Container(
- height: hsp(94),
- width: MediaQuery.of(context).size.width-wsp(24)*2,
- alignment: Alignment.center,
- margin: EdgeInsets.only(top: hsp(58)),
- decoration: BoxDecoration(
- color: Color(0xFF0079FF),
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- child: Text('查看订单',style: TextStyle(color: Colors.white,fontSize: zsp(34)),),
- ),
- )
- ],
- ):Column(
- children: [
- Container(
- height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44-hsp(120),
- width: MediaQuery.of(context).size.width,
- color: Color(0xFFF1F2F3),
- child: SingleChildScrollView(
- child: Column(
- children: [
- Container(
- width: MediaQuery.of(context).size.width,
- padding: EdgeInsets.all(hsp(30)),
- color: Colors.white,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- child: Text('未支付',style: TextStyle(fontSize: zsp(32),color: Color(0xFFFF4747),fontWeight: FontWeight.bold),),
- margin: EdgeInsets.only(top: hsp(10),bottom: hsp(10)),
- ),
- Text('请在${_getMin('${widget.orderDict['expiredtime']}')}分钟内完成支付, 否则该订单将被自动取消',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),)//${int.parse('${(widget.orderDict['expireHour'])*60}')}
- ],
- ),
- ),
- widget.type==payType.doctor?Column(
- children: [
- Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(12)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- width: MediaQuery.of(context).size.width*0.6,
- child: ListView.builder(
- itemBuilder: (context,index){
- return Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Column(
- children: [
- Container(
- height: hsp(30),
- width: hsp(30),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(50)),
- border: Border.all(color: index==0?Color(0xFF02C094):Color(0xFFFB9658),width: wsp(6))
- ),
- margin: EdgeInsets.only(top: hsp(7),bottom: hsp(7)),
- ),
- if(index<1)Container(
- height: hsp(30),
- width: hsp(5),
- color: Color(0xFFCACAD4),
- )
- ],
- ),
- Container(
- child: RichText(
- text: TextSpan(
- text: '${widget.orderDict[index==0?'citySetout':'cityArrive']}',
- style: TextStyle(color: Color(0xFF000000),fontSize: zsp(32),fontWeight: FontWeight.bold),
- children: [
- TextSpan(
- text: ' ${widget.orderDict[index==0?'setoutInfo':'arriveInfo']['airplaneName']}',
- style: TextStyle(color: Color(0xFF999999),fontSize: zsp(20),fontWeight: FontWeight.normal),
- )
- ]
- ),
- ),
- margin: EdgeInsets.only(left: wsp(10),top: hsp(5)),
- )
- ],
- );
- },
- itemCount: 2,
- shrinkWrap: true,
- physics: NeverScrollableScrollPhysics(),
- ),
- ),
- Container(
- child: Text('¥ ${widget.orderDict['retailPrice']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFFA2A2A2)),),
- padding: EdgeInsets.only(top: hsp(10)),
- )
- ],
- ),
- ),
- Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(12)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- RichText(
- text: TextSpan(
- text: '乘机人数 ',
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '${widget.orderDict['travelersNumber']}人',
- style: TextStyle(fontSize: zsp(32),color: Color(0xFF333333)),
- )
- ]
- ),
- ),
- Container(height: 0.5,color: Color(0xFFE5E5E5),margin: EdgeInsets.only(top: hsp(20),bottom: hsp(20),left: hsp(170)),),
- RichText(
- text: TextSpan(
- text: '出发时间 ',
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '${widget.orderDict['flightTime']}',
- style: TextStyle(fontSize: zsp(32),color: Color(0xFF333333)),
- )
- ]
- ),
- ),
- ],
- ),
- ),
- ],
- ):widget.type==payType.help?Column(
- children: [
- Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(12)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- width: MediaQuery.of(context).size.width*0.6,
- child: ListView.builder(
- itemBuilder: (context,index){
- return Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Column(
- children: [
- Container(
- height: hsp(30),
- width: hsp(30),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(50)),
- border: Border.all(color: index==0?Color(0xFF02C094):Color(0xFFFB9658),width: wsp(6))
- ),
- margin: EdgeInsets.only(top: hsp(7),bottom: hsp(7)),
- ),
- if(index<1)Container(
- height: hsp(30),
- width: hsp(5),
- color: Color(0xFFCACAD4),
- )
- ],
- ),
- Container(
- child: RichText(
- text: TextSpan(
- text: '${widget.orderDict[index==0?'citySetout':'cityArrive']}',
- style: TextStyle(color: Color(0xFF000000),fontSize: zsp(32),fontWeight: FontWeight.bold),
- ),
- ),
- margin: EdgeInsets.only(left: wsp(10),top: hsp(5)),
- )
- ],
- );
- },
- itemCount: 2,
- shrinkWrap: true,
- physics: NeverScrollableScrollPhysics(),
- ),
- ),
- Container(//¥ ${widget.orderDict['retailPrice']} x ${widget.orderDict['travelersNumber']}人
- child: Text('',style: TextStyle(fontSize: zsp(28),color: Color(0xFFA2A2A2)),),
- padding: EdgeInsets.only(top: hsp(10)),
- )
- ],
- ),
- ),
- Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(12)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- RichText(
- text: TextSpan(
- text: '人数 ',
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '${widget.orderDict['travelersNumber']}人',
- style: TextStyle(fontSize: zsp(32),color: Color(0xFF333333)),
- )
- ]
- ),
- ),
- Container(height: 0.5,color: Color(0xFFE5E5E5),margin: EdgeInsets.only(top: hsp(20),bottom: hsp(20),left: hsp(120)),),
- RichText(
- text: TextSpan(
- text: '电话 ',
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '${widget.orderDict['phone']}',
- style: TextStyle(fontSize: zsp(32),color: Color(0xFF333333)),
- )
- ]
- ),
- ),
- Container(height: 0.5,color: Color(0xFFE5E5E5),margin: EdgeInsets.only(top: hsp(20),bottom: hsp(20),left: hsp(120)),),
- RichText(
- text: TextSpan(
- text: '描述 ',
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF999999)),
- children: [
- TextSpan(
- text: '${widget.orderDict['des']==null?'无':widget.orderDict['des']}',
- style: TextStyle(fontSize: zsp(32),color: Color(0xFF333333)),
- )
- ]
- ),
- ),
- ],
- ),
- ),
- ],
- ):widget.type==payType.goods?Column(
- children: [
- Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(12)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- child: Text('费用明细',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
- ),
- Container(
- width: (MediaQuery.of(context).size.width-hsp(280))*0.55,
- padding: EdgeInsets.only(right: wsp(30)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(widget.orderDict['sourceType']==1?'整机':'拼机',style: TextStyle(fontSize: zsp(32),color: Colors.black,fontWeight: FontWeight.bold),),
- Container(
- margin: EdgeInsets.only(top: hsp(20),bottom: hsp(20)),
- child: SingleChildScrollView(
- scrollDirection: Axis.horizontal,
- child: Row(
- children: [
- Text('${widget.orderDict['dtAirplaneGoods']['goodsPlace']} ',style: TextStyle(fontSize: zsp(25),color: Color(0xFF9A9A9A))),
- Container(
- height: 1,
- width: wsp(20),
- color: Color(0xFFCCCCCC),
- ),
- Text(' ${widget.orderDict['dtAirplaneGoods']['goodsUnloadingPlace']}',style: TextStyle(fontSize: zsp(25),color: Color(0xFF9A9A9A)))
- ],
- ),
- ),
- ),
- // RichText(
- // text: TextSpan(
- // text: '预订须知',
- // style: TextStyle(fontSize: zsp(24),color: Color(0xFF348AE1)),
- // children: [
- // TextSpan(
- // text: ' >',
- // style: TextStyle(color: Color(0xFF000000))
- // ),
- // ]
- // ),
- // )
- ],
- ),
- ),
- Container(
- width: (MediaQuery.of(context).size.width-wsp(280))*0.4,
- alignment: Alignment.centerRight,
- child: Text('¥ ${widget.orderDict['price']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFFA2A2A2)),),
- padding: EdgeInsets.only(top: hsp(10)),
- )
- ],
- ),
- ),
- Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(12)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- width: wsp(150),
- alignment: Alignment.center,
- child: Text('联系人 ',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
- ),
- Container(
- width: MediaQuery.of(context).size.width-hsp(60)-wsp(150),
- child: ListView.separated(
- itemBuilder: (context,index){
- return Container(
- width: MediaQuery.of(context).size.width-hsp(60)-wsp(150),
- padding: EdgeInsets.only(bottom: index==1?0:hsp(20),top: index==0?0:hsp(20)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('${widget.orderDict['dtAirplaneGoods']['contactPerson']}',style: TextStyle(fontSize: zsp(32),color: Color(0xFF343434),fontWeight: FontWeight.bold),),
- Text('联系方式 ${widget.orderDict['dtAirplaneGoods']['phone']}',style: TextStyle(fontSize: zsp(25),color: Color(0xFF666666),))
- ],
- ),
- );
- },
- separatorBuilder: (context,index){
- return Divider(color: Color(0xFFE5E5E5),height: 0.5,thickness: 0.5,);
- },
- itemCount: 1,
- padding: EdgeInsets.all(0),
- shrinkWrap: true,
- ),
- ),
- ],
- ),
- ),
- ],
- ):widget.type==payType.marry||widget.type==payType.sport||widget.type==payType.sightseeing?Column(
- children: [
- Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(12)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('${widget.orderDict['orderName']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFF000000)),),
- Text('¥${widget.orderDict['price']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),)
- ],
- ),
- ),
- Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(2)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: RichText(
- text: TextSpan(
- text: '联系方式 ',
- style: TextStyle(color: Colors.black,fontWeight: FontWeight.bold,fontSize: zsp(30)),
- children: [
- TextSpan(
- text: '${widget.orderDict['phone']}',
- style: TextStyle(fontWeight: FontWeight.normal,color: Color(0xFF666666))
- )
- ]
- ),
- ),
- ),
- if(widget.type==payType.marry)Container(
- padding: EdgeInsets.only(top: hsp(30),left: hsp(30),right: hsp(30),bottom: hsp(10)),
- margin: EdgeInsets.only(top: hsp(2)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: Text('贺卡备注',style: TextStyle(color: Colors.black,fontWeight: FontWeight.bold,fontSize: zsp(30)),),
- ),
- if(widget.type==payType.marry)Container(
- padding: EdgeInsets.only(left: hsp(40),right: hsp(30),bottom: hsp(30)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: Text(widget.orderDict['des']==null?'':'${widget.orderDict['des']}',style: TextStyle(color: Color(0xFF666666),fontWeight: FontWeight.normal,fontSize: zsp(30)),),
- )
- ],
- ):widget.type==payType.short?Column(
- children: [
- Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(12)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- width: MediaQuery.of(context).size.width*0.6,
- child: ListView.builder(
- itemBuilder: (context,index){
- return Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Column(
- children: [
- Container(
- height: hsp(30),
- width: hsp(30),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(50)),
- border: Border.all(color: index==0?Color(0xFF02C094):Color(0xFFFB9658),width: wsp(6))
- ),
- margin: EdgeInsets.only(top: hsp(10),bottom: hsp(7)),
- ),
- if(index<1)Container(
- height: hsp(30),
- width: hsp(5),
- color: Color(0xFFCACAD4),
- )
- ],
- ),
- Container(
- child: RichText(
- text: TextSpan(
- text: '${widget.orderDict[index==0?'setoutInfo':'arriveInfo']['display']}',
- style: TextStyle(color: Color(0xFF000000),fontSize: zsp(32),fontWeight: FontWeight.bold),
- children: [
- TextSpan(
- text: ' ${widget.orderDict[index==0?'setoutInfo':'arriveInfo']['airplaneName']}',
- style: TextStyle(color: Color(0xFF999999),fontSize: zsp(20),fontWeight: FontWeight.normal),
- )
- ]
- ),
- ),
- margin: EdgeInsets.only(left: wsp(10)),
- )
- ],
- );
- },
- itemCount: 2,
- shrinkWrap: true,
- physics: NeverScrollableScrollPhysics(),
- ),
- ),
- Container(//¥ ${widget.orderDict['unitPrice']} x ${widget.orderDict['travelersNumber']}人
- child: Text('',style: TextStyle(fontSize: zsp(28),color: Color(0xFFA2A2A2)),),
- padding: EdgeInsets.only(top: hsp(10)),
- )
- ],
- ),
- )
- ],
- ):widget.type==payType.business?Container(
- margin: EdgeInsets.only(top: hsp(10)),
- child: Column(
- children: [
- ListView.separated(
- shrinkWrap: true,
- itemBuilder: (context,index){
- return Container(
- color: Colors.white,
- child: Column(
- children: [
- widget.orderDict['charterType']=='1'?Container(
- padding: EdgeInsets.only(left: wsp(32),right: wsp(32),top: hsp(20),bottom: hsp(20)),
- child: Column(
- children: [
- Row(
- children: [
- Container(
- child: SingleChildScrollView(
- child: Text('${widget.orderDict['itineraries'][index]['setOutInfo']['display']}',
- style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),maxLines: 1,),
- scrollDirection: Axis.horizontal,
- ),
- width: (MediaQuery.of(context).size.width-hsp(240))/2,
- ),
- Image(height: hsp(60),width: hsp(60),image: AssetImage('lib/images/plane.png'),),
- Container(
- child: SingleChildScrollView(
- child: Text('${widget.orderDict['itineraries'][index]['arriveInfo']['display']}',
- style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),maxLines: 1,),
- scrollDirection: Axis.horizontal,
- ),
- width: (MediaQuery.of(context).size.width-hsp(240))/2,
- alignment: Alignment.centerRight,
- ),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- child: Text('${widget.orderDict['itineraries'][index]['setOutInfo']['airplaneName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
- width: (MediaQuery.of(context).size.width-hsp(300))/2,
- ),
- // Text('${widget.orderDict['itineraries'][index]['time']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
- Container(
- child: Text('${widget.orderDict['itineraries'][index]['arriveInfo']['airplaneName']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
- width: (MediaQuery.of(context).size.width-hsp(300))/2,
- alignment: Alignment.centerRight,
- ),
- ],
- )
- ],
- ),
- ):Container(
- width: MediaQuery.of(context).size.width-hsp(60),
- child: ListView.builder(
- itemBuilder: (context,indexSub){
- return Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Column(
- children: [
- Container(
- height: hsp(30),
- width: hsp(30),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(50)),
- border: Border.all(color: indexSub%2==0?Color(0xFF02C094):Color(0xFFFB9658),width: wsp(6))
- ),
- margin: EdgeInsets.only(top: hsp(10),bottom: hsp(7)),
- ),
- if(indexSub<1)Container(
- height: hsp(30),
- width: hsp(5),
- color: Color(0xFFCACAD4),
- )
- ],
- ),
- Container(
- child: RichText(
- text: TextSpan(
- text: '${widget.orderDict['itineraries'][index][indexSub==0?'setout':'arrive']}',
- style: TextStyle(color: Color(0xFF000000),fontSize: hsp(30),fontWeight: FontWeight.bold),
- children: [
- ]
- ),
- ),
- margin: EdgeInsets.only(left: wsp(10),top: hsp(5)),
- )
- ],
- );
- },
- itemCount: 2,
- shrinkWrap: true,
- physics: NeverScrollableScrollPhysics(),
- padding: EdgeInsets.only(top: hsp(10),bottom: hsp(10)),
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),),
- Container(
- padding: EdgeInsets.only(left: wsp(32),right: wsp(32),top: hsp(20),bottom: hsp(20)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Column(
- children: [
- Text('出发',style: TextStyle(fontSize: zsp(24),color: Color(0xFF666666)),),
- RichText(
- text: TextSpan(
- text: _getDateStr('${widget.orderDict['itineraries'][index]['timeSetout']}'),style: TextStyle(fontSize: zsp(28),fontWeight: FontWeight.bold,color: Colors.black),
- children: [
- // TextSpan(
- // text: '今天',
- // style: TextStyle(fontSize: zsp(24),fontWeight: FontWeight.normal),
- // )
- ]
- ),
- )],
- crossAxisAlignment: CrossAxisAlignment.start,
- ),
- Column(
- children: [
- Text('到达',style: TextStyle(fontSize: zsp(24),color: Color(0xFF666666)),),
- RichText(
- text: TextSpan(
- text: _getDateStr('${widget.orderDict['itineraries'][index]['timeArrive']}'),style: TextStyle(fontSize: zsp(28),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),)
- ],
- ),
- ),
- ],
- ),
- );
- },
- separatorBuilder: (context,index){
- return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),);
- },
- itemCount: (widget.orderDict['itineraries']).length,
- padding: EdgeInsets.all(0),
- physics: NeverScrollableScrollPhysics(),
- ),
- ],
- ),
- ):Column(
- children: [
- Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(12)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- width: (MediaQuery.of(context).size.width-hsp(280)),
- padding: EdgeInsets.only(right: wsp(30)),
- child: ListView.builder(
- itemBuilder: (context,indexSub){
- return Stack(
- children: [
- Container(
- width: MediaQuery.of(context).size.width-hsp(280)-wsp(60),
- child: Column(
- children: [
- Text('${widget.orderDict[indexSub==0?'setoutInfo':'arriveInfo']['display']}',style: TextStyle(fontSize: zsp(30),color: Colors.black),),
- Text('${widget.orderDict[indexSub==0?'setoutInfo':'arriveInfo']['airplaneName']}',style: TextStyle(fontSize: zsp(22),color: Color(0xFF999999)),),
- ],
- crossAxisAlignment: CrossAxisAlignment.start,
- ),
- decoration: BoxDecoration(
- border: Border(left: BorderSide(width: 1,color: indexSub==1?Colors.transparent:Color(0xFFEFEFEE))),
- ),
- padding: EdgeInsets.only(left: 15,bottom: hsp(28)),
- margin: EdgeInsets.only(left: hsp(14)),
- ),
- Positioned(
- left: 0,
- width: 12,
- top: 0,
- child: Container(
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(50)),
- border: Border.all(color: indexSub==0?Color(0xFF02C094):Color(0xFFFB9658),width: wsp(6))
- ),
- margin: EdgeInsets.only(top: 5),
- ),
- height: 17,
- ),
- Positioned(
- left: 4,
- width: 5,
- top: 0,
- child: Container(color: Colors.white),
- height: 5,
- ),
- Positioned(
- left: 4,
- width: 5,
- top: 17,
- child: Container(color: Colors.white),
- height: 5,
- ),
- ],
- );
- },
- itemCount: 2,
- shrinkWrap: true,
- padding: EdgeInsets.all(0),
- physics: NeverScrollableScrollPhysics(),
- )
- ),
- Container(//¥ ${widget.orderDict['price']}x ${(widget.orderDict['travelersNumber']==null?1:widget.orderDict['travelersNumber'])}人
- width: (MediaQuery.of(context).size.width-wsp(280))*0.35,
- child: Text('',style: TextStyle(fontSize: zsp(28),color: Color(0xFFA2A2A2)),),
- padding: EdgeInsets.only(top: hsp(10)),
- )
- ],
- ),
- ),
- if(widget.orderDict['travelersNumber']!=null)Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(12)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- width: wsp(150),
- alignment: Alignment.center,
- child: Text('乘机人',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
- ),
- Container(
- width: MediaQuery.of(context).size.width-hsp(60)-wsp(150),
- child: ListView.separated(
- itemBuilder: (context,index){
- return Container(
- width: MediaQuery.of(context).size.width-hsp(60)-wsp(150),
- padding: EdgeInsets.only(bottom: index==1?0:hsp(20),top: index==0?0:hsp(20)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('${widget.orderDict['personnelInfo'][index]['username']} ${widget.orderDict['personnelInfo'][index]['phone']}',style: TextStyle(fontSize: zsp(32),color: Color(0xFF343434),fontWeight: FontWeight.bold),),
- Text('身份证 ${widget.orderDict['personnelInfo'][index]['cardid']}',style: TextStyle(fontSize: zsp(25),color: Color(0xFF666666),))
- ],
- ),
- );
- },
- separatorBuilder: (context,index){
- return Divider(color: Color(0xFFE5E5E5),height: 0.5,thickness: 0.5,);
- },
- itemCount: widget.orderDict['personnelInfo']!=null?widget.orderDict['personnelInfo'].length:0,
- padding: EdgeInsets.all(0),
- shrinkWrap: true,
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(12)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: RichText(
- text: TextSpan(
- text: '应付总额:',
- style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),
- children: [
- TextSpan(
- text: '¥${widget.orderDict['price']}',
- style: TextStyle(color: Color(0xFF007EFF),fontWeight: FontWeight.bold),
- )
- ]
- ),
- ),
- ),
- Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(12)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: Text('订单编号:${widget.orderDict['orderSn']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF9A9A9A)),),
- ),
- Container(
- padding: EdgeInsets.all(hsp(30)),
- margin: EdgeInsets.only(top: hsp(12)),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- child: Text('支付方式',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
- ),
- ListView.separated(
- itemBuilder: (context,index){
- return GestureDetector(
- onTap: (){
- setState(() {
- _selected = index;
- });
- },
- behavior: HitTestBehavior.opaque,
- child: Container(
- height: hsp(92),
- color: Colors.white,
- padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Row(
- children: [
- Container(
- height: hsp(50),
- width: hsp(50),
- margin: EdgeInsets.only(right: hsp(25)),
- child: Image.asset(index==0?'lib/images/余额.png':index==1?'lib/images/wexinLogo.png':'lib/images/aliLogo.png'),
- ),
- Text(index==0?'余额':index==1?'微信支付':'支付宝',style: TextStyle(fontSize: zsp(30),color: Color(0xFF343434),)),
- ],
- ),
- Icon(Icons.check,color:index==_selected?Color(0xFF007EFF):Colors.transparent,size: hsp(40),),
- ],
- ),
- ),
- );
- },
- separatorBuilder: (context,index){
- return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF1F2F3),);
- },
- itemCount: 3,
- padding: EdgeInsets.all(0),
- physics: NeverScrollableScrollPhysics(),
- shrinkWrap: true,
- )
- ],
- ),
- ),
- ),
- Container(
- height: hsp(120),
- width: MediaQuery.of(context).size.width,
- color: Colors.white,
- padding: EdgeInsets.only(left: wsp(60),right: wsp(60)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- GestureDetector(
- onTap: (){
- showDialog(
- context: context,
- builder: (context) {
- return AlertDialog(
- actionsPadding: EdgeInsets.all(0),
- title: Text('提示',style: TextStyle(fontWeight: FontWeight.bold,fontSize: zsp(36)),),
- content: Text('确认取消订单吗?',style: TextStyle(fontWeight: FontWeight.bold,fontSize: zsp(30))),
- actions: <Widget>[
- FlatButton(child: Text('取消',style: TextStyle(fontWeight: FontWeight.bold,fontSize: zsp(30))),onPressed: (){
- Navigator.pop(context);
- },),
- FlatButton(child: Text('确认',style: TextStyle(fontWeight: FontWeight.bold,fontSize: zsp(30))),onPressed: (){
- Navigator.pop(context);
- _postCancelOrderData();
- },),
- ],
- );
- }
- );
- },
- child: Container(
- height: hsp(88),
- width: wsp(300),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(50)),
- border: Border.all(color: Color(0xFFD9D9D9),width: 1)
- ),
- alignment: Alignment.center,
- child: Text('取消订单',style: TextStyle(fontSize: zsp(34),color: Color(0xFF343434)),),
- ),
- ),
- GestureDetector(
- onTap: () {
- _postOrderData();
- },
- child: Container(
- height: hsp(88),
- width: wsp(300),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(50)),
- color: Color(0xFF007EFF)
- ),
- alignment: Alignment.center,
- child: Text('去付款',style: TextStyle(fontSize: zsp(34),color: Colors.white),),
- ),
- )
- ],
- ),
- )
- ],
- ),
- );
- }
- _postOrderData() async{
- if(_selected==0){
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/balance/wx/checkBalance',parameter: {},isLoading: true,isToken: true,
- refresh: (){});
- if(dict!=null){
- if(dict['code']==801){
- _showAlertView(1);
- }else{
- showDialog(context: context,builder: (context){
- return AlertDialog(
- contentPadding: EdgeInsets.all(0),
- actionsPadding: EdgeInsets.all(0),
- buttonPadding: EdgeInsets.all(0),
- insetPadding: EdgeInsets.all(0),
- titlePadding: EdgeInsets.all(0),
- backgroundColor: Colors.transparent,
- content: ysPayKeybord(context,(value){
- _postPayData(value);
- },'${widget.orderDict['orderName']}',
- '${widget.orderDict['price']}')
- );
- });
- }
- }
- }else{
- Map dict = await ysRequestHttp(context,type: requestType.post,api: '/app/applets/createPayOrder',
- parameter: {'id':widget.orderDict['orderSn'],'way':_selected+1,'type':2},isLoading: true,
- isToken: true,refresh: (){});
- if(dict!=null){
- if(_selected==2){
- var payResult = await FlutterAlipay.pay('${dict['data']}');
- String payResultStatus = payResult.resultStatus;
- if (payResultStatus == "9000") {
- print('=================================订单支付成功');
- setState(() {
- _isSucceed = true;
- });
- } else if (payResultStatus == "6001") {
- print('=================================支付取消');
- } else if (payResultStatus == "4000") {
- print('=================================支付失败');
- } else if (payResultStatus == "8000") {
- print('=================================等待支付');
- } else if (payResultStatus == "6002") {
- print('=================================无网络');
- } else if (payResultStatus == "5000") {
- print('=================================重复支付');
- } else {
- print('=================================支付失败,未知错误');
- }
- }else if(_selected==1){
- Map result = dict['data'];
- fluwx.payWithWeChat(
- appId: result['appId'].toString(),
- partnerId: result['partnerId'].toString(),
- prepayId: result['prepayId'].toString(),
- packageValue: result['package'].toString(),
- nonceStr: result['nonceStr'].toString(),
- timeStamp: int.parse('${result['timeStamp']}'),
- sign: result['paySign'].toString(),
- ).then((data) {});
- }
- }
- }
- }
- _getMin(String hours){
- DateTime day1 = DateTime.parse(hours);
- DateTime day2 = DateTime.now();
- return day1.difference(day2).inMinutes;
- }
- _postCancelOrderData() async{
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneorder/cancelOrder',
- parameter: {'orderSn':widget.orderDict['orderSn']},isLoading: false,isToken: true);
- if(dict!=null){
- Navigator.pop(context);
- }
- }
- _postPayData(String pass) async{
- var dict = await ysRequestHttpEncrypt(context,type: requestType.post,api: '/app/applets/balance/balancePay',
- parameter: {'orderSn':widget.orderDict['orderSn'],'price':widget.orderDict['price'],'password': pass},isLoading: true,isToken: true);
- if(dict!=null){
- if(dict==''){
- setState(() {
- _isSucceed = true;
- });
- }else if(dict['code']==804){
- _showAlertView(2);
- }else if(dict['code']==801){
- _showAlertView(1);
- }
- }
- }
- _showAlertView (int type) async{
- showCupertinoDialog(
- context: context,
- builder: (context) {
- return CupertinoAlertDialog(
- title: Text('提示\n'),
- content: Text(type==1?'未设置支付密码':'余额不足请充值'),
- actions: <Widget>[
- CupertinoDialogAction(child: Text('取消'),onPressed: (){Navigator.pop(context);},),
- CupertinoDialogAction(child: Text(type==1?'去设置':'去充值'),onPressed: (){
- Navigator.pop(context);
- Navigator.of(context).push(
- CupertinoPageRoute(
- builder: (context){
- return type==1?YSSetPayPass():YSMoney();
- }
- )
- );
- },),
- ],
- );
- }
- );
- }
- _getDateStr(String date){
- return date.substring(0,date.length-3);
- }
- }
|