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. 57
      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: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<OrderDetailPage> {
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<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;
int payStatus = 0;
int orderStatus = 0;
@ -123,9 +139,11 @@ class _OrderDetailPage extends State<OrderDetailPage> {
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<OrderDetailPage> {
orderInfo,
),
///
if(orderInfo != null && orderInfo.addressExt != null)
OrderAddress(
@ -241,7 +260,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
context: context,
backgroundColor: Colors.transparent,
builder: (context) {
return OrderPaySelected();
return OrderPaySelected(userInfo);
},
);
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: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<OrderHistoryList>
context: context,
token: value.getString("token")),
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 {
var payChannel = await showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (context) {
return OrderPaySelected();
return OrderPaySelected(userInfo);
},
);
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/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<StatefulWidget> createState() {
@ -54,6 +59,7 @@ class _OrderPaySelected extends State<OrderPaySelected> {
),
),
),
if(widget.userInfo.raiseMoney != "0.00")
GestureDetector(
onTap: () {
// Navigator.of(context).pop(3);
@ -147,6 +153,7 @@ class _OrderPaySelected extends State<OrderPaySelected> {
SizedBox(
height: 10,
),
if(widget.userInfo.greenMoney != "0.00")
GestureDetector(
onTap: () {
// Navigator.of(context).pop(3);
@ -176,6 +183,7 @@ class _OrderPaySelected extends State<OrderPaySelected> {
],
),
),
if(widget.userInfo.greenMoney != "0.00")
SizedBox(
height: 10,
),

57
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<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
Widget build(BuildContext context) {
@ -126,11 +155,25 @@ class _OrderStatus extends State<OrderStatus> {
],
),
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<OrderStatus> {
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";

4
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/";///线

4
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)

5
lib/settlement/settlement.dart

@ -726,7 +726,7 @@ class _Settlement extends State<Settlement> {
});
// 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<Settlement> {
'/router/order_details',
arguments: {
"id": orderId,
"jumpState": 1,
//toasttoast12
"jumpState": 2,
},
);
// Navigator.of(context).pop();

Loading…
Cancel
Save