Browse Source

订单详情不需要显示订单支付成功的Toast;

订单详情等待配餐漏斗增加旋转动画;
订单详情支付方式,助农支付跟绿币支付根据该余额是否是0判断显示隐藏;
new_revision_app
wurong 2 years ago
parent
commit
a76894820f
  1. 23
      lib/order/order_detail_page.dart
  2. 18
      lib/order/order_history_page.dart
  3. 8
      lib/order/order_view/order_pay_selected.dart
  4. 49
      lib/order/order_view/order_status.dart
  5. 4
      lib/retrofit/min_api.dart
  6. 4
      lib/retrofit/retrofit_api.dart
  7. 5
      lib/settlement/settlement.dart

23
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:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../retrofit/data/user_info.dart';
import '../utils/flutter_utils.dart'; import '../utils/flutter_utils.dart';
import '../view_widget/classic_header.dart'; import '../view_widget/classic_header.dart';
import '../view_widget/my_footer.dart'; import '../view_widget/my_footer.dart';
@ -40,15 +41,18 @@ class _OrderDetailPage extends State<OrderDetailPage> {
MinApiService minService; MinApiService minService;
int jumpState; int jumpState;
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
UserInfo userInfo;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
jumpState = widget.arguments["jumpState"]; jumpState = widget.arguments["jumpState"];
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
EasyLoading.show(status: S.of(context).zhengzaijiazai);
apiService = ApiService(Dio(), apiService = ApiService(Dio(),
context: context, token: value.getString("token"), showLoading: jumpState == 2? true:false); context: context, token: value.getString("token"),);
queryDetails(); queryDetails();
queryUserBalance();
}); });
} }
@ -81,6 +85,18 @@ class _OrderDetailPage extends State<OrderDetailPage> {
}); });
} }
///
queryUserBalance() async {
BaseData<UserInfo> 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; OrderInfo orderInfo;
int payStatus = 0; int payStatus = 0;
int orderStatus = 0; int orderStatus = 0;
@ -123,9 +139,11 @@ class _OrderDetailPage extends State<OrderDetailPage> {
setState(() { setState(() {
statusTitle(); statusTitle();
}); });
EasyLoading.dismiss();
refreshController.refreshCompleted(); refreshController.refreshCompleted();
refreshController.loadComplete(); refreshController.loadComplete();
} else { } else {
EasyLoading.dismiss();
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed(); refreshController.loadFailed();
@ -196,6 +214,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
orderInfo, orderInfo,
), ),
/// ///
if(orderInfo != null && orderInfo.addressExt != null) if(orderInfo != null && orderInfo.addressExt != null)
OrderAddress( OrderAddress(
@ -241,7 +260,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
context: context, context: context,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
builder: (context) { builder: (context) {
return OrderPaySelected(); return OrderPaySelected(userInfo);
}, },
); );
if (payChannel != null && payChannel > 0) { if (payChannel != null && payChannel > 0) {

18
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:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../retrofit/data/user_info.dart';
class OrderHistoryPage extends StatefulWidget { class OrderHistoryPage extends StatefulWidget {
final Map arguments; final Map arguments;
@ -228,6 +230,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
context: context, context: context,
token: value.getString("token")), token: value.getString("token")),
queryOrder(), queryOrder(),
queryUserBalance(),
}); });
} }
@ -575,12 +578,25 @@ class _OrderHistoryList extends State<OrderHistoryList>
} }
} }
UserInfo userInfo;
queryUserBalance() async {
BaseData<UserInfo> 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 { paySelected(OrderInfo orderInfo, MinApiService minService) async {
var payChannel = await showModalBottomSheet( var payChannel = await showModalBottomSheet(
context: context, context: context,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
builder: (context) { builder: (context) {
return OrderPaySelected(); return OrderPaySelected(userInfo);
}, },
); );
if (payChannel != null && payChannel > 0) { if (payChannel != null && payChannel > 0) {

8
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/generated/l10n.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import '../../retrofit/data/settleOrderInfo.dart';
import '../../retrofit/data/user_info.dart';
class OrderPaySelected extends StatefulWidget { class OrderPaySelected extends StatefulWidget {
final UserInfo userInfo;
OrderPaySelected(this.userInfo);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -54,6 +59,7 @@ class _OrderPaySelected extends State<OrderPaySelected> {
), ),
), ),
), ),
if(widget.userInfo.raiseMoney != "0.00")
GestureDetector( GestureDetector(
onTap: () { onTap: () {
// Navigator.of(context).pop(3); // Navigator.of(context).pop(3);
@ -147,6 +153,7 @@ class _OrderPaySelected extends State<OrderPaySelected> {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
if(widget.userInfo.greenMoney != "0.00")
GestureDetector( GestureDetector(
onTap: () { onTap: () {
// Navigator.of(context).pop(3); // Navigator.of(context).pop(3);
@ -176,6 +183,7 @@ class _OrderPaySelected extends State<OrderPaySelected> {
], ],
), ),
), ),
if(widget.userInfo.greenMoney != "0.00")
SizedBox( SizedBox(
height: 10, height: 10,
), ),

49
lib/order/order_view/order_status.dart

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
@ -27,8 +29,35 @@ class OrderStatus extends StatefulWidget {
} }
class _OrderStatus extends State<OrderStatus> { class _OrderStatus extends State<OrderStatus> with SingleTickerProviderStateMixin{
AnimationController _controller;
Animation<double> _animation;
@override
void initState() {
super.initState();
_controller = AnimationController(
duration: Duration(seconds: 1),
vsync: this,
);
_animation = Tween<double>(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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -126,7 +155,21 @@ class _OrderStatus extends State<OrderStatus> {
], ],
), ),
if(widget.payStatus != 0) if(widget.payStatus != 0)
Image.asset( (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), statusPicture(widget.title),
height: 66.h, height: 66.h,
width:66.w, width:66.w,
@ -252,7 +295,7 @@ class _OrderStatus extends State<OrderStatus> {
tripStatus = "assets/image/order_refund.webp"; tripStatus = "assets/image/order_refund.webp";
} else if (status.contains(S.of(context).yiquxiao)) { } else if (status.contains(S.of(context).yiquxiao)) {
tripStatus = "assets/image/oeder_cancel.webp"; 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"; tripStatus = "assets/image/wait_meal.webp";
}else if (status.contains(S.of(context).zhengzaihujiaoqishou)) { }else if (status.contains(S.of(context).zhengzaihujiaoqishou)) {
tripStatus = "assets/image/distribution.webp"; tripStatus = "assets/image/distribution.webp";

4
lib/retrofit/min_api.dart

@ -26,8 +26,8 @@ import 'data/shopping_home_config.dart';
part 'min_api.g.dart'; part 'min_api.g.dart';
// const localBaseUrl = "http://192.168.10.78:8765/app/";/// const localBaseUrl = "http://192.168.10.78:8765/app/";///
const localBaseUrl = "http://pos-test.api.lotus-wallet.com/app/";/// // const localBaseUrl = "http://pos-test.api.lotus-wallet.com/app/";///
const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线 const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线

4
lib/retrofit/retrofit_api.dart

@ -66,8 +66,8 @@ import 'data/wx_pay.dart';
part 'retrofit_api.g.dart'; part 'retrofit_api.g.dart';
// const localBaseUrl = "http://192.168.10.78:8766/app/";/// const localBaseUrl = "http://192.168.10.78:8766/app/";///
const localBaseUrl = "http://platform.test.api.lotus-wallet.com/app/";/// // const localBaseUrl = "http://platform.test.api.lotus-wallet.com/app/";///
const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线 const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线
@RestApi(baseUrl: localBaseUrl) @RestApi(baseUrl: localBaseUrl)

5
lib/settlement/settlement.dart

@ -726,7 +726,7 @@ class _Settlement extends State<Settlement> {
}); });
// orderButton = false; // orderButton = false;
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
SmartDialog.showToast(baseData.data, alignment: Alignment.center); // SmartDialog.showToast(baseData.data, alignment: Alignment.center);
toOrderDetails(placeOrderFirst.id); toOrderDetails(placeOrderFirst.id);
} else { } else {
SmartDialog.show( SmartDialog.show(
@ -807,7 +807,8 @@ class _Settlement extends State<Settlement> {
'/router/order_details', '/router/order_details',
arguments: { arguments: {
"id": orderId, "id": orderId,
"jumpState": 1, //toasttoast12
"jumpState": 2,
}, },
); );
// Navigator.of(context).pop(); // Navigator.of(context).pop();

Loading…
Cancel
Save