|
|
|
@ -137,11 +137,12 @@ class _StoreOrderPage extends State<StoreOrderPage>
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
queryMemberInfo() async { |
|
|
|
|
BaseData baseData = await minService.memberInfo() |
|
|
|
|
.catchError((error){debugPrint(error);}); |
|
|
|
|
BaseData baseData = await minService.memberInfo().catchError((error) { |
|
|
|
|
debugPrint(error); |
|
|
|
|
}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
SharedPreferences.getInstance().then( |
|
|
|
|
(value) => { |
|
|
|
|
(value) => { |
|
|
|
|
value.setString('minMember', jsonEncode(baseData.data)), |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
@ -150,8 +151,10 @@ class _StoreOrderPage extends State<StoreOrderPage>
|
|
|
|
|
|
|
|
|
|
///获取父订单(火锅订单加菜前调用) |
|
|
|
|
getParentInfo() async { |
|
|
|
|
BaseData baseData = await minService.getParentInfo("$tableId") |
|
|
|
|
.catchError((error) {debugPrint(error);}); |
|
|
|
|
BaseData baseData = |
|
|
|
|
await minService.getParentInfo("$tableId").catchError((error) { |
|
|
|
|
debugPrint(error); |
|
|
|
|
}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
if (baseData.data != null) { |
|
|
|
|
parentId = baseData.data["id"]; |
|
|
|
@ -182,7 +185,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
|
|
|
|
|
|
|
|
|
|
/// 查询店铺信息 |
|
|
|
|
queryStoreInfo() async { |
|
|
|
|
BaseData baseData = await apiService.queryStoreInfo(storeId).catchError((error) { |
|
|
|
|
BaseData baseData = |
|
|
|
|
await apiService.queryStoreInfo(storeId).catchError((error) { |
|
|
|
|
debugPrint(error); |
|
|
|
|
}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
@ -202,8 +206,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
return |
|
|
|
|
WillPopScope( |
|
|
|
|
return WillPopScope( |
|
|
|
|
onWillPop: () async { |
|
|
|
|
if (dialogShowing) { |
|
|
|
|
debugPrint("ssssasdadsasdadasd"); |
|
|
|
@ -213,8 +216,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
child: |
|
|
|
|
Container( |
|
|
|
|
child: Container( |
|
|
|
|
color: Colors.white, |
|
|
|
|
child: Stack( |
|
|
|
|
children: [ |
|
|
|
@ -227,14 +229,15 @@ class _StoreOrderPage extends State<StoreOrderPage>
|
|
|
|
|
controller: controller, |
|
|
|
|
dragStartBehavior: DragStartBehavior.start, |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
headerSliverBuilder: (BuildContext context, bool innerScrolled) { |
|
|
|
|
headerSliverBuilder: |
|
|
|
|
(BuildContext context, bool innerScrolled) { |
|
|
|
|
return [ |
|
|
|
|
SliverOverlapAbsorber( |
|
|
|
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor( |
|
|
|
|
context), |
|
|
|
|
sliver: SliverAppBar( |
|
|
|
|
expandedHeight: |
|
|
|
|
(storeInfo != null && storeInfo.couponVOList != null) |
|
|
|
|
expandedHeight: (storeInfo != null && |
|
|
|
|
storeInfo.couponVOList != null) |
|
|
|
|
? 470.h |
|
|
|
|
: 365.h, |
|
|
|
|
floating: false, |
|
|
|
@ -262,9 +265,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
flexibleSpace: FlexibleSpaceBar( |
|
|
|
|
title: Title( |
|
|
|
|
controller, |
|
|
|
|
storeInfo != null ? storeInfo.storeName : ''), |
|
|
|
|
title: Title(controller, |
|
|
|
|
storeInfo != null ? storeInfo.storeName : ''), |
|
|
|
|
collapseMode: CollapseMode.pin, |
|
|
|
|
stretchModes: [ |
|
|
|
|
StretchMode.zoomBackground, |
|
|
|
@ -555,6 +557,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
await Navigator.of(context).pushNamed( |
|
|
|
|
'/router/settlement', |
|
|
|
|
arguments: { |
|
|
|
@ -562,15 +565,15 @@ class _StoreOrderPage extends State<StoreOrderPage>
|
|
|
|
|
"tableId": tableId, |
|
|
|
|
"parentCode": parentCode, |
|
|
|
|
"parentId": parentId, |
|
|
|
|
"pName":pName, |
|
|
|
|
"pid":pid, |
|
|
|
|
"cName":cName, |
|
|
|
|
"cid":cid, |
|
|
|
|
"pName": pName, |
|
|
|
|
"pid": pid, |
|
|
|
|
"cName": cName, |
|
|
|
|
"cid": cid, |
|
|
|
|
"shoppingCart": shopCarGoods, |
|
|
|
|
"numberOfPeople": numberOfPeople, |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
if(tableId >0){ |
|
|
|
|
if (tableId > 0) { |
|
|
|
|
getParentInfo(); |
|
|
|
|
} |
|
|
|
|
queryShopCar().then((value) { |
|
|
|
@ -651,18 +654,19 @@ class _StoreOrderPage extends State<StoreOrderPage>
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///选规格 |
|
|
|
|
_queryMiNiDetail(String id,int count) async { |
|
|
|
|
_queryMiNiDetail(String id, int count) async { |
|
|
|
|
EasyLoading.show(status: S.current.zhengzaijiazai); |
|
|
|
|
BaseData<MiNiDetail> baseData = await minService.miNiDetail(id); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
showStoreSelector(baseData.data, id,count); |
|
|
|
|
showStoreSelector(baseData.data, id, count); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///选规格弹窗 |
|
|
|
|
showStoreSelector(MiNiDetail miNiDetail, String id,int count) async { |
|
|
|
|
if (miNiDetail.attrList != null && miNiDetail.attrList.length == 1 |
|
|
|
|
&& miNiDetail.attrList[0].attrValueList.length == 1) { |
|
|
|
|
showStoreSelector(MiNiDetail miNiDetail, String id, int count) async { |
|
|
|
|
if (miNiDetail.attrList != null && |
|
|
|
|
miNiDetail.attrList.length == 1 && |
|
|
|
|
miNiDetail.attrList[0].attrValueList.length == 1) { |
|
|
|
|
_addShopCar(miNiDetail, [], count); |
|
|
|
|
} else { |
|
|
|
|
EasyLoading.dismiss(); |
|
|
|
@ -687,7 +691,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
|
|
|
|
|
///添加购物车 |
|
|
|
|
Future _addShopCar(MiNiDetail miNiDetail, selectSkus, int count) async { |
|
|
|
|
ProductSkuVOListBean productSku; |
|
|
|
|
if (selectSkus!= null && selectSkus.length == 0) { |
|
|
|
|
if (selectSkus != null && selectSkus.length == 0) { |
|
|
|
|
productSku = miNiDetail.productSkuVOList.first; |
|
|
|
|
} else { |
|
|
|
|
productSku = miNiDetail.productSkuVOList.firstWhere((element) { |
|
|
|
@ -743,28 +747,28 @@ class _StoreOrderPage extends State<StoreOrderPage>
|
|
|
|
|
|
|
|
|
|
///查询购物车 |
|
|
|
|
Future<ShoppingCart> queryShopCar() async { |
|
|
|
|
pName="";//活动 |
|
|
|
|
pid="";//活动 |
|
|
|
|
cName="";//优惠券 |
|
|
|
|
cid="";//优惠券 |
|
|
|
|
pName = ""; //活动 |
|
|
|
|
pid = ""; //活动 |
|
|
|
|
cName = ""; //优惠券 |
|
|
|
|
cid = ""; //优惠券 |
|
|
|
|
BaseData<List<ShoppingCart>> baseDate = |
|
|
|
|
await minService.getShoppingCart(tableId); |
|
|
|
|
if (baseDate != null && |
|
|
|
|
baseDate.isSuccess && |
|
|
|
|
baseDate.data != null && |
|
|
|
|
baseDate.data.length > 0) { |
|
|
|
|
if( baseDate.data[0].selectDiscount ==1){ |
|
|
|
|
if (baseDate.data[0].selectDiscount == 1) { |
|
|
|
|
baseDate.data[0].couponList.forEach((element) { |
|
|
|
|
if(element.isMaxCoupon){ |
|
|
|
|
if (element.isMaxCoupon) { |
|
|
|
|
cName = element.promotionName; |
|
|
|
|
cid = element.id; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}else if(baseDate.data[0].selectDiscount==2){ |
|
|
|
|
} else if (baseDate.data[0].selectDiscount == 2) { |
|
|
|
|
baseDate.data[0].promotionInfoList.forEach((element) { |
|
|
|
|
if(element.isMaxPromotion){ |
|
|
|
|
pName=element.name; |
|
|
|
|
pid=element.id; |
|
|
|
|
if (element.isMaxPromotion) { |
|
|
|
|
pName = element.name; |
|
|
|
|
pid = element.id; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|