YSRefund.dart 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:ysairplane2/base/YSBase.dart';
  4. import 'package:ysairplane2/tools/YSNetWorking.dart';
  5. import 'package:ysairplane2/tools/YSTools.dart';
  6. class YSRefund extends StatefulWidget {
  7. final msgDict;
  8. const YSRefund({Key key, this.msgDict}) : super(key: key);
  9. @override
  10. _YSRefundState createState() => _YSRefundState();
  11. }
  12. class _YSRefundState extends State<YSRefund> {
  13. TextEditingController _text = TextEditingController();
  14. @override
  15. Widget build(BuildContext context) {
  16. return YSBase(
  17. ystitle: '申请退款',
  18. yscolor: Color(0xFFF0F0F0),
  19. yschild: Column(
  20. children: [
  21. Container(
  22. width: MediaQuery.of(context).size.width,
  23. height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44-hsp(100),
  24. child: SingleChildScrollView(
  25. child: Column(
  26. children: [
  27. Container(
  28. margin: EdgeInsets.all(hsp(30)),
  29. decoration: BoxDecoration(
  30. color: Colors.white,
  31. borderRadius: BorderRadius.all(Radius.circular(5))
  32. ),
  33. child: Column(
  34. children: [
  35. Container(
  36. padding: EdgeInsets.all(hsp(20)),
  37. child: Row(
  38. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  39. children: [
  40. Text('退款商品',style: TextStyle(fontSize: zsp(30),color: Color(0xFF141416),fontWeight: FontWeight.bold),),
  41. Text('${widget.msgDict['name']}',style: TextStyle(fontSize: zsp(26),color: Color(0xFF666666)),),
  42. ],
  43. ),
  44. ),
  45. Divider(height: 1,thickness: 1,color: Color(0xFFF5F5F5),),
  46. Container(
  47. padding: EdgeInsets.all(hsp(20)),
  48. child: Row(
  49. children: [
  50. Icon(Icons.access_time,color: Color(0xFFBABAC6),size: hsp(28),),
  51. Text(' ${widget.msgDict['time']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF24242B)),)
  52. ],
  53. ),
  54. ),
  55. widget.msgDict['setout']!=null?Container(
  56. width: MediaQuery.of(context).size.width-hsp(140),
  57. child: ListView.builder(
  58. itemBuilder: (context,indexSub2){
  59. return Row(
  60. crossAxisAlignment: CrossAxisAlignment.start,
  61. children: [
  62. Column(
  63. children: [
  64. Container(
  65. height: hsp(28),
  66. width: hsp(28),
  67. decoration: BoxDecoration(
  68. color: Colors.white,
  69. borderRadius: BorderRadius.all(Radius.circular(50)),
  70. border: Border.all(color: indexSub2==0?Color(0xFF02C094):Color(0xFFFB9658),width: wsp(6))
  71. ),
  72. margin: EdgeInsets.only(top: hsp(7),bottom: hsp(7)),
  73. ),
  74. if(indexSub2<1)Container(
  75. height: hsp(28),
  76. child: DashedRect(
  77. color: Color(0xFFCACAD4),
  78. strokeWidth: 1,
  79. gap: 1
  80. ),
  81. )
  82. ],
  83. ),
  84. Container(
  85. child: indexSub2==0?Row(
  86. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  87. children: [
  88. Text(widget.msgDict['setout']!=null?' ${widget.msgDict['setout']}':' ',
  89. style: TextStyle(color: Color(0xFF68686F),fontSize: zsp(28))),
  90. // Icon(Icons.keyboard_arrow_right,size: hsp(50),color: Color(0xFF999999),)
  91. ],
  92. ):Text(widget.msgDict['arrive']!=null?' ${widget.msgDict['arrive']}':' ',style: TextStyle(color: Color(0xFF68686F),fontSize: zsp(28))),
  93. width: MediaQuery.of(context).size.width-hsp(180),
  94. ),
  95. ],
  96. );
  97. },
  98. itemCount: 2,
  99. shrinkWrap: true,
  100. physics: NeverScrollableScrollPhysics(),
  101. padding: EdgeInsets.only(bottom: hsp(20)),
  102. ),
  103. ):Container(
  104. child: Text('${widget.msgDict['title']}',style: TextStyle(color: Color(0xFF68686F),fontSize: zsp(28))),
  105. width: MediaQuery.of(context).size.width-hsp(140),
  106. alignment: Alignment.centerLeft,
  107. padding: EdgeInsets.only(bottom: hsp(20)),
  108. ),
  109. ],
  110. ),
  111. ),
  112. Container(
  113. margin: EdgeInsets.only(left: hsp(30),right: hsp(30),bottom: hsp(30)),
  114. padding: EdgeInsets.only(left: hsp(20),right: hsp(20)),
  115. height: hsp(100),
  116. decoration: BoxDecoration(
  117. color: Colors.white,
  118. borderRadius: BorderRadius.all(Radius.circular(5))
  119. ),
  120. child: Row(
  121. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  122. children: [
  123. Text('退款金额',style: TextStyle(color: Color(0xFF141416),fontSize: zsp(30))),
  124. Text('¥${widget.msgDict['payPrice']}',style: TextStyle(color: Color(0xFFED561F),fontSize: zsp(30))),
  125. ],
  126. )
  127. ),
  128. Container(
  129. margin: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  130. padding: EdgeInsets.all(hsp(20)),
  131. decoration: BoxDecoration(
  132. color: Colors.white,
  133. borderRadius: BorderRadius.all(Radius.circular(5))
  134. ),
  135. child: Column(
  136. crossAxisAlignment: CrossAxisAlignment.start,
  137. children: [
  138. Text('补充描述',style: TextStyle(color: Color(0xFF141416),fontSize: zsp(30))),
  139. Container(
  140. margin: EdgeInsets.only(top: hsp(20)),
  141. height: hsp(300),
  142. decoration: BoxDecoration(
  143. color: Color(0xFFF9F9F9),
  144. borderRadius: BorderRadius.all(Radius.circular(5))
  145. ),
  146. padding: EdgeInsets.all(hsp(20)),
  147. child: Column(
  148. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  149. crossAxisAlignment: CrossAxisAlignment.end,
  150. children: [
  151. Container(
  152. height: hsp(220),
  153. child: CupertinoTextField(
  154. placeholder: '补充描述,有助于商家更好的处理售后问题',
  155. style: TextStyle(fontSize: zsp(28),color: Color(0xFF999999)),
  156. padding: EdgeInsets.all(0),
  157. maxLines: 100,
  158. maxLength: 200,
  159. decoration: BoxDecoration(),
  160. controller: _text,
  161. ),
  162. ),
  163. Text('${_text.text.length}/200',style: TextStyle(fontSize: zsp(20),color: Color(0xFF999999)),)
  164. ],
  165. ),
  166. )
  167. ],
  168. ),
  169. )
  170. ],
  171. ),
  172. ),
  173. ),
  174. GestureDetector(
  175. onTap: (){
  176. _postRefundData();
  177. },
  178. child: Container(
  179. height: hsp(100),
  180. width: MediaQuery.of(context).size.width,
  181. color: Colors.white,
  182. child: Container(
  183. margin: EdgeInsets.only(left: hsp(40),right: hsp(40),top: hsp(10),bottom: hsp(10)),
  184. decoration: BoxDecoration(
  185. color: Color(0xFF1784FB),
  186. borderRadius: BorderRadius.all(Radius.circular(50))
  187. ),
  188. alignment: Alignment.center,
  189. child: Text('提交',style: TextStyle(fontSize: zsp(30),color: Colors.white),),
  190. ),
  191. ),
  192. )
  193. ],
  194. ),
  195. );
  196. }
  197. _postRefundData() async{
  198. if(_text.text.isEmpty){
  199. ysFlutterToast(context, '请在补充描述里说明退款理由');
  200. return;
  201. }
  202. Map dict = await ysRequestHttp(context,type: requestType.post,api: '/partner/refund/application/refund',
  203. parameter: {'ordersn':widget.msgDict['orderSn'],'count':_text.text},isLoading: true,isToken: true,refresh: (){_postRefundData();});
  204. if(dict!=null){
  205. ysFlutterToast(context, '退款申请已提交');
  206. Navigator.of(context).pop('');
  207. }
  208. }
  209. }