|
|
@ -2,6 +2,7 @@ import 'dart:convert'; |
|
|
|
import 'dart:math' as mm; |
|
|
|
import 'dart:math' as mm; |
|
|
|
|
|
|
|
|
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
|
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter/services.dart'; |
|
|
|
import 'package:flutter/services.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
@ -68,6 +69,8 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
MemberVo? memberVo; |
|
|
|
MemberVo? memberVo; |
|
|
|
MiniDetail? miniDetail; |
|
|
|
MiniDetail? miniDetail; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final GlobalKey<StoreOrderListPageState> productListKey = GlobalKey<StoreOrderListPageState>(); |
|
|
|
|
|
|
|
|
|
|
|
///小程序token |
|
|
|
///小程序token |
|
|
|
String? minToken; |
|
|
|
String? minToken; |
|
|
|
String? pName; |
|
|
|
String? pName; |
|
|
@ -120,6 +123,9 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
getParentInfo(); |
|
|
|
getParentInfo(); |
|
|
|
} |
|
|
|
} |
|
|
|
this.shopCarGoods = value; |
|
|
|
this.shopCarGoods = value; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
productListKey.currentState?.appletGoods(); |
|
|
|
|
|
|
|
|
|
|
|
setState(() {}); |
|
|
|
setState(() {}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -137,8 +143,8 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
|
|
|
|
|
|
|
|
///获取父订单(火锅订单加菜前调用) |
|
|
|
///获取父订单(火锅订单加菜前调用) |
|
|
|
Future getParentInfo() async { |
|
|
|
Future getParentInfo() async { |
|
|
|
BaseData? baseData = |
|
|
|
BaseData? baseData = await minService?.getParentInfo("$tableId") |
|
|
|
await minService?.getParentInfo("$tableId").catchError((error) { |
|
|
|
.catchError((error) { |
|
|
|
debugPrint("${error}"); |
|
|
|
debugPrint("${error}"); |
|
|
|
return BaseData()..isSuccess = false; |
|
|
|
return BaseData()..isSuccess = false; |
|
|
|
}); |
|
|
|
}); |
|
|
@ -170,8 +176,8 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
|
|
|
|
|
|
|
|
/// 查询店铺信息 |
|
|
|
/// 查询店铺信息 |
|
|
|
Future queryStoreInfo() async { |
|
|
|
Future queryStoreInfo() async { |
|
|
|
BaseData<StoreInfo>? baseData = |
|
|
|
BaseData<StoreInfo>? baseData = await apiService?.queryStoreInfo(storeId) |
|
|
|
await apiService?.queryStoreInfo(storeId).catchError((error) { |
|
|
|
.catchError((error) { |
|
|
|
debugPrint("${error}"); |
|
|
|
debugPrint("${error}"); |
|
|
|
return BaseData<StoreInfo>()..isSuccess = false; |
|
|
|
return BaseData<StoreInfo>()..isSuccess = false; |
|
|
|
}); |
|
|
|
}); |
|
|
@ -357,6 +363,7 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
), |
|
|
|
), |
|
|
|
SliverFillRemaining( |
|
|
|
SliverFillRemaining( |
|
|
|
child: StoreOrderListPage( |
|
|
|
child: StoreOrderListPage( |
|
|
|
|
|
|
|
key: productListKey, |
|
|
|
widget.arguments, |
|
|
|
widget.arguments, |
|
|
|
activitys, |
|
|
|
activitys, |
|
|
|
storeInfo, |
|
|
|
storeInfo, |
|
|
@ -365,7 +372,9 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
minToken, |
|
|
|
minToken, |
|
|
|
tenant, |
|
|
|
tenant, |
|
|
|
tableId, |
|
|
|
tableId, |
|
|
|
_queryMiNiDetail, |
|
|
|
(String id, int count) { |
|
|
|
|
|
|
|
_queryMiNiDetail(id, count); |
|
|
|
|
|
|
|
}, |
|
|
|
() { |
|
|
|
() { |
|
|
|
queryShopCar().then((value) { |
|
|
|
queryShopCar().then((value) { |
|
|
|
this.shopCarGoods = value; |
|
|
|
this.shopCarGoods = value; |
|
|
@ -703,9 +712,15 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
miniDetail, |
|
|
|
miniDetail, |
|
|
|
shopCarGoods, |
|
|
|
shopCarGoods, |
|
|
|
id, |
|
|
|
id, |
|
|
|
_addShopCar, |
|
|
|
(MiniDetail? miniDetail, selectSkus, int count) { |
|
|
|
add, |
|
|
|
_addShopCar(miniDetail, selectSkus, count); |
|
|
|
reduce, |
|
|
|
}, |
|
|
|
|
|
|
|
(MiniDetail miniDetail, selectSkus) { |
|
|
|
|
|
|
|
add(miniDetail, selectSkus); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
(MiniDetail miNiDetail, selectSkus) { |
|
|
|
|
|
|
|
reduce(miNiDetail, selectSkus); |
|
|
|
|
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
|
}, |
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
@ -777,7 +792,8 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
if (storeInfo?.posType?.code == "NORMALSTORE" && tableId == 0) { |
|
|
|
if (storeInfo?.posType?.code == "NORMALSTORE" && tableId == 0) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
BaseListData<ShoppingCart>? baseDate = await minService?.getShoppingCart(tableId).catchLEr<ShoppingCart>(); |
|
|
|
BaseListData<ShoppingCart>? baseDate = await minService?.getShoppingCart(tableId) |
|
|
|
|
|
|
|
.catchLEr<ShoppingCart>(); |
|
|
|
if ((baseDate?.isSuccess ?? false) && (baseDate!.data?.isNotEmpty ?? false)) { |
|
|
|
if ((baseDate?.isSuccess ?? false) && (baseDate!.data?.isNotEmpty ?? false)) { |
|
|
|
if (baseDate.data![0].selectDiscount == 1) { |
|
|
|
if (baseDate.data![0].selectDiscount == 1) { |
|
|
|
baseDate.data![0].couponList?.forEach((element) { |
|
|
|
baseDate.data![0].couponList?.forEach((element) { |
|
|
|