Browse Source

点单页,单规格,多规格起购量加购流程更改;

商品详情起购量流程更改;
购物车起购量商品数量加减流程更改;
门店列表,商品新增跳转事件;
订单详情新增结算金额明细;
wr_2023_new_business_new
wurong 4 months ago
parent
commit
3da1ea3432
  1. 203
      lib/order/order_view/order_commodity.dart
  2. 3
      lib/retrofit/data/findMiNiGroupList.dart
  3. 19
      lib/retrofit/data/miNiDetail.dart
  4. 136
      lib/retrofit/data/order_info.dart
  5. 3
      lib/retrofit/data/shoppingCart.dart
  6. 2
      lib/retrofit/min_api.g.dart
  7. 217
      lib/store/shop_details_page.dart
  8. 19
      lib/store/store_order.dart
  9. 377
      lib/store/store_view/product_sku.dart
  10. 76
      lib/store/store_view/shop_goods.dart
  11. 125
      lib/store/store_view/shop_goods_car.dart
  12. 7
      lib/store/store_view/store_order_list.dart
  13. 18
      lib/union/union_list.dart

203
lib/order/order_view/order_commodity.dart

@ -76,7 +76,9 @@ class _OrderCommodity extends State<OrderCommodity> {
} }
widgets.add(SizedBox(height: 20.h)); 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( widgets.add(
discountItem( discountItem(
@ -113,7 +115,6 @@ class _OrderCommodity extends State<OrderCommodity> {
); );
} }
if (widget.orderInfo.orderDetail != null && if (widget.orderInfo.orderDetail != null &&
widget.orderInfo.orderDetail.couponDTO != null) { widget.orderInfo.orderDetail.couponDTO != null) {
// //
@ -129,7 +130,8 @@ class _OrderCommodity extends State<OrderCommodity> {
if (widget.orderInfo.orderDetail != null && if (widget.orderInfo.orderDetail != null &&
widget.orderInfo.orderDetail.activityPrice != null && widget.orderInfo.orderDetail.activityPrice != null &&
double.tryParse(widget.orderInfo.orderDetail.activityPrice ?? "0") > 0) { double.tryParse(widget.orderInfo.orderDetail.activityPrice ?? "0") >
0) {
// //
widgets.add( widgets.add(
discountItem( discountItem(
@ -141,7 +143,6 @@ class _OrderCommodity extends State<OrderCommodity> {
); );
} }
if (widget.orderInfo.orderDetail != null && if (widget.orderInfo.orderDetail != null &&
widget.orderInfo.vipDiscountPrice != null && widget.orderInfo.vipDiscountPrice != null &&
double.tryParse(widget.orderInfo.vipDiscountPrice ?? "0") > 0) { double.tryParse(widget.orderInfo.vipDiscountPrice ?? "0") > 0) {
@ -151,7 +152,7 @@ class _OrderCommodity extends State<OrderCommodity> {
Color(0xFFFF7A1A), Color(0xFFFF7A1A),
"VIP优惠", "VIP优惠",
"", "",
"- ${widget.orderInfo.vipDiscountPrice??""}", "- ${widget.orderInfo.vipDiscountPrice ?? ""}",
), ),
); );
} }
@ -179,7 +180,6 @@ class _OrderCommodity extends State<OrderCommodity> {
return widgets; return widgets;
} }
Widget commodityItem(OrderProductVOList productList) { Widget commodityItem(OrderProductVOList productList) {
return Container( return Container(
margin: EdgeInsets.only(top: 8.h, bottom: 8.h), margin: EdgeInsets.only(top: 8.h, bottom: 8.h),
@ -248,15 +248,23 @@ class _OrderCommodity extends State<OrderCommodity> {
children: [ children: [
Text( Text(
productList.buyNum > 1 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(
: S.of(context).yuan_(AppUtils.calculateDouble(double.tryParse(productList.sellPrice ?? "0") - double.tryParse(productList.discountAmount ?? "0"))), 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( style: TextStyle(
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xFF4C4C4C), color: Color(0xFF4C4C4C),
), ),
), ),
if (productList.discountAmount != null && productList.discountAmount != "0") if (productList.discountAmount != null &&
productList.discountAmount != "0")
Text( Text(
S.of(context).yuan_(productList.sellPrice), S.of(context).yuan_(productList.sellPrice),
style: TextStyle( style: TextStyle(
@ -288,53 +296,55 @@ class _OrderCommodity extends State<OrderCommodity> {
} }
Widget orderMealsItem(SetMealDataList setMealDataList) { Widget orderMealsItem(SetMealDataList setMealDataList) {
return Column(children: setMealDataList.productInfoList.map((e) { return Column(
return Container( children: setMealDataList.productInfoList.map((e) {
margin: EdgeInsets.symmetric( return Container(
vertical: 10.h, margin: EdgeInsets.symmetric(
), vertical: 10.h,
child: Row( ),
children: [ child: Row(
Expanded( children: [
flex: 2, Expanded(
child: Text( flex: 2,
e.productName, child: Text(
overflow: TextOverflow.ellipsis, e.productName,
maxLines: 1, overflow: TextOverflow.ellipsis,
style: TextStyle( maxLines: 1,
color: Color(0xffA29E9E), style: TextStyle(
fontSize: 14.sp, color: Color(0xffA29E9E),
fontWeight: MyFontWeight.regular, fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
), ),
), ),
), Expanded(
Expanded( flex: 3,
flex: 3, child: Text(
child: Text( "${(e.skuName == "") ? "" : e.skuName}",
"${(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, overflow: TextOverflow.ellipsis,
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
color: Color(0xffA29E9E), color: Color(0xffFF7A1A),
fontSize: 13.sp, fontSize: 13.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
), ),
), ),
), ],
Text( ),
"x${e.buyNumber.toString()}", );
overflow: TextOverflow.ellipsis, }).toList(),
maxLines: 1, );
style: TextStyle(
color: Color(0xffFF7A1A),
fontSize: 13.sp,
fontWeight: MyFontWeight.regular,
),
),
],
),
);
}).toList(),);
} }
Widget discountItem(Color color, textName, condition, amount) { Widget discountItem(Color color, textName, condition, amount) {
@ -386,7 +396,7 @@ class _OrderCommodity extends State<OrderCommodity> {
); );
} }
Widget vipItem(Color color, textName,amount) { Widget vipItem(Color color, textName, amount) {
return Container( return Container(
margin: EdgeInsets.only(top: 9.h, bottom: 9.h), margin: EdgeInsets.only(top: 9.h, bottom: 9.h),
child: Row( child: Row(
@ -497,9 +507,9 @@ class _OrderCommodity extends State<OrderCommodity> {
); );
} }
String buyNumAllGoods(){ String buyNumAllGoods() {
int count = 0; int count = 0;
if(widget.orderInfo != null){ if (widget.orderInfo != null) {
widget.orderInfo.productList.forEach((element) { widget.orderInfo.productList.forEach((element) {
count += element.buyNum; count += element.buyNum;
}); });
@ -512,7 +522,7 @@ class _OrderCommodity extends State<OrderCommodity> {
margin: EdgeInsets.only(top: 7.h, bottom: 11.h), margin: EdgeInsets.only(top: 7.h, bottom: 11.h),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.baseline, crossAxisAlignment: CrossAxisAlignment.start,
textBaseline: TextBaseline.alphabetic, textBaseline: TextBaseline.alphabetic,
children: [ children: [
Expanded( Expanded(
@ -538,27 +548,76 @@ class _OrderCommodity extends State<OrderCommodity> {
SizedBox( SizedBox(
width: 15.w, width: 15.w,
), ),
Container( Row(
child: Text( mainAxisAlignment: MainAxisAlignment.center,
S.of(context).jiesuanjine, children: [
style: TextStyle( Column(
fontSize: 12.sp, crossAxisAlignment: CrossAxisAlignment.end,
color: Color(0xFF353535), children: [
fontWeight: MyFontWeight.semi_bold), Container(
), margin: EdgeInsets.only(bottom:8.h),
), child: Text(
SizedBox( "${S.of(context).jiesuanjine}:",
width: 5.w, style: TextStyle(
), fontSize: 12.sp,
Text( color: Color(0xFF353535),
"${widget.orderInfo.orderDetail.paySumPrice}" fontWeight: MyFontWeight.medium),
/*totalPrice()*/, ),
textAlign: TextAlign.end, ),
style: TextStyle( if(widget.orderInfo.orderDetail.payRecords != null)
fontSize: 14.sp, Column(
color: Color(0xFF32A060), crossAxisAlignment: CrossAxisAlignment.end,
fontFamily: 'JDZhengHT', children: widget.orderInfo.orderDetail.payRecords.map((e) {
fontWeight: MyFontWeight.semi_bold), 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(),
),
],
),
],
) )
], ],
), ),

3
lib/retrofit/data/findMiNiGroupList.dart

@ -104,6 +104,7 @@ class ProductListBean {
dynamic markProductNone; dynamic markProductNone;
SubscribeParam subscribeParam; SubscribeParam subscribeParam;
bool isSetMeal; bool isSetMeal;
int minQty;
static ProductListBean fromJson(Map<String, dynamic> map) { static ProductListBean fromJson(Map<String, dynamic> map) {
if (map == null) return null; if (map == null) return null;
@ -139,6 +140,7 @@ class ProductListBean {
productListBean.markProductNone = map['markProductNone']; productListBean.markProductNone = map['markProductNone'];
productListBean.subscribeParam = SubscribeParam.fromJson(map['subscribeParam']); productListBean.subscribeParam = SubscribeParam.fromJson(map['subscribeParam']);
productListBean.isSetMeal = map['isSetMeal']; productListBean.isSetMeal = map['isSetMeal'];
productListBean.minQty = map['minQty'];
return productListBean; return productListBean;
} }
@ -174,6 +176,7 @@ class ProductListBean {
"markProductNone": markProductNone, "markProductNone": markProductNone,
"subscribeParam": subscribeParam, "subscribeParam": subscribeParam,
"isSetMeal": isSetMeal, "isSetMeal": isSetMeal,
"minQty": minQty,
}; };
} }

19
lib/retrofit/data/miNiDetail.dart

@ -87,6 +87,7 @@ class MiNiDetail {
dynamic namePinyin; dynamic namePinyin;
dynamic nameInitials; dynamic nameInitials;
SubscribeParam subscribeParam; SubscribeParam subscribeParam;
int minQty;
static MiNiDetail fromJson(Map<String, dynamic> map) { static MiNiDetail fromJson(Map<String, dynamic> map) {
if (map == null) return null; if (map == null) return null;
@ -142,6 +143,7 @@ class MiNiDetail {
miNiDetailBean.nameInitials = map['nameInitials']; miNiDetailBean.nameInitials = map['nameInitials'];
miNiDetailBean.subscribeParam = miNiDetailBean.subscribeParam =
SubscribeParam.fromJson(map['subscribeParam']); SubscribeParam.fromJson(map['subscribeParam']);
miNiDetailBean.minQty = map['minQty'];
return miNiDetailBean; return miNiDetailBean;
} }
@ -192,6 +194,7 @@ class MiNiDetail {
"namePinyin": namePinyin, "namePinyin": namePinyin,
"nameInitials": nameInitials, "nameInitials": nameInitials,
"subscribeParam": subscribeParam, "subscribeParam": subscribeParam,
"minQty": minQty
}; };
} }
@ -229,6 +232,7 @@ class ProductSkuVOListBean {
String storeId; String storeId;
String skuCode; String skuCode;
String skuNameStr; String skuNameStr;
int _minQty;
String productId; String productId;
String skuPrice; String skuPrice;
String applyPrice; String applyPrice;
@ -246,6 +250,19 @@ class ProductSkuVOListBean {
List<SkuAttrListBean> skuAttrList; List<SkuAttrListBean> skuAttrList;
List<ProductSetMeals> productSetMeals; List<ProductSetMeals> productSetMeals;
dynamic setMealDTOList; 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<String, dynamic> map) { static ProductSkuVOListBean fromJson(Map<String, dynamic> map) {
if (map == null) return null; if (map == null) return null;
@ -258,6 +275,7 @@ class ProductSkuVOListBean {
productSkuVOListBean.storeId = map['storeId']; productSkuVOListBean.storeId = map['storeId'];
productSkuVOListBean.skuCode = map['skuCode']; productSkuVOListBean.skuCode = map['skuCode'];
productSkuVOListBean.skuNameStr = map['skuNameStr']; productSkuVOListBean.skuNameStr = map['skuNameStr'];
productSkuVOListBean._minQty = map['minQty'];
productSkuVOListBean.productId = map['productId']; productSkuVOListBean.productId = map['productId'];
productSkuVOListBean.skuPrice = map['skuPrice']; productSkuVOListBean.skuPrice = map['skuPrice'];
productSkuVOListBean.applyPrice = map['applyPrice']; productSkuVOListBean.applyPrice = map['applyPrice'];
@ -291,6 +309,7 @@ class ProductSkuVOListBean {
"storeId": storeId, "storeId": storeId,
"skuCode": skuCode, "skuCode": skuCode,
"skuNameStr": skuNameStr, "skuNameStr": skuNameStr,
"minQty": _minQty,
"productId": productId, "productId": productId,
"skuPrice": skuPrice, "skuPrice": skuPrice,
"applyPrice": applyPrice, "applyPrice": applyPrice,

136
lib/retrofit/data/order_info.dart

@ -433,6 +433,7 @@ class OrderDetail {
String shipperCode; String shipperCode;
String logisticsName; String logisticsName;
String logisticsNum; String logisticsNum;
List<PayRecords> payRecords;
int orderNum; int orderNum;
int productNum; int productNum;
int mins; int mins;
@ -461,6 +462,7 @@ class OrderDetail {
String shipperCode, String shipperCode,
String logisticsName, String logisticsName,
String logisticsNum, String logisticsNum,
List<PayRecords> payRecords,
int orderNum, int orderNum,
int productNum, int productNum,
int mins, int mins,
@ -487,6 +489,7 @@ class OrderDetail {
this.shipperCode = shipperCode; this.shipperCode = shipperCode;
this.logisticsName = logisticsName; this.logisticsName = logisticsName;
this.logisticsNum = logisticsNum; this.logisticsNum = logisticsNum;
this.payRecords = payRecords;
this.orderNum = orderNum; this.orderNum = orderNum;
this.productNum = productNum; this.productNum = productNum;
this.mins = mins; this.mins = mins;
@ -526,6 +529,12 @@ class OrderDetail {
this.shipperCode = json["shipperCode"]; this.shipperCode = json["shipperCode"];
this.logisticsName = json["logisticsName"]; this.logisticsName = json["logisticsName"];
this.logisticsNum = json["logisticsNum"]; 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.orderNum = json["orderNum"];
this.productNum = json["productNum"]; this.productNum = json["productNum"];
this.mins = json["mins"]; this.mins = json["mins"];
@ -560,6 +569,9 @@ class OrderDetail {
map["shipperCode"] = this.shipperCode; map["shipperCode"] = this.shipperCode;
map["logisticsName"] = this.logisticsName; map["logisticsName"] = this.logisticsName;
map["logisticsNum"] = this.logisticsNum; map["logisticsNum"] = this.logisticsNum;
if (this.payRecords != null) {
map["payRecords"] = this.payRecords.map((v) => v.toJson()).toList();
}
map["orderNum"] = this.orderNum; map["orderNum"] = this.orderNum;
map["productNum"] = this.productNum; map["productNum"] = this.productNum;
map["mins"] = this.mins; map["mins"] = this.mins;
@ -891,3 +903,127 @@ class CouponDTO {
return map; 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<String, dynamic> toJson() {
final map = <String, dynamic>{};
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;
}
}

3
lib/retrofit/data/shoppingCart.dart

@ -88,6 +88,7 @@ class ShoppingCartSkuItemListBean {
int skuStock; int skuStock;
String storeId; String storeId;
String tableId; String tableId;
int minQty;
static ShoppingCartSkuItemListBean fromJson(Map<String, dynamic> map) { static ShoppingCartSkuItemListBean fromJson(Map<String, dynamic> map) {
if (map == null) return null; if (map == null) return null;
@ -112,6 +113,7 @@ class ShoppingCartSkuItemListBean {
shoppingCartSkuItemListBean.skuStock = map['skuStock']; shoppingCartSkuItemListBean.skuStock = map['skuStock'];
shoppingCartSkuItemListBean.storeId = map['storeId']; shoppingCartSkuItemListBean.storeId = map['storeId'];
shoppingCartSkuItemListBean.tableId = map['tableId']; shoppingCartSkuItemListBean.tableId = map['tableId'];
shoppingCartSkuItemListBean.minQty = map['minQty'];
return shoppingCartSkuItemListBean; return shoppingCartSkuItemListBean;
} }
@ -132,6 +134,7 @@ class ShoppingCartSkuItemListBean {
"skuStock": skuStock, "skuStock": skuStock,
"storeId": storeId, "storeId": storeId,
"tableId": tableId, "tableId": tableId,
"minQty": minQty,
}; };
} }

2
lib/retrofit/min_api.g.dart

@ -78,7 +78,7 @@ class _MinApiService implements MinApiService {
data: _data); data: _data);
final value = BaseData<MiNiDetail>.fromJson( final value = BaseData<MiNiDetail>.fromJson(
_result.data, _result.data,
(json) => MiNiDetail.fromJson(json), (json) => ((json??"") == "")? null :MiNiDetail.fromJson(json),
); );
return value; return value;
} }

217
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 'package:shared_preferences/shared_preferences.dart';
import '../view_widget/border_text.dart'; import '../view_widget/border_text.dart';
import '../view_widget/request_permission.dart'; import '../view_widget/request_permission.dart';
import '../view_widget/settlement_tips_dialog.dart';
class ShopDetailsPage extends StatefulWidget { class ShopDetailsPage extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic> arguments;
@ -68,6 +69,10 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
int index; int index;
bool isSetMeal; bool isSetMeal;
int scIndex = 0; int scIndex = 0;
int skuMinQty = 0;
int singleNum = 0;
String goodsSkuId;
bool isCounts = false;
@override @override
void initState() { void initState() {
@ -347,6 +352,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
BaseData<bool> baseData = await minService.clearShoppingCart(storeId); BaseData<bool> baseData = await minService.clearShoppingCart(storeId);
if (baseData.isSuccess) { if (baseData.isSuccess) {
shopCarGoods = null; shopCarGoods = null;
singleNum = 0;
setState(() {}); setState(() {});
} }
} }
@ -367,6 +373,8 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
BaseData<MiNiDetail> baseData = await minService.miNiDetail(id); BaseData<MiNiDetail> baseData = await minService.miNiDetail(id);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
showStoreSelector(baseData.data, id, count); showStoreSelector(baseData.data, id, count);
}else{
SmartDialog.showToast(baseData.msg);
} }
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
@ -376,9 +384,11 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
if (miNiDetail.attrList != null && if (miNiDetail.attrList != null &&
miNiDetail.attrList.length == 1 && miNiDetail.attrList.length == 1 &&
miNiDetail.attrList[0].attrValueList.length == 1) { miNiDetail.attrList[0].attrValueList.length == 1) {
_addShopCar(miNiDetail, [], counts); _addShopCar(miNiDetail, [], count);
} else { } else {
// showSpanDialog(); setState(() {
buildCount();
});
selectSpecsShowBottomSheet(); selectSpecsShowBottomSheet();
} }
} }
@ -443,8 +453,13 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
setState(() {}); setState(() {});
}); });
} else { } else {
SmartDialog.showToast(baseDate?.msg, alignment: Alignment.center); SmartDialog.show(
} widget: SettlementTips(
() {},
text: "${baseDate.msg.replaceAll("~", ",") + "请重新加购商品"}",
),
);
}
} }
} }
@ -475,6 +490,17 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
} }
}); });
} }
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]; return baseDate.data[0];
} else { } else {
return null; return null;
@ -501,9 +527,9 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
///1 ///1
Future<ShoppingCart> shopCartReduce( Future<ShoppingCart> shopCartReduce(
ShoppingCartSkuItemListBean cartSkuItem) async { ShoppingCartSkuItemListBean cartSkuItem,{int count = 1}) async {
Map<String, dynamic> shopCarTemp = shopCarGoods.toJson(); Map<String, dynamic> 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()]; shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
BaseData<List<ShoppingCart>> baseDate = BaseData<List<ShoppingCart>> baseDate =
await minService.shoppingCartSingle(shopCarTemp); await minService.shoppingCartSingle(shopCarTemp);
@ -578,7 +604,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
if (shopSkuItem != null) { if (shopSkuItem != null) {
if (shopSkuItem.buyNum > 1) { if (shopSkuItem.buyNum > 1) {
shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= 1; shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= (skuMinQty > 1 && skuMinQty ==shopSkuItem.buyNum) ? skuMinQty:1;
} }
} else { } else {
await _addShopCar(miNiDetail, selectSkus, 2); await _addShopCar(miNiDetail, selectSkus, 2);
@ -626,6 +652,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
if (productSku == null) return; if (productSku == null) return;
selectedPrice = productSku.skuPrice; selectedPrice = productSku.skuPrice;
String skuId = productSku.id; String skuId = productSku.id;
skuMinQty = productSku.minQty;
if (shopCarGoods == null || shopCarGoods.shoppingCartSkuItemList == null) if (shopCarGoods == null || shopCarGoods.shoppingCartSkuItemList == null)
return; return;
int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList
@ -848,8 +875,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
SizedBox( SizedBox(
width: 2.w, width: 2.w,
), ),
Expanded( Text(
child: Text(
miNiDetail?.applyPrice ?? "", miNiDetail?.applyPrice ?? "",
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
@ -858,7 +884,32 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: Color(0xFFA29E9E), 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( GestureDetector(
onTap: () async { onTap: () async {
if (storeInfo.posType.code == "NORMALSTORE" && if (storeInfo.posType.code == "NORMALSTORE" &&
@ -968,8 +1019,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
SizedBox( SizedBox(
width: 2.w, width: 2.w,
), ),
Expanded( Text(
child: Text(
miNiDetail?.applyPrice ?? "", miNiDetail?.applyPrice ?? "",
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
@ -978,7 +1028,31 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: Color(0xFFA29E9E), 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( GestureDetector(
onTap: () async { onTap: () async {
if (storeInfo.posType.code == "NORMALSTORE" && if (storeInfo.posType.code == "NORMALSTORE" &&
@ -997,7 +1071,8 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
setState(() {}); setState(() {});
}); });
} else { } else {
_queryMiNiDetail(id, counts); _queryMiNiDetail(id,(skuMinQty > 1 ? counts : ((widget.arguments["minQty"]??0) > 1 && singleNum==0)
? (widget.arguments["minQty"]??0):counts));
} }
}, },
child: Container( child: Container(
@ -1191,6 +1266,31 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
), ),
], ],
), ),
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( Text(
"${miNiDetail?.price ?? ""}", "${miNiDetail?.price ?? ""}",
style: TextStyle( style: TextStyle(
@ -1237,7 +1337,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
), ),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Text( Text(
S.of(context).shuliang, S.of(context).shuliang,
@ -1247,28 +1347,59 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
), ),
), ),
SizedBox( if(skuMinQty > 1 && (counts ==1 || counts ==0))
height: 10, 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( Row(
children: [ children: [
InkWell( GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
state(() { state(() {
if (counts > 1) if (counts > 1)
setState(() { 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, Icons.remove,
color: Color(0xFF32A060), color: Color(0xFF32A060),
size: 24, size: 24,
)), ))),
Padding( Padding(
padding: EdgeInsets.only(left: 8, right: 8), padding: EdgeInsets.only(right: 8.w,bottom: 14.h),
child: Text( child: Text(
"$counts", "$counts",
style: TextStyle( style: TextStyle(
@ -1278,25 +1409,27 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
), ),
), ),
), ),
InkWell( GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
state(() { state(() {
counts += 1; counts += 1;
// add(miNiDetail, selectSkus); isCounts = true;
add(miNiDetail, selectSkus);
}); });
}, },
child: Icon( child: Container(
Icons.add, padding:EdgeInsets.only(right:20.w,top: 10.h,bottom: 24.h),
color: Color(0xFF32A060), child: Icon(
size: 24, Icons.add,
color: Color(0xFF32A060),
size: 24,
),
)), )),
], ],
) )
], ],
), ),
SizedBox(
height: 24,
),
RoundButton( RoundButton(
width: double.infinity, width: double.infinity,
height: 54.h, height: 54.h,
@ -1308,12 +1441,24 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
textColor: Colors.white, textColor: Colors.white,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
radius: 27, radius: 27,
backgroup: Color(0xFF32A060), backgroup:Color(0xFF32A060),
fontSize: 16.sp, fontSize: 16.sp,
callback: () { callback: () {
state(() { state(() {
_addShopCar(miNiDetail, selectSkus, counts); if(skuMinQty > 1 && counts == 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(); Navigator.of(context).pop();
}); });
}, },

19
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 'package:shared_preferences/shared_preferences.dart';
import '../retrofit/data/settleOrderInfo.dart'; import '../retrofit/data/settleOrderInfo.dart';
import '../view_widget/settlement_tips_dialog.dart';
class StoreOrderPage extends StatefulWidget { class StoreOrderPage extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic> arguments;
@ -777,7 +778,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
if (count < 0) { if (count < 0) {
shopCarGoods.shoppingCartSkuItemList.forEach((element) async { shopCarGoods.shoppingCartSkuItemList.forEach((element) async {
if (element.productId == id) { if (element.productId == id) {
await shopCartReduce(element); await shopCartReduce(element,count: count);
setState(() {}); setState(() {});
} }
}); });
@ -873,7 +874,12 @@ class _StoreOrderPage extends State<StoreOrderPage>
toDownOrder(); toDownOrder();
setState(() {}); setState(() {});
} else { } else {
SmartDialog.showToast(baseDate?.msg, alignment: Alignment.center); SmartDialog.show(
widget: SettlementTips(
() {},
text: "${baseDate.msg.replaceAll("~", ",") + "请重新加购商品"}",
),
);
} }
} }
} }
@ -947,9 +953,9 @@ class _StoreOrderPage extends State<StoreOrderPage>
///1 ///1
Future<ShoppingCart> shopCartReduce( Future<ShoppingCart> shopCartReduce(
ShoppingCartSkuItemListBean cartSkuItem) async { ShoppingCartSkuItemListBean cartSkuItem,{int count = 1}) async {
Map<String, dynamic> shopCarTemp = shopCarGoods.toJson(); Map<String, dynamic> 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()]; shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
BaseData<List<ShoppingCart>> baseDate = BaseData<List<ShoppingCart>> baseDate =
await minService.shoppingCartSingle(shopCarTemp); await minService.shoppingCartSingle(shopCarTemp);
@ -1004,10 +1010,13 @@ class _StoreOrderPage extends State<StoreOrderPage>
} }
} }
int countMinQty = 1;
///1 ///1
reduce(MiNiDetail miNiDetail, selectSkus) async { reduce(MiNiDetail miNiDetail, selectSkus) async {
ProductSkuVOListBean productSku = ProductSkuVOListBean productSku =
miNiDetail.productSkuVOList.firstWhere((element) { miNiDetail.productSkuVOList.firstWhere((element) {
countMinQty = element.minQty;
return skuY(element, selectSkus); return skuY(element, selectSkus);
}); });
@ -1025,7 +1034,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
if (shopSkuItem != null) { if (shopSkuItem != null) {
if (shopSkuItem.buyNum > 1) { if (shopSkuItem.buyNum > 1) {
shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= 1; shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= (countMinQty > 1 && countMinQty ==shopSkuItem.buyNum) ? countMinQty:1;
} }
} else { } else {
await _addShopCar(miNiDetail, selectSkus, 1); await _addShopCar(miNiDetail, selectSkus, 1);

377
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/custom_image.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
import '../../view_widget/settlement_tips_dialog.dart';
class ProductSku extends StatefulWidget { class ProductSku extends StatefulWidget {
final MiNiDetail miNiDetail; final MiNiDetail miNiDetail;
final String productId; final String productId;
@ -31,43 +33,56 @@ class ProductSku extends StatefulWidget {
class _ProductSku extends State<ProductSku> { class _ProductSku extends State<ProductSku> {
List<String> selectSkus = []; List<String> selectSkus = [];
int count = 1, realCount = 0;
String selectedPrice = "";
bool _isTapEd = false; bool _isTapEd = false;
int _currentSkuIndex;
@override @override
void initState() { void initState() {
super.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) { widget.miNiDetail.attrList.forEach((element) {
selectSkus.add(element.attrValueList[0].attrValue); selectSkus.add(element.attrValueList[0].attrValue);
}); });
_currentSkuIndex = widget.miNiDetail.productSkuVOList.indexWhere((element) {
buildCount(); return skuY(element, selectSkus);
});
} }
buildCount() { // buildCount() {
count = 1; // count = 1;
ProductSkuVOListBean productSku; // ProductSkuVOListBean productSku;
try { // try {
productSku = widget.miNiDetail.productSkuVOList.firstWhere((element) { // productSku = widget.miNiDetail.productSkuVOList.firstWhere((element) {
return skuY(element, selectSkus); // return skuY(element, selectSkus);
}); // });
} catch (ex) { // } catch (ex) {
return; // return;
} // }
if (productSku == null) return; // if (productSku == null) return;
selectedPrice = productSku.vipPrice ?? productSku.skuPrice ?? ""; // selectedPrice = productSku.vipPrice ?? productSku.skuPrice ?? "";
String skuId = productSku.id; // String skuId = productSku.id;
if (widget.shopCarGoods == null || // widget.miNiDetail.productSkuVOList[_currentSkuIndex].minQty = productSku.minQty;
widget.shopCarGoods.shoppingCartSkuItemList == null) return; // if (widget.shopCarGoods == null ||
int shopSkuIndex = widget.shopCarGoods.shoppingCartSkuItemList // widget.shopCarGoods.shoppingCartSkuItemList == null) return;
.indexWhere((element) => skuId == element.id); // int shopSkuIndex = widget.shopCarGoods.shoppingCartSkuItemList
if (shopSkuIndex >= 0) { // .indexWhere((element) => skuId == element.id);
count = widget.shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum; // if (shopSkuIndex >= 0) {
realCount = count; // count = widget.shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum;
} // realCount = count;
} // }
// }
bool skuY(ProductSkuVOListBean productSku, selectSkus) { bool skuY(ProductSkuVOListBean productSku, selectSkus) {
bool gg = true; bool gg = true;
@ -140,11 +155,7 @@ class _ProductSku extends State<ProductSku> {
Padding( Padding(
padding: EdgeInsets.only(top: 4, bottom: 7), padding: EdgeInsets.only(top: 4, bottom: 7),
child: Text( child: Text(
"已选: " + "已选: " + selectSkus.join(" "),
(selectSkus
.map((e) => "$e")
.toList()
.toString()),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -154,6 +165,7 @@ class _ProductSku extends State<ProductSku> {
), ),
), ),
), ),
/// ///
// Row( // Row(
// children: [ // children: [
@ -175,6 +187,34 @@ class _ProductSku extends State<ProductSku> {
// ), // ),
// ], // ],
// ), // ),
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( InkWell(
@ -210,7 +250,11 @@ class _ProductSku extends State<ProductSku> {
(attrValue) { (attrValue) {
state(() { state(() {
selectSkus[position] = attrValue; selectSkus[position] = attrValue;
buildCount(); _currentSkuIndex = widget
.miNiDetail.productSkuVOList
.indexWhere((element) {
return skuY(element, selectSkus);
});
}); });
}, },
widget.miNiDetail.attrList[position], widget.miNiDetail.attrList[position],
@ -237,71 +281,197 @@ class _ProductSku extends State<ProductSku> {
), ),
), ),
), ),
InkWell( if (widget.miNiDetail.productSkuVOList[_currentSkuIndex]
onTap: () async { .minQty >
if (count == 1) return; 1 &&
if ((widget?.miNiDetail?.subscribeParam widget.miNiDetail.productSkuVOList[_currentSkuIndex]
?.isEnableSubscribe ?? .count ==
false) == 1)
false) { GestureDetector(
_isTapEd = true; behavior: HitTestBehavior.opaque,
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); onTap: () async {
await widget.reduce(widget.miNiDetail, selectSkus); if ((widget?.miNiDetail?.subscribeParam
} ?.isEnableSubscribe ??
count -= 1; false) ==
setState(() {}); false) {
EasyLoading.dismiss(); _isTapEd = true;
}, EasyLoading.show(
child: Image.asset( status: S.current.zhengzaijiazai,
"assets/image/reduce.webp", maskType: EasyLoadingMaskType.black);
width: 22, if (widget
height: 22, .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,
),
), ),
), if ((widget.miNiDetail.productSkuVOList[_currentSkuIndex]
Padding( .minQty >
padding: EdgeInsets.only(left: 8, right: 8), 1 &&
child: Text( widget.miNiDetail.productSkuVOList[_currentSkuIndex]
"$count", .count !=
style: TextStyle( 1) ||
color: Colors.black, widget.miNiDetail.productSkuVOList[_currentSkuIndex]
fontSize: 14.sp, .minQty ==
fontWeight: MyFontWeight.medium, 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,
),
), ),
), ),
), if ((widget.miNiDetail.productSkuVOList[_currentSkuIndex]
InkWell( .minQty >
onTap: () async { 1 &&
if ((widget?.miNiDetail?.subscribeParam widget.miNiDetail.productSkuVOList[_currentSkuIndex]
?.isEnableSubscribe ?? .count !=
false) == 1) ||
false) { widget.miNiDetail.productSkuVOList[_currentSkuIndex]
_isTapEd = true; .minQty ==
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); 0 ||
if (count == 1 && realCount == 0) widget.miNiDetail.productSkuVOList[_currentSkuIndex]
await widget.addShopCar( .minQty ==
widget.miNiDetail, selectSkus, 2); 1)
else InkWell(
await widget.add(widget.miNiDetail, selectSkus); onTap: () async {
} if ((widget?.miNiDetail?.subscribeParam
if ((widget?.miNiDetail?.oversold ?? 0) == 0 && ?.isEnableSubscribe ??
count >= false) ==
(widget?.miNiDetail?.productSkuVOList[0] false) {
?.skuStock ?? _isTapEd = true;
0)) { EasyLoading.show(
SmartDialog.showToast("库存不足", status: S.current.zhengzaijiazai,
alignment: Alignment.center); maskType: EasyLoadingMaskType.black);
} else { if (widget.miNiDetail.productSkuVOList[_currentSkuIndex].count == 1)
count += 1; await widget.addShopCar(
} widget.miNiDetail, selectSkus,2);
setState(() {}); else
EasyLoading.dismiss(); await widget.add(widget.miNiDetail, selectSkus);
}, }
child: Image.asset( if ((widget?.miNiDetail?.oversold ?? 0) == 0 &&
"assets/image/add.webp", widget.miNiDetail.productSkuVOList[_currentSkuIndex]
width: 22, .count >=
height: 22, (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( SizedBox(
@ -320,9 +490,19 @@ class _ProductSku extends State<ProductSku> {
textColor: Colors.white, textColor: Colors.white,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
radius: 27, radius: 27,
backgroup: Color(0xFF32A060), backgroup:Color(0xFF32A060),
fontSize: 16.sp, fontSize: 16.sp,
callback: () { callback: () {
if(widget.miNiDetail.productSkuVOList[_currentSkuIndex].minQty > 1 && widget.miNiDetail
.productSkuVOList[_currentSkuIndex].count ==1){
SmartDialog.show(
widget: SettlementTips(
() {},
text: "请选择购买数量",
),
);
return;
}
Navigator.of(context).pop(); Navigator.of(context).pop();
// SmartDialog.dismiss(); // SmartDialog.dismiss();
if (!_isTapEd) if (!_isTapEd)
@ -334,7 +514,8 @@ class _ProductSku extends State<ProductSku> {
false) == false) ==
false) false)
? 1 ? 1
: count); : widget.miNiDetail
.productSkuVOList[_currentSkuIndex].count);
}, },
), ),
if (widget.buttonType == 1) if (widget.buttonType == 1)
@ -350,7 +531,11 @@ class _ProductSku extends State<ProductSku> {
callback: () { callback: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
// SmartDialog.dismiss(); // SmartDialog.dismiss();
widget.addShopCar(widget.miNiDetail, selectSkus, count); widget.addShopCar(
widget.miNiDetail,
selectSkus,
widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.count);
}, },
), ),

76
lib/store/store_view/shop_goods.dart

@ -208,7 +208,7 @@ class _ShopGoods extends State<ShopGoods> {
), ),
), ),
SizedBox( SizedBox(
width: 2.w, width:5.w,
), ),
// Container( // Container(
// width: 44.w, // width: 44.w,
@ -227,8 +227,71 @@ class _ShopGoods extends State<ShopGoods> {
// ), // ),
// ), // ),
// ), // ),
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 && if (!widget.isShopCart &&
(widget.productListBean?.attrStyle ?? 0) == 1 && (widget.productListBean?.attrStyle ?? 0) == 1 &&
!(widget?.productListBean?.subscribeParam !(widget?.productListBean?.subscribeParam
@ -297,7 +360,8 @@ class _ShopGoods extends State<ShopGoods> {
!(widget?.productListBean?.isSetMeal ?? false)) !(widget?.productListBean?.isSetMeal ?? false))
Spacer(), Spacer(),
if (widget.isShopCart || 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 !(widget?.productListBean?.subscribeParam
?.isEnableSubscribe ?? ?.isEnableSubscribe ??
false) && false) &&
@ -322,7 +386,8 @@ class _ShopGoods extends State<ShopGoods> {
), ),
), ),
if (widget.isShopCart || 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 !(widget?.productListBean?.subscribeParam
?.isEnableSubscribe ?? ?.isEnableSubscribe ??
false) && false) &&
@ -339,7 +404,8 @@ class _ShopGoods extends State<ShopGoods> {
), ),
), ),
if (widget.isShopCart || 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 !(widget?.productListBean?.subscribeParam
?.isEnableSubscribe ?? ?.isEnableSubscribe ??
false) && false) &&
@ -375,7 +441,7 @@ class _ShopGoods extends State<ShopGoods> {
} }
}, },
child: Container( child: Container(
padding: EdgeInsets.only(left: 6.w, right: 9.w), padding: EdgeInsets.only(left: 6.w, right: 5.5.w),
child: Image.asset( child: Image.asset(
"assets/image/add.webp", "assets/image/add.webp",
width: 22, width: 22,

125
lib/store/store_view/shop_goods_car.dart

@ -40,10 +40,10 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
color: Colors.white, color: Colors.white,
padding: EdgeInsets.only( // padding: EdgeInsets.only(
right: 16.w, // right: 16.w,
// bottom: 20.h, // // bottom: 20.h,
), // ),
child: Column( child: Column(
children: [ children: [
Row( Row(
@ -135,12 +135,10 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
), ),
], ],
), ),
SizedBox(
height: 7.h,
),
Row( Row(
children: [ children: [
Row( Padding(padding:EdgeInsets.only(top: 7.h,bottom: 4.h),
child: Row(
children: [ children: [
Text( Text(
"¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.price) ?? 0)}", "¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.price) ?? 0)}",
@ -172,70 +170,76 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
// ), // ),
// ), // ),
], ],
), ),),
Spacer(), Spacer(),
if (!widget.isShopCart && if (!widget.isShopCart &&
(widget.productListBean?.attrStyle ?? 0) == 1) (widget.productListBean?.attrStyle ?? 0) == 1)
Stack( Container(
children: [ padding:EdgeInsets.only(top: 7.h,bottom: 4.h),
Container( child: Stack(
margin: EdgeInsets.only(right: 8, top: 4), children: [
child: RoundButton( Container(
width: 49.w, margin: EdgeInsets.only(right: 8, top: 4),
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( child: RoundButton(
width: 17, width: 49.w,
height: 17.h, text: S.of(context).xuanguige,
text: "${widget.count}", textColor: Colors.white,
textColor: Color(0xFF32A060), fontWeight: MyFontWeight.medium,
fontWeight: MyFontWeight.regular, radius: 3,
backgroup: Colors.white, backgroup: Color(0xFF32A060),
fontSize: 12.sp, fontSize: 11.sp,
radius: 100, 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 || if (widget.isShopCart ||
(widget.productListBean?.attrStyle ?? 0) == 0) (widget.productListBean?.attrStyle ?? 0) == 0)
InkWell( GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
widget widget.reduce(widget.shoppingCartSkuItemListBean);
.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", "assets/image/reduce.webp",
width: 22, width: 22,
height: 22.h, height: 22.h,
), )),
), ),
if (widget.isShopCart || if (widget.isShopCart ||
(widget.productListBean?.attrStyle ?? 0) == 0) (widget.productListBean?.attrStyle ?? 0) == 0)
Container( Container(
width: 30, width: 30,
padding: EdgeInsets.only(top: 7.h,bottom: 4.h),
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
"${widget.count}", "${widget.count}",
@ -249,20 +253,21 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
if (widget.isShopCart || if (widget.isShopCart ||
(widget.productListBean?.attrStyle ?? 0) == 0) (widget.productListBean?.attrStyle ?? 0) == 0)
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
widget.add(widget.shoppingCartSkuItemListBean); widget.add(widget.shoppingCartSkuItemListBean);
}, },
child: Image.asset( child: Container(
"assets/image/add.webp", padding: EdgeInsets.only(right: 16.w,top: 7.h,bottom: 4.h),
width: 22, child: Image.asset(
height: 22.h, "assets/image/add.webp",
width: 22,
height: 22.h,
),
), ),
), ),
], ],
), ),
SizedBox(
height: 4.h,
),
Text( Text(
"${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.applyPrice) ?? 0)}", "${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.applyPrice) ?? 0)}",
style: TextStyle( style: TextStyle(

7
lib/store/store_view/store_order_list.dart

@ -211,7 +211,8 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
.pushNamed('/router/shop_details_page', arguments: { .pushNamed('/router/shop_details_page', arguments: {
"id": e.id, "id": e.id,
"storeId": e.storeId, "storeId": e.storeId,
"isSetMeal":e.isSetMeal "isSetMeal":e.isSetMeal,
"minQty":e.minQty,
}); });
widget.queryShoppingCart(); widget.queryShoppingCart();
} }
@ -367,10 +368,10 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
} }
return ShopGoods( return ShopGoods(
(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) {
widget.queryMiNiDetail(e.id, 1); widget.queryMiNiDetail(e.id, ((e.minQty?? 0).toInt()>1 && count == 0)? (e.minQty??0):1);
}, },
(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { (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, productListBean: e,
count: count, count: count,

18
lib/union/union_list.dart

@ -107,10 +107,7 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return buildStoreItemSm();
onTap: () {},
child: buildStoreItemSm(),
);
}, },
):((storeList == null || storeList.length == 0) ):((storeList == null || storeList.length == 0)
? NoDataView( ? NoDataView(
@ -128,7 +125,8 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
bottom: 100.h, bottom: 100.h,
), ),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return InkWell( return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
{ {
// if (storeList[position].storeName == "一心回乡商城") { // if (storeList[position].storeName == "一心回乡商城") {
@ -353,7 +351,15 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
physics:BouncingScrollPhysics(), physics:BouncingScrollPhysics(),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return GestureDetector( 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( child: unionGoodsItem(
storeList[position].productShow[index]), storeList[position].productShow[index]),
); );

Loading…
Cancel
Save