From 487617616a5244a1929d5ff579dd1862b3cd1735 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Tue, 18 Jan 2022 15:14:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=94=B6=E8=B4=A7=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ui/market/order/my_order_card.dart | 16 ++-- lib/ui/market/order/my_order_func.dart | 5 +- lib/ui/market/order/order_card.dart | 6 +- lib/ui/market/order/receive_success.dart | 109 +++++++++++++++++++++++ 4 files changed, 122 insertions(+), 14 deletions(-) create mode 100644 lib/ui/market/order/receive_success.dart diff --git a/lib/ui/market/order/my_order_card.dart b/lib/ui/market/order/my_order_card.dart index 6c7e2244..47249d70 100644 --- a/lib/ui/market/order/my_order_card.dart +++ b/lib/ui/market/order/my_order_card.dart @@ -8,6 +8,7 @@ import 'package:aku_new_community/ui/market/order/my_order_detail_page.dart'; import 'package:aku_new_community/ui/market/order/my_order_evaluation_page.dart'; import 'package:aku_new_community/ui/market/order/my_order_func.dart'; import 'package:aku_new_community/ui/market/order/my_order_refund_page.dart'; +import 'package:aku_new_community/ui/market/order/receive_success.dart'; import 'package:aku_new_community/widget/bee_divider.dart'; import 'package:aku_new_community/widget/buttons/card_bottom_button.dart'; import 'package:flutter/material.dart'; @@ -110,16 +111,6 @@ class _MyOrderCardState extends State { .make() ], ), - // 12.w.heightBox, - // Row( - // children: [ - // ('${widget.model.levelTwoCategory}') - // .text - // .size(24.sp) - // .color(ktextSubColor) - // .make() - // ], - // ), ], ), ).expand() @@ -175,8 +166,11 @@ class _MyOrderCardState extends State { CardBottomButton.yellow( text: '确认收货', onPressed: () async { - await MyOrderFunc.confirmReceive(widget.model.id); + var re = await MyOrderFunc.confirmReceive(widget.model.id); widget.callRefresh(); + if (re) { + Get.to(() => ReceiveSuccess()); + } }), ].sepWidget(separate: 24.w.widthBox); case 4: diff --git a/lib/ui/market/order/my_order_func.dart b/lib/ui/market/order/my_order_func.dart index 44551a17..0f16e3e3 100644 --- a/lib/ui/market/order/my_order_func.dart +++ b/lib/ui/market/order/my_order_func.dart @@ -6,9 +6,10 @@ import 'package:aku_new_community/utils/network/net_util.dart'; class MyOrderFunc { ///确认收货 - static Future confirmReceive(int goodsAppointmentId) async { - await NetUtil().get(API.market.confirmReceive, + static Future confirmReceive(int goodsAppointmentId) async { + var result = await NetUtil().get(API.market.confirmReceive, params: {"goodsAppointmentId": goodsAppointmentId}, showMessage: true); + return result.status ?? false; } ///申请退换 diff --git a/lib/ui/market/order/order_card.dart b/lib/ui/market/order/order_card.dart index 8fdefedc..79fd70b6 100644 --- a/lib/ui/market/order/order_card.dart +++ b/lib/ui/market/order/order_card.dart @@ -3,6 +3,7 @@ import 'package:aku_new_community/constants/api.dart'; import 'package:aku_new_community/model/order/order_list_model.dart'; import 'package:aku_new_community/pages/life_pay/pay_finish_page.dart'; import 'package:aku_new_community/pages/life_pay/pay_util.dart'; +import 'package:aku_new_community/ui/market/order/receive_success.dart'; import 'package:aku_new_community/ui/market/search/settlementGoodsDTO.dart'; import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/network/base_model.dart'; @@ -169,7 +170,10 @@ class _OrderCardState extends State { }); if (baseModel.status ?? false) { BotToast.showText(text: '收货成功'); - Get.back(); + Get.off(() => ReceiveSuccess( + integralGood: widget.model.payType == 10, + integral: widget.model.payPrice!.toInt(), + )); widget.callRefresh(); } cancel(); diff --git a/lib/ui/market/order/receive_success.dart b/lib/ui/market/order/receive_success.dart new file mode 100644 index 00000000..c21b5a15 --- /dev/null +++ b/lib/ui/market/order/receive_success.dart @@ -0,0 +1,109 @@ +import 'package:aku_new_community/pages/tab_navigator.dart'; +import 'package:aku_new_community/ui/profile/order/order_page.dart'; +import 'package:aku_new_community/widget/bee_scaffold.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class ReceiveSuccess extends StatefulWidget { + final bool integralGood; + final int? integral; + + const ReceiveSuccess({Key? key, this.integralGood = false, this.integral}) + : super(key: key); + + @override + _ReceiveSuccessState createState() => _ReceiveSuccessState(); +} + +class _ReceiveSuccessState extends State { + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '订单结果', + body: SafeArea( + child: Center( + child: Column( + children: [ + Container( + width: 56.w, + height: 56.w, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(28.w), + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [Color(0xFFE52E2E), Color(0xFFF58123)], + ), + ), + child: Icon( + CupertinoIcons.check_mark, + size: 42.w, + color: Colors.white, + ), + ), + 24.w.heightBox, + '收货成功'.text.size(32.sp).color(Colors.black).make(), + widget.integral != null + ? Column( + children: [ + 8.w.heightBox, + '已获得${widget.integral}积分' + .text + .size(28.sp) + .color(Colors.red) + .make(), + 48.w.heightBox, + ], + ) + : Column( + children: [ + 8.w.heightBox, + '本单已享受积分兑换不予返还积分' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.25)) + .make(), + 32.w.heightBox, + ], + ), + Row( + children: [ + MaterialButton( + onPressed: () { + Get.offAll(() => TabNavigator()); + }, + color: Colors.white, + minWidth: 168.w, + height: 68.w, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(34.w), + side: BorderSide(color: Colors.red), + ), + child: '返回首页'.text.size(28.sp).color(Colors.red).make(), + ), + 24.w.widthBox, + MaterialButton( + onPressed: () { + Get.off(() => OrderPage(initIndex: 3)); + }, + color: Colors.white, + minWidth: 168.w, + height: 68.w, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(34.w), + side: BorderSide(color: Colors.red), + ), + child: '查看详情'.text.size(28.sp).color(Colors.red).make(), + ) + ], + ) + ], + ), + )), + ); + } +}