import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:ysairplane2/base/YSBase.dart'; import 'package:ysairplane2/tools/YSNetWorking.dart'; import 'package:ysairplane2/tools/YSTools.dart'; class YSRefund extends StatefulWidget { final msgDict; const YSRefund({Key key, this.msgDict}) : super(key: key); @override _YSRefundState createState() => _YSRefundState(); } class _YSRefundState extends State { TextEditingController _text = TextEditingController(); @override Widget build(BuildContext context) { return YSBase( ystitle: '申请退款', yscolor: Color(0xFFF0F0F0), yschild: Column( children: [ Container( width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44-hsp(100), child: SingleChildScrollView( child: Column( children: [ Container( margin: EdgeInsets.all(hsp(30)), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5)) ), child: Column( children: [ Container( padding: EdgeInsets.all(hsp(20)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('退款商品',style: TextStyle(fontSize: zsp(30),color: Color(0xFF141416),fontWeight: FontWeight.bold),), Text('${widget.msgDict['name']}',style: TextStyle(fontSize: zsp(26),color: Color(0xFF666666)),), ], ), ), Divider(height: 1,thickness: 1,color: Color(0xFFF5F5F5),), Container( padding: EdgeInsets.all(hsp(20)), child: Row( children: [ Icon(Icons.access_time,color: Color(0xFFBABAC6),size: hsp(28),), Text(' ${widget.msgDict['time']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF24242B)),) ], ), ), widget.msgDict['setout']!=null?Container( width: MediaQuery.of(context).size.width-hsp(140), child: ListView.builder( itemBuilder: (context,indexSub2){ return Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Column( children: [ Container( height: hsp(28), width: hsp(28), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(50)), border: Border.all(color: indexSub2==0?Color(0xFF02C094):Color(0xFFFB9658),width: wsp(6)) ), margin: EdgeInsets.only(top: hsp(7),bottom: hsp(7)), ), if(indexSub2<1)Container( height: hsp(28), child: DashedRect( color: Color(0xFFCACAD4), strokeWidth: 1, gap: 1 ), ) ], ), Container( child: indexSub2==0?Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(widget.msgDict['setout']!=null?' ${widget.msgDict['setout']}':' ', style: TextStyle(color: Color(0xFF68686F),fontSize: zsp(28))), // Icon(Icons.keyboard_arrow_right,size: hsp(50),color: Color(0xFF999999),) ], ):Text(widget.msgDict['arrive']!=null?' ${widget.msgDict['arrive']}':' ',style: TextStyle(color: Color(0xFF68686F),fontSize: zsp(28))), width: MediaQuery.of(context).size.width-hsp(180), ), ], ); }, itemCount: 2, shrinkWrap: true, physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.only(bottom: hsp(20)), ), ):Container( child: Text('${widget.msgDict['title']}',style: TextStyle(color: Color(0xFF68686F),fontSize: zsp(28))), width: MediaQuery.of(context).size.width-hsp(140), alignment: Alignment.centerLeft, padding: EdgeInsets.only(bottom: hsp(20)), ), ], ), ), Container( margin: EdgeInsets.only(left: hsp(30),right: hsp(30),bottom: hsp(30)), padding: EdgeInsets.only(left: hsp(20),right: hsp(20)), height: hsp(100), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5)) ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('退款金额',style: TextStyle(color: Color(0xFF141416),fontSize: zsp(30))), Text('¥${widget.msgDict['payPrice']}',style: TextStyle(color: Color(0xFFED561F),fontSize: zsp(30))), ], ) ), Container( margin: EdgeInsets.only(left: hsp(30),right: hsp(30)), padding: EdgeInsets.all(hsp(20)), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5)) ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('补充描述',style: TextStyle(color: Color(0xFF141416),fontSize: zsp(30))), Container( margin: EdgeInsets.only(top: hsp(20)), height: hsp(300), decoration: BoxDecoration( color: Color(0xFFF9F9F9), borderRadius: BorderRadius.all(Radius.circular(5)) ), padding: EdgeInsets.all(hsp(20)), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.end, children: [ Container( height: hsp(220), child: CupertinoTextField( placeholder: '补充描述,有助于商家更好的处理售后问题', style: TextStyle(fontSize: zsp(28),color: Color(0xFF999999)), padding: EdgeInsets.all(0), maxLines: 100, maxLength: 200, decoration: BoxDecoration(), controller: _text, ), ), Text('${_text.text.length}/200',style: TextStyle(fontSize: zsp(20),color: Color(0xFF999999)),) ], ), ) ], ), ) ], ), ), ), GestureDetector( onTap: (){ _postRefundData(); }, child: Container( height: hsp(100), width: MediaQuery.of(context).size.width, color: Colors.white, child: Container( margin: EdgeInsets.only(left: hsp(40),right: hsp(40),top: hsp(10),bottom: hsp(10)), decoration: BoxDecoration( color: Color(0xFF1784FB), borderRadius: BorderRadius.all(Radius.circular(50)) ), alignment: Alignment.center, child: Text('提交',style: TextStyle(fontSize: zsp(30),color: Colors.white),), ), ), ) ], ), ); } _postRefundData() async{ if(_text.text.isEmpty){ ysFlutterToast(context, '请在补充描述里说明退款理由'); return; } Map dict = await ysRequestHttp(context,type: requestType.post,api: '/partner/refund/application/refund', parameter: {'ordersn':widget.msgDict['orderSn'],'count':_text.text},isLoading: true,isToken: true,refresh: (){_postRefundData();}); if(dict!=null){ ysFlutterToast(context, '退款申请已提交'); Navigator.of(context).pop(''); } } }