Browse Source

app订单结算页面更改;

dev
wurong 1 year ago
parent
commit
0ba7841499
  1. 233
      lib/settlement/settlement.dart

233
lib/settlement/settlement.dart

@ -557,124 +557,135 @@ class _Settlement extends State<Settlement> {
/// ///
queryPlaceOrderFirst() async { queryPlaceOrderFirst() async {
// for (int i = 0; i < settleOrderInfo.orderProductList.length; i++) { try {
// settleOrderInfo.orderProductList.forEach((element1) { EasyLoading.show(status: S.current.zhengzaijiazai,
// if (settleOrderInfo.orderProductList[i].productId == maskType: EasyLoadingMaskType.black);
// element1.productId) { // for (int i = 0; i < settleOrderInfo.orderProductList.length; i++) {
// settleOrderInfo.orderProductList[i].skuId = element1.skuId; // settleOrderInfo.orderProductList.forEach((element1) {
// } // if (settleOrderInfo.orderProductList[i].productId ==
// }); // element1.productId) {
// } // settleOrderInfo.orderProductList[i].skuId = element1.skuId;
// }
placeOrderFirst = PlaceOrderFirst(); // });
placeOrderFirst.cartNum = settleOrderInfo.orderNum; // }
placeOrderFirst.cartSum = settleOrderInfo.price;
placeOrderFirst.addressId = address == null ? null : address.id;
placeOrderFirst.isSubscribe =
((subscribeParam?.isEnableSubscribe ?? false) == true)
? true
: false; //
placeOrderFirst.isTakeOut =
((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 ?? ""))}"
: "");
placeOrderFirst.numberOfPeople = "$numberOfPeople";
placeOrderFirst.orderSource = 2;
placeOrderFirst.orderType = "0";
placeOrderFirst.orderTypeId = 0;
placeOrderFirst.parentCode = parentCode; //
placeOrderFirst.parentId = parentId; //
placeOrderFirst.payChannel = ((placeOrderFirst.cartSum == "0.00")
? payChannel = 0
: ((tableId > 0
? (minOrderInfo?.isRaise ?? false)
: (settleOrderInfo?.isRaise ?? false))
? 7
: payChannel));
placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean();
placeOrderFirst.promotionInfoDTO.promotionId =
(promotion != null && tableId <= 0) ? promotion.id : "";
// : widget.arguments["pid"] ?? "";
placeOrderFirst.promotionInfoDTO.couponId =
(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 ?? "";
placeOrderFirst.recMobile =
(mobile == null || mobile == "") ? mobile : storeInfo.headMobile;
placeOrderFirst.shoppingCartSkuItemList = settleOrderInfo.orderProductList;
placeOrderFirst.skuItemDTOList = [];
placeOrderFirst.source = 1;
placeOrderFirst.storeId = storeInfo.id;
placeOrderFirst.subcribeTime = subTime ?? ""; //
placeOrderFirst.tableId = "$tableId";
for (int i = 0;
i < (shopCarGoods?.shoppingCartSkuItemList?.length ?? 0);
i++) {
placeOrderFirst.shoppingCartSkuItemList[i].setMealDataList =
shopCarGoods.shoppingCartSkuItemList[i].setMealDataList;
}
if (tableId == 0) { placeOrderFirst = PlaceOrderFirst();
/// placeOrderFirst.cartNum = settleOrderInfo.orderNum;
BaseData<dynamic> baseData = await minService placeOrderFirst.cartSum = settleOrderInfo.price;
.placeOrderFirst(placeOrderFirst.toJson()) placeOrderFirst.addressId = address == null ? null : address.id;
.catchError((error) { placeOrderFirst.isSubscribe =
print("error: $error"); ((subscribeParam?.isEnableSubscribe ?? false) == true)
}); ? true
if (baseData != null && baseData.isSuccess) { : false; //
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); placeOrderFirst.isTakeOut =
placeOrder = true; ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true &&
this.downOrder = DownOrder.fromJson(baseData.data); (subscribeParam?.isEnableSubscribe ?? false) == false &&
querySettlement(); selectedBtn != 1 &&
} else { selectedBtn != 2)
// orderButton = false; ? diningStatus
SmartDialog.showToast(baseData?.msg, alignment: Alignment.center); : selectedBtn;
placeOrderFirst.notes = remakers +
(reservationTime ?? "") +
((subscribeParam?.isEnableSubscribe ?? false) == true
? "预约门店:${((subscribeParam?.stores?.length ?? 0) == 1
? (subscribeParam.stores[0])
: (subscribeStoresName ?? ""))}"
: "");
placeOrderFirst.numberOfPeople = "$numberOfPeople";
placeOrderFirst.orderSource = 2;
placeOrderFirst.orderType = "0";
placeOrderFirst.orderTypeId = 0;
placeOrderFirst.parentCode = parentCode; //
placeOrderFirst.parentId = parentId; //
placeOrderFirst.payChannel = ((placeOrderFirst.cartSum == "0.00")
? payChannel = 0
: ((tableId > 0
? (minOrderInfo?.isRaise ?? false)
: (settleOrderInfo?.isRaise ?? false))
? 7
: payChannel));
placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean();
placeOrderFirst.promotionInfoDTO.promotionId =
(promotion != null && tableId <= 0) ? promotion.id : "";
// : widget.arguments["pid"] ?? "";
placeOrderFirst.promotionInfoDTO.couponId =
(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 ?? "";
placeOrderFirst.recMobile =
(mobile == null || mobile == "") ? mobile : storeInfo.headMobile;
placeOrderFirst.shoppingCartSkuItemList =
settleOrderInfo.orderProductList;
placeOrderFirst.skuItemDTOList = [];
placeOrderFirst.source = 1;
placeOrderFirst.storeId = storeInfo.id;
placeOrderFirst.subcribeTime = subTime ?? ""; //
placeOrderFirst.tableId = "$tableId";
for (int i = 0;
i < (shopCarGoods?.shoppingCartSkuItemList?.length ?? 0);
i++) {
placeOrderFirst.shoppingCartSkuItemList[i].setMealDataList =
shopCarGoods.shoppingCartSkuItemList[i].setMealDataList;
} }
} else {
/// if (tableId == 0) {
BaseData<dynamic> baseData; ///
if (placeOrder) { BaseData<dynamic> baseData = await minService
// .placeOrderFirst(placeOrderFirst.toJson())
querySettlement(); .catchError((error) {
return; print("error: $error");
} else { });
if (parentId == "") { if (baseData != null && baseData.isSuccess) {
// // EasyLoading.show(status: S.current.zhengzaijiazai,
baseData = await minService // maskType: EasyLoadingMaskType.black);
.placeOrderFirst(placeOrderFirst.toJson()) placeOrder = true;
.catchError((error) { this.downOrder = DownOrder.fromJson(baseData.data);
print("error: $error"); await querySettlement();
});
} else { } else {
// // orderButton = false;
baseData = await minService SmartDialog.showToast(baseData?.msg, alignment: Alignment.center);
.addOrder(placeOrderFirst.toJson())
.catchError((error) {
print("error: $error");
});
} }
}
// orderButton = false;
if (baseData != null && baseData.isSuccess) {
placeOrder = true;
this.downOrder = DownOrder.fromJson(baseData.data);
parentId = this.downOrder.id ?? this.downOrder.parentId;
queryOrderDetails(parentId);
setState(() {});
} else { } else {
///
BaseData<dynamic> baseData;
if (placeOrder) {
//
querySettlement();
return;
} else {
if (parentId == "") {
//
baseData = await minService
.placeOrderFirst(placeOrderFirst.toJson())
.catchError((error) {
print("error: $error");
});
} else {
//
baseData = await minService
.addOrder(placeOrderFirst.toJson())
.catchError((error) {
print("error: $error");
});
}
}
// orderButton = false; // orderButton = false;
SmartDialog.showToast(baseData?.msg, alignment: Alignment.center); if (baseData != null && baseData.isSuccess) {
placeOrder = true;
this.downOrder = DownOrder.fromJson(baseData.data);
parentId = this.downOrder.id ?? this.downOrder.parentId;
queryOrderDetails(parentId);
setState(() {});
} else {
// orderButton = false;
SmartDialog.showToast(baseData?.msg, alignment: Alignment.center);
}
} }
}finally{
EasyLoading.dismiss();
} }
} }

Loading…
Cancel
Save