|
|
|
@ -5,6 +5,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/findMiNiGroupList.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/shoppingCart.dart'; |
|
|
|
|
import 'package:huixiang/store/store_view/red_dot_page.dart'; |
|
|
|
|
import 'package:huixiang/utils/flutter_utils.dart'; |
|
|
|
|
import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
@ -30,6 +31,7 @@ class ShopGoods extends StatefulWidget {
|
|
|
|
|
final ShoppingCartSkuItemListBean shoppingCartSkuItemListBean; |
|
|
|
|
final int count; |
|
|
|
|
final int tableId; |
|
|
|
|
final Offset endOffset; |
|
|
|
|
final bool isShopCart; |
|
|
|
|
final StoreInfo storeInfo; |
|
|
|
|
|
|
|
|
@ -40,6 +42,7 @@ class ShopGoods extends StatefulWidget {
|
|
|
|
|
this.count = 0, |
|
|
|
|
this.isShopCart = false, |
|
|
|
|
this.tableId, |
|
|
|
|
this.endOffset, |
|
|
|
|
this.queryShoppingCart, |
|
|
|
|
this.queryMiNiDetail, |
|
|
|
|
this.shoppingCartSkuItemListBean, |
|
|
|
@ -114,8 +117,8 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
: (widget.shoppingCartSkuItemListBean != null |
|
|
|
|
? widget.shoppingCartSkuItemListBean.skuImg |
|
|
|
|
: ""), |
|
|
|
|
width: 70.h, |
|
|
|
|
height: 70.h, |
|
|
|
|
width: 102.h, |
|
|
|
|
height: 102.h, |
|
|
|
|
radius: BorderRadius.circular(4), |
|
|
|
|
fit: BoxFit.cover, |
|
|
|
|
errorSrc: "assets/image/default_1.webp", |
|
|
|
@ -127,9 +130,9 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
Expanded( |
|
|
|
|
child: Column( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
children:[ |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.only(right: 16.w), |
|
|
|
|
padding: EdgeInsets.only(right: 16.w,bottom:7.h), |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
@ -140,9 +143,9 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
maxLines: 1, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Colors.black, |
|
|
|
|
fontSize: 13.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Color(0xFF282828), |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
fontWeight:MyFontWeight.semi_bold, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -163,15 +166,9 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 2.h, |
|
|
|
|
), |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.only(right: 16.w), |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
padding: EdgeInsets.only(right: 16.w,bottom:7.h), |
|
|
|
|
child:Text( |
|
|
|
|
(widget.productListBean != null |
|
|
|
|
? widget.productListBean.shortName |
|
|
|
|
: widget.shoppingCartSkuItemListBean.skuName ?? |
|
|
|
@ -183,22 +180,37 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
), |
|
|
|
|
),), |
|
|
|
|
((widget.productListBean?.minQty ?? 0).toInt() > 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, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
width: 10.w, |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
child: Text( |
|
|
|
|
"${widget.productListBean?.minQty ?? 0}份起购", |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Color(0xFFF65720), |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
)), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 7.h, |
|
|
|
|
), |
|
|
|
|
Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
children: [ |
|
|
|
|
), |
|
|
|
|
Spacer(), |
|
|
|
|
], |
|
|
|
|
):SizedBox(height:23.h), |
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
Expanded(child:Text( |
|
|
|
|
"¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.price) ?? 0)}", |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Color(0xFFFF4500), |
|
|
|
@ -206,10 +218,10 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
fontFamily: 'JDZhengHT', |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
width:5.w, |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
// SizedBox( |
|
|
|
|
// width:5.w, |
|
|
|
|
// ), |
|
|
|
|
// Container( |
|
|
|
|
// width: 44.w, |
|
|
|
|
// height: 18.h, |
|
|
|
@ -227,38 +239,33 @@ 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( |
|
|
|
|
Builder( |
|
|
|
|
builder: (context) { |
|
|
|
|
return GestureDetector( |
|
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
|
onTap: () async { |
|
|
|
|
if (widget.storeInfo.posType.code == "NORMALSTORE" && |
|
|
|
|
widget.tableId == 0) { |
|
|
|
|
showDeleteDialog(); |
|
|
|
|
} else { |
|
|
|
|
/// 点击的时候获取当前 widget 的位置,传入 overlayEntry |
|
|
|
|
var _overlayEntry = OverlayEntry(builder: (_) { |
|
|
|
|
RenderBox box = context.findRenderObject(); |
|
|
|
|
var offset = box.localToGlobal(Offset.zero); |
|
|
|
|
return RedDotPage( |
|
|
|
|
startPosition: offset, |
|
|
|
|
endPosition: widget.endOffset, |
|
|
|
|
); |
|
|
|
|
}); |
|
|
|
|
// 显示Overlay |
|
|
|
|
Overlay.of(context).insert(_overlayEntry); |
|
|
|
|
// 等待动画结束 |
|
|
|
|
Future.delayed(Duration(milliseconds: 800), () { |
|
|
|
|
_overlayEntry.remove(); |
|
|
|
|
_overlayEntry = null; |
|
|
|
|
}); |
|
|
|
|
if (_jumpType == -1) |
|
|
|
|
queryMiNiDetail(widget.productListBean.id); |
|
|
|
|
else if (_jumpType == 0) |
|
|
|
@ -276,7 +283,7 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
}, |
|
|
|
|
child:Container( |
|
|
|
|
padding: EdgeInsets.only( |
|
|
|
|
left:50.w, |
|
|
|
|
// left:48.w, |
|
|
|
|
top: 4.h, |
|
|
|
|
bottom: 4.h, |
|
|
|
|
), |
|
|
|
@ -285,13 +292,14 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
text:"${widget?.productListBean?.minQty ?? 0}份起购", |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
radius: 3, |
|
|
|
|
radius: 11, |
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
padding: EdgeInsets.symmetric( |
|
|
|
|
vertical: 5.h, horizontal: 3.w), |
|
|
|
|
vertical:2.h, horizontal:6.w), |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
));},), |
|
|
|
|
///选规格 |
|
|
|
|
if (!widget.isShopCart && |
|
|
|
|
(widget.productListBean?.attrStyle ?? 0) == 1 && |
|
|
|
|
!(widget?.productListBean?.subscribeParam |
|
|
|
@ -306,7 +314,7 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
widget.tableId == 0) { |
|
|
|
|
showDeleteDialog(); |
|
|
|
|
} else { |
|
|
|
|
widget.queryMiNiDetail( |
|
|
|
|
await widget.queryMiNiDetail( |
|
|
|
|
widget.productListBean != null |
|
|
|
|
? widget.productListBean.id |
|
|
|
|
: widget.shoppingCartSkuItemListBean |
|
|
|
@ -318,7 +326,6 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
children: [ |
|
|
|
|
Container( |
|
|
|
|
padding: EdgeInsets.only( |
|
|
|
|
left: 35.w, |
|
|
|
|
top: 4.h, |
|
|
|
|
bottom: 4.h, |
|
|
|
|
), |
|
|
|
@ -327,11 +334,11 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
text: S.of(context).xuanguige, |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
radius: 3, |
|
|
|
|
radius: 11, |
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
padding: EdgeInsets.symmetric( |
|
|
|
|
vertical: 5.h, horizontal: 3.w), |
|
|
|
|
vertical:3.h, horizontal:6.w), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Positioned( |
|
|
|
@ -352,20 +359,14 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
)), |
|
|
|
|
if (widget.isShopCart || |
|
|
|
|
(widget.productListBean?.attrStyle ?? 0) == 0 && |
|
|
|
|
!(widget?.productListBean?.subscribeParam |
|
|
|
|
?.isEnableSubscribe ?? |
|
|
|
|
false) && |
|
|
|
|
!(widget?.productListBean?.isSetMeal ?? false)) |
|
|
|
|
Spacer(), |
|
|
|
|
///数量- |
|
|
|
|
if (widget.isShopCart || |
|
|
|
|
(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) && |
|
|
|
|
!(widget?.productListBean?.isSetMeal ?? false)) |
|
|
|
|
!(widget?.productListBean?.isSetMeal ?? false) && widget.count != 0) |
|
|
|
|
GestureDetector( |
|
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
|
onTap: () async { |
|
|
|
@ -380,18 +381,19 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
padding: EdgeInsets.only(left: 15.w, right: 6.w), |
|
|
|
|
child: Image.asset( |
|
|
|
|
"assets/image/reduce.webp", |
|
|
|
|
width: 22, |
|
|
|
|
width: 22.h, |
|
|
|
|
height: 22.h, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
///数量显示 |
|
|
|
|
if (widget.isShopCart || |
|
|
|
|
(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) && |
|
|
|
|
!(widget?.productListBean?.isSetMeal ?? false)) |
|
|
|
|
!(widget?.productListBean?.isSetMeal ?? false) && widget.count != 0) |
|
|
|
|
Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
child: Text( |
|
|
|
@ -403,6 +405,7 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
///数量+ |
|
|
|
|
if (widget.isShopCart || |
|
|
|
|
(widget.productListBean?.attrStyle ?? 0) == 0 &&(((widget.productListBean?.minQty ?? 0).toInt() > 1 && widget.count != 0) |
|
|
|
|
|| (widget.productListBean?.minQty ?? 0).toInt() == 0) && |
|
|
|
@ -410,7 +413,9 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
?.isEnableSubscribe ?? |
|
|
|
|
false) && |
|
|
|
|
!(widget?.productListBean?.isSetMeal ?? false)) |
|
|
|
|
GestureDetector( |
|
|
|
|
Builder( |
|
|
|
|
builder: (context) { |
|
|
|
|
return GestureDetector( |
|
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
|
onTap: () async { |
|
|
|
|
if (widget.storeInfo.posType.code == "NORMALSTORE" && |
|
|
|
@ -425,6 +430,22 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
// SmartDialog.showToast("库存不足", |
|
|
|
|
// alignment: Alignment.center); |
|
|
|
|
// } else |
|
|
|
|
/// 点击的时候获取当前 widget 的位置,传入 overlayEntry |
|
|
|
|
var _overlayEntry = OverlayEntry(builder: (_) { |
|
|
|
|
RenderBox box = context.findRenderObject(); |
|
|
|
|
var offset = box.localToGlobal(Offset.zero); |
|
|
|
|
return RedDotPage( |
|
|
|
|
startPosition: offset, |
|
|
|
|
endPosition: widget.endOffset, |
|
|
|
|
); |
|
|
|
|
}); |
|
|
|
|
// 显示Overlay |
|
|
|
|
Overlay.of(context).insert(_overlayEntry); |
|
|
|
|
// 等待动画结束 |
|
|
|
|
Future.delayed(Duration(milliseconds: 800), () { |
|
|
|
|
_overlayEntry.remove(); |
|
|
|
|
_overlayEntry = null; |
|
|
|
|
}); |
|
|
|
|
if (_jumpType == -1) |
|
|
|
|
queryMiNiDetail(widget.productListBean.id); |
|
|
|
|
else if (_jumpType == 0) |
|
|
|
@ -439,16 +460,20 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
}); |
|
|
|
|
widget.queryShoppingCart(); |
|
|
|
|
} |
|
|
|
|
// Navigator.of(context).pushNamed('/router/goods_list_page'); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
padding: EdgeInsets.only(left: 6.w, right: 5.5.w), |
|
|
|
|
child: Image.asset( |
|
|
|
|
"assets/image/add.webp", |
|
|
|
|
width: 22, |
|
|
|
|
width: 22.h, |
|
|
|
|
height: 22.h, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
///立即预约 |
|
|
|
|
if ((widget.productListBean.subscribeParam |
|
|
|
|
.isEnableSubscribe ?? |
|
|
|
|
false) == |
|
|
|
@ -474,7 +499,6 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
padding: EdgeInsets.only( |
|
|
|
|
left: 35.w, |
|
|
|
|
top: 4.h, |
|
|
|
|
bottom: 4.h, |
|
|
|
|
), |
|
|
|
@ -483,13 +507,14 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
text: S.of(context).lijiyuyue, |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
radius: 3, |
|
|
|
|
radius: 11, |
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
padding: EdgeInsets.symmetric( |
|
|
|
|
vertical: 5.h, horizontal: 3.w), |
|
|
|
|
vertical:3.h, horizontal:6.w), |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
///选套餐 |
|
|
|
|
if ((widget.productListBean.isSetMeal ?? false) == true) |
|
|
|
|
GestureDetector( |
|
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
@ -524,7 +549,6 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
children: [ |
|
|
|
|
Container( |
|
|
|
|
padding: EdgeInsets.only( |
|
|
|
|
left: 35.w, |
|
|
|
|
top: 4.h, |
|
|
|
|
bottom: 4.h, |
|
|
|
|
), |
|
|
|
@ -533,11 +557,11 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
text: "选套餐", |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
radius: 3, |
|
|
|
|
radius: 11, |
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
padding: EdgeInsets.symmetric( |
|
|
|
|
vertical: 5.h, horizontal: 3.w), |
|
|
|
|
vertical:3.h, horizontal:6.w), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Positioned( |
|
|
|
@ -563,7 +587,6 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
SizedBox( |
|
|
|
|
height: 4.h, |
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
///VIP价格(暂时弃用) |
|
|
|
|
// if (widget.productListBean.vipPrice != null) |
|
|
|
|
// Row( |
|
|
|
|