diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index 50a33874..b6e7da6b 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -140,9 +140,7 @@ class _Settlement extends State { storeId: storeId, showLoading: false); queryMemberInfo(); - if (widget.arguments["pid"] != null && - widget.arguments["pid"] != "" && - tableId <= 0) { + if (widget.arguments["pid"] != null && widget.arguments["pid"] != "" && tableId <= 0) { queryOrderInfo( address != null ? address.id : null, ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && @@ -163,9 +161,7 @@ class _Settlement extends State { count1, payChannel, tableId); - } else if (widget.arguments["cid"] != null && - widget.arguments["cid"] != "" && - tableId <= 0) { + } else if ( widget.arguments["cid"] != null && widget.arguments["cid"] != "" && tableId <= 0) { queryOrderInfo( address != null ? address.id : null, ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && @@ -174,7 +170,7 @@ class _Settlement extends State { selectedBtn != 2) ? diningStatus : selectedBtn, - widget.arguments["cid"] ?? 0, + widget.arguments["cid"]??0, 0, productId ?? 0, productSkuId ?? "", @@ -232,9 +228,7 @@ class _Settlement extends State { payChannel, tableId) async { try { - EasyLoading.show( - status: S.current.zhengzaijiazai, - maskType: EasyLoadingMaskType.black); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); BaseData baseData = await minService.getOrderInfo({ "addressId": addressId, @@ -335,8 +329,7 @@ class _Settlement extends State { ///查看订单详情 queryOrderDetails(id) async { - EasyLoading.show( - status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); BaseData baseData = await minService.getOrderDetails({ "id": pageType != null ? widget.arguments["orderId"] : id ?? parentId, }).catchError((error) {}); @@ -565,8 +558,7 @@ class _Settlement extends State { ///小程序下单 queryPlaceOrderFirst() async { try { - EasyLoading.show( - status: S.current.zhengzaijiazai, + EasyLoading.show(status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); // for (int i = 0; i < settleOrderInfo.orderProductList.length; i++) { // settleOrderInfo.orderProductList.forEach((element1) { @@ -582,20 +574,22 @@ class _Settlement extends State { placeOrderFirst.cartSum = settleOrderInfo.price; placeOrderFirst.addressId = address == null ? null : address.id; placeOrderFirst.isSubscribe = - ((subscribeParam?.isEnableSubscribe ?? false) == true) - ? true - : false; //是否预约 + ((subscribeParam?.isEnableSubscribe ?? false) == true) + ? true + : false; //是否预约 placeOrderFirst.isTakeOut = - ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && - (subscribeParam?.isEnableSubscribe ?? false) == false && - selectedBtn != 1 && - selectedBtn != 2) - ? diningStatus - : selectedBtn; + ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && + (subscribeParam?.isEnableSubscribe ?? false) == false && + selectedBtn != 1 && + selectedBtn != 2) + ? diningStatus + : selectedBtn; placeOrderFirst.notes = remakers + (reservationTime ?? "") + ((subscribeParam?.isEnableSubscribe ?? false) == true - ? "预约门店:${((subscribeParam?.stores?.length ?? 0) == 1 ? (subscribeParam.stores[0]) : (subscribeStoresName ?? ""))}" + ? "预约门店:${((subscribeParam?.stores?.length ?? 0) == 1 + ? (subscribeParam.stores[0]) + : (subscribeStoresName ?? ""))}" : ""); placeOrderFirst.numberOfPeople = "$numberOfPeople"; placeOrderFirst.orderSource = 2; @@ -606,23 +600,23 @@ class _Settlement extends State { placeOrderFirst.payChannel = ((placeOrderFirst.cartSum == "0.00") ? payChannel = 0 : ((tableId > 0 - ? (minOrderInfo?.isRaise ?? false) - : (settleOrderInfo?.isRaise ?? false)) - ? 7 - : payChannel)); + ? (minOrderInfo?.isRaise ?? false) + : (settleOrderInfo?.isRaise ?? false)) + ? 7 + : payChannel)); placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean(); placeOrderFirst.promotionInfoDTO.promotionId = - (promotion != null && tableId <= 0) ? promotion.id : ""; + (promotion != null && tableId <= 0) ? promotion.id : ""; // : widget.arguments["pid"] ?? ""; placeOrderFirst.promotionInfoDTO.couponId = - (couponListBean != null && tableId <= 0) ? couponListBean.id : ""; + (couponListBean != null && tableId <= 0) ? couponListBean.id : ""; // : widget.arguments["cid"] ?? ""; // placeOrderFirst.promotionInfoDTO.useVipPrice = (settleOrderInfo.isRaise || payChannel == 5 || ((payChannel == 4 && (settleOrderInfo.usePlateMoney == false))) ) ? false : useVipPriceSelect; // placeOrderFirst.promotionInfoDTO.useBenefit = (settleOrderInfo.isRaise || payChannel == 5 || ((payChannel == 4 && settleOrderInfo.usePlateMoney == false))) ? false : useBenefitSelect; placeOrderFirst.promotionInfoDTO.discountType = - (!placeOrder) ? "AUTO" : settleOrderInfo?.discountType ?? ""; + (!placeOrder) ? "AUTO" : settleOrderInfo?.discountType ?? ""; placeOrderFirst.recMobile = - (mobile == null || mobile == "") ? mobile : storeInfo.headMobile; + (mobile == null || mobile == "") ? mobile : storeInfo.headMobile; placeOrderFirst.shoppingCartSkuItemList = settleOrderInfo.orderProductList; placeOrderFirst.skuItemDTOList = []; @@ -631,8 +625,8 @@ class _Settlement extends State { placeOrderFirst.subcribeTime = subTime ?? ""; //预约时间 placeOrderFirst.tableId = "$tableId"; for (int i = 0; - i < (shopCarGoods?.shoppingCartSkuItemList?.length ?? 0); - i++) { + i < (shopCarGoods?.shoppingCartSkuItemList?.length ?? 0); + i++) { placeOrderFirst.shoppingCartSkuItemList[i].setMealDataList = shopCarGoods.shoppingCartSkuItemList[i].setMealDataList; } @@ -645,8 +639,7 @@ class _Settlement extends State { print("error: $error"); }); if (baseData != null && baseData.isSuccess) { - // EasyLoading.show( - // status: S.current.zhengzaijiazai, + // EasyLoading.show(status: S.current.zhengzaijiazai, // maskType: EasyLoadingMaskType.black); placeOrder = true; this.downOrder = DownOrder.fromJson(baseData.data); @@ -691,14 +684,13 @@ class _Settlement extends State { SmartDialog.showToast(baseData?.msg, alignment: Alignment.center); } } - } finally { - // EasyLoading.dismiss(); + }finally{ + EasyLoading.dismiss(); } } ///结算 querySettlement() async { - try{ placeOrderFirst.id = ((parentId != "") ? parentId : downOrder.id); placeOrderFirst.orderProductVOList = ((downOrder == null) ? minOrderInfo.orderProductVOList @@ -735,10 +727,10 @@ class _Settlement extends State { timeStamp: int.tryParse(wxPay.timeStamp), sign: wxPay.sign, ); - } else { + }else{ EasyLoading.dismiss(); SmartDialog.showToast(baseData.msg, alignment: Alignment.center); - Future.delayed(Duration(seconds: 2), () { + Future.delayed(Duration(seconds:2), () { toOrderDetails(placeOrderFirst.id); }); } @@ -762,8 +754,6 @@ class _Settlement extends State { text: "${baseData?.msg}", )); } - }}finally{ - EasyLoading.dismiss(); } } @@ -971,10 +961,8 @@ class _Settlement extends State { ///会员优惠选择 if ((settleOrderInfo != null || - minOrderInfo != null) && - (placeOrder && - tableId <= 0 && - !(settleOrderInfo?.isRaise ?? false))) + minOrderInfo != null) && (placeOrder && tableId <= 0 && + !(settleOrderInfo?.isRaise ?? false))) VipDiscountsSelect( vipSelectCheck, settleOrderInfo, @@ -1557,19 +1545,13 @@ class _Settlement extends State { selectedBtn != 2) ? diningStatus : selectedBtn, - ((couponBean?.id ?? 0) == 0 && (promotion?.id ?? productId ?? 0) != 0) - ? 0 - : couponBean?.id, + ((couponBean?.id??0) == 0 && (promotion?.id ?? productId ?? 0) !=0) ? 0: couponBean?.id, 0, - ((couponBean?.id ?? 0) == 0 && (promotion?.id ?? productId ?? 0) != 0) - ? promotion?.id ?? productId - : 0, + ((couponBean?.id??0) == 0 && (promotion?.id ?? productId ?? 0) !=0) ? promotion?.id ?? productId :0, productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - (couponBean?.id ?? 0) == 0 - ? ((promotion?.id ?? productId ?? 0) != 0 ? "ACTIVITY" : "AUTO") - : "COUPON", + (couponBean?.id ?? 0) == 0 ? ((promotion?.id ?? productId ?? 0) !=0 ? "ACTIVITY":"AUTO") : "COUPON", // useVipPriceSelect, // useBenefitSelect, count1, @@ -1603,21 +1585,13 @@ class _Settlement extends State { selectedBtn != 2) ? diningStatus : selectedBtn, - (((pro?.id ?? 0) ?? (productId ?? 0)) == 0 && - (couponListBean?.id ?? 0) != 0) - ? couponListBean?.id - : 0, + (((pro?.id ?? 0) ?? (productId ?? 0)) == 0 && (couponListBean?.id ??0) != 0)?couponListBean?.id:0, 0, - (((pro?.id ?? 0) ?? (productId ?? 0)) == 0 && - (couponListBean?.id ?? 0) != 0) - ? 0 - : ((pro?.id ?? 0) ?? productId), + (((pro?.id ?? 0) ?? (productId ?? 0)) == 0 && (couponListBean?.id ??0) != 0) ? 0 :((pro?.id ?? 0) ?? productId), productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - (((pro?.id ?? 0) ?? (productId ?? 0)) == 0 - ? ((couponListBean?.id ?? 0) != 0 ? "COUPON" : "AUTO") - : "ACTIVITY"), + (((pro?.id ?? 0) ?? (productId ?? 0)) == 0 ? ((couponListBean?.id ??0) != 0 ? "COUPON":"AUTO") : "ACTIVITY"), // useVipPriceSelect, // useBenefitSelect, count1,