Browse Source

safety

master
fmk 3 years ago
parent
commit
17aa407ef7
  1. 2
      lib/retrofit/data/shoppingCart.dart
  2. 18
      lib/settlement/settlement.dart
  3. 46
      lib/store/store_order.dart
  4. 8
      lib/store/store_view/shop_car.dart

2
lib/retrofit/data/shoppingCart.dart

@ -34,7 +34,7 @@ class ShoppingCart {
"cartSum": cartSum, "cartSum": cartSum,
"numberOfPeople": numberOfPeople, "numberOfPeople": numberOfPeople,
"selected": selected, "selected": selected,
"shoppingCartSkuItemList": shoppingCartSkuItemList, "shoppingCartSkuItemList": shoppingCartSkuItemList == null ? null : shoppingCartSkuItemList.map((e) => e.toJson()).toList(),
"storeId": storeId, "storeId": storeId,
"storeName": storeName, "storeName": storeName,
"tableId": tableId, "tableId": tableId,

18
lib/settlement/settlement.dart

@ -109,6 +109,9 @@ class _Settlement extends State<Settlement> {
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
settleOrderInfo = baseData.data; settleOrderInfo = baseData.data;
if (settleOrderInfo.orderProductList == null || settleOrderInfo.orderProductList.length == 0) {
queryOrderDetails(parentId);
}
}); });
} }
} }
@ -248,21 +251,6 @@ class _Settlement extends State<Settlement> {
} }
} }
//Undefined symbols for architecture armv7:
// "_OBJC_CLASS_$_HmsBitMap", referenced from:
// objc-class-ref in libflutter_scankit.a(FLScanKitView.o)
// objc-class-ref in libflutter_scankit.a(FlutterScankitPlugin.o)
// "_OBJC_CLASS_$_HmsDefaultScanViewController", referenced from:
// objc-class-ref in libflutter_scankit.a(FlutterScankitPlugin.o)
// "_OBJC_CLASS_$_HmsCustomScanViewController", referenced from:
// objc-class-ref in libflutter_scankit.a(FLScanKitView.o)
// "_OBJC_CLASS_$_HmsScanOptions", referenced from:
// objc-class-ref in libflutter_scankit.a(FLScanKitView.o)
// objc-class-ref in libflutter_scankit.a(FlutterScankitPlugin.o)
// ld: symbol(s) not found for architecture armv7
// clang: error: linker command failed with exit code 1 (use -v to see invocation)
/// ///
querySettlement() async { querySettlement() async {
placeOrderFirst.id = parentId != "" ? parentId : downOrder.id; placeOrderFirst.id = parentId != "" ? parentId : downOrder.id;

46
lib/store/store_order.dart

@ -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 == "") {
if (num == 0) {
SmartDialog.showToast("请先选择您要购买的商品!~"); SmartDialog.showToast("请先选择您要购买的商品!~");
return; 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(() {});
} }

8
lib/store/store_view/shop_car.dart

@ -105,8 +105,12 @@ class _ShopCar extends State<ShopCar> {
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return ShopGoods( return ShopGoods(
widget.shopCartAdd, (ShoppingCartSkuItemListBean cart) {
widget.shopCartReduce, widget.shopCartAdd(cart);
},
(ShoppingCartSkuItemListBean cart) {
widget.shopCartReduce(cart);
},
count: widget.shopingCar count: widget.shopingCar
.shoppingCartSkuItemList[position].buyNum, .shoppingCartSkuItemList[position].buyNum,
shoppingCartSkuItemListBean: shoppingCartSkuItemListBean:

Loading…
Cancel
Save