import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:ysairplane/base/YSBase.dart'; import 'package:ysairplane/code/YSCourseDetail.dart'; import 'package:ysairplane/code/YSHome.dart'; import 'package:ysairplane/code/YSMoney.dart'; import 'package:ysairplane/code/YSSetPayPass.dart'; import 'package:ysairplane/tools/YSNetWorking.dart'; import 'package:ysairplane/tools/YSPayKeybord.dart'; import 'package:ysairplane/tools/YSTools.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 { int _selected = 0; bool _isSucceed = false; @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('支付成功',style: TextStyle(fontSize: zsp(40),color: Color(0xFF333333)),), margin: EdgeInsets.only(top: hsp(40),bottom: hsp(33)), ), Text('本次支付金额${widget.orderDict['price']}元',style: TextStyle(fontSize: zsp(28),color: Color(0xFF878787)),), ], ), ), GestureDetector( onTap: (){ Navigator.of(context).pushAndRemoveUntil( CupertinoPageRoute( builder: (context){ return YSHome(); } ), (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['expireHour']}')}分钟内完成支付, 否则该订单将被自动取消',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?'airportSetout':'airportArrive']}', 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']} x ${widget.orderDict['travelersNumber']}人',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( child: Text('¥ ${widget.orderDict['retailPrice']} x ${widget.orderDict['travelersNumber']}人',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: Row( children: [ Text('${widget.orderDict['setoutInfo']['display']} ',style: TextStyle(fontSize: zsp(25),color: Color(0xFF9A9A9A))), Container( height: 1, width: wsp(20), color: Color(0xFFCCCCCC), ), Text(' ${widget.orderDict['arriveInfo']['display']}',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(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?'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),top: hsp(5)), ) ], ); }, itemCount: 2, shrinkWrap: true, physics: NeverScrollableScrollPhysics(), ), ), Container( child: Text('¥ ${widget.orderDict['retailPrice']} x ${widget.orderDict['travelersNumber']}人',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: Text('${widget.orderDict['itineraries'][index]['setOutInfo']['display']}', style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),), width: (MediaQuery.of(context).size.width-hsp(210))/2, ), Image(height: hsp(60),width: hsp(60),image: AssetImage('lib/images/plane.png'),), Container( child: Text('${widget.orderDict['itineraries'][index]['arriveInfo']['display']}', style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),), width: (MediaQuery.of(context).size.width-hsp(210))/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))*0.65, padding: EdgeInsets.only(right: wsp(30)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Text('${widget.orderDict['setoutInfo']['display']}',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),), Container( height: 2, width: wsp(40), color: Color(0xFFCCCCCC), ), Text('${widget.orderDict['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),) ], mainAxisAlignment: MainAxisAlignment.spaceBetween, ), Container( child: Row( children: [ Text('${widget.orderDict['setoutInfo']['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),), Text('${widget.orderDict['arriveInfo']['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),), ], mainAxisAlignment: MainAxisAlignment.spaceBetween, ), margin: EdgeInsets.only(top: hsp(10),bottom: hsp(20)), ), // Row( // children: [ // Container( // color: Color(0xFF000000), // height: hsp(35), // child: Row( // children: [ // Image(image: AssetImage('lib/images/vip2.png'),height: hsp(15),width: wsp(16),), // Text(' G450',style: TextStyle(fontSize: zsp(18),color: Color(0xFFF9DEAC)),) // ], // ), // padding: EdgeInsets.only(left: wsp(5),right: wsp(5)), // ), // Container( // padding: EdgeInsets.only(left: wsp(5),right: wsp(5)), // height: hsp(35), // child: Text('座位30',style: TextStyle(fontSize: zsp(20),color: Color(0xFF565656)),), // decoration: BoxDecoration( // border: Border.all(color: Color(0xFF565656),width: 0.5) // ), // alignment: Alignment.center, // ), // ], // ), ], ), ), Container( width: (MediaQuery.of(context).size.width-wsp(280))*0.35, child: Text('¥ ${widget.orderDict['price']}x ${widget.orderDict['travelersNumber']}人',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['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/wexinLogo.png':index==1?'lib/images/aliLogo.png':'lib/images/wexinLogo.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: [ 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: (){ 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.type==payType.marry||widget.type==payType.sport||widget.type==payType.sightseeing?'${widget.orderDict['orderName']}':(widget.type==payType.doctor|| widget.type==payType.help)?'${widget.orderDict['citySetout']}到${widget.orderDict['cityArrive']}':widget.type==payType.business?'商旅包机':'${widget.orderDict['setoutInfo']['display']}到' '${widget.orderDict['arriveInfo']['display']}', '${widget.orderDict['price']}') ); }); }, 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),), ), ) ], ), ) ], ), ); } _getMin(String hours){ double time = double.parse(hours); return '${(time*60)~/1}'; } _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(1); }else if(dict['code']==801){ _showAlertView(2); } } } _showAlertView (int type) async{ showCupertinoDialog( context: context, builder: (context) { return CupertinoAlertDialog( title: Text('提示\n'), content: Text(type==1?'未设置支付密码':'余额不足请充值'), actions: [ 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); } }