diff --git a/assets/image/2x/vip_day_logo.webp b/assets/image/2x/vip_day_logo.webp new file mode 100644 index 00000000..2b4f3d8d Binary files /dev/null and b/assets/image/2x/vip_day_logo.webp differ diff --git a/assets/image/2x/vip_equity_logo.webp b/assets/image/2x/vip_equity_logo.webp new file mode 100644 index 00000000..7f16c0cc Binary files /dev/null and b/assets/image/2x/vip_equity_logo.webp differ diff --git a/assets/image/2x/vip_level_logo.webp b/assets/image/2x/vip_level_logo.webp new file mode 100644 index 00000000..e26a13cf Binary files /dev/null and b/assets/image/2x/vip_level_logo.webp differ diff --git a/assets/image/3x/vip_day_logo.webp b/assets/image/3x/vip_day_logo.webp new file mode 100644 index 00000000..5c36b0d0 Binary files /dev/null and b/assets/image/3x/vip_day_logo.webp differ diff --git a/assets/image/3x/vip_equity_logo.webp b/assets/image/3x/vip_equity_logo.webp new file mode 100644 index 00000000..1a868173 Binary files /dev/null and b/assets/image/3x/vip_equity_logo.webp differ diff --git a/assets/image/3x/vip_level_logo.webp b/assets/image/3x/vip_level_logo.webp new file mode 100644 index 00000000..378aa439 Binary files /dev/null and b/assets/image/3x/vip_level_logo.webp differ diff --git a/assets/image/vip_day_logo.webp b/assets/image/vip_day_logo.webp new file mode 100644 index 00000000..937a3e53 Binary files /dev/null and b/assets/image/vip_day_logo.webp differ diff --git a/assets/image/vip_equity_logo.webp b/assets/image/vip_equity_logo.webp new file mode 100644 index 00000000..3284bab3 Binary files /dev/null and b/assets/image/vip_equity_logo.webp differ diff --git a/assets/image/vip_level_logo.webp b/assets/image/vip_level_logo.webp new file mode 100644 index 00000000..0f1ac8a9 Binary files /dev/null and b/assets/image/vip_level_logo.webp differ diff --git a/lib/order/logistics_information_page.dart b/lib/order/logistics_information_page.dart index 68f6233c..9995cee2 100644 --- a/lib/order/logistics_information_page.dart +++ b/lib/order/logistics_information_page.dart @@ -13,6 +13,9 @@ import 'package:huixiang/view_widget/no_data_view.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import '../view_widget/classic_header.dart'; +import '../view_widget/my_footer.dart'; + class LogisticsInformationPage extends StatefulWidget { final arguments; @@ -53,42 +56,65 @@ class _LogisticsInformationPage extends State { .shippingTrace(shipperCode, logisticCode) .catchError((error) { _refreshController.refreshFailed(); + _refreshController.loadFailed(); }); if (baseData != null && baseData.isSuccess) { Logistics lgs = baseData.data; logistics.clear(); - logistics.addAll(lgs.traces.reversed); + //lgs.traces.reversed:列表倒叙 + logistics.addAll(lgs.traces); setState(() { shipStatus = logisticsStatus(lgs.state); if (logistics.length > 0) logistics[0].acceptStation += shipStatus; _refreshController.refreshCompleted(); + _refreshController.loadComplete(); }); } else { _refreshController.refreshFailed(); + _refreshController.loadFailed(); } } queryAppShippingTrace(orderId) async { BaseData baseData = await apiService.getAppShippingTrace(orderId).catchError((error) { - _refreshController.refreshFailed(); + _refreshController.refreshFailed(); + _refreshController.loadFailed(); }); if (baseData != null && baseData.isSuccess) { Logistics lgs = baseData.data; logistics.clear(); - logistics.addAll(lgs.traces.reversed); + //lgs.traces.reversed:列表倒叙 + logistics.addAll(lgs.traces); setState(() { shipStatus = logisticsStatus(lgs.state); widget.arguments["logisticsName"] = lgs.shipperCode; widget.arguments["logisticsNum"] = lgs.logisticCode; if (logistics.length > 0) logistics[0].acceptStation += shipStatus; _refreshController.refreshCompleted(); + _refreshController.loadComplete(); }); } else { _refreshController.refreshFailed(); + _refreshController.loadFailed(); } } + _onRefresh(){ + if((widget.arguments["shipperCode"]??"") != "" && + (widget.arguments["logisticsNum"]??"") != "") + getShippingTrace(widget.arguments["shipperCode"] ?? "", + widget.arguments["logisticsNum"] ?? ""); + else + queryAppShippingTrace(widget.arguments["orderId"]); + } + + @override + void dispose() { + super.dispose(); + _refreshController.dispose(); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -98,7 +124,22 @@ class _LogisticsInformationPage extends State { titleColor: Colors.black, leadingColor: Colors.black, ), - body: Container( + body: SmartRefresher( + controller: _refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader( + ), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: () { + _onRefresh(); + }, + physics: BouncingScrollPhysics(), + scrollController: ScrollController(), child: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Column( @@ -337,8 +378,6 @@ class _LogisticsInformationPage extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Column( - // mainAxisAlignment: MainAxisAlignment.start, - // crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( logistics.acceptTime.split(" ")[0], @@ -372,7 +411,7 @@ class _LogisticsInformationPage extends State { if (position != size - 1) Container( width: 1.w, - height: 75.h, + height: logistics.acceptStation.length > 100 ? 118.h :75.h, decoration: new BoxDecoration( color: Color(0xffE1E1E1), ), @@ -433,9 +472,11 @@ class _LogisticsInformationPage extends State { String tripStatus = "assets/image/icon_sign.webp"; if (type.contains("已签收")) { tripStatus = "assets/image/icon_sign.webp"; - } else if (type.contains("派送中") || type.contains("派件中")) { + } else if (type.contains("派送中") || type.contains("派件")) { + tripStatus = "assets/image/icon_delivery.webp"; + }else if (type.contains("揽收") || type.contains("揽收")) { tripStatus = "assets/image/icon_delivery.webp"; - } else if (type.contains("运输中") || type.contains("发往")) { + } else if (type.contains("运输中") || type.contains("发往")) { tripStatus = "assets/image/icon_transport.webp"; } else if (type.contains("已发货") || type.contains("分配")) { tripStatus = "assets/image/icon_deliver_goods.webp"; @@ -449,7 +490,9 @@ class _LogisticsInformationPage extends State { String logisticsTripStatus = ""; if (state.contains("已签收")) { logisticsTripStatus = "已签收"; - } else if (state.contains("派送中") || state.contains("派件中")) { + } else if (state.contains("揽收")) { + logisticsTripStatus = "已揽件"; + }else if (state.contains("派送中") || state.contains("派件")) { logisticsTripStatus = "派送中"; } else if (state.contains("运输中") || state.contains("发往")) { logisticsTripStatus = "运输中"; diff --git a/lib/retrofit/data/settleOrderInfo.dart b/lib/retrofit/data/settleOrderInfo.dart index 4b7d6ccf..817e3b08 100644 --- a/lib/retrofit/data/settleOrderInfo.dart +++ b/lib/retrofit/data/settleOrderInfo.dart @@ -20,10 +20,12 @@ class SettleOrderInfo { String memberCouponId; bool usePlateMoney; bool isRaise; + bool isVipDay; int selectDiscount; bool useVipPriceSelect = false; String vipDiscountAmount; String totalDiscountAmount; + String vipDayDiscountAmount; String discountType; String totalPackagingFee; @@ -55,9 +57,11 @@ class SettleOrderInfo { settleOrderInfoBean.memberCouponId = map['memberCouponId']; settleOrderInfoBean.usePlateMoney = map['usePlateMoney']; settleOrderInfoBean.isRaise = map['isRaise']; + settleOrderInfoBean.isVipDay = map['isVipDay']; settleOrderInfoBean.selectDiscount = map['selectDiscount']; settleOrderInfoBean.vipDiscountAmount = map['vipDiscountAmount']; settleOrderInfoBean.totalDiscountAmount = map['totalDiscountAmount']; + settleOrderInfoBean.vipDayDiscountAmount = map['vipDayDiscountAmount']; settleOrderInfoBean.discountType = map['discountType']; settleOrderInfoBean.totalPackagingFee = map['totalPackagingFee']; return settleOrderInfoBean; @@ -81,10 +85,11 @@ class SettleOrderInfo { "promotionId": promotionId, "memberCouponId": memberCouponId, "usePlateMoney":usePlateMoney, - "isRaise":isRaise, + "isVipDay":isVipDay, "selectDiscount":selectDiscount, "vipDiscountAmount":vipDiscountAmount, "totalDiscountAmount": totalDiscountAmount, + "vipDayDiscountAmount": vipDayDiscountAmount, "discountType":discountType, "packagingFee" : totalPackagingFee, }; diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index 59e87869..f5d0a966 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -31,6 +31,7 @@ import 'package:huixiang/settlement/settlement_view/pay_method.dart'; import 'package:huixiang/settlement/settlement_view/settlement_activity.dart'; import 'package:huixiang/settlement/settlement_view/settlement_coupon.dart'; import 'package:huixiang/settlement/settlement_view/settlement_order_commodity.dart'; +import 'package:huixiang/settlement/settlement_view/vip_discounts_select.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/min.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; @@ -96,6 +97,7 @@ class _Settlement extends State { int storesIndex = 0; String discountType; int diningStatus = 4; + int vipSelect = 0; @override void initState() { @@ -141,7 +143,10 @@ class _Settlement extends State { if (promotions != null && promotions != "" && tableId <= 0) { queryOrderInfo( address != null ? address.id : null, - ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && (subscribeParam?.isEnableSubscribe ?? false) == false && selectedBtn != 1 && selectedBtn != 2) + ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && + (subscribeParam?.isEnableSubscribe ?? false) == false && + selectedBtn != 1 && + selectedBtn != 2) ? diningStatus : selectedBtn, 0, @@ -159,7 +164,10 @@ class _Settlement extends State { } else if (coupons != null && coupons != "" && tableId <= 0) { queryOrderInfo( address != null ? address.id : null, - ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && (subscribeParam?.isEnableSubscribe ?? false) == false && selectedBtn != 1 && selectedBtn != 2) + ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && + (subscribeParam?.isEnableSubscribe ?? false) == false && + selectedBtn != 1 && + selectedBtn != 2) ? diningStatus : selectedBtn, widget.arguments["cid"], @@ -177,7 +185,10 @@ class _Settlement extends State { } else queryOrderInfo( null, - ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && (subscribeParam?.isEnableSubscribe ?? false) == false && selectedBtn != 1 && selectedBtn != 2) + ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && + (subscribeParam?.isEnableSubscribe ?? false) == false && + selectedBtn != 1 && + selectedBtn != 2) ? diningStatus : selectedBtn, 0, @@ -186,9 +197,7 @@ class _Settlement extends State { productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - (!placeOrder) - ? "NONE" - : "AUTO", + (!placeOrder) ? "NONE" : "AUTO", // useVipPriceSelect, // (useVipPriceSelect == true && isVips) ? false:useBenefitSelect, count1, @@ -272,7 +281,10 @@ class _Settlement extends State { isRaiseChannel = true; queryOrderInfo( address?.id, - ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && (subscribeParam?.isEnableSubscribe ?? false) == false && selectedBtn != 1 && selectedBtn != 2) + ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && + (subscribeParam?.isEnableSubscribe ?? false) == false && + selectedBtn != 1 && + selectedBtn != 2) ? diningStatus : selectedBtn, couponListBean?.id, @@ -366,7 +378,10 @@ class _Settlement extends State { if (address != null) { queryOrderInfo( address.id, - ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && (subscribeParam?.isEnableSubscribe ?? false) == false && selectedBtn != 1 && selectedBtn != 2) + ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && + (subscribeParam?.isEnableSubscribe ?? false) == false && + selectedBtn != 1 && + selectedBtn != 2) ? diningStatus : selectedBtn, null, @@ -422,7 +437,10 @@ class _Settlement extends State { } await queryOrderInfo( address.id, - ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && (subscribeParam?.isEnableSubscribe ?? false) == false && selectedBtn != 1 && selectedBtn != 2) + ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && + (subscribeParam?.isEnableSubscribe ?? false) == false && + selectedBtn != 1 && + selectedBtn != 2) ? diningStatus : selectedBtn, null, @@ -454,7 +472,10 @@ class _Settlement extends State { queryOrderInfo( address.id, - ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && (subscribeParam?.isEnableSubscribe ?? false) == false && selectedBtn != 1 && selectedBtn != 2) + ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && + (subscribeParam?.isEnableSubscribe ?? false) == false && + selectedBtn != 1 && + selectedBtn != 2) ? diningStatus : selectedBtn, 0, @@ -554,7 +575,10 @@ class _Settlement extends State { ? true : false; //是否预约 placeOrderFirst.isTakeOut = - ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && (subscribeParam?.isEnableSubscribe ?? false) == false && selectedBtn != 1 && selectedBtn != 2) + ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && + (subscribeParam?.isEnableSubscribe ?? false) == false && + selectedBtn != 1 && + selectedBtn != 2) ? diningStatus : selectedBtn; placeOrderFirst.notes = remakers + @@ -846,7 +870,16 @@ class _Settlement extends State { }); queryOrderInfo( addressId, - ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && (subscribeParam?.isEnableSubscribe ?? false) == false && selectedBtn != 1 && selectedBtn != 2) + ((storeInfo?.pickupType + ?.dineInTakeStatus ?? + false) == + true && + (subscribeParam + ?.isEnableSubscribe ?? + false) == + false && + selectedBtn != 1 && + selectedBtn != 2) ? diningStatus : selectedBtn, memberCouponId, @@ -909,6 +942,16 @@ class _Settlement extends State { useBenefitSelect, placeOrder), + ///会员优惠选择 + if ((settleOrderInfo != null || + minOrderInfo != null) && (placeOrder && tableId <= 0 && + !(settleOrderInfo?.isRaise ?? false))) + VipDiscountsSelect( + vipSelectCheck, + settleOrderInfo, + minOrderInfo, + payChannel,), + ///优惠券/备注/会员优惠金额 if (settleOrderInfo != null || minOrderInfo != null) @@ -1096,7 +1139,12 @@ class _Settlement extends State { diningStatus = 4; queryOrderInfo( address?.id, - ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && (subscribeParam?.isEnableSubscribe ?? false) == false && selectedBtn != 1 && selectedBtn != 2) + ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == + true && + (subscribeParam?.isEnableSubscribe ?? false) == + false && + selectedBtn != 1 && + selectedBtn != 2) ? diningStatus : selectedBtn, (settleOrderInfo.isRaise || payChannel == 5) @@ -1109,7 +1157,11 @@ class _Settlement extends State { productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - ((promotion?.id ?? productId ?? "") != "") ? "ACTIVITY" : ((couponListBean?.id ?? "") != "" ? "COUPON":"AUTO"), + ((promotion?.id ?? productId ?? "") != "") + ? "ACTIVITY" + : ((couponListBean?.id ?? "") != "" + ? "COUPON" + : "AUTO"), // useVipPriceSelect, // useBenefitSelect, count1, @@ -1182,7 +1234,12 @@ class _Settlement extends State { diningStatus = 3; queryOrderInfo( address?.id, - ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && (subscribeParam?.isEnableSubscribe ?? false) == false && selectedBtn != 1 && selectedBtn != 2) + ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == + true && + (subscribeParam?.isEnableSubscribe ?? false) == + false && + selectedBtn != 1 && + selectedBtn != 2) ? diningStatus : selectedBtn, (settleOrderInfo.isRaise || payChannel == 5) @@ -1195,7 +1252,11 @@ class _Settlement extends State { productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - ((promotion?.id ?? productId ?? "") != "") ? "ACTIVITY" : ((couponListBean?.id ?? "") != "" ? "COUPON":"AUTO"), + ((promotion?.id ?? productId ?? "") != "") + ? "ACTIVITY" + : ((couponListBean?.id ?? "") != "" + ? "COUPON" + : "AUTO"), // useVipPriceSelect, // useBenefitSelect, count1, @@ -1264,6 +1325,44 @@ class _Settlement extends State { ); } + ///会员优惠选择 + vipSelectCheck(int vipSelect) { + this.vipSelect = vipSelect; + if (tableId > 0) { + queryOrderDetails(parentId); + } else { + queryOrderInfo( + address?.id, + ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && + (subscribeParam?.isEnableSubscribe ?? false) == false && + selectedBtn != 1 && + selectedBtn != 2) + ? diningStatus + : selectedBtn, + 0, + 0, + productId ?? 0, + productSkuId ?? "", + actProductId ?? "", + actProductSkuId ?? "", + vipSelectType(), + count1, + payChannel, + tableId); + } + } + + String vipSelectType() { + if (vipSelect == 1) return "MEMBER_RANK"; + if (vipSelect == 2) { + return "SURPRISE"; + } else if (vipSelect == 3) { + return "VIP"; + } else { + return "AUTO"; + } + } + payChannelCheck(int payChannel) { this.payChannel = payChannel; if (tableId > 0) { @@ -1271,7 +1370,10 @@ class _Settlement extends State { } else { queryOrderInfo( address?.id, - ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && (subscribeParam?.isEnableSubscribe ?? false) == false && selectedBtn != 1 && selectedBtn != 2) + ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && + (subscribeParam?.isEnableSubscribe ?? false) == false && + selectedBtn != 1 && + selectedBtn != 2) ? diningStatus : selectedBtn, (settleOrderInfo.isRaise || payChannel == 5) @@ -1302,20 +1404,22 @@ class _Settlement extends State { } } - String preferentialType(){ - if(settleOrderInfo.isRaise || payChannel == 5) - return "NONE"; - if(settleOrderInfo.discountType == "ACTIVITY"){ - return "ACTIVITY"; - }else if(settleOrderInfo.discountType == "COUPON"){ - return "COUPON"; - }else if(settleOrderInfo.discountType == "MEMBER_RANK" || settleOrderInfo.discountType == "SURPRISE"){ - return "MEMBER_RANK"; - }else if(settleOrderInfo.discountType == "VIP"){ + String preferentialType() { + if (settleOrderInfo.isRaise || payChannel == 5) return "NONE"; + if (settleOrderInfo.discountType == "ACTIVITY") { + return "ACTIVITY"; + } else if (settleOrderInfo.discountType == "COUPON") { + return "COUPON"; + } else if (settleOrderInfo.discountType == "SURPRISE") { + return "SURPRISE"; + } else if (settleOrderInfo.discountType == "MEMBER_RANK" || + settleOrderInfo.discountType == "SURPRISE") { + return "MEMBER_RANK"; + } else if (settleOrderInfo.discountType == "VIP") { return "VIP"; - }else { - return "AUTO"; - } + } else { + return "AUTO"; + } } vipPriceSelect(bool useVipPriceSelect) { @@ -1325,7 +1429,10 @@ class _Settlement extends State { } else { queryOrderInfo( address?.id, - ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && (subscribeParam?.isEnableSubscribe ?? false) == false && selectedBtn != 1 && selectedBtn != 2) + ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && + (subscribeParam?.isEnableSubscribe ?? false) == false && + selectedBtn != 1 && + selectedBtn != 2) ? diningStatus : selectedBtn, 0, @@ -1351,7 +1458,10 @@ class _Settlement extends State { } else { queryOrderInfo( address?.id, - ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && (subscribeParam?.isEnableSubscribe ?? false) == false && selectedBtn != 1 && selectedBtn != 2) + ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && + (subscribeParam?.isEnableSubscribe ?? false) == false && + selectedBtn != 1 && + selectedBtn != 2) ? diningStatus : selectedBtn, null, @@ -1411,7 +1521,10 @@ class _Settlement extends State { } else { queryOrderInfo( address?.id, - ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && (subscribeParam?.isEnableSubscribe ?? false) == false && selectedBtn != 1 && selectedBtn != 2) + ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && + (subscribeParam?.isEnableSubscribe ?? false) == false && + selectedBtn != 1 && + selectedBtn != 2) ? diningStatus : selectedBtn, couponBean?.id, @@ -1420,9 +1533,7 @@ class _Settlement extends State { productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - (couponBean?.id ?? 0) == 0 - ? "AUTO" - : "COUPON", + (couponBean?.id ?? 0) == 0 ? "AUTO" : "COUPON", // useVipPriceSelect, // useBenefitSelect, count1, @@ -1450,7 +1561,10 @@ class _Settlement extends State { // this.couponListBean = null; queryOrderInfo( address?.id, - ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && (subscribeParam?.isEnableSubscribe ?? false) == false && selectedBtn != 1 && selectedBtn != 2) + ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && + (subscribeParam?.isEnableSubscribe ?? false) == false && + selectedBtn != 1 && + selectedBtn != 2) ? diningStatus : selectedBtn, 0, @@ -1459,9 +1573,7 @@ class _Settlement extends State { productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - ((pro?.id ?? 0) ?? productId) == 0 - ?"AUTO" - : "ACTIVITY", + ((pro?.id ?? 0) ?? productId) == 0 ? "AUTO" : "ACTIVITY", // useVipPriceSelect, // useBenefitSelect, count1, diff --git a/lib/settlement/settlement_view/activity_coupon_remarks.dart b/lib/settlement/settlement_view/activity_coupon_remarks.dart index fd510c3b..db8522c9 100644 --- a/lib/settlement/settlement_view/activity_coupon_remarks.dart +++ b/lib/settlement/settlement_view/activity_coupon_remarks.dart @@ -1,5 +1,3 @@ -import 'dart:io'; - import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; @@ -86,7 +84,6 @@ class _ActivityCouponRemarks extends State { ], borderRadius: BorderRadius.circular(8), ), - // height: 122.h / (!widget.placeOrder ? 2 : 1), margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 14.h, bottom: 14.h), padding: EdgeInsets.only( left: 16.w, @@ -98,100 +95,101 @@ class _ActivityCouponRemarks extends State { mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [ - if ((widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) : !(widget?.settleOrderInfo?.isRaise ?? false)) && - (widget?.settleOrderInfo?.memberVO?.isVip ?? false) && - widget.placeOrder) - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 1, - child: Text( - "VIP权益", - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 14.sp, - color: Color(0xFF353535), - ), - ), - ), - Platform.isAndroid - ? Switch.adaptive( - value: - (widget.coupons != null && widget.coupons != "" || - widget.promotions != null && - widget.promotions != "" || - widget.payChannell == 5 || widget.payChannell == 7 || ((widget?.settleOrderInfo?.discountType ?? "") == "MEMBER_RANK" || (widget?.settleOrderInfo?.discountType ?? "") == "SURPRISE") ) - ? false - : vipSelect, - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - activeColor: Color(0xff32A060), - onChanged: (bool value) { - setState(() { - if(widget.settleOrderInfo.usePlateMoney == false || widget.payChannell == 5){ - SmartDialog.show( - widget: SettlementTips( - () { - }, - text: widget.payChannell == 5 ? "该支付余额为特殊活动充值, 不可参与任何活动" :"该用户平台余额为特殊活动充值, 不可参与任何活动", - )); - return; - } - if ((widget?.settleOrderInfo?.memberVO?.isVip ?? - false)) { - vipSelect = !vipSelect; - widget.vipPriceSelect(vipSelect); - } else { - widget.showVipTips(); - return; - } - }); - }, - ) - : GestureDetector( - onTap: () { - setState(() { - if(widget.settleOrderInfo.usePlateMoney == false || widget.payChannell == 5){ - SmartDialog.show( - widget: SettlementTips( - () { - }, - text: widget.payChannell == 5 ? "该支付余额为特殊活动充值, 不可参与任何活动" :"该用户平台余额为特殊活动充值, 不可参与任何活动", - )); - return; - } - if ((widget?.settleOrderInfo?.memberVO?.isVip ?? - false)) { - vipSelect = !vipSelect; - widget.vipPriceSelect(vipSelect); - } else { - widget.showVipTips(); - return; - } - }); - }, - child: Container( - padding: EdgeInsets.only(bottom: 18.w), - alignment: Alignment.center, - child: Image.asset( - ((widget.coupons != null && widget.coupons != "" || - widget.promotions != null && - widget.promotions != "" || - widget.payChannell == 5 || - widget.payChannell == 7 ||((widget?.settleOrderInfo?.discountType ?? "") == "MEMBER_RANK" || (widget?.settleOrderInfo?.discountType ?? "") == "SURPRISE") - || (widget.payChannell == 4 && widget.settleOrderInfo.promotionInfoList.length <=0 && widget.settleOrderInfo.couponList.length <= 0)) - ? false - : vipSelect) - ? "assets/image/vip_price.webp" - : "assets/image/vip_unprice.webp", - width: 38.w, - height: 20.h, - ), - ), - ) - ], - ), + // if ((widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) : !(widget?.settleOrderInfo?.isRaise ?? false)) && + // (widget?.settleOrderInfo?.memberVO?.isVip ?? false) && + // widget.placeOrder) + // Row( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Expanded( + // flex: 1, + // child: Text( + // "VIP权益", + // style: TextStyle( + // fontWeight: MyFontWeight.regular, + // fontSize: 14.sp, + // color: Color(0xFF353535), + // ), + // ), + // ), + // Platform.isAndroid + // ? Switch.adaptive( + // value: + // (widget.coupons != null && widget.coupons != "" || + // widget.promotions != null && + // widget.promotions != "" || + // widget.payChannell == 5 || widget.payChannell == 7 || ((widget?.settleOrderInfo?.discountType ?? "") == "MEMBER_RANK" || (widget?.settleOrderInfo?.discountType ?? "") == "SURPRISE") ) + // ? false + // : vipSelect, + // materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + // activeColor: Color(0xff32A060), + // onChanged: (bool value) { + // setState(() { + // if(widget.settleOrderInfo.usePlateMoney == false || widget.payChannell == 5){ + // SmartDialog.show( + // widget: SettlementTips( + // () { + // }, + // text: widget.payChannell == 5 ? "该支付余额为特殊活动充值, 不可参与任何活动" :"该用户平台余额为特殊活动充值, 不可参与任何活动", + // )); + // return; + // } + // if ((widget?.settleOrderInfo?.memberVO?.isVip ?? + // false)) { + // vipSelect = !vipSelect; + // widget.vipPriceSelect(vipSelect); + // } else { + // widget.showVipTips(); + // return; + // } + // }); + // }, + // ) + // : GestureDetector( + // onTap: () { + // setState(() { + // if(widget.settleOrderInfo.usePlateMoney == false || widget.payChannell == 5){ + // SmartDialog.show( + // widget: SettlementTips( + // () { + // }, + // text: widget.payChannell == 5 ? "该支付余额为特殊活动充值, 不可参与任何活动" :"该用户平台余额为特殊活动充值, 不可参与任何活动", + // )); + // return; + // } + // if ((widget?.settleOrderInfo?.memberVO?.isVip ?? + // false)) { + // vipSelect = !vipSelect; + // widget.vipPriceSelect(vipSelect); + // } else { + // widget.showVipTips(); + // return; + // } + // }); + // }, + // child: Container( + // padding: EdgeInsets.only(bottom: 18.w), + // alignment: Alignment.center, + // child: Image.asset( + // ((widget.coupons != null && widget.coupons != "" || + // widget.promotions != null && + // widget.promotions != "" || + // widget.payChannell == 5 || + // widget.payChannell == 7 ||((widget?.settleOrderInfo?.discountType ?? "") == "MEMBER_RANK" || (widget?.settleOrderInfo?.discountType ?? "") == "SURPRISE") + // || (widget.payChannell == 4 && widget.settleOrderInfo.promotionInfoList.length <=0 && widget.settleOrderInfo.couponList.length <= 0)) + // ? false + // : vipSelect) + // ? "assets/image/vip_price.webp" + // : "assets/image/vip_unprice.webp", + // width: 38.w, + // height: 20.h, + // ), + // ), + // ) + // ], + // ), + // if (widget.placeOrder && !(widget?.settleOrderInfo?.isRaise ?? false)) // Container( // margin: EdgeInsets.only( @@ -278,50 +276,52 @@ class _ActivityCouponRemarks extends State { // ], // ), // ), + + // if (widget.placeOrder && + // ((widget?.settleOrderInfo?.discountType == "MEMBER_RANK" || widget?.settleOrderInfo?.discountType == "SURPRISE") && widget?.settleOrderInfo?.benefitDiscountAmount != null && + // widget?.settleOrderInfo?.benefitDiscountAmount != "0")) + // Container( + // margin: EdgeInsets.only(bottom: 13), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Expanded( + // flex: 1, + // child: Text( + // "会员优惠金额", + // style: TextStyle( + // fontWeight: MyFontWeight.regular, + // fontSize: 14.sp, + // color: Color(0xFF353535), + // ), + // ), + // ), + // Text( + // widget.settleOrderInfo.benefitDiscountAmount, + // textAlign: TextAlign.end, + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xFF32A060), + // fontWeight: MyFontWeight.semi_bold, + // ), + // ), + // ], + // ), + // ), if (widget.placeOrder && - ((widget?.settleOrderInfo?.discountType == "MEMBER_RANK" || widget?.settleOrderInfo?.discountType == "SURPRISE") && widget?.settleOrderInfo?.benefitDiscountAmount != null && - widget?.settleOrderInfo?.benefitDiscountAmount != "0")) - Container( - margin: EdgeInsets.only(bottom: 13), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 1, - child: Text( - "会员优惠金额", - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 14.sp, - color: Color(0xFF353535), - ), - ), - ), - Text( - widget.settleOrderInfo.benefitDiscountAmount, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF32A060), - fontWeight: MyFontWeight.semi_bold, - ), - ), - ], - ), - ), - if (widget.placeOrder && widget.tableId <= 0 && !(widget?.settleOrderInfo?.isRaise ?? false)) + widget.tableId <= 0 && + !(widget?.settleOrderInfo?.isRaise ?? false)) InkWell( onTap: () { - if(widget.payChannell == 5){ - SmartDialog.show( - widget: SettlementTips( - () { - }, - text: "该支付余额为特殊活动充值, 不可参与任何活动", - )); - return; - } + if (widget.payChannell == 5) { + SmartDialog.show( + widget: SettlementTips( + () {}, + text: "该支付余额为特殊活动充值, 不可参与任何活动", + )); + return; + } widget.activityCart(); }, child: Row( @@ -357,18 +357,20 @@ class _ActivityCouponRemarks extends State { ), if (widget.placeOrder && !(widget?.settleOrderInfo?.isRaise ?? false)) SizedBox( - height: 13, + height: 13.h, ), - if (widget.placeOrder && (widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) : !(widget?.settleOrderInfo?.isRaise ?? false))) + if (widget.placeOrder && + (widget.tableId > 0 + ? !(widget?.minOrderInfo?.isRaise ?? false) + : !(widget?.settleOrderInfo?.isRaise ?? false))) InkWell( onTap: () { - if(widget.payChannell == 5){ + if (widget.payChannell == 5) { SmartDialog.show( widget: SettlementTips( - () { - }, - text: "该支付余额为特殊活动充值, 不可参与任何活动", - )); + () {}, + text: "该支付余额为特殊活动充值, 不可参与任何活动", + )); return; } widget.couponCart(); @@ -404,7 +406,10 @@ class _ActivityCouponRemarks extends State { ], ), ), - if (widget.placeOrder && (widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) : !(widget?.settleOrderInfo?.isRaise ?? false))) + if (widget.placeOrder && + (widget.tableId > 0 + ? !(widget?.minOrderInfo?.isRaise ?? false) + : !(widget?.settleOrderInfo?.isRaise ?? false))) SizedBox( height: 13, ), diff --git a/lib/settlement/settlement_view/settlement_order_commodity.dart b/lib/settlement/settlement_view/settlement_order_commodity.dart index e4fab047..0844707c 100644 --- a/lib/settlement/settlement_view/settlement_order_commodity.dart +++ b/lib/settlement/settlement_view/settlement_order_commodity.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/generated/l10n.dart'; -import 'package:huixiang/retrofit/data/activity_details.dart'; import 'package:huixiang/retrofit/data/min_order_info.dart'; import 'package:huixiang/retrofit/data/order_product_vo.dart'; import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; @@ -150,8 +149,23 @@ class _SettlementOrderCommodity extends State { } if (widget.useBenefitSelect && - ((widget?.settleOrderInfo?.discountType == "MEMBER_RANK" || - widget?.settleOrderInfo?.discountType == "SURPRISE") && + (widget?.settleOrderInfo?.discountType == "SURPRISE" && + widget?.settleOrderInfo?.vipDayDiscountAmount != "0") && + ((widget.tableId > 0 + ? !(widget?.minOrderInfo?.isRaise ?? false) + : !(widget?.settleOrderInfo?.isRaise ?? false)))) { + widgets.add(vipItem( + Color(0xFFFF7A1A), + "会员日优惠金额", + AppUtils.calculateDouble(double.tryParse( + (widget.minOrderInfo != null && + widget.minOrderInfo.orderProductVOList != null) + ? (widget.minOrderInfo?.discountAmount ?? "") + : (widget?.settleOrderInfo?.vipDayDiscountAmount ?? ""))))); + } + + if (widget.useBenefitSelect && + ((widget?.settleOrderInfo?.discountType == "MEMBER_RANK") && widget?.settleOrderInfo?.benefitDiscountAmount != "0") && ((widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) @@ -619,7 +633,7 @@ class _SettlementOrderCommodity extends State { String discountPrice() { if (widget.minOrderInfo != null) { return AppUtils.calculateDouble( - double.tryParse(widget.minOrderInfo?.totalDiscountPrice ?? "0")); + double.tryParse(widget.minOrderInfo?.totalDiscountPrice ?? "0")+double.tryParse(widget.minOrderInfo?.couponSubPrice ?? "0")); } else if (widget.tableId < 0) { return "0"; } else { diff --git a/lib/settlement/settlement_view/vip_discounts_select.dart b/lib/settlement/settlement_view/vip_discounts_select.dart new file mode 100644 index 00000000..1148fc90 --- /dev/null +++ b/lib/settlement/settlement_view/vip_discounts_select.dart @@ -0,0 +1,195 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/utils/font_weight.dart'; + +import '../../retrofit/data/min_order_info.dart'; +import '../../retrofit/data/settleOrderInfo.dart'; +import '../../view_widget/settlement_tips_dialog.dart'; + +class VipDiscountsSelect extends StatefulWidget { + final Function(int vipSelect) vipSelectCheck; + final SettleOrderInfo settleOrderInfo; + final MinOrderInfo minOrderInfo; + final int payChannel; + + VipDiscountsSelect(this.vipSelectCheck,this.settleOrderInfo,this.minOrderInfo,this.payChannel); + + @override + State createState() { + return _VipDiscountsSelect(); + } +} + +class _VipDiscountsSelect extends State { + var selectVip = 0; + + @override + Widget build(BuildContext context) { + return Container( + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x0D000000), + offset: Offset(0, 1), + blurRadius: 8, + spreadRadius: 0, + ), + ], + borderRadius: BorderRadius.circular(8), + ), + margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 14.h, bottom: 14.h), + padding: EdgeInsets.only( + left: 16.w, + right: 16.w, + top: 14.h, + bottom: 14.h, + ), + child: Column( + children: [ + Padding(padding:EdgeInsets.only(bottom: 14.h), + child: GestureDetector( + onTap: (){ + setState(() { + if (widget.settleOrderInfo.usePlateMoney == false || widget.payChannel == 5) { + SmartDialog.show( + widget: SettlementTips( + () {}, + text: widget.payChannel == 5 + ? "该支付余额为特殊活动充值, 不可参与任何活动" + : "该用户平台余额为特殊活动充值, 不可参与任何活动", + )); + return; + } else { + selectVip = 1; + widget.vipSelectCheck(1); + } + });}, + child: Row( + children: [ + Image.asset( + "assets/image/vip_level_logo.webp", + fit: BoxFit.fill, + width: 20, + height: 20, + ), + SizedBox( + width: 8.w, + ), + Expanded(child:Text( + "会员等级优惠", + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + color: Color(0xFF868686), + ), + )), + vipCheckView(1) + ], + ), + ),), + if((widget?.settleOrderInfo?.isVipDay?? false) == true) + Padding(padding:EdgeInsets.only(bottom: 14.h), + child: GestureDetector( + onTap: (){ + setState(() { + if (widget.settleOrderInfo.usePlateMoney == false || widget.payChannel == 5) { + SmartDialog.show( + widget: SettlementTips( + () {}, + text: widget.payChannel == 5 + ? "该支付余额为特殊活动充值, 不可参与任何活动" + : "该用户平台余额为特殊活动充值, 不可参与任何活动", + )); + return; + } else { + selectVip = 2; + widget.vipSelectCheck(2); + } + });}, + child: Row( + children: [ + Image.asset( + "assets/image/vip_day_logo.webp", + fit: BoxFit.fill, + width: 20, + height: 20, + ), + SizedBox( + width: 8.w, + ), + Expanded(child:Text( + "会员日", + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + color: Color(0xFF868686), + ), + )), + vipCheckView(2) + ], + ), + ),), + GestureDetector( + onTap: (){ + setState(() { + if (widget.settleOrderInfo.usePlateMoney == false || widget.payChannel == 5) { + SmartDialog.show( + widget: SettlementTips( + () {}, + text: widget.payChannel == 5 + ? "该支付余额为特殊活动充值, 不可参与任何活动" + : "该用户平台余额为特殊活动充值, 不可参与任何活动", + )); + return; + } else { + selectVip = 3; + widget.vipSelectCheck(3); + } + });}, + child: Row( + children: [ + Image.asset( + "assets/image/vip_equity_logo.webp", + fit: BoxFit.fill, + width: 20, + height: 20, + ), + SizedBox( + width: 8.w, + ), + Expanded(child:Text( + "会员卡优惠", + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + color: Color(0xFF868686), + ), + )), + vipCheckView(3) + ], + ), + ), + ], + ), + ); + } + + Widget vipCheckView(var index) { + return Image.asset( + ((widget?.settleOrderInfo?.discountType??"") == "MEMBER_RANK" + ? 1 + : ((widget?.settleOrderInfo?.discountType??"") == "SURPRISE" + ? 2 + : ((widget?.settleOrderInfo?.discountType??"") == "VIP" + ? 3 + : 0))) != + index + ? "assets/image/icon_radio_unselected.webp" + : "assets/image/icon_radio_selected.webp", + width: 15.w, + height: 15.h, + ); + } +}