提交 b0c5b2ee authored 作者: maodou's avatar maodou

1:修复订单列表点击查看详情与列表项不一致问题

2:修复订单列表进入后数据请求多次的问题 3:弹窗可点击区域扩大
上级 7a9c606e
......@@ -164,6 +164,11 @@ class OrderListModel {
}
return map;
}
@override
String toString() {
return 'OrderListModel{id: $id, ordersnum: $ordersnum, totalPrice: $totalPrice, finalTotalPrice: $finalTotalPrice, num_: $num_, status: $status, payType: $payType, types: $types, createTime: $createTime, cartList: $cartList}';
}
}
/// 书籍列表
......
......@@ -195,26 +195,26 @@ class _LoginPageState extends State<LoginPage> {
child: Row(
children: [
SizedBox(
width: 10.w,
height: 10.w,
width: 14.w,
height: 14.w,
// color: AppTheme.primary,
child: Image.asset(
controller.agree?'assets/images/check_box_select.png':'assets/images/uncheck.png',
),
),
Gaps.hGaps5,
Text('我已阅读并同意',style: TextStyle(color: Colours.c9,fontSize:10.w,height: 1.4)),
Text('我已阅读并同意',style: TextStyle(color: Colours.c9,fontSize:14.w,height: 1.4)),
],
),
),
GestureDetector(
child: Text('《用户协议》',style: TextStyle(color: Colours.cBlue,fontSize:10.w,height: 1.4)),
child: Text('《用户协议》',style: TextStyle(color: Colours.cBlue,fontSize:14.w,height: 1.4)),
onTap: (){
context.pushNamed(Routes.terms);
},
),
GestureDetector(
child: Text('《隐私政策》',style: TextStyle(color: Colours.cBlue,fontSize:10.w,height: 1.4)),
child: Text('《隐私政策》',style: TextStyle(color: Colours.cBlue,fontSize:14.w,height: 1.4)),
onTap: (){
context.pushNamed(Routes.terms);
},
......
......@@ -29,16 +29,9 @@ class UserOrderController extends GetxController
int _page = 1;
bool _noMore = false;
@override
void onInit() {
super.onInit();
}
@override
void onReady() {
onRefresh();
// onRefresh();
super.onReady();
}
......@@ -68,6 +61,7 @@ class UserOrderController extends GetxController
void onRefresh() async {
try {
await _getOrders(isRefresh:true);
refreshController.finishRefresh(IndicatorResult.success);
refreshController.resetFooter();
} catch (error) {
......
......@@ -2,10 +2,10 @@ part of user_order_awaiting;
/// 等待付款订单
class UserOrderAwaitingController extends GetxController {
final String orderNum;
late String _orderNum;
final BuildContext context;
UserOrderAwaitingController(this.orderNum,this.context); // 订单编号
UserOrderAwaitingController(this.context); // 订单编号
late OrderInfoModel model;
// 应付款、订单编号等
......@@ -18,6 +18,12 @@ class UserOrderAwaitingController extends GetxController {
late PayOrderModel payOrderModel;
String get orderNum => _orderNum; // 获取订单编号的方法
// 更新订单编号的方法
void updateOrderNum(String newOrderNum) {
_orderNum = newOrderNum;
}
@override
void onReady() {
......
......@@ -13,7 +13,8 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
@override
void initState() {
myController = Get.put(UserOrderAwaitingController(widget.orderNum,context));
myController = Get.put(UserOrderAwaitingController(context));
myController.updateOrderNum(widget.orderNum);
super.initState();
}
......@@ -33,9 +34,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
context.pop(true);
return false;
},
child: GetBuilder<UserOrderAwaitingController>(
init: UserOrderAwaitingController(widget.orderNum,context),
builder: (controller) => Scaffold(
child: Scaffold(
appBar: CustomAppBar(
title: const Text('等待付款'),
actions: [],
......@@ -72,7 +71,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.network(
controller.model?.bookList?[0].img??'',
myController.model?.bookList?[0].img??'',
fit: BoxFit.cover, // 设置适应方式为充满
width: 72.0.w,
height: 86.0.w,
......@@ -90,7 +89,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
CrossAxisAlignment.end, // 下面的Text靠左
children: [
Text(
controller.model.bookList?[0].name??'',
myController.model.bookList?[0].name??'',
style: TextStyle(
color: Colours.c3,
fontWeight: Fonts.bold,
......@@ -102,7 +101,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
),
SizedBox(height: 25.5.w),
Text(
"需付款 ¥${controller.model.finalTotalPrice}",
"需付款 ¥${myController.model.finalTotalPrice}",
style: TextStyle(
color: Colours.cAB1941,
fontWeight: Fonts.bold,
......@@ -129,7 +128,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children:
controller.orderAwaitings.map((model) {
myController.orderAwaitings.map((model) {
return Padding(
padding: EdgeInsets.only(top: 12.w),
child: Row(
......@@ -168,7 +167,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
),
GestureDetector(
onTap: (){
controller.payOrder();
myController.payOrder();
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: 15.w),
......@@ -180,7 +179,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
Border.all(color: Colours.cC31F4C, width: 0.5.w)),
child: Center(
child: Text(
'立即支付 ¥${controller.model.finalTotalPrice}',
'立即支付 ¥${myController.model.finalTotalPrice}',
style: TextStyle(
fontWeight: Fonts.medium,
fontSize: 14.w,
......@@ -230,6 +229,10 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
children: [
GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: Container(
width: 105.w,
color: Colours.cFF,
alignment: Alignment.center,
child: const Text(
'取消',
style: TextStyle(
......@@ -239,6 +242,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
),
),
),
),
Container(
height: 39.5.w, // 设置分割线的高度
width: 1, // 设置分割线的宽度
......@@ -246,10 +250,14 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
),
GestureDetector(
onTap: () {
controller.cancelPay();
myController.cancelPay();
Navigator.of(context).pop();
Navigator.pop(context);
},
child: Container(
width: 105.w,
color: Colours.cFF,
alignment: Alignment.center,
child: const Text(
'确定',
style: TextStyle(
......@@ -259,6 +267,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
),
),
),
),
],
),
......@@ -267,20 +276,25 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
},
);
},
child: Text(
child: Container(
width: 105.w,
color: Colours.cFF,
alignment: Alignment.center,
child: const Text(
'取消订单',
style: TextStyle(
fontWeight: Fonts.medium,
fontSize: 15.w,
fontSize: 15,
color: Colours.c9,
),
),
),
),
],
),
)),
); ;
),
);
}
......
......@@ -2,10 +2,14 @@ part of user_order_coin_awaiting;
/// 紫荆币等待付款订单
class UserOrderCoinAwaitingController extends GetxController {
final String orderNum;
UserOrderCoinAwaitingController(this.orderNum); // 订单编号
late String _orderNum;
String get orderNum => _orderNum; // 获取订单编号的方法
UserOrderCoinAwaitingController();
// 更新订单编号的方法
void updateOrderNum(String newOrderNum) {
_orderNum = newOrderNum;
}
late OrderInfoModel model;
// 应付款、订单编号等
List<OrderCompletedModel> orderAwaitings = [];
......@@ -33,9 +37,6 @@ class UserOrderCoinAwaitingController extends GetxController {
}
}
/// 获取订单信息
Future<void> getOrderInfo() async {
model = await MineAPI.getOrderInfo(orderNum: orderNum);
......@@ -91,7 +92,6 @@ class UserOrderCoinAwaitingController extends GetxController {
// 支付宝支付
void requestAliPay(){
print('================================================================${payOrderModel.encryptionOrder!}');
tobias.pay(payOrderModel.encryptionOrder!).then((payResult){
if (payResult['resultStatus'] == '9000') {
......
......@@ -16,7 +16,8 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> {
@override
void initState() {
myController = Get.put(UserOrderCoinAwaitingController(widget.orderNum));
myController = Get.put(UserOrderCoinAwaitingController());
myController.updateOrderNum(widget.orderNum);
super.initState();
}
......@@ -38,9 +39,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> {
context.pop(true);
return false;
},
child: GetBuilder<UserOrderCoinAwaitingController>(
init: UserOrderCoinAwaitingController(widget.orderNum),
builder: (controller) => Scaffold(
child: Scaffold(
appBar: CustomAppBar(
title: const Text('待支付'),
actions: [],
......@@ -99,7 +98,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> {
// 下面的Text靠左
children: [
Text(
'充值${controller.model.bean}紫荆币',
'充值${myController.model.bean}紫荆币',
style: TextStyle(
color: Colours.c3,
fontWeight: Fonts.bold,
......@@ -111,7 +110,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> {
),
SizedBox(height: 9.w),
Text(
"需付款 ¥${controller.model.finalTotalPrice}",
"需付款 ¥${myController.model.finalTotalPrice}",
style: TextStyle(
color: Colours.cAB1941,
fontWeight: Fonts.bold,
......@@ -139,7 +138,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> {
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: controller.orderAwaitings
children: myController.orderAwaitings
.map((model) {
return Padding(
padding: EdgeInsets.only(top: 12.w),
......@@ -192,7 +191,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> {
// context.pushNamed(Routes.orderEvaluate);
},
child: Text(
'立即支付 ¥${controller.model.finalTotalPrice}',
'立即支付 ¥${myController.model.finalTotalPrice}',
style: TextStyle(
fontWeight: Fonts.medium,
fontSize: 14.w,
......@@ -250,6 +249,10 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> {
GestureDetector(
onTap: () =>
Navigator.of(context).pop(),
child:Container(
width: 105.w,
color: Colours.cFF,
alignment: Alignment.center,
child: const Text(
'取消',
style: TextStyle(
......@@ -259,6 +262,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> {
),
),
),
),
Container(
height: 39.5.w, // 设置分割线的高度
width: 1, // 设置分割线的宽度
......@@ -266,10 +270,14 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> {
),
GestureDetector(
onTap: () {
controller.cancelPay();
myController.cancelPay();
Navigator.of(context).pop();
Navigator.pop(context);
},
child:Container(
width: 105.w,
color: Colours.cFF,
alignment: Alignment.center,
child: const Text(
'确定',
style: TextStyle(
......@@ -279,6 +287,7 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> {
),
),
),
),
],
),
],
......@@ -286,18 +295,23 @@ class _UserOrderCoinAwaitingState extends State<UserOrderCoinAwaitingPage> {
},
);
},
child: Text(
child: Container(
width: 105.w,
color: Colours.cFF,
alignment: Alignment.center,
child: const Text(
'取消订单',
style: TextStyle(
fontWeight: Fonts.medium,
fontSize: 15.w,
fontSize: 15,
color: Colours.c9,
),
),
),
),
],
),
)),
),
);
}
},
......
......@@ -259,11 +259,6 @@ class _UserSetPageState extends State<UserSetPage> {
// 去除操作按钮区域的内边距
actionsPadding: EdgeInsets.zero,
actions: <Widget>[
Wrap(
children: [
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
......@@ -312,6 +307,11 @@ class _UserSetPageState extends State<UserSetPage> {
if (!forcedUpgrade)
Padding(padding: EdgeInsets.only(right: 28.w),
child: GestureDetector(
child:
Container(
width: 85.w,
color: Colours.cFF,
alignment: Alignment.center,
child: const Text(
'稍后再说',
style: TextStyle(
......@@ -319,6 +319,7 @@ class _UserSetPageState extends State<UserSetPage> {
fontSize: 12,
fontWeight: Fonts.medium),
),
),
onTap: () => Navigator.of(context).pop(),
),),
......@@ -329,6 +330,10 @@ class _UserSetPageState extends State<UserSetPage> {
),
Padding(padding: EdgeInsets.only(left: 28.w),
child: GestureDetector(
child: Container(
width: 85.w,
color: Colours.cFF,
alignment: Alignment.center,
child: const Text(
'立即更新',
style: TextStyle(
......@@ -336,6 +341,7 @@ class _UserSetPageState extends State<UserSetPage> {
fontSize: 12,
fontWeight: Fonts.medium),
),
),
onTap: () {
_appUpdate();
if (!forcedUpgrade) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论