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. 50
      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,
"numberOfPeople": numberOfPeople,
"selected": selected,
"shoppingCartSkuItemList": shoppingCartSkuItemList,
"shoppingCartSkuItemList": shoppingCartSkuItemList == null ? null : shoppingCartSkuItemList.map((e) => e.toJson()).toList(),
"storeId": storeId,
"storeName": storeName,
"tableId": tableId,

18
lib/settlement/settlement.dart

@ -109,6 +109,9 @@ class _Settlement extends State<Settlement> {
if (baseData != null && baseData.isSuccess) {
setState(() {
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 {
placeOrderFirst.id = parentId != "" ? parentId : downOrder.id;

50
lib/store/store_order.dart

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

8
lib/store/store_view/shop_car.dart

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

Loading…
Cancel
Save