diff --git a/lib/store/store_view/settlement.dart b/lib/store/store_view/settlement.dart index 410cf977..0d69992b 100644 --- a/lib/store/store_view/settlement.dart +++ b/lib/store/store_view/settlement.dart @@ -11,6 +11,7 @@ import 'package:huixiang/retrofit/data/order_info.dart'; import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/min_api.dart'; +import 'package:huixiang/store/store_view/settlement_order_commodity.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/rename_dialog.dart'; @@ -22,9 +23,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; class Settlement extends StatefulWidget { final arguments; - final OrderInfo orderInfo; - Settlement({this.arguments,this.orderInfo}); + Settlement({this.arguments}); @override State createState() { @@ -35,7 +35,6 @@ class Settlement extends StatefulWidget { class _Settlement extends State { MinApiService minService; int selectedBtn = 0; - OrderInfo orderInfo; Coupon coupon; Function(int type) callback; GestureTapCallback callbackEx; @@ -44,58 +43,33 @@ class _Settlement extends State { @override void initState() { super.initState(); - + storeInfo = widget.arguments["storeInfo"]; SharedPreferences.getInstance().then((value) { + String minToken = value.getString("minToken"); + String tenant = value.getString("tenant"); minService = MinApiService( Dio(), context: context, - token: value.getString("token"), + token: minToken, + tenant: tenant, ); queryOrderInfo(); }); - storeInfo = widget.arguments["storeInfo"]; } StoreInfo storeInfo; SettleOrderInfo settleOrderInfo; - int payStatus = 0; - int orderStatus = 0; - int sendStatus = 0; - int isTakeOut = 0; - int refundStatus = 0; - // String storeType = "NORMALSTORE"; //NORMALSTORE FASTSTORE RETAILSTORE - // queryDetails() async { - // BaseData baseData = await apiService.orderDetail(widget.arguments["id"]); - // if (baseData != null && baseData.isSuccess) { - // orderInfo = baseData.data; - // payStatus = orderInfo.payStatus; - // orderStatus = orderInfo.orderStatus; - // sendStatus = orderInfo.sendStatus; - // isTakeOut = orderInfo.isTakeOut; - // refundStatus = orderInfo.refundStatus; - // // storeType = orderInfo.storeVO.posType.code; - // print("order refund_status: $refundStatus"); - // print("order payStatus: $payStatus"); - // print("order orderStatus: $orderStatus"); - // print("order sendStatus: $sendStatus"); - // print("order isTakeOut: $isTakeOut"); - // if (mounted) - // setState(() { - // statusTitle(); - // }); - // } - // } - ///订单结算信息 queryOrderInfo() async { BaseData baseData = await minService.getOrderInfo({ - "addressId":0, + "addressId":null, "isTake": 0, - "memberCouponId": 0, - "orderId": widget.arguments["orderId"], - "promotionId": 0 + "memberCouponId": null, + // "orderId": widget.arguments["orderId"], + "orderId":"1449199929208602624", + "promotionId": null }); if (baseData != null && baseData.isSuccess) { settleOrderInfo = baseData.data; @@ -113,10 +87,7 @@ class _Settlement extends State { left: 0, right: 0, child: Container( - height: (orderStatus >= 4 ? 118.h : 118.h) + - MediaQuery.of(context).padding.top + - kToolbarHeight + - 48.h, + height: 175.h, color: Color(0xFF3A405A), width: MediaQuery.of(context).size.width, ), @@ -141,7 +112,7 @@ class _Settlement extends State { SizedBox(height: 14,), ///订单商品 - OrderCommodity(orderInfo), + SettlementOrderCommodity(settleOrderInfo,0), // if (payStatus == 0) couponRemarks(), /*(payStatus == 0) ? paySelector() : */ @@ -219,93 +190,6 @@ class _Settlement extends State { TextEditingController _vc = TextEditingController(); - statusTitle() { - if (isTakeOut == 0) { - if (payStatus == 0) { - title = S.of(context).dingdandaizhifu; - } else { - title = S.of(context).dingdanyizhifu; - switch (orderStatus) { - case 2: - title = S.of(context).shangjiazhengzaipeican; - break; - case 3: - title = S.of(context).dengdaiyonghuqucan; - center = S.of(context).qudanhao(orderInfo.dayFlowCode); - break; - case 4: - title = S.of(context).dingdanyiwancheng; - center = S.of(context).dingdanyiwancheng; - break; - case 5: - title = S.of(context).yiquxiao; - center = S.of(context).yiquxiao; - break; - } - } - } else if (isTakeOut == 1) { - if (payStatus == 0) { - title = S.of(context).dingdandaizhifu; - } else { - title = S.of(context).dengdaishangjiaqueren; - if (orderStatus < 4) { - switch (sendStatus) { - case 1: - title = S.of(context).zhengzaihujiaoqishou; - break; - case 2: - title = S.of(context).qishouyijiedanquhuozhong; - break; - case 3: - title = S.of(context).qishoupeisongzhongyujisongdashijian; - break; - case 4: - title = S.of(context).dingdanyisongda; - center = S.of(context).dingdanyisongda; - switch (orderStatus) { - case 4: - title = S.of(context).dingdanyiwancheng; - center = S.of(context).dingdanyiwancheng; - break; - } - break; - } - } else if (orderStatus == 4) { - title = S.of(context).dingdanyiwancheng; - center = S.of(context).dingdanyiwancheng; - } - } - } else if (isTakeOut == 2) { - if (payStatus == 0) { - title = S.of(context).dingdandaizhifu; - } else { - title = S.of(context).dingdandaifahuo; - if (orderStatus < 4) { - switch (sendStatus) { - case 1: - title = S.of(context).shangjiayifahuo; - break; - case 4: - title = S.of(context).huopinyisongda; - center = S.of(context).huopinyisongda; - break; - } - } else if (orderStatus == 4) { - title = S.of(context).dingdanyiwancheng; - center = S.of(context).dingdanyiwancheng; - } - } - } - if (orderStatus == 5) { - title = S.of(context).yiquxiao; - center = S.of(context).yiquxiao; - } - if (refundStatus == 1) { - title = S.of(context).dingdanyituikuan; - center = S.of(context).dingdanyituikuan; - } - } - Widget distributionMode() { return Container( decoration: BoxDecoration( @@ -1187,29 +1071,4 @@ class _Settlement extends State { ); } - String payChannel() { - switch (orderInfo.payChannel) { - case 0: - return "现金支付"; - case 1: - return "微信支付"; - case 2: - return "支付宝支付"; - case 3: - return "商户会员余额支付"; - case 4: - return "平台会员余额支付"; - case 5: - return "美团买单"; - case 6: - return "饿了么支付"; - case 7: - return "扫呗支付"; - case 8: - return "微生活"; - case 9: - return "银联支付"; - } - return S.of(context).yue; - } }