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 {
// for (int i = 0; i < settleOrderInfo.orderProductList.length; i++) {
// 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;
}
try {
EasyLoading.show(status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
// for (int i = 0; i < settleOrderInfo.orderProductList.length; i++) {
// settleOrderInfo.orderProductList.forEach((element1) {
// if (settleOrderInfo.orderProductList[i].productId ==
// element1.productId) {
// settleOrderInfo.orderProductList[i].skuId = element1.skuId;
// }
// });
// }
if (tableId == 0) {
///
BaseData<dynamic> baseData = await minService
.placeOrderFirst(placeOrderFirst.toJson())
.catchError((error) {
print("error: $error");
});
if (baseData != null && baseData.isSuccess) {
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);
placeOrder = true;
this.downOrder = DownOrder.fromJson(baseData.data);
querySettlement();
} else {
// orderButton = false;
SmartDialog.showToast(baseData?.msg, alignment: Alignment.center);
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;
}
} else {
///
BaseData<dynamic> baseData;
if (placeOrder) {
//
querySettlement();
return;
} else {
if (parentId == "") {
//
baseData = await minService
.placeOrderFirst(placeOrderFirst.toJson())
.catchError((error) {
print("error: $error");
});
if (tableId == 0) {
///
BaseData<dynamic> baseData = await minService
.placeOrderFirst(placeOrderFirst.toJson())
.catchError((error) {
print("error: $error");
});
if (baseData != null && baseData.isSuccess) {
// EasyLoading.show(status: S.current.zhengzaijiazai,
// maskType: EasyLoadingMaskType.black);
placeOrder = true;
this.downOrder = DownOrder.fromJson(baseData.data);
await querySettlement();
} else {
//
baseData = await minService
.addOrder(placeOrderFirst.toJson())
.catchError((error) {
print("error: $error");
});
// orderButton = false;
SmartDialog.showToast(baseData?.msg, alignment: Alignment.center);
}
}
// 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 {
///
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;
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