|
|
|
@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:fluttertoast/fluttertoast.dart'; |
|
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/coupon_vo.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/order_info.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
|
|
import 'package:huixiang/utils/flutter_utils.dart'; |
|
|
|
@ -104,9 +103,9 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
titleSpacing: 2, |
|
|
|
|
leadingWidth: 56.w, |
|
|
|
|
bottom: PreferredSize( |
|
|
|
|
preferredSize: Size(double.infinity, orderStatus >= 4 ? 88.h : 98.h), |
|
|
|
|
preferredSize: Size(double.infinity, orderStatus >= 4 ? 98.h : 108.h), |
|
|
|
|
child: Container( |
|
|
|
|
height: orderStatus >= 4 ? 88.h : 98.h, |
|
|
|
|
height: orderStatus >= 4 ? 98.h : 108.h, |
|
|
|
|
padding: EdgeInsets.fromLTRB(16.w, 0, 16.w, 10.h), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
@ -114,7 +113,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
visible: center != null && center != "", |
|
|
|
|
child: Container( |
|
|
|
|
child: IconText( |
|
|
|
|
S.of(context).dingdanyiwancheng, |
|
|
|
|
(center != null && center != "") ? center : "", |
|
|
|
|
leftImage: "assets/image/icon_order_ok.png", |
|
|
|
|
iconSize: 40.w, |
|
|
|
|
textStyle: TextStyle( |
|
|
|
@ -144,14 +143,12 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
width: 42.w, |
|
|
|
|
height: 20.h, |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
padding: |
|
|
|
|
EdgeInsets.fromLTRB(8.w, 1.h, 8.w, 1.h), |
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
radius: 15.w, |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 6.h, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
title, |
|
|
|
|
style: TextStyle( |
|
|
|
@ -171,9 +168,12 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
children: timeWidget(), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
visible: (isTakeOut == 0) ? !(payStatus == 1) : |
|
|
|
|
(isTakeOut == 1) ? !(payStatus == 1 && (sendStatus != 2 && sendStatus != 3)) : |
|
|
|
|
!(payStatus == 1 && (sendStatus != 1)), |
|
|
|
|
visible: (orderStatus >= 4) ? false : (isTakeOut == 0) |
|
|
|
|
? !(payStatus == 1) |
|
|
|
|
: (isTakeOut == 1) |
|
|
|
|
? !(payStatus == 1 && |
|
|
|
|
(sendStatus != 2 && sendStatus != 3)) |
|
|
|
|
: !(payStatus == 1 && (sendStatus != 1)), |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
@ -230,7 +230,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<Widget> timeWidget() { |
|
|
|
|
if(orderInfo == null) return []; |
|
|
|
|
if (orderInfo == null) return []; |
|
|
|
|
String hour = ""; |
|
|
|
|
String minute = ""; |
|
|
|
|
if (payStatus == 0) { |
|
|
|
@ -325,69 +325,73 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
title = S.of(context).dingdanyiwancheng; |
|
|
|
|
center = S.of(context).dingdanyiwancheng; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if (refundStatus == 1) { |
|
|
|
|
title = S.of(context).dingdanyituikuan; |
|
|
|
|
center = S.of(context).dingdanyituikuan; |
|
|
|
|
case 5: |
|
|
|
|
title = S.of(context).yiquxiao; |
|
|
|
|
center = S.of(context).yiquxiao; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else if (isTakeOut == 1) { |
|
|
|
|
if (payStatus == 0) { |
|
|
|
|
title = S.of(context).dingdandaizhifu; |
|
|
|
|
} else { |
|
|
|
|
title = "等待商家确认"; |
|
|
|
|
switch (sendStatus) { |
|
|
|
|
case 1: |
|
|
|
|
title = S.of(context).zhengzaihujiaoqishou; |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
title = S.of(context).qishouyijiedanquhuozhong; |
|
|
|
|
break; |
|
|
|
|
case 3: |
|
|
|
|
title = S.of(context).qishoupeisongzhongyujisongdashijian; |
|
|
|
|
break; |
|
|
|
|
case 4: |
|
|
|
|
title = S.of(context).dingdanyisongda; |
|
|
|
|
center = S.of(context).dingdanyisongda; |
|
|
|
|
switch (orderStatus) { |
|
|
|
|
case 4: |
|
|
|
|
title = S.of(context).dingdanyiwancheng; |
|
|
|
|
center = S.of(context).dingdanyiwancheng; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if (refundStatus == 1) { |
|
|
|
|
title = S.of(context).dingdanyituikuan; |
|
|
|
|
center = S.of(context).dingdanyituikuan; |
|
|
|
|
title = S.of(context).dengdaishangjiaqueren; |
|
|
|
|
if (orderStatus < 4) { |
|
|
|
|
switch (sendStatus) { |
|
|
|
|
case 1: |
|
|
|
|
title = S.of(context).zhengzaihujiaoqishou; |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
title = S.of(context).qishouyijiedanquhuozhong; |
|
|
|
|
break; |
|
|
|
|
case 3: |
|
|
|
|
title = S.of(context).qishoupeisongzhongyujisongdashijian; |
|
|
|
|
break; |
|
|
|
|
case 4: |
|
|
|
|
title = S.of(context).dingdanyisongda; |
|
|
|
|
center = S.of(context).dingdanyisongda; |
|
|
|
|
switch (orderStatus) { |
|
|
|
|
case 4: |
|
|
|
|
title = S.of(context).dingdanyiwancheng; |
|
|
|
|
center = S.of(context).dingdanyiwancheng; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} else if (orderStatus == 4) { |
|
|
|
|
title = S.of(context).dingdanyiwancheng; |
|
|
|
|
center = S.of(context).dingdanyiwancheng; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else if (isTakeOut == 2) { |
|
|
|
|
if (payStatus == 0) { |
|
|
|
|
title = S.of(context).dingdandaizhifu; |
|
|
|
|
} else { |
|
|
|
|
title = "订单待发货"; |
|
|
|
|
switch (sendStatus) { |
|
|
|
|
case 1: |
|
|
|
|
title = S.of(context).shangjiayifahuo; |
|
|
|
|
break; |
|
|
|
|
case 4: |
|
|
|
|
title = S.of(context).huopinyisongda; |
|
|
|
|
center = S.of(context).huopinyisongda; |
|
|
|
|
switch (orderStatus) { |
|
|
|
|
case 4: |
|
|
|
|
title = S.of(context).dingdanyiwancheng; |
|
|
|
|
center = S.of(context).dingdanyiwancheng; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if (refundStatus == 1) { |
|
|
|
|
title = S.of(context).dingdanyituikuan; |
|
|
|
|
center = S.of(context).dingdanyituikuan; |
|
|
|
|
title = S.of(context).dingdandaifahuo; |
|
|
|
|
if (orderStatus < 4) { |
|
|
|
|
switch (sendStatus) { |
|
|
|
|
case 1: |
|
|
|
|
title = S.of(context).shangjiayifahuo; |
|
|
|
|
break; |
|
|
|
|
case 4: |
|
|
|
|
title = S.of(context).huopinyisongda; |
|
|
|
|
center = S.of(context).huopinyisongda; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} else if (orderStatus == 4) { |
|
|
|
|
title = S.of(context).dingdanyiwancheng; |
|
|
|
|
center = S.of(context).dingdanyiwancheng; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (orderStatus == 5) { |
|
|
|
|
title = S.of(context).yiquxiao; |
|
|
|
|
center = S.of(context).yiquxiao; |
|
|
|
|
} |
|
|
|
|
if (refundStatus == 1) { |
|
|
|
|
title = S.of(context).dingdanyituikuan; |
|
|
|
|
center = S.of(context).dingdanyituikuan; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Widget couponRemarks() { |
|
|
|
@ -438,7 +442,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
Text( |
|
|
|
|
S |
|
|
|
|
.of(context) |
|
|
|
|
.yuan(orderInfo != null ? orderInfo.finalPayPrice : "0"), |
|
|
|
|
.yuan_(orderInfo != null ? orderInfo.finalPayPrice : "0"), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 20.sp, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
@ -716,84 +720,90 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Container( |
|
|
|
|
margin: EdgeInsets.only(top: 20.h, bottom: 16.h), |
|
|
|
|
child: MySeparator( |
|
|
|
|
width: 5.w, |
|
|
|
|
height: 1.h, |
|
|
|
|
color: Color(0xFFA29E9E), |
|
|
|
|
Visibility( |
|
|
|
|
visible: orderStatus < 5, |
|
|
|
|
child: Container( |
|
|
|
|
margin: EdgeInsets.only(top: 20.h, bottom: 16.h), |
|
|
|
|
child: MySeparator( |
|
|
|
|
width: 5.w, |
|
|
|
|
height: 1.h, |
|
|
|
|
color: Color(0xFFA29E9E), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
InkWell( |
|
|
|
|
onTap: () { |
|
|
|
|
showModalBottomSheet( |
|
|
|
|
context: context, |
|
|
|
|
builder: (context) { |
|
|
|
|
return PayInputWidget(); |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Image.asset( |
|
|
|
|
payStatus == 0 |
|
|
|
|
? "assets/image/icon_order_cancel.png" |
|
|
|
|
: "assets/image/icon_request_refund.png", |
|
|
|
|
width: 24.w, |
|
|
|
|
height: 24.h, |
|
|
|
|
fit: BoxFit.contain, |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 8.h, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
payStatus == 0 |
|
|
|
|
? S.of(context).quxiaodingdan |
|
|
|
|
: S.of(context).shenqingtuikuan, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Color(0xFF353535), |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
Visibility( |
|
|
|
|
visible: orderStatus < 5, |
|
|
|
|
child: Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
InkWell( |
|
|
|
|
onTap: () { |
|
|
|
|
showModalBottomSheet( |
|
|
|
|
context: context, |
|
|
|
|
builder: (context) { |
|
|
|
|
return PayInputWidget(); |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Image.asset( |
|
|
|
|
payStatus == 0 |
|
|
|
|
? "assets/image/icon_order_cancel.png" |
|
|
|
|
: "assets/image/icon_request_refund.png", |
|
|
|
|
width: 24.w, |
|
|
|
|
height: 24.h, |
|
|
|
|
fit: BoxFit.contain, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
SizedBox( |
|
|
|
|
height: 8.h, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
payStatus == 0 |
|
|
|
|
? S.of(context).quxiaodingdan |
|
|
|
|
: S.of(context).shenqingtuikuan, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Color(0xFF353535), |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
if (payStatus == 0) { |
|
|
|
|
carryOnPay(); |
|
|
|
|
} else {} |
|
|
|
|
}, |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Image.asset( |
|
|
|
|
payStatus == 0 |
|
|
|
|
? "assets/image/icon_order_renminbi.png" |
|
|
|
|
: "assets/image/icon_order_agin.png", |
|
|
|
|
width: 24.w, |
|
|
|
|
height: 24.h, |
|
|
|
|
fit: BoxFit.contain, |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 8.h, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
payStatus == 0 |
|
|
|
|
? S.of(context).jixuzhifu |
|
|
|
|
: S.of(context).zailaiyidan, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
if (payStatus == 0) { |
|
|
|
|
carryOnPay(); |
|
|
|
|
} else {} |
|
|
|
|
}, |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Image.asset( |
|
|
|
|
payStatus == 0 |
|
|
|
|
? "assets/image/icon_order_renminbi.png" |
|
|
|
|
: "assets/image/icon_order_agin.png", |
|
|
|
|
width: 24.w, |
|
|
|
|
height: 24.h, |
|
|
|
|
fit: BoxFit.contain, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
SizedBox( |
|
|
|
|
height: 8.h, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
payStatus == 0 |
|
|
|
|
? S.of(context).jixuzhifu |
|
|
|
|
: S.of(context).zailaiyidan, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
@ -843,12 +853,20 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
} |
|
|
|
|
widgets.add(SizedBox(height: 20.h)); |
|
|
|
|
|
|
|
|
|
if (orderInfo.isTakeOut != 0) { // 配送费 |
|
|
|
|
widgets.add(discountItem(Color(0xFFFF7A1A), "配送费", "", orderInfo.postFee)); |
|
|
|
|
if (orderInfo.isTakeOut != 0) { |
|
|
|
|
// 配送费 |
|
|
|
|
widgets.add( |
|
|
|
|
discountItem(Color(0xFFFF7A1A), "配送费", "", "+${orderInfo.postFee}")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (orderInfo.storeVO != null && orderInfo.storeVO.freePostAge != null) { // 配送费 |
|
|
|
|
widgets.add(discountItem(Color(0xFF32A060), "配送费", "活动减免3元配送费", orderInfo.storeVO.freePostAge)); |
|
|
|
|
if (orderInfo.orderDetail != null && |
|
|
|
|
orderInfo.orderDetail.couponDTO != null) { |
|
|
|
|
// 配送费 |
|
|
|
|
widgets.add(discountItem( |
|
|
|
|
Color(0xFF32A060), |
|
|
|
|
"优惠券", |
|
|
|
|
orderInfo.orderDetail.couponDTO.name, |
|
|
|
|
orderInfo.orderDetail.couponDTO.money)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (orderInfo.storeVO != null && orderInfo.storeVO.couponVO != null) { |
|
|
|
@ -1101,7 +1119,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
S.of(context).yuan(productList.sellPrice), |
|
|
|
|
S.of(context).yuan_(productList.sellPrice), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
fontSize: 12.sp, |
|
|
|
@ -1156,7 +1174,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
flex: 1, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
S.of(context).yuan("$amount"), |
|
|
|
|
S.of(context).yuan_("$amount"), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
color: color, |
|
|
|
@ -1198,7 +1216,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
orderInfo != null ? "${(double.tryParse(orderInfo.orderSum) + double.tryParse(orderInfo.postFee))}" : "", |
|
|
|
|
totalPrice(), |
|
|
|
|
textAlign: TextAlign.end, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 30.sp, |
|
|
|
@ -1209,4 +1227,15 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String totalPrice() { |
|
|
|
|
if (orderInfo == null) return ""; |
|
|
|
|
double totalPrice = (double.tryParse(orderInfo.orderSum) + |
|
|
|
|
double.tryParse(orderInfo.postFee)); |
|
|
|
|
if (orderInfo.orderDetail != null && |
|
|
|
|
orderInfo.orderDetail.couponDTO != null) { |
|
|
|
|
totalPrice -= double.tryParse(orderInfo.orderDetail.couponDTO.money); |
|
|
|
|
} |
|
|
|
|
return "$totalPrice"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|