diff --git a/lib/order/order_view/order_commodity.dart b/lib/order/order_view/order_commodity.dart index beae0d51..e53ed5cf 100644 --- a/lib/order/order_view/order_commodity.dart +++ b/lib/order/order_view/order_commodity.dart @@ -76,7 +76,9 @@ class _OrderCommodity extends State { } widgets.add(SizedBox(height: 20.h)); - if (widget.orderInfo.isTakeOut != 0 && widget.orderInfo.isTakeOut != 3 && widget.orderInfo.isTakeOut != 4) { + if (widget.orderInfo.isTakeOut != 0 && + widget.orderInfo.isTakeOut != 3 && + widget.orderInfo.isTakeOut != 4) { // 配送费 widgets.add( discountItem( @@ -113,7 +115,6 @@ class _OrderCommodity extends State { ); } - if (widget.orderInfo.orderDetail != null && widget.orderInfo.orderDetail.couponDTO != null) { // 优惠券 @@ -129,7 +130,8 @@ class _OrderCommodity extends State { if (widget.orderInfo.orderDetail != null && widget.orderInfo.orderDetail.activityPrice != null && - double.tryParse(widget.orderInfo.orderDetail.activityPrice ?? "0") > 0) { + double.tryParse(widget.orderInfo.orderDetail.activityPrice ?? "0") > + 0) { // 活动 widgets.add( discountItem( @@ -141,7 +143,6 @@ class _OrderCommodity extends State { ); } - if (widget.orderInfo.orderDetail != null && widget.orderInfo.vipDiscountPrice != null && double.tryParse(widget.orderInfo.vipDiscountPrice ?? "0") > 0) { @@ -151,7 +152,7 @@ class _OrderCommodity extends State { Color(0xFFFF7A1A), "VIP优惠", "", - "- ${widget.orderInfo.vipDiscountPrice??""}", + "- ${widget.orderInfo.vipDiscountPrice ?? ""}", ), ); } @@ -179,7 +180,6 @@ class _OrderCommodity extends State { return widgets; } - Widget commodityItem(OrderProductVOList productList) { return Container( margin: EdgeInsets.only(top: 8.h, bottom: 8.h), @@ -248,15 +248,23 @@ class _OrderCommodity extends State { children: [ Text( productList.buyNum > 1 - ? S.of(context).yuan_(AppUtils.calculateDouble(double.tryParse(productList.sellPrice ?? "0") - AppUtils.stringAsFixedDouble2((double.tryParse(productList.discountAmount ?? "0") / productList.buyNum)))) - : S.of(context).yuan_(AppUtils.calculateDouble(double.tryParse(productList.sellPrice ?? "0") - double.tryParse(productList.discountAmount ?? "0"))), + ? S.of(context).yuan_(AppUtils.calculateDouble( + double.tryParse(productList.sellPrice ?? "0") - + AppUtils.stringAsFixedDouble2((double.tryParse( + productList.discountAmount ?? "0") / + productList.buyNum)))) + : S.of(context).yuan_(AppUtils.calculateDouble( + double.tryParse(productList.sellPrice ?? "0") - + double.tryParse( + productList.discountAmount ?? "0"))), style: TextStyle( fontWeight: MyFontWeight.medium, fontSize: 14.sp, color: Color(0xFF4C4C4C), ), ), - if (productList.discountAmount != null && productList.discountAmount != "0") + if (productList.discountAmount != null && + productList.discountAmount != "0") Text( S.of(context).yuan_(productList.sellPrice), style: TextStyle( @@ -288,53 +296,55 @@ class _OrderCommodity extends State { } Widget orderMealsItem(SetMealDataList setMealDataList) { - return Column(children: setMealDataList.productInfoList.map((e) { - return Container( - margin: EdgeInsets.symmetric( - vertical: 10.h, - ), - child: Row( - children: [ - Expanded( - flex: 2, - child: Text( - e.productName, - overflow: TextOverflow.ellipsis, - maxLines: 1, - style: TextStyle( - color: Color(0xffA29E9E), - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, + return Column( + children: setMealDataList.productInfoList.map((e) { + return Container( + margin: EdgeInsets.symmetric( + vertical: 10.h, + ), + child: Row( + children: [ + Expanded( + flex: 2, + child: Text( + e.productName, + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + color: Color(0xffA29E9E), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), ), ), - ), - Expanded( - flex: 3, - child: Text( - "${(e.skuName == "") ? "" : e.skuName}", + Expanded( + flex: 3, + child: Text( + "${(e.skuName == "") ? "" : e.skuName}", + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + color: Color(0xffA29E9E), + fontSize: 13.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ), + Text( + "x${e.buyNumber.toString()}", overflow: TextOverflow.ellipsis, maxLines: 1, style: TextStyle( - color: Color(0xffA29E9E), + color: Color(0xffFF7A1A), fontSize: 13.sp, fontWeight: MyFontWeight.regular, ), ), - ), - Text( - "x${e.buyNumber.toString()}", - overflow: TextOverflow.ellipsis, - maxLines: 1, - style: TextStyle( - color: Color(0xffFF7A1A), - fontSize: 13.sp, - fontWeight: MyFontWeight.regular, - ), - ), - ], - ), - ); - }).toList(),); + ], + ), + ); + }).toList(), + ); } Widget discountItem(Color color, textName, condition, amount) { @@ -386,7 +396,7 @@ class _OrderCommodity extends State { ); } - Widget vipItem(Color color, textName,amount) { + Widget vipItem(Color color, textName, amount) { return Container( margin: EdgeInsets.only(top: 9.h, bottom: 9.h), child: Row( @@ -497,9 +507,9 @@ class _OrderCommodity extends State { ); } - String buyNumAllGoods(){ + String buyNumAllGoods() { int count = 0; - if(widget.orderInfo != null){ + if (widget.orderInfo != null) { widget.orderInfo.productList.forEach((element) { count += element.buyNum; }); @@ -512,7 +522,7 @@ class _OrderCommodity extends State { margin: EdgeInsets.only(top: 7.h, bottom: 11.h), child: Row( mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.baseline, + crossAxisAlignment: CrossAxisAlignment.start, textBaseline: TextBaseline.alphabetic, children: [ Expanded( @@ -538,27 +548,76 @@ class _OrderCommodity extends State { SizedBox( width: 15.w, ), - Container( - child: Text( - S.of(context).jiesuanjine, - style: TextStyle( - fontSize: 12.sp, - color: Color(0xFF353535), - fontWeight: MyFontWeight.semi_bold), - ), - ), - SizedBox( - width: 5.w, - ), - Text( - "${widget.orderInfo.orderDetail.paySumPrice}" - /*totalPrice()*/, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF32A060), - fontFamily: 'JDZhengHT', - fontWeight: MyFontWeight.semi_bold), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container( + margin: EdgeInsets.only(bottom:8.h), + child: Text( + "${S.of(context).jiesuanjine}:", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF353535), + fontWeight: MyFontWeight.medium), + ), + ), + if(widget.orderInfo.orderDetail.payRecords != null) + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: widget.orderInfo.orderDetail.payRecords.map((e) { + return Container( + margin:EdgeInsets.only(bottom:5.h), + child: Text( + "${e?.countName ?? ""}:", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF727272), + fontWeight: MyFontWeight.regular), + )); + }).toList(), + ), + ], + ), + SizedBox( + width: 5.w, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container(margin:EdgeInsets.only(bottom:7.5.h), + child: Text( + "¥${widget.orderInfo.orderDetail.paySumPrice}" /*totalPrice()*/, + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 13.sp, + color: Color(0xFF32A060), + fontFamily: 'JDZhengHT', + fontWeight: MyFontWeight.semi_bold), + )), + if(widget.orderInfo.orderDetail.payRecords != null) + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: widget.orderInfo.orderDetail.payRecords.map((e) { + return Container( + margin:EdgeInsets.only(bottom:4.h), + child: Text( + "¥${e?.amount ?? "0.00"}", + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF32A060), + fontFamily: 'JDZhengHT', + fontWeight: MyFontWeight.regular), + ), + ); + }).toList(), + ), + ], + ), + ], ) ], ), diff --git a/lib/retrofit/data/findMiNiGroupList.dart b/lib/retrofit/data/findMiNiGroupList.dart index 8b22f8f5..c55f612f 100644 --- a/lib/retrofit/data/findMiNiGroupList.dart +++ b/lib/retrofit/data/findMiNiGroupList.dart @@ -104,6 +104,7 @@ class ProductListBean { dynamic markProductNone; SubscribeParam subscribeParam; bool isSetMeal; + int minQty; static ProductListBean fromJson(Map map) { if (map == null) return null; @@ -139,6 +140,7 @@ class ProductListBean { productListBean.markProductNone = map['markProductNone']; productListBean.subscribeParam = SubscribeParam.fromJson(map['subscribeParam']); productListBean.isSetMeal = map['isSetMeal']; + productListBean.minQty = map['minQty']; return productListBean; } @@ -174,6 +176,7 @@ class ProductListBean { "markProductNone": markProductNone, "subscribeParam": subscribeParam, "isSetMeal": isSetMeal, + "minQty": minQty, }; } diff --git a/lib/retrofit/data/miNiDetail.dart b/lib/retrofit/data/miNiDetail.dart index 8b116c3e..afd55ae0 100644 --- a/lib/retrofit/data/miNiDetail.dart +++ b/lib/retrofit/data/miNiDetail.dart @@ -87,6 +87,7 @@ class MiNiDetail { dynamic namePinyin; dynamic nameInitials; SubscribeParam subscribeParam; + int minQty; static MiNiDetail fromJson(Map map) { if (map == null) return null; @@ -142,6 +143,7 @@ class MiNiDetail { miNiDetailBean.nameInitials = map['nameInitials']; miNiDetailBean.subscribeParam = SubscribeParam.fromJson(map['subscribeParam']); + miNiDetailBean.minQty = map['minQty']; return miNiDetailBean; } @@ -192,6 +194,7 @@ class MiNiDetail { "namePinyin": namePinyin, "nameInitials": nameInitials, "subscribeParam": subscribeParam, + "minQty": minQty }; } @@ -229,6 +232,7 @@ class ProductSkuVOListBean { String storeId; String skuCode; String skuNameStr; + int _minQty; String productId; String skuPrice; String applyPrice; @@ -246,6 +250,19 @@ class ProductSkuVOListBean { List skuAttrList; List productSetMeals; dynamic setMealDTOList; + int _count; + + int get minQty => _minQty??0; + + set minQty(int value) { + _minQty = value; + } + + int get count => _count??1; + + set count(int value) { + _count = value; + } static ProductSkuVOListBean fromJson(Map map) { if (map == null) return null; @@ -258,6 +275,7 @@ class ProductSkuVOListBean { productSkuVOListBean.storeId = map['storeId']; productSkuVOListBean.skuCode = map['skuCode']; productSkuVOListBean.skuNameStr = map['skuNameStr']; + productSkuVOListBean._minQty = map['minQty']; productSkuVOListBean.productId = map['productId']; productSkuVOListBean.skuPrice = map['skuPrice']; productSkuVOListBean.applyPrice = map['applyPrice']; @@ -291,6 +309,7 @@ class ProductSkuVOListBean { "storeId": storeId, "skuCode": skuCode, "skuNameStr": skuNameStr, + "minQty": _minQty, "productId": productId, "skuPrice": skuPrice, "applyPrice": applyPrice, diff --git a/lib/retrofit/data/order_info.dart b/lib/retrofit/data/order_info.dart index b2139368..a2a3c96d 100644 --- a/lib/retrofit/data/order_info.dart +++ b/lib/retrofit/data/order_info.dart @@ -433,6 +433,7 @@ class OrderDetail { String shipperCode; String logisticsName; String logisticsNum; + List payRecords; int orderNum; int productNum; int mins; @@ -461,6 +462,7 @@ class OrderDetail { String shipperCode, String logisticsName, String logisticsNum, + List payRecords, int orderNum, int productNum, int mins, @@ -487,6 +489,7 @@ class OrderDetail { this.shipperCode = shipperCode; this.logisticsName = logisticsName; this.logisticsNum = logisticsNum; + this.payRecords = payRecords; this.orderNum = orderNum; this.productNum = productNum; this.mins = mins; @@ -526,6 +529,12 @@ class OrderDetail { this.shipperCode = json["shipperCode"]; this.logisticsName = json["logisticsName"]; this.logisticsNum = json["logisticsNum"]; + if (json["payRecords"] != null) { + this.payRecords = []; + json["payRecords"].forEach((v) { + this.payRecords.add(PayRecords.fromJson(v)); + }); + } this.orderNum = json["orderNum"]; this.productNum = json["productNum"]; this.mins = json["mins"]; @@ -560,6 +569,9 @@ class OrderDetail { map["shipperCode"] = this.shipperCode; map["logisticsName"] = this.logisticsName; map["logisticsNum"] = this.logisticsNum; + if (this.payRecords != null) { + map["payRecords"] = this.payRecords.map((v) => v.toJson()).toList(); + } map["orderNum"] = this.orderNum; map["productNum"] = this.productNum; map["mins"] = this.mins; @@ -891,3 +903,127 @@ class CouponDTO { return map; } } + +/// id : "1828720860895117312" +/// orderId : "1828720033405075456" +/// countName : "商户活动余额支付" +/// type : 8 +/// amount : "10.00" +/// refundAmount : "0.00" +/// createTime : "2024-08-28 17:06:44" +/// refId : "1828720859515191296" +/// memberName : "soon" +/// memberBalance : "3551.19" +/// memberPhone : "13052919193" +/// isDiscount : false + +class PayRecords { + PayRecords({ + String id, + String orderId, + String countName, + int type, + String amount, + String refundAmount, + String createTime, + String refId, + String memberName, + String memberBalance, + String memberPhone, + bool isDiscount,}){ + _id = id; + _orderId = orderId; + _countName = countName; + _type = type; + _amount = amount; + _refundAmount = refundAmount; + _createTime = createTime; + _refId = refId; + _memberName = memberName; + _memberBalance = memberBalance; + _memberPhone = memberPhone; + _isDiscount = isDiscount; + } + + PayRecords.fromJson(dynamic json) { + _id = json['id']; + _orderId = json['orderId']; + _countName = json['countName']; + _type = json['type']; + _amount = json['amount']; + _refundAmount = json['refundAmount']; + _createTime = json['createTime']; + _refId = json['refId']; + _memberName = json['memberName']; + _memberBalance = json['memberBalance']; + _memberPhone = json['memberPhone']; + _isDiscount = json['isDiscount']; + } + String _id; + String _orderId; + String _countName; + int _type; + String _amount; + String _refundAmount; + String _createTime; + String _refId; + String _memberName; + String _memberBalance; + String _memberPhone; + bool _isDiscount; + PayRecords copyWith({ String id, + String orderId, + String countName, + int type, + String amount, + String refundAmount, + String createTime, + String refId, + String memberName, + String memberBalance, + String memberPhone, + bool isDiscount, + }) => PayRecords( id: id ?? _id, + orderId: orderId ?? _orderId, + countName: countName ?? _countName, + type: type ?? _type, + amount: amount ?? _amount, + refundAmount: refundAmount ?? _refundAmount, + createTime: createTime ?? _createTime, + refId: refId ?? _refId, + memberName: memberName ?? _memberName, + memberBalance: memberBalance ?? _memberBalance, + memberPhone: memberPhone ?? _memberPhone, + isDiscount: isDiscount ?? _isDiscount, + ); + String get id => _id; + String get orderId => _orderId; + String get countName => _countName; + int get type => _type; + String get amount => _amount; + String get refundAmount => _refundAmount; + String get createTime => _createTime; + String get refId => _refId; + String get memberName => _memberName; + String get memberBalance => _memberBalance; + String get memberPhone => _memberPhone; + bool get isDiscount => _isDiscount; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['orderId'] = _orderId; + map['countName'] = _countName; + map['type'] = _type; + map['amount'] = _amount; + map['refundAmount'] = _refundAmount; + map['createTime'] = _createTime; + map['refId'] = _refId; + map['memberName'] = _memberName; + map['memberBalance'] = _memberBalance; + map['memberPhone'] = _memberPhone; + map['isDiscount'] = _isDiscount; + return map; + } + +} diff --git a/lib/retrofit/data/shoppingCart.dart b/lib/retrofit/data/shoppingCart.dart index 489fd961..ed1fb0ba 100644 --- a/lib/retrofit/data/shoppingCart.dart +++ b/lib/retrofit/data/shoppingCart.dart @@ -88,6 +88,7 @@ class ShoppingCartSkuItemListBean { int skuStock; String storeId; String tableId; + int minQty; static ShoppingCartSkuItemListBean fromJson(Map map) { if (map == null) return null; @@ -112,6 +113,7 @@ class ShoppingCartSkuItemListBean { shoppingCartSkuItemListBean.skuStock = map['skuStock']; shoppingCartSkuItemListBean.storeId = map['storeId']; shoppingCartSkuItemListBean.tableId = map['tableId']; + shoppingCartSkuItemListBean.minQty = map['minQty']; return shoppingCartSkuItemListBean; } @@ -132,6 +134,7 @@ class ShoppingCartSkuItemListBean { "skuStock": skuStock, "storeId": storeId, "tableId": tableId, + "minQty": minQty, }; } diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index bb860d8e..7397ed25 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -78,7 +78,7 @@ class _MinApiService implements MinApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => MiNiDetail.fromJson(json), + (json) => ((json??"") == "")? null :MiNiDetail.fromJson(json), ); return value; } diff --git a/lib/store/shop_details_page.dart b/lib/store/shop_details_page.dart index af7c01d2..57b023dd 100644 --- a/lib/store/shop_details_page.dart +++ b/lib/store/shop_details_page.dart @@ -28,6 +28,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../view_widget/border_text.dart'; import '../view_widget/request_permission.dart'; +import '../view_widget/settlement_tips_dialog.dart'; class ShopDetailsPage extends StatefulWidget { final Map arguments; @@ -68,6 +69,10 @@ class _ShopDetailsPage extends State { int index; bool isSetMeal; int scIndex = 0; + int skuMinQty = 0; + int singleNum = 0; + String goodsSkuId; + bool isCounts = false; @override void initState() { @@ -347,6 +352,7 @@ class _ShopDetailsPage extends State { BaseData baseData = await minService.clearShoppingCart(storeId); if (baseData.isSuccess) { shopCarGoods = null; + singleNum = 0; setState(() {}); } } @@ -367,6 +373,8 @@ class _ShopDetailsPage extends State { BaseData baseData = await minService.miNiDetail(id); if (baseData != null && baseData.isSuccess) { showStoreSelector(baseData.data, id, count); + }else{ + SmartDialog.showToast(baseData.msg); } EasyLoading.dismiss(); } @@ -376,9 +384,11 @@ class _ShopDetailsPage extends State { if (miNiDetail.attrList != null && miNiDetail.attrList.length == 1 && miNiDetail.attrList[0].attrValueList.length == 1) { - _addShopCar(miNiDetail, [], counts); + _addShopCar(miNiDetail, [], count); } else { - // showSpanDialog(); + setState(() { + buildCount(); + }); selectSpecsShowBottomSheet(); } } @@ -443,8 +453,13 @@ class _ShopDetailsPage extends State { setState(() {}); }); } else { - SmartDialog.showToast(baseDate?.msg, alignment: Alignment.center); - } + SmartDialog.show( + widget: SettlementTips( + () {}, + text: "${baseDate.msg.replaceAll("~", ",") + "请重新加购商品"}", + ), + ); + } } } @@ -475,6 +490,17 @@ class _ShopDetailsPage extends State { } }); } + baseDate.data[0].shoppingCartSkuItemList.forEach((element) { + if((goodsSkuId == element.id)){ + singleNum = element.buyNum; + }else{ + if(id == element.productId){ + singleNum = element.buyNum; + }else{ + singleNum = 0; + } + } + }); return baseDate.data[0]; } else { return null; @@ -501,9 +527,9 @@ class _ShopDetailsPage extends State { ///购物车➖1 Future shopCartReduce( - ShoppingCartSkuItemListBean cartSkuItem) async { + ShoppingCartSkuItemListBean cartSkuItem,{int count = 1}) async { Map shopCarTemp = shopCarGoods.toJson(); - cartSkuItem.buyNum -= 1; + cartSkuItem.buyNum -= (count>0) ? ((cartSkuItem.minQty>1 && cartSkuItem.buyNum == cartSkuItem.minQty) ? cartSkuItem.minQty: count) : -count; shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; BaseData> baseDate = await minService.shoppingCartSingle(shopCarTemp); @@ -578,7 +604,7 @@ class _ShopDetailsPage extends State { if (shopSkuItem != null) { if (shopSkuItem.buyNum > 1) { - shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= 1; + shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= (skuMinQty > 1 && skuMinQty ==shopSkuItem.buyNum) ? skuMinQty:1; } } else { await _addShopCar(miNiDetail, selectSkus, 2); @@ -626,6 +652,7 @@ class _ShopDetailsPage extends State { if (productSku == null) return; selectedPrice = productSku.skuPrice; String skuId = productSku.id; + skuMinQty = productSku.minQty; if (shopCarGoods == null || shopCarGoods.shoppingCartSkuItemList == null) return; int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList @@ -848,8 +875,7 @@ class _ShopDetailsPage extends State { SizedBox( width: 2.w, ), - Expanded( - child: Text( + Text( miNiDetail?.applyPrice ?? "", style: TextStyle( fontSize: 16.sp, @@ -858,7 +884,32 @@ class _ShopDetailsPage extends State { fontWeight: MyFontWeight.regular, color: Color(0xFFA29E9E), ), - )), + ), + if((widget?.arguments["minQty"] ?? 0).toInt() > 1) + Container( + height: 20.h, + padding: EdgeInsets.symmetric(horizontal:6.w), + margin: EdgeInsets.only(left: 16.w), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + border: Border.all( + width: 1, + color: Color(0xFFF65720), + style: BorderStyle.solid, + ), + ), + alignment: Alignment.center, + child: Text( + "${widget?.arguments["minQty"] ?? 0 ?? "0"}份起购", + style: TextStyle( + color: Color(0xFFF65720), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ), + Spacer(), GestureDetector( onTap: () async { if (storeInfo.posType.code == "NORMALSTORE" && @@ -968,8 +1019,7 @@ class _ShopDetailsPage extends State { SizedBox( width: 2.w, ), - Expanded( - child: Text( + Text( miNiDetail?.applyPrice ?? "", style: TextStyle( fontSize: 16.sp, @@ -978,7 +1028,31 @@ class _ShopDetailsPage extends State { fontWeight: MyFontWeight.regular, color: Color(0xFFA29E9E), ), - )), + ), + if((widget?.arguments["minQty"] ?? 0).toInt() > 1) + Container( + padding: EdgeInsets.symmetric(horizontal:6.w,vertical: 2.h), + margin: EdgeInsets.only(left: 16.w), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + border: Border.all( + width: 1, + color: Color(0xFFF65720), + style: BorderStyle.solid, + ), + ), + alignment: Alignment.center, + child: Text( + "${widget?.arguments["minQty"] ?? 0}份起购", + style: TextStyle( + color: Color(0xFFF65720), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ), + Spacer(), GestureDetector( onTap: () async { if (storeInfo.posType.code == "NORMALSTORE" && @@ -997,7 +1071,8 @@ class _ShopDetailsPage extends State { setState(() {}); }); } else { - _queryMiNiDetail(id, counts); + _queryMiNiDetail(id,(skuMinQty > 1 ? counts : ((widget.arguments["minQty"]??0) > 1 && singleNum==0) + ? (widget.arguments["minQty"]??0):counts)); } }, child: Container( @@ -1191,6 +1266,31 @@ class _ShopDetailsPage extends State { ), ], ), + if(skuMinQty > 1) + Row(children: [ + Container( + padding: EdgeInsets.symmetric(horizontal:4.w), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + border: Border.all( + width: 1, + color: Color(0xFFF65720), + style: BorderStyle.solid, + ), + ), + alignment: Alignment.center, + child: Text( + "${skuMinQty}份起购", + style: TextStyle( + color: Color(0xFFF65720), + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ), + Spacer() + ]), Text( "¥${miNiDetail?.price ?? ""}", style: TextStyle( @@ -1237,7 +1337,7 @@ class _ShopDetailsPage extends State { ), Column( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, + // mainAxisAlignment: MainAxisAlignment.start, children: [ Text( S.of(context).shuliang, @@ -1247,28 +1347,59 @@ class _ShopDetailsPage extends State { fontWeight: MyFontWeight.regular, ), ), - SizedBox( - height: 10, - ), + if(skuMinQty > 1 && (counts ==1 || counts ==0)) + Row( + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () async { + state(() { + isCounts = true; + counts += skuMinQty-1; + _addShopCar(miNiDetail, selectSkus, counts); + }); + }, + child:Container( + margin: EdgeInsets.only(right: 8.w, top: 14.h,bottom: 24.h), + child: RoundButton( + text:"${skuMinQty}份起购", + textColor: Colors.white, + fontWeight: MyFontWeight.medium, + radius: 3, + backgroup: Color(0xFF32A060), + fontSize: 11.sp, + padding: EdgeInsets.symmetric( + vertical: 5.h, horizontal: 3.w), + ), + )), + Spacer() + ], + ), + if((skuMinQty > 1 && counts !=1) || skuMinQty == 0 || skuMinQty == 1) Row( children: [ - InkWell( + GestureDetector( + behavior: HitTestBehavior.opaque, onTap: () { state(() { if (counts > 1) setState(() { - counts -= 1; + counts -= (skuMinQty > 1 && skuMinQty == counts) ? (skuMinQty - 1) : 1; }); - // reduce(miNiDetail, selectSkus); + + isCounts = true; + reduce(miNiDetail, selectSkus); }); }, - child: Icon( + child: Container( + padding:EdgeInsets.only(right:8.w,top: 10.h,bottom: 24.h), + child: Icon( Icons.remove, color: Color(0xFF32A060), size: 24, - )), + ))), Padding( - padding: EdgeInsets.only(left: 8, right: 8), + padding: EdgeInsets.only(right: 8.w,bottom: 14.h), child: Text( "$counts", style: TextStyle( @@ -1278,25 +1409,27 @@ class _ShopDetailsPage extends State { ), ), ), - InkWell( + GestureDetector( + behavior: HitTestBehavior.opaque, onTap: () { state(() { counts += 1; - // add(miNiDetail, selectSkus); + isCounts = true; + add(miNiDetail, selectSkus); }); }, - child: Icon( - Icons.add, - color: Color(0xFF32A060), - size: 24, + child: Container( + padding:EdgeInsets.only(right:20.w,top: 10.h,bottom: 24.h), + child: Icon( + Icons.add, + color: Color(0xFF32A060), + size: 24, + ), )), ], ) ], ), - SizedBox( - height: 24, - ), RoundButton( width: double.infinity, height: 54.h, @@ -1308,12 +1441,24 @@ class _ShopDetailsPage extends State { textColor: Colors.white, fontWeight: MyFontWeight.semi_bold, radius: 27, - backgroup: Color(0xFF32A060), + backgroup:Color(0xFF32A060), fontSize: 16.sp, callback: () { state(() { - _addShopCar(miNiDetail, selectSkus, counts); - counts = 1; + if(skuMinQty > 1 && counts == 1){ + SmartDialog.show( + widget: SettlementTips( + () {}, + text: "请选择购买数量", + ), + ); + return; + } + if(!isCounts || counts == 1){ + _addShopCar(miNiDetail, selectSkus,1); + counts = 1; + isCounts = false; + } Navigator.of(context).pop(); }); }, diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 79956e0b..b77a8a34 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -32,6 +32,7 @@ import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../retrofit/data/settleOrderInfo.dart'; +import '../view_widget/settlement_tips_dialog.dart'; class StoreOrderPage extends StatefulWidget { final Map arguments; @@ -777,7 +778,7 @@ class _StoreOrderPage extends State if (count < 0) { shopCarGoods.shoppingCartSkuItemList.forEach((element) async { if (element.productId == id) { - await shopCartReduce(element); + await shopCartReduce(element,count: count); setState(() {}); } }); @@ -873,7 +874,12 @@ class _StoreOrderPage extends State toDownOrder(); setState(() {}); } else { - SmartDialog.showToast(baseDate?.msg, alignment: Alignment.center); + SmartDialog.show( + widget: SettlementTips( + () {}, + text: "${baseDate.msg.replaceAll("~", ",") + "请重新加购商品"}", + ), + ); } } } @@ -947,9 +953,9 @@ class _StoreOrderPage extends State ///购物车➖1 Future shopCartReduce( - ShoppingCartSkuItemListBean cartSkuItem) async { + ShoppingCartSkuItemListBean cartSkuItem,{int count = 1}) async { Map shopCarTemp = shopCarGoods.toJson(); - cartSkuItem.buyNum -= 1; + cartSkuItem.buyNum -= (count>0) ? ((cartSkuItem.minQty>1 && cartSkuItem.buyNum == cartSkuItem.minQty) ? cartSkuItem.minQty: count) : -count; shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; BaseData> baseDate = await minService.shoppingCartSingle(shopCarTemp); @@ -1004,10 +1010,13 @@ class _StoreOrderPage extends State } } + int countMinQty = 1; + ///商品➖1 reduce(MiNiDetail miNiDetail, selectSkus) async { ProductSkuVOListBean productSku = miNiDetail.productSkuVOList.firstWhere((element) { + countMinQty = element.minQty; return skuY(element, selectSkus); }); @@ -1025,7 +1034,7 @@ class _StoreOrderPage extends State if (shopSkuItem != null) { if (shopSkuItem.buyNum > 1) { - shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= 1; + shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= (countMinQty > 1 && countMinQty ==shopSkuItem.buyNum) ? countMinQty:1; } } else { await _addShopCar(miNiDetail, selectSkus, 1); diff --git a/lib/store/store_view/product_sku.dart b/lib/store/store_view/product_sku.dart index 93535f3b..1df618de 100644 --- a/lib/store/store_view/product_sku.dart +++ b/lib/store/store_view/product_sku.dart @@ -9,6 +9,8 @@ import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/round_button.dart'; +import '../../view_widget/settlement_tips_dialog.dart'; + class ProductSku extends StatefulWidget { final MiNiDetail miNiDetail; final String productId; @@ -31,43 +33,56 @@ class ProductSku extends StatefulWidget { class _ProductSku extends State { List selectSkus = []; - int count = 1, realCount = 0; - String selectedPrice = ""; bool _isTapEd = false; + int _currentSkuIndex; @override void initState() { super.initState(); + if (widget.shopCarGoods != null && widget.shopCarGoods.shoppingCartSkuItemList != null) { + widget.shopCarGoods.shoppingCartSkuItemList.forEach((e1) { + if (widget.miNiDetail != null && widget.miNiDetail.productSkuVOList != null && widget.miNiDetail.productSkuVOList.isNotEmpty) { + try { + widget.miNiDetail.productSkuVOList.firstWhere((e2) => e1.id == e2.id).count = e1.buyNum; + } catch (e) { + return; + } + } + }); + } + widget.miNiDetail.attrList.forEach((element) { selectSkus.add(element.attrValueList[0].attrValue); }); - - buildCount(); + _currentSkuIndex = widget.miNiDetail.productSkuVOList.indexWhere((element) { + return skuY(element, selectSkus); + }); } - buildCount() { - count = 1; - ProductSkuVOListBean productSku; - try { - productSku = widget.miNiDetail.productSkuVOList.firstWhere((element) { - return skuY(element, selectSkus); - }); - } catch (ex) { - return; - } - if (productSku == null) return; - selectedPrice = productSku.vipPrice ?? productSku.skuPrice ?? ""; - String skuId = productSku.id; - if (widget.shopCarGoods == null || - widget.shopCarGoods.shoppingCartSkuItemList == null) return; - int shopSkuIndex = widget.shopCarGoods.shoppingCartSkuItemList - .indexWhere((element) => skuId == element.id); - if (shopSkuIndex >= 0) { - count = widget.shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum; - realCount = count; - } - } + // buildCount() { + // count = 1; + // ProductSkuVOListBean productSku; + // try { + // productSku = widget.miNiDetail.productSkuVOList.firstWhere((element) { + // return skuY(element, selectSkus); + // }); + // } catch (ex) { + // return; + // } + // if (productSku == null) return; + // selectedPrice = productSku.vipPrice ?? productSku.skuPrice ?? ""; + // String skuId = productSku.id; + // widget.miNiDetail.productSkuVOList[_currentSkuIndex].minQty = productSku.minQty; + // if (widget.shopCarGoods == null || + // widget.shopCarGoods.shoppingCartSkuItemList == null) return; + // int shopSkuIndex = widget.shopCarGoods.shoppingCartSkuItemList + // .indexWhere((element) => skuId == element.id); + // if (shopSkuIndex >= 0) { + // count = widget.shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum; + // realCount = count; + // } + // } bool skuY(ProductSkuVOListBean productSku, selectSkus) { bool gg = true; @@ -140,11 +155,7 @@ class _ProductSku extends State { Padding( padding: EdgeInsets.only(top: 4, bottom: 7), child: Text( - "已选: " + - (selectSkus - .map((e) => "$e") - .toList() - .toString()), + "已选: " + selectSkus.join(" "), maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( @@ -154,6 +165,7 @@ class _ProductSku extends State { ), ), ), + ///业务需求暂时隐藏 // Row( // children: [ @@ -175,6 +187,34 @@ class _ProductSku extends State { // ), // ], // ), + Row( + children: [ + if (widget.miNiDetail + .productSkuVOList[_currentSkuIndex].minQty > + 1) + Container( + padding: EdgeInsets.symmetric(horizontal: 4.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + border: Border.all( + width: 1, + color: Color(0xFFF65720), + style: BorderStyle.solid, + ), + ), + alignment: Alignment.center, + child: Text( + "${widget.miNiDetail.productSkuVOList[_currentSkuIndex].minQty}份起购", + style: TextStyle( + color: Color(0xFFF65720), + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ), + Spacer() + ], + ) ], )), InkWell( @@ -210,7 +250,11 @@ class _ProductSku extends State { (attrValue) { state(() { selectSkus[position] = attrValue; - buildCount(); + _currentSkuIndex = widget + .miNiDetail.productSkuVOList + .indexWhere((element) { + return skuY(element, selectSkus); + }); }); }, widget.miNiDetail.attrList[position], @@ -237,71 +281,197 @@ class _ProductSku extends State { ), ), ), - InkWell( - onTap: () async { - if (count == 1) return; - if ((widget?.miNiDetail?.subscribeParam - ?.isEnableSubscribe ?? - false) == - false) { - _isTapEd = true; - EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); - await widget.reduce(widget.miNiDetail, selectSkus); - } - count -= 1; - setState(() {}); - EasyLoading.dismiss(); - }, - child: Image.asset( - "assets/image/reduce.webp", - width: 22, - height: 22, + if (widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .minQty > + 1 && + widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .count == + 1) + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () async { + if ((widget?.miNiDetail?.subscribeParam + ?.isEnableSubscribe ?? + false) == + false) { + _isTapEd = true; + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + if (widget + .miNiDetail + .productSkuVOList[_currentSkuIndex] + .count == + 1) + await widget.addShopCar( + widget.miNiDetail, + selectSkus, + widget.miNiDetail.productSkuVOList[ _currentSkuIndex].minQty > 1 + ? widget + .miNiDetail + .productSkuVOList[_currentSkuIndex] + .minQty + : 2); + else + await widget.add(widget.miNiDetail, selectSkus); + } + if ((widget?.miNiDetail?.oversold ?? 0) == 0 && + widget.miNiDetail.productSkuVOList[_currentSkuIndex] .count >= + (widget?.miNiDetail?.productSkuVOList[0]?.skuStock ?? 0)) { + SmartDialog.showToast("库存不足", + alignment: Alignment.center); + } else { + if (widget.miNiDetail.productSkuVOList[_currentSkuIndex].minQty > 1) { + widget + .miNiDetail + .productSkuVOList[_currentSkuIndex] + .count += widget + .miNiDetail + .productSkuVOList[_currentSkuIndex] + .minQty - 1; + } else { + widget + .miNiDetail + .productSkuVOList[_currentSkuIndex] + .count += 1; + } + } + setState(() {}); + EasyLoading.dismiss(); + }, + child: Container( + margin: EdgeInsets.only(right: 8.w, top: 4.h), + child: RoundButton( + text: + "${widget.miNiDetail.productSkuVOList[_currentSkuIndex].minQty}份起购", + textColor: Colors.white, + fontWeight: MyFontWeight.medium, + radius: 3, + backgroup: Color(0xFF32A060), + fontSize: 11.sp, + padding: EdgeInsets.symmetric( + vertical: 5.h, horizontal: 3.w), + ), + )), + if ((widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .minQty > + 1 && + widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .count != + 1) || + widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .minQty == + 0 || + widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .minQty == + 1) + InkWell( + onTap: () async { + if (widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .count == + 1) return; + if ((widget?.miNiDetail?.subscribeParam + ?.isEnableSubscribe ?? + false) == + false) { + _isTapEd = true; + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + await widget.reduce(widget.miNiDetail, selectSkus); + } + if (widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .minQty == + widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .count) { + widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .count -= (widget.miNiDetail + .productSkuVOList[_currentSkuIndex].minQty); + } else { + widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .count -= 1; + } + setState(() {}); + EasyLoading.dismiss(); + }, + child: Image.asset( + "assets/image/reduce.webp", + width: 22, + height: 22, + ), ), - ), - Padding( - padding: EdgeInsets.only(left: 8, right: 8), - child: Text( - "$count", - style: TextStyle( - color: Colors.black, - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, + if ((widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .minQty > + 1 && + widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .count != + 1) || + widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .minQty == + 0 || + widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .minQty == + 1) + Padding( + padding: EdgeInsets.only(left: 8, right: 8), + child: Text( + "${widget.miNiDetail.productSkuVOList[_currentSkuIndex].count}", + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), ), ), - ), - InkWell( - onTap: () async { - if ((widget?.miNiDetail?.subscribeParam - ?.isEnableSubscribe ?? - false) == - false) { - _isTapEd = true; - EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); - if (count == 1 && realCount == 0) - await widget.addShopCar( - widget.miNiDetail, selectSkus, 2); - else - await widget.add(widget.miNiDetail, selectSkus); - } - if ((widget?.miNiDetail?.oversold ?? 0) == 0 && - count >= - (widget?.miNiDetail?.productSkuVOList[0] - ?.skuStock ?? - 0)) { - SmartDialog.showToast("库存不足", - alignment: Alignment.center); - } else { - count += 1; - } - setState(() {}); - EasyLoading.dismiss(); - }, - child: Image.asset( - "assets/image/add.webp", - width: 22, - height: 22, + if ((widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .minQty > + 1 && + widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .count != + 1) || + widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .minQty == + 0 || + widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .minQty == + 1) + InkWell( + onTap: () async { + if ((widget?.miNiDetail?.subscribeParam + ?.isEnableSubscribe ?? + false) == + false) { + _isTapEd = true; + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + if (widget.miNiDetail.productSkuVOList[_currentSkuIndex].count == 1) + await widget.addShopCar( + widget.miNiDetail, selectSkus,2); + else + await widget.add(widget.miNiDetail, selectSkus); + } + if ((widget?.miNiDetail?.oversold ?? 0) == 0 && + widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .count >= + (widget?.miNiDetail?.productSkuVOList[0] + ?.skuStock ?? + 0)) { + SmartDialog.showToast("库存不足", + alignment: Alignment.center); + } else { + widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .count += 1; + } + setState(() {}); + EasyLoading.dismiss(); + }, + child: Image.asset( + "assets/image/add.webp", + width: 22, + height: 22, + ), ), - ), ], ), SizedBox( @@ -320,9 +490,19 @@ class _ProductSku extends State { textColor: Colors.white, fontWeight: MyFontWeight.semi_bold, radius: 27, - backgroup: Color(0xFF32A060), + backgroup:Color(0xFF32A060), fontSize: 16.sp, callback: () { + if(widget.miNiDetail.productSkuVOList[_currentSkuIndex].minQty > 1 && widget.miNiDetail + .productSkuVOList[_currentSkuIndex].count ==1){ + SmartDialog.show( + widget: SettlementTips( + () {}, + text: "请选择购买数量", + ), + ); + return; + } Navigator.of(context).pop(); // SmartDialog.dismiss(); if (!_isTapEd) @@ -334,7 +514,8 @@ class _ProductSku extends State { false) == false) ? 1 - : count); + : widget.miNiDetail + .productSkuVOList[_currentSkuIndex].count); }, ), if (widget.buttonType == 1) @@ -350,7 +531,11 @@ class _ProductSku extends State { callback: () { Navigator.of(context).pop(); // SmartDialog.dismiss(); - widget.addShopCar(widget.miNiDetail, selectSkus, count); + widget.addShopCar( + widget.miNiDetail, + selectSkus, + widget.miNiDetail.productSkuVOList[_currentSkuIndex] + .count); }, ), diff --git a/lib/store/store_view/shop_goods.dart b/lib/store/store_view/shop_goods.dart index 3c0fede4..0e0fadf6 100644 --- a/lib/store/store_view/shop_goods.dart +++ b/lib/store/store_view/shop_goods.dart @@ -208,7 +208,7 @@ class _ShopGoods extends State { ), ), SizedBox( - width: 2.w, + width:5.w, ), // Container( // width: 44.w, @@ -227,8 +227,71 @@ class _ShopGoods extends State { // ), // ), // ), + if((widget.productListBean?.minQty ?? 0).toInt() > 1) + Container( + padding: EdgeInsets.symmetric(horizontal:4.w), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + border: Border.all( + width: 1, + color: Color(0xFFF65720), + style: BorderStyle.solid, + ), + ), + alignment: Alignment.center, + child: Text( + "${widget.productListBean?.minQty ?? 0}份起购", + style: TextStyle( + color: Color(0xFFF65720), + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ), ], ), + if((widget.productListBean?.minQty ?? 0).toInt() > 1 && widget.count == 0 && (widget.productListBean?.attrStyle ?? 0) != 1) + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () async { + if (widget.storeInfo.posType.code == "NORMALSTORE" && + widget.tableId == 0) { + showDeleteDialog(); + } else { + if (_jumpType == -1) + queryMiNiDetail(widget.productListBean.id); + else if (_jumpType == 0) + widget.add(widget.shoppingCartSkuItemListBean); + else if (_jumpType == 1) + await Navigator.of(context).pushNamed( + '/router/product_meals_sku', + arguments: { + "id": widget.productListBean.id, + "storeId": widget.productListBean.storeId, + "tableId": widget.tableId + }); + widget.queryShoppingCart(); + } + }, + child:Container( + padding: EdgeInsets.only( + left:50.w, + top: 4.h, + bottom: 4.h, + ), + margin: EdgeInsets.only(right: 8.w, top: 4.h), + child: RoundButton( + text:"${widget?.productListBean?.minQty ?? 0}份起购", + textColor: Colors.white, + fontWeight: MyFontWeight.medium, + radius: 3, + backgroup: Color(0xFF32A060), + fontSize: 11.sp, + padding: EdgeInsets.symmetric( + vertical: 5.h, horizontal: 3.w), + ), + )), if (!widget.isShopCart && (widget.productListBean?.attrStyle ?? 0) == 1 && !(widget?.productListBean?.subscribeParam @@ -297,7 +360,8 @@ class _ShopGoods extends State { !(widget?.productListBean?.isSetMeal ?? false)) Spacer(), if (widget.isShopCart || - (widget.productListBean?.attrStyle ?? 0) == 0 && + (widget.productListBean?.attrStyle ?? 0) == 0 && (((widget.productListBean?.minQty ?? 0).toInt() > 1 && widget.count != 0) + || (widget.productListBean?.minQty ?? 0).toInt() == 0) && !(widget?.productListBean?.subscribeParam ?.isEnableSubscribe ?? false) && @@ -322,7 +386,8 @@ class _ShopGoods extends State { ), ), if (widget.isShopCart || - (widget.productListBean?.attrStyle ?? 0) == 0 && + (widget.productListBean?.attrStyle ?? 0) == 0 && (((widget.productListBean?.minQty ?? 0).toInt() > 1 && widget.count != 0) + || (widget.productListBean?.minQty ?? 0).toInt() == 0) && !(widget?.productListBean?.subscribeParam ?.isEnableSubscribe ?? false) && @@ -339,7 +404,8 @@ class _ShopGoods extends State { ), ), if (widget.isShopCart || - (widget.productListBean?.attrStyle ?? 0) == 0 && + (widget.productListBean?.attrStyle ?? 0) == 0 &&(((widget.productListBean?.minQty ?? 0).toInt() > 1 && widget.count != 0) + || (widget.productListBean?.minQty ?? 0).toInt() == 0) && !(widget?.productListBean?.subscribeParam ?.isEnableSubscribe ?? false) && @@ -375,7 +441,7 @@ class _ShopGoods extends State { } }, child: Container( - padding: EdgeInsets.only(left: 6.w, right: 9.w), + padding: EdgeInsets.only(left: 6.w, right: 5.5.w), child: Image.asset( "assets/image/add.webp", width: 22, diff --git a/lib/store/store_view/shop_goods_car.dart b/lib/store/store_view/shop_goods_car.dart index f9d82847..1dd2079e 100644 --- a/lib/store/store_view/shop_goods_car.dart +++ b/lib/store/store_view/shop_goods_car.dart @@ -40,10 +40,10 @@ class _ShopGoodsCar extends State { Widget build(BuildContext context) { return Container( color: Colors.white, - padding: EdgeInsets.only( - right: 16.w, - // bottom: 20.h, - ), + // padding: EdgeInsets.only( + // right: 16.w, + // // bottom: 20.h, + // ), child: Column( children: [ Row( @@ -135,12 +135,10 @@ class _ShopGoodsCar extends State { ), ], ), - SizedBox( - height: 7.h, - ), Row( children: [ - Row( + Padding(padding:EdgeInsets.only(top: 7.h,bottom: 4.h), + child: Row( children: [ Text( "¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.price) ?? 0)}", @@ -172,70 +170,76 @@ class _ShopGoodsCar extends State { // ), // ), ], - ), + ),), Spacer(), if (!widget.isShopCart && (widget.productListBean?.attrStyle ?? 0) == 1) - Stack( - children: [ - Container( - margin: EdgeInsets.only(right: 8, top: 4), - child: RoundButton( - width: 49.w, - text: S.of(context).xuanguige, - textColor: Colors.white, - fontWeight: MyFontWeight.medium, - radius: 3, - backgroup: Color(0xFF32A060), - fontSize: 11.sp, - padding: - EdgeInsets.symmetric(vertical: 5.h), - callback: () { - widget.queryMiNiDetail( - widget.productListBean != null - ? widget.productListBean.id - : widget - .shoppingCartSkuItemListBean - .productId, - 0); - }, - ), - ), - Positioned( - right: 0, - child: Visibility( - visible: widget.count > 0, + Container( + padding:EdgeInsets.only(top: 7.h,bottom: 4.h), + child: Stack( + children: [ + Container( + margin: EdgeInsets.only(right: 8, top: 4), child: RoundButton( - width: 17, - height: 17.h, - text: "${widget.count}", - textColor: Color(0xFF32A060), - fontWeight: MyFontWeight.regular, - backgroup: Colors.white, - fontSize: 12.sp, - radius: 100, + width: 49.w, + text: S.of(context).xuanguige, + textColor: Colors.white, + fontWeight: MyFontWeight.medium, + radius: 3, + backgroup: Color(0xFF32A060), + fontSize: 11.sp, + padding: + EdgeInsets.symmetric(vertical: 5.h), + callback: () { + widget.queryMiNiDetail( + widget.productListBean != null + ? widget.productListBean.id + : widget + .shoppingCartSkuItemListBean + .productId, + 0); + }, ), ), - ), - ], + Positioned( + right: 0, + child: Visibility( + visible: widget.count > 0, + child: RoundButton( + width: 17, + height: 17.h, + text: "${widget.count}", + textColor: Color(0xFF32A060), + fontWeight: MyFontWeight.regular, + backgroup: Colors.white, + fontSize: 12.sp, + radius: 100, + ), + ), + ), + ], + ), ), if (widget.isShopCart || (widget.productListBean?.attrStyle ?? 0) == 0) - InkWell( + GestureDetector( + behavior: HitTestBehavior.opaque, onTap: () { - widget - .reduce(widget.shoppingCartSkuItemListBean); + widget.reduce(widget.shoppingCartSkuItemListBean); }, - child: Image.asset( + child: Container( + padding: EdgeInsets.only(top: 7.h,bottom: 4.h,left:20.w), + child: Image.asset( "assets/image/reduce.webp", width: 22, height: 22.h, - ), + )), ), if (widget.isShopCart || (widget.productListBean?.attrStyle ?? 0) == 0) Container( width: 30, + padding: EdgeInsets.only(top: 7.h,bottom: 4.h), alignment: Alignment.center, child: Text( "${widget.count}", @@ -249,20 +253,21 @@ class _ShopGoodsCar extends State { if (widget.isShopCart || (widget.productListBean?.attrStyle ?? 0) == 0) GestureDetector( + behavior: HitTestBehavior.opaque, onTap: () { widget.add(widget.shoppingCartSkuItemListBean); }, - child: Image.asset( - "assets/image/add.webp", - width: 22, - height: 22.h, + child: Container( + padding: EdgeInsets.only(right: 16.w,top: 7.h,bottom: 4.h), + child: Image.asset( + "assets/image/add.webp", + width: 22, + height: 22.h, + ), ), ), ], ), - SizedBox( - height: 4.h, - ), Text( "¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.applyPrice) ?? 0)}", style: TextStyle( diff --git a/lib/store/store_view/store_order_list.dart b/lib/store/store_view/store_order_list.dart index 85d2cb27..efe59f6c 100644 --- a/lib/store/store_view/store_order_list.dart +++ b/lib/store/store_view/store_order_list.dart @@ -211,7 +211,8 @@ class _StoreOrderListPage extends State { .pushNamed('/router/shop_details_page', arguments: { "id": e.id, "storeId": e.storeId, - "isSetMeal":e.isSetMeal + "isSetMeal":e.isSetMeal, + "minQty":e.minQty, }); widget.queryShoppingCart(); } @@ -367,10 +368,10 @@ class _StoreOrderListPage extends State { } return ShopGoods( (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { - widget.queryMiNiDetail(e.id, 1); + widget.queryMiNiDetail(e.id, ((e.minQty?? 0).toInt()>1 && count == 0)? (e.minQty??0):1); }, (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { - if (count > 0) widget.queryMiNiDetail(e.id, -1); + if (count > 0) widget.queryMiNiDetail(e.id, ((e.minQty?? 0).toInt()>1 && count==(e.minQty??0) )? -(e.minQty??0):-1); }, productListBean: e, count: count, diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index 5feec663..ba2d2cc1 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -107,10 +107,7 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { physics: BouncingScrollPhysics(), shrinkWrap: true, itemBuilder: (context, position) { - return GestureDetector( - onTap: () {}, - child: buildStoreItemSm(), - ); + return buildStoreItemSm(); }, ):((storeList == null || storeList.length == 0) ? NoDataView( @@ -128,7 +125,8 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { bottom: 100.h, ), itemBuilder: (context, position) { - return InkWell( + return GestureDetector( + behavior: HitTestBehavior.opaque, onTap: () { { // if (storeList[position].storeName == "一心回乡商城") { @@ -353,7 +351,15 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { physics:BouncingScrollPhysics(), itemBuilder: (context, index) { return GestureDetector( - onTap: () {}, + onTap: () {Navigator.of(context).pushNamed( + '/router/store_order', + arguments: { + "id": storeList[position].id, + "tenant": storeList[position].tenantCode, + "storeName": storeList[position].storeName, + "distance": storeList[position].distance + }, + );}, child: unionGoodsItem( storeList[position].productShow[index]), );