From a76894820f50c805033f875cee0546437513b262 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Mon, 17 Jul 2023 17:02:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85=E4=B8=8D?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E6=98=BE=E7=A4=BA=E8=AE=A2=E5=8D=95=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E6=88=90=E5=8A=9F=E7=9A=84Toast;=20=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E7=AD=89=E5=BE=85=E9=85=8D=E9=A4=90=E6=BC=8F?= =?UTF-8?q?=E6=96=97=E5=A2=9E=E5=8A=A0=E6=97=8B=E8=BD=AC=E5=8A=A8=E7=94=BB?= =?UTF-8?q?=EF=BC=9B=20=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E6=96=B9=E5=BC=8F=EF=BC=8C=E5=8A=A9=E5=86=9C=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E8=B7=9F=E7=BB=BF=E5=B8=81=E6=94=AF=E4=BB=98=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E8=AF=A5=E4=BD=99=E9=A2=9D=E6=98=AF=E5=90=A6=E6=98=AF?= =?UTF-8?q?0=E5=88=A4=E6=96=AD=E6=98=BE=E7=A4=BA=E9=9A=90=E8=97=8F?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/order/order_detail_page.dart | 23 +++++++- lib/order/order_history_page.dart | 18 ++++++- lib/order/order_view/order_pay_selected.dart | 8 +++ lib/order/order_view/order_status.dart | 57 +++++++++++++++++--- lib/retrofit/min_api.dart | 4 +- lib/retrofit/retrofit_api.dart | 4 +- lib/settlement/settlement.dart | 5 +- 7 files changed, 103 insertions(+), 16 deletions(-) diff --git a/lib/order/order_detail_page.dart b/lib/order/order_detail_page.dart index e7837eeb..798a9c0b 100644 --- a/lib/order/order_detail_page.dart +++ b/lib/order/order_detail_page.dart @@ -19,6 +19,7 @@ import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import '../retrofit/data/user_info.dart'; import '../utils/flutter_utils.dart'; import '../view_widget/classic_header.dart'; import '../view_widget/my_footer.dart'; @@ -40,15 +41,18 @@ class _OrderDetailPage extends State { MinApiService minService; int jumpState; final RefreshController refreshController = RefreshController(); + UserInfo userInfo; @override void initState() { super.initState(); jumpState = widget.arguments["jumpState"]; SharedPreferences.getInstance().then((value) { + EasyLoading.show(status: S.of(context).zhengzaijiazai); apiService = ApiService(Dio(), - context: context, token: value.getString("token"), showLoading: jumpState == 2? true:false); + context: context, token: value.getString("token"),); queryDetails(); + queryUserBalance(); }); } @@ -81,6 +85,18 @@ class _OrderDetailPage extends State { }); } + ///查询用户信息 + queryUserBalance() async { + BaseData baseData = + await apiService.queryInfo().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + userInfo = baseData.data; + if (mounted) setState(() {}); + }else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + OrderInfo orderInfo; int payStatus = 0; int orderStatus = 0; @@ -123,9 +139,11 @@ class _OrderDetailPage extends State { setState(() { statusTitle(); }); + EasyLoading.dismiss(); refreshController.refreshCompleted(); refreshController.loadComplete(); } else { + EasyLoading.dismiss(); SmartDialog.showToast(baseData.msg, alignment: Alignment.center); refreshController.refreshFailed(); refreshController.loadFailed(); @@ -196,6 +214,7 @@ class _OrderDetailPage extends State { orderInfo, ), + ///订单取货地址,或, 收货地址 if(orderInfo != null && orderInfo.addressExt != null) OrderAddress( @@ -241,7 +260,7 @@ class _OrderDetailPage extends State { context: context, backgroundColor: Colors.transparent, builder: (context) { - return OrderPaySelected(); + return OrderPaySelected(userInfo); }, ); if (payChannel != null && payChannel > 0) { diff --git a/lib/order/order_history_page.dart b/lib/order/order_history_page.dart index 59b7e465..8e37518e 100644 --- a/lib/order/order_history_page.dart +++ b/lib/order/order_history_page.dart @@ -24,6 +24,8 @@ import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import '../retrofit/data/user_info.dart'; + class OrderHistoryPage extends StatefulWidget { final Map arguments; @@ -228,6 +230,7 @@ class _OrderHistoryList extends State context: context, token: value.getString("token")), queryOrder(), + queryUserBalance(), }); } @@ -575,12 +578,25 @@ class _OrderHistoryList extends State } } + UserInfo userInfo; + + queryUserBalance() async { + BaseData baseData = + await apiService.queryInfo().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + userInfo = baseData.data; + if (mounted) setState(() {}); + }else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + paySelected(OrderInfo orderInfo, MinApiService minService) async { var payChannel = await showModalBottomSheet( context: context, backgroundColor: Colors.transparent, builder: (context) { - return OrderPaySelected(); + return OrderPaySelected(userInfo); }, ); if (payChannel != null && payChannel > 0) { diff --git a/lib/order/order_view/order_pay_selected.dart b/lib/order/order_view/order_pay_selected.dart index c3ea3250..2d442531 100644 --- a/lib/order/order_view/order_pay_selected.dart +++ b/lib/order/order_view/order_pay_selected.dart @@ -3,7 +3,12 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/utils/font_weight.dart'; +import '../../retrofit/data/settleOrderInfo.dart'; +import '../../retrofit/data/user_info.dart'; + class OrderPaySelected extends StatefulWidget { + final UserInfo userInfo; + OrderPaySelected(this.userInfo); @override State createState() { @@ -54,6 +59,7 @@ class _OrderPaySelected extends State { ), ), ), + if(widget.userInfo.raiseMoney != "0.00") GestureDetector( onTap: () { // Navigator.of(context).pop(3); @@ -147,6 +153,7 @@ class _OrderPaySelected extends State { SizedBox( height: 10, ), + if(widget.userInfo.greenMoney != "0.00") GestureDetector( onTap: () { // Navigator.of(context).pop(3); @@ -176,6 +183,7 @@ class _OrderPaySelected extends State { ], ), ), + if(widget.userInfo.greenMoney != "0.00") SizedBox( height: 10, ), diff --git a/lib/order/order_view/order_status.dart b/lib/order/order_view/order_status.dart index 23ec9774..a1438089 100644 --- a/lib/order/order_view/order_status.dart +++ b/lib/order/order_view/order_status.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/generated/l10n.dart'; @@ -27,8 +29,35 @@ class OrderStatus extends StatefulWidget { } -class _OrderStatus extends State { +class _OrderStatus extends State with SingleTickerProviderStateMixin{ + AnimationController _controller; + Animation _animation; + + @override + void initState() { + super.initState(); + _controller = AnimationController( + duration: Duration(seconds: 1), + vsync: this, + ); + _animation = Tween(begin: 0, end: 1).animate(_controller); + _controller.addStatusListener((status) { + if (status == AnimationStatus.completed) { + Future.delayed(Duration(seconds: 1), () { + _controller.reset(); + }); + } else if (status == AnimationStatus.dismissed) { + _controller.forward(); + } + }); + _controller.forward(); + } + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } @override Widget build(BuildContext context) { @@ -126,11 +155,25 @@ class _OrderStatus extends State { ], ), if(widget.payStatus != 0) - Image.asset( - statusPicture(widget.title), - height: 66.h, - width:66.w, - ), + (widget.title == "商家正在配餐" || widget.title == "订单待发货") ? + AnimatedBuilder( + animation: _animation, + builder: (BuildContext context, Widget child) { + return Transform.rotate( + angle: _animation.value * 1 * 3.14159, + child: Image.asset( + statusPicture(widget.title), + height: 66.h, + width:66.w, + ), + alignment: Alignment.center, + ); + }, + ):Image.asset( + statusPicture(widget.title), + height: 66.h, + width:66.w, + ), ], ), ], @@ -252,7 +295,7 @@ class _OrderStatus extends State { tripStatus = "assets/image/order_refund.webp"; } else if (status.contains(S.of(context).yiquxiao)) { tripStatus = "assets/image/oeder_cancel.webp"; - } else if (status.contains(S.of(context).dengdaiyonghuqucan)) { + } else if (status.contains(S.of(context).dengdaiyonghuqucan)|| status.contains("商家正在配餐")) { tripStatus = "assets/image/wait_meal.webp"; }else if (status.contains(S.of(context).zhengzaihujiaoqishou)) { tripStatus = "assets/image/distribution.webp"; diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 15d058e5..286a292b 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -26,8 +26,8 @@ import 'data/shopping_home_config.dart'; part 'min_api.g.dart'; -// const localBaseUrl = "http://192.168.10.78:8765/app/";///本地 -const localBaseUrl = "http://pos-test.api.lotus-wallet.com/app/";///测试 +const localBaseUrl = "http://192.168.10.78:8765/app/";///本地 +// const localBaseUrl = "http://pos-test.api.lotus-wallet.com/app/";///测试 const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线上 diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 13c3a7de..78a38906 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -66,8 +66,8 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; -// const localBaseUrl = "http://192.168.10.78:8766/app/";///本地 -const localBaseUrl = "http://platform.test.api.lotus-wallet.com/app/";///测试 +const localBaseUrl = "http://192.168.10.78:8766/app/";///本地 +// const localBaseUrl = "http://platform.test.api.lotus-wallet.com/app/";///测试 const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线上 @RestApi(baseUrl: localBaseUrl) diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index d2bc5d6c..e23aca93 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -726,7 +726,7 @@ class _Settlement extends State { }); // orderButton = false; if (baseData != null && baseData.isSuccess) { - SmartDialog.showToast(baseData.data, alignment: Alignment.center); + // SmartDialog.showToast(baseData.data, alignment: Alignment.center); toOrderDetails(placeOrderFirst.id); } else { SmartDialog.show( @@ -807,7 +807,8 @@ class _Settlement extends State { '/router/order_details', arguments: { "id": orderId, - "jumpState": 1, + //原结算页跳转详情无需正在加载样式,因为,结算页支付成功会显示一个“订单支付成功”的toast,避免两者重叠显示;现在据要求,去掉toast,故而需要显示正在加载样式;1不需要加载,2需要加载 + "jumpState": 2, }, ); // Navigator.of(context).pop();