123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405 |
- import 'package:flutter/material.dart';
- import 'package:ysairplane2/base/YSBase.dart';
- import 'package:ysairplane2/tools/YSNetWorking.dart';
- import 'package:ysairplane2/tools/YSTools.dart';
- import 'YSPayTypeView.dart';
- class YSTicketChange extends StatefulWidget {
- final String title;
- final String dateStr;
- final String orderSn;
- const YSTicketChange({Key key, this.title = '', this.dateStr, this.orderSn}) : super(key: key);
- @override
- _YSTicketChangeState createState() => _YSTicketChangeState();
- }
- class _YSTicketChangeState extends State<YSTicketChange> {
- Map _msgDict = {};
- String _amount = '0.00';
- bool _isDetail = false;
- @override
- void initState() {
- Future.delayed(Duration(seconds: 0)).then((value){
- _getTicketData();
- });
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- return YSBase(
- ystitle: widget.title,
- yscolor: Color(0xFFF1F2F3),
- yschild: Container(
- height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44,
- decoration: BoxDecoration(
- gradient: LinearGradient(
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- colors: [
- Color(0xFF007CFF),
- Color(0xFFB8D8F8),
- Color(0xFFF1F2F3),
- Color(0xFFF1F2F3),
- ]
- )
- ),
- child: Stack(
- children: [
- Column(
- children: [
- Container(
- padding: EdgeInsets.only(top: hsp(20),left: hsp(20),right: hsp(20)),
- height: MediaQuery.of(context).size.height-hsp(220)-MediaQuery.of(context).padding.top-44,
- width: MediaQuery.of(context).size.width,
- child: SingleChildScrollView(
- child: Column(
- children: [
- ListView.separated(
- itemBuilder: (context,index){
- return Container(
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- child: LayoutBuilder(
- builder: (context,listSize){
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- height: hsp(30),
- width: hsp(80),
- decoration: BoxDecoration(
- color: Color(index==0?0xFFFF9950:0xFFCACBCE),
- borderRadius: BorderRadius.only(topRight: Radius.circular(5),bottomLeft: Radius.circular(5))
- ),
- margin: EdgeInsets.only(left: listSize.maxWidth-hsp(80)),
- alignment: Alignment.center,
- child: Text(index==0?'新订单':'老订单',style: TextStyle(fontSize: zsp(16),color: Colors.white),),
- ),
- Container(
- child: RichText(
- text: TextSpan(
- // text: '9月30日 明天 预计',
- style: TextStyle(fontSize: zsp(24),color: Color(index==0?0xFF4A4A4A:0xFF9B9B9B)),
- children: [
- TextSpan(
- text: index==0?(_msgDict['newEndorseTime']??''):(_msgDict['time']??''),
- style: TextStyle(color: Color(index==0?0xFF0078FF:0xFF9B9B9B))
- ),
- TextSpan(
- text: ' 上机'
- )
- ]
- ),
- ),
- padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
- ),
- _msgDict['setout']!=null?Column(
- children: [
- Container(
- decoration: BoxDecoration(
- border: Border(bottom: BorderSide(color: Color(0xFFD8D8D8),width: hsp(1)))
- ),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(50)),
- border: Border.all(color: Color(0xFF00C390),width: hsp(10))
- ),
- height: hsp(30),
- width: hsp(30),
- ),
- Container(
- width: listSize.maxWidth-hsp(70),
- padding: EdgeInsets.only(left: hsp(20)),
- child: Text('${_msgDict['setoutCity']??''}· ${_msgDict['setout']??''}',style: TextStyle(fontSize: zsp(32),
- color: index==0?Colors.black:Color(0xFF9B9B9B),fontWeight: FontWeight.bold,height: 1),),
- )
- ],
- ),
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20),top: hsp(40),bottom: hsp(30)),
- ),
- Container(
- decoration: BoxDecoration(
- border: Border(bottom: BorderSide(color: Color(0xFFD8D8D8),width: hsp(1)))
- ),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(50)),
- border: Border.all(color: Color(0xFFFF8F46),width: hsp(10))
- ),
- height: hsp(30),
- width: hsp(30),
- ),
- Container(
- width: listSize.maxWidth-hsp(70),
- padding: EdgeInsets.only(left: hsp(20)),
- child: Text('${_msgDict['arriveCity']??''}· ${_msgDict['arrive']??''}',style: TextStyle(fontSize: zsp(32),
- color: index==0?Colors.black:Color(0xFF9B9B9B),fontWeight: FontWeight.bold,height: 1),),
- )
- ],
- ),
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20),top: hsp(40),bottom: hsp(30)),
- )
- ],
- ):Column(
- children: [
- Container(
- child: Text('${_msgDict['name']??''}',style: TextStyle(fontSize: zsp(32),
- color: index==0?Colors.black:Color(0xFF9B9B9B),fontWeight: FontWeight.bold,height: 1),),
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20),top: hsp(40)),
- ),
- Container(
- child: Text('${_msgDict['title']??''}',style: TextStyle(fontSize: zsp(28),
- color: index==0?Colors.black:Color(0xFF9B9B9B),fontWeight: FontWeight.normal,height: 1),),
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20),top: hsp(20)),
- )
- ],
- crossAxisAlignment: CrossAxisAlignment.start,
- ),
- Container(
- height: hsp(100),
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20)),
- alignment: Alignment.centerRight,
- child: RichText(
- text: TextSpan(
- text: '订单金额:',
- style: TextStyle(fontSize: zsp(24),color: Color(0xFF4A4A4A)),
- children: [
- TextSpan(
- text: '¥${index==0?(_msgDict['newOrderPrice']??''):(_msgDict['orderPrice']??'')}',
- style: TextStyle(color: index==0?Color(0xFFFD2A2E):Color(0xFF9B9B9B),fontSize: zsp(36),fontWeight: FontWeight.bold)
- ),
- ]
- ),
- )
- )
- ],
- );
- },
- ),
- );
- },
- separatorBuilder: (context,index){return Container(height: hsp(20),);},
- itemCount: 2,
- padding: EdgeInsets.all(0),
- physics: NeverScrollableScrollPhysics(),
- shrinkWrap: true,
- ),
- if(_msgDict['personInfos']!=null)Container(
- margin: EdgeInsets.only(top: hsp(20)),
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20),top: hsp(30)),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('乘车人',style: TextStyle(fontSize: zsp(28),color: Color(0xFF4A4A4A),fontWeight: FontWeight.bold),),
- ListView.separated(
- itemCount: _msgDict['personInfos'].length,
- separatorBuilder: (context,index){
- return Divider(height: hsp(1),thickness: hsp(1),color: Color(0xFFF1F2F3),);
- },
- itemBuilder: (context,index){
- Map item = _msgDict['personInfos'][index];
- return Container(
- padding: EdgeInsets.only(top: hsp(30),bottom: hsp(30)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('姓名:${item['username']}',style: TextStyle(fontSize: zsp(30),color: Color(0xFF4A4A4A)),),
- Text('手机号码:${item['phone']}',style: TextStyle(fontSize: zsp(30),color: Color(0xFF4A4A4A),height: 2),),
- Text('身份证号码:${item['cardid']}',style: TextStyle(fontSize: zsp(30),color: Color(0xFF4A4A4A),height: 2),)
- ],
- ),
- );
- },
- shrinkWrap: true,
- physics: NeverScrollableScrollPhysics(),
- padding: EdgeInsets.all(0),
- )
- ],
- ),
- width: MediaQuery.of(context).size.width,
- )
- ],
- ),
- ),
- ),
- Container(
- height: hsp(100),
- color: Color(0xFFFFF6CC),
- alignment: Alignment.center,
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20)),
- child: Text('改签订单金额高于原订单金额,需补足差价',style: TextStyle(fontSize: zsp(28),color: Color(0xFF93631B)),),
- ),
- 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: ' $_amount',
- 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: (){
- showModalBottomSheet(
- context: context,
- backgroundColor: Colors.transparent,
- isScrollControlled: true,
- builder: (context){
- return YSPayTypeView(orderDict: {'orderSn':widget.orderSn,'price':_amount,'orderName':_msgDict['name']},postSuccess: (){
- Navigator.pop(context);
- Navigator.of(context).pop('');
- },);
- }
- );
- },
- 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-MediaQuery.of(context).padding.top-44-hsp(120),
- color: Colors.black45,
- child: Container(
- margin: EdgeInsets.only(top: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44-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(270),
- color: Color(0xFFF7F8F9),
- padding: EdgeInsets.only(left: wsp(40),right: wsp(40),bottom: hsp(20),top: hsp(20)),
- child: Column(
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [//x ${_customer.length==0?1:_customer.length}人
- Text('手续费',style: TextStyle(fontSize: zsp(32),color: Color(0xFF000000),decoration: TextDecoration.none),),
- Text('¥ ${_msgDict['newEndorsePrice']??0*_msgDict['personNum']??0}',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none),),
- ],
- ),
- if((_msgDict['newOrderPrice']??0)-(_msgDict['orderPrice']??0)>0)Container(
- margin: EdgeInsets.only(top: hsp(10)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [//x ${_customer.length==0?1:_customer.length}人
- Text('差价',style: TextStyle(fontSize: zsp(32),color: Color(0xFF000000),decoration: TextDecoration.none),),
- Text('¥ ${(_msgDict['newOrderPrice']??0)-(_msgDict['orderPrice']??0)}',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none),),
- ],
- ),
- )
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- )
- ],
- ),
- ),
- );
- }
- _getTicketData() async{
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneorder/createChanging',
- parameter: {'orderSn':widget.orderSn,'changeTime':widget.dateStr},isLoading: false,isToken: true);
- if(dict!=null){
- _msgDict = dict['data'];
- _amount = '${_msgDict['newEndorsePrice']*_msgDict['personNum']+(_msgDict['newOrderPrice']-_msgDict['orderPrice'])}';
- setState(() {});
- }
- }
- }
|