|
|
@ -3,6 +3,7 @@ import 'package:dio/dio.dart'; |
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
import 'package:flutter/gestures.dart'; |
|
|
|
import 'package:flutter/gestures.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart'; |
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart'; |
|
|
@ -54,6 +55,8 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
ScrollController controller = ScrollController(); |
|
|
|
ScrollController controller = ScrollController(); |
|
|
|
ShoppingCart shopCarGoods; |
|
|
|
ShoppingCart shopCarGoods; |
|
|
|
int tableId = 0; |
|
|
|
int tableId = 0; |
|
|
|
|
|
|
|
String parentId = ""; |
|
|
|
|
|
|
|
String parentCode = ""; |
|
|
|
String tenant = ""; |
|
|
|
String tenant = ""; |
|
|
|
String storeId = ""; |
|
|
|
String storeId = ""; |
|
|
|
int numberOfPeople = 0; |
|
|
|
int numberOfPeople = 0; |
|
|
@ -62,7 +65,7 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
void initState() { |
|
|
|
void initState() { |
|
|
|
super.initState(); |
|
|
|
super.initState(); |
|
|
|
|
|
|
|
|
|
|
|
tableId = widget.arguments["tableId"]; |
|
|
|
tableId = widget.arguments["tableId"] ?? 0; |
|
|
|
tenant = widget.arguments["tenant"]; |
|
|
|
tenant = widget.arguments["tenant"]; |
|
|
|
storeId = widget.arguments["id"]; |
|
|
|
storeId = widget.arguments["id"]; |
|
|
|
|
|
|
|
|
|
|
@ -82,10 +85,12 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
|
|
|
|
|
|
|
|
/// 小程序登录 |
|
|
|
/// 小程序登录 |
|
|
|
minLogin(SharedPreferences shared) async { |
|
|
|
minLogin(SharedPreferences shared) async { |
|
|
|
|
|
|
|
EasyLoading.show(status: S.of(context).zhengzaijiazai); |
|
|
|
apiService = ApiService( |
|
|
|
apiService = ApiService( |
|
|
|
Dio(), |
|
|
|
Dio(), |
|
|
|
context: context, |
|
|
|
context: context, |
|
|
|
token: shared.getString('token'), |
|
|
|
token: shared.getString('token'), |
|
|
|
|
|
|
|
showLoading: false, |
|
|
|
); |
|
|
|
); |
|
|
|
queryStoreInfo(); |
|
|
|
queryStoreInfo(); |
|
|
|
apiService.minLogin(storeId).catchError((onError) { |
|
|
|
apiService.minLogin(storeId).catchError((onError) { |
|
|
@ -107,25 +112,33 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
token: minToken, |
|
|
|
token: minToken, |
|
|
|
tenant: tenant, |
|
|
|
tenant: tenant, |
|
|
|
storeId: storeId, |
|
|
|
storeId: storeId, |
|
|
|
|
|
|
|
showLoading: false, |
|
|
|
); |
|
|
|
); |
|
|
|
queryShopCar().then((value) { |
|
|
|
queryShopCar().then((value) { |
|
|
|
this.shopCarGoods = value; |
|
|
|
this.shopCarGoods = value; |
|
|
|
setState(() {}); |
|
|
|
setState(() {}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (tableId > 0) { |
|
|
|
if (tableId > 0) { |
|
|
|
queryStoreInfo1(); |
|
|
|
getParentInfo(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
EasyLoading.dismiss(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
///获取父订单(火锅订单加菜前调用) |
|
|
|
///获取父订单(火锅订单加菜前调用) |
|
|
|
getParentInfo() async { |
|
|
|
getParentInfo() async { |
|
|
|
BaseData baseData = |
|
|
|
BaseData baseData = await minService.getParentInfo("$tableId") |
|
|
|
await minService.getParentInfo("$tableId").catchError((error) { |
|
|
|
.catchError((error) {debugPrint(error);}); |
|
|
|
debugPrint(error); |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
}); |
|
|
|
if(baseData.data != null) { |
|
|
|
if (baseData != null && baseData.isSuccess) {} |
|
|
|
parentId = baseData.data["id"]; |
|
|
|
|
|
|
|
parentCode = baseData.data["parentCode"]; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
///TODO: 没有父订单, |
|
|
|
|
|
|
|
queryStoreInfo1(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
///获取桌子信息 |
|
|
|
///获取桌子信息 |
|
|
@ -147,10 +160,8 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
|
|
|
|
|
|
|
|
/// 查询店铺信息 |
|
|
|
/// 查询店铺信息 |
|
|
|
queryStoreInfo() async { |
|
|
|
queryStoreInfo() async { |
|
|
|
BaseData baseData = |
|
|
|
BaseData baseData = await apiService.queryStoreInfo(storeId) |
|
|
|
await apiService.queryStoreInfo(storeId).catchError((error) { |
|
|
|
.catchError((error) {debugPrint(error);}); |
|
|
|
debugPrint(error); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
storeInfo = StoreInfo.fromJson(baseData.data); |
|
|
|
storeInfo = StoreInfo.fromJson(baseData.data); |
|
|
|
activitys = storeInfo.informationVOPageVO.list |
|
|
|
activitys = storeInfo.informationVOPageVO.list |
|
|
@ -160,6 +171,7 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
setState(() {}); |
|
|
|
setState(() {}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
EasyLoading.dismiss(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
RefreshController refreshController; |
|
|
|
RefreshController refreshController; |
|
|
@ -489,18 +501,24 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
toDownOrder() async { |
|
|
|
toDownOrder() async { |
|
|
|
int num = count(); |
|
|
|
int num = count(); |
|
|
|
|
|
|
|
|
|
|
|
if (tableId > 0 && num == 0) { |
|
|
|
if (parentId == null || parentId == "") { |
|
|
|
SmartDialog.showToast("请先选择您要购买的商品!~"); |
|
|
|
if (num == 0) { |
|
|
|
return; |
|
|
|
SmartDialog.showToast("请先选择您要购买的商品!~"); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await Navigator.of(context).pushNamed( |
|
|
|
await Navigator.of(context).pushNamed( |
|
|
|
'/router/settlement', |
|
|
|
'/router/settlement', |
|
|
|
arguments: { |
|
|
|
arguments: { |
|
|
|
"storeInfo": storeInfo, |
|
|
|
"storeInfo": storeInfo, |
|
|
|
|
|
|
|
"tableId": tableId, |
|
|
|
|
|
|
|
"parentCode": parentCode, |
|
|
|
|
|
|
|
"parentId": parentId, |
|
|
|
"shoppingCart": shopCarGoods, |
|
|
|
"shoppingCart": shopCarGoods, |
|
|
|
}, |
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
getParentInfo(); |
|
|
|
queryShopCar().then((value) { |
|
|
|
queryShopCar().then((value) { |
|
|
|
this.shopCarGoods = value; |
|
|
|
this.shopCarGoods = value; |
|
|
|
setState(() {}); |
|
|
|
setState(() {}); |
|
|
@ -629,6 +647,8 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
"storeName": storeInfo.storeName ?? "", |
|
|
|
"storeName": storeInfo.storeName ?? "", |
|
|
|
"numberOfPeople": numberOfPeople, |
|
|
|
"numberOfPeople": numberOfPeople, |
|
|
|
"tableId": tableId, |
|
|
|
"tableId": tableId, |
|
|
|
|
|
|
|
"parentId": parentId, |
|
|
|
|
|
|
|
"parentCode": parentCode, |
|
|
|
"shoppingCartSkuItemList": [ |
|
|
|
"shoppingCartSkuItemList": [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
"buyNum": count, |
|
|
|
"buyNum": count, |
|
|
@ -676,6 +696,7 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
if (baseDate.isSuccess) { |
|
|
|
if (baseDate.isSuccess) { |
|
|
|
queryShopCar().then((value) { |
|
|
|
queryShopCar().then((value) { |
|
|
|
this.shopCarGoods = value; |
|
|
|
this.shopCarGoods = value; |
|
|
|
|
|
|
|
print("shopingCar111111: ${this.shopCarGoods.toJson()}"); |
|
|
|
if (shopCartKey != null) { |
|
|
|
if (shopCartKey != null) { |
|
|
|
shopCartKey.currentState.setState(() {}); |
|
|
|
shopCartKey.currentState.setState(() {}); |
|
|
|
} |
|
|
|
} |
|
|
@ -694,6 +715,7 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
if (baseDate.isSuccess) { |
|
|
|
if (baseDate.isSuccess) { |
|
|
|
queryShopCar().then((value) { |
|
|
|
queryShopCar().then((value) { |
|
|
|
this.shopCarGoods = value; |
|
|
|
this.shopCarGoods = value; |
|
|
|
|
|
|
|
print("shopingCar111111: ${this.shopCarGoods.toJson()}"); |
|
|
|
if (shopCartKey != null) { |
|
|
|
if (shopCartKey != null) { |
|
|
|
shopCartKey.currentState.setState(() {}); |
|
|
|
shopCartKey.currentState.setState(() {}); |
|
|
|
} |
|
|
|
} |
|
|
|