diff --git a/lib/main_page.dart b/lib/main_page.dart index 4df0ed88..9d2814ea 100644 --- a/lib/main_page.dart +++ b/lib/main_page.dart @@ -340,7 +340,7 @@ class _MainPage extends State with WidgetsBindingObserver { // baseData.data.appLastVersion = "1.0.95"; // baseData.data.appLastVersionUp = "1.0.95"; if(AppUtils.versionCompare(packageInfo.version,baseData.data?.appLastVersion) - && AppUtils.versionCompare(value.getString("appLastVersion"),baseData.data?.appLastVersion)){ + && AppUtils.versionCompare(value.getString("appLastVersion")??"1.0.0",baseData.data?.appLastVersion)){ showDialog( context: context, barrierDismissible: false, diff --git a/lib/retrofit/data/settleOrderInfo.dart b/lib/retrofit/data/settleOrderInfo.dart index 1504d4f0..d045b833 100644 --- a/lib/retrofit/data/settleOrderInfo.dart +++ b/lib/retrofit/data/settleOrderInfo.dart @@ -16,6 +16,8 @@ class SettleOrderInfo { String threshold; String freePostAge; List orderProductList; + String promotionId; + String memberCouponId; static SettleOrderInfo fromJson(Map map) { if (map == null) return null; @@ -40,6 +42,8 @@ class SettleOrderInfo { settleOrderInfoBean.orderProductList = List()..addAll( (map['orderProductList'] as List ?? []).map((o) => OrderProductVOList.fromJson(o)) ); + settleOrderInfoBean.promotionId = map['promotionId']; + settleOrderInfoBean.memberCouponId = map['memberCouponId']; return settleOrderInfoBean; } @@ -58,6 +62,8 @@ class SettleOrderInfo { "threshold": threshold, "freePostAge": freePostAge, "orderProductList": orderProductList, + "promotionId": promotionId, + "memberCouponId": memberCouponId, }; } diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index 6e0626cf..215f5cfc 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -89,7 +89,7 @@ class _Settlement extends State { tenant: tenant, storeId: storeId, showLoading: true); - if (promotions != null && promotions != "" || tableId <= 0) { + if (promotions != null && promotions != "" && tableId <= 0) { queryOrderInfo( address != null ? address.id : null, selectedBtn, @@ -98,7 +98,7 @@ class _Settlement extends State { widget.arguments["pid"], payChannel ); - } else if (coupons != null && coupons != "" || tableId <= 0) { + } else if (coupons != null && coupons != "" && tableId <= 0) { queryOrderInfo( address != null ? address.id : null, selectedBtn, @@ -134,9 +134,29 @@ class _Settlement extends State { "promotionId": promotionId, "payChannel": payChannel }).catchError((error) {}); + this.promotion = null; + promotions = ""; + this.couponListBean = null; + coupons = ""; if (baseData != null && baseData.isSuccess) { setState(() { settleOrderInfo = baseData.data; + if((settleOrderInfo?.promotionId??"")!=""){ + settleOrderInfo.promotionInfoList.forEach((element) { + if(element.id == settleOrderInfo.promotionId){ + this.promotion = element; + promotions = promotion?.name ?? ""; + } + }); + } + if((settleOrderInfo?.memberCouponId??"")!=""){ + settleOrderInfo.couponList.forEach((element) { + if(element.id == settleOrderInfo.memberCouponId){ + this.couponListBean = element; + coupons = couponListBean?.promotionName ?? ""; + } + }); + } if (settleOrderInfo.orderProductList == null || settleOrderInfo.orderProductList.length == 0) { placeOrder = true; @@ -468,8 +488,8 @@ class _Settlement extends State { couponCart, activityCart, settleOrderInfo, - payChannel == 4 ? null : coupons, - payChannel == 4 ? null : promotions, + coupons, + promotions, couponCount(), placeOrder, remakers, @@ -562,9 +582,9 @@ class _Settlement extends State { queryOrderInfo( address?.id, selectedBtn, - payChannel == 4 ? null : couponListBean?.id, + couponListBean?.id, 0, - payChannel == 4 ? null : promotion?.id, + promotion?.id, payChannel ); } @@ -599,20 +619,20 @@ class _Settlement extends State { couponBean: couponListBean); }, ); - if (couponBean != null) { - this.couponListBean = couponBean; - coupons = couponListBean?.promotionName ?? ""; - promotions = ""; - this.promotion = null; + // if (couponBean != null) { + // this.couponListBean = couponBean; + // coupons = couponListBean?.promotionName ?? ""; + // promotions = ""; + // this.promotion = null; queryOrderInfo( address?.id, selectedBtn, - couponListBean?.id, + couponBean?.id, 0, null, payChannel ); - } + // } } ///活动弹窗 @@ -625,19 +645,19 @@ class _Settlement extends State { return SettlementActivity(settleOrderInfo, storeInfo); }, ); - if (pro != null) { - this.promotion = pro; - promotions = promotion?.name ?? ""; - coupons = ""; - this.couponListBean = null; + // if (pro != null) { + // this.promotion = pro; + // promotions = promotion?.name ?? ""; + // coupons = ""; + // this.couponListBean = null; queryOrderInfo( address?.id, selectedBtn, null, 0, - promotion?.id, + pro?.id, payChannel ); - } + // } } } diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 9523df4c..082045bf 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -566,9 +566,9 @@ class _StoreOrderPage extends State "tableId": tableId, "parentCode": parentCode, "parentId": parentId, - "pName": pName, + // "pName": pName, "pid": pid, - "cName": cName, + // "cName": cName, "cid": cid, "shoppingCart": shopCarGoods, "numberOfPeople": numberOfPeople,