Browse Source

safety

master
fmk 3 years ago
parent
commit
e61ab8f86b
  1. 24
      lib/mine/mine_view/mine_view.dart
  2. 22
      lib/mine/vip_detail_page.dart
  3. 35
      lib/order/order_history_page.dart
  4. 20
      lib/order/order_view/order_address.dart
  5. 53
      lib/store/scan.dart
  6. 90
      lib/store/store_order.dart
  7. 21
      lib/store/store_view/product_sku.dart
  8. 41
      lib/store/store_view/shop_car.dart
  9. 4
      lib/store/store_view/store_order_list.dart
  10. 64
      lib/union/union_page.dart
  11. 26
      lib/view_widget/selector_store_dialog.dart
  12. 27
      lib/web/web_view/web_header.dart

24
lib/mine/mine_view/mine_view.dart

@ -23,7 +23,6 @@ class MineView extends StatefulWidget {
} }
class _MineView extends State<MineView> { class _MineView extends State<MineView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
@ -91,7 +90,23 @@ class _MineView extends State<MineView> {
); );
}); });
} else if (await Permission.camera.isGranted) { } else if (await Permission.camera.isGranted) {
Navigator.of(context).pushNamed('/router/qr_scan'); ///http://pos.app.gznl.top/placeorder/?tableId=1315903669597634560&tenantCode=1166&shopId=1300372027722432512
var result = await Navigator.of(context).pushNamed('/router/qr_scan');
Uri uri = Uri.parse(result);
String tableId = uri.queryParameters["tableId"];
String tenantCode = uri.queryParameters["tenantCode"];
String shopId = uri.queryParameters["shopId"];
if (tableId != null && tableId != "" && tenantCode != null && tenantCode != "" && shopId != null && shopId != "") {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {
"id": shopId,
"tenant": tenantCode,
"storeName": "",
"tableId": int.tryParse(tableId),
},
);
}
} else { } else {
await Permission.camera.request(); await Permission.camera.request();
} }
@ -145,13 +160,16 @@ class _MineView extends State<MineView> {
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
widget.userInfo == null widget.userInfo == null
? Text( ? InkWell(
child: Text(
S.of(context).denglu, S.of(context).denglu,
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
color: Color(0xFF353535), color: Color(0xFF353535),
), ),
),
onTap: widget.toUserInfo,
) )
: Row( : Row(
children: [ children: [

22
lib/mine/vip_detail_page.dart

@ -7,6 +7,7 @@ import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/product.dart'; import 'package:huixiang/retrofit/data/product.dart';
import 'package:huixiang/retrofit/data/vip_card.dart'; import 'package:huixiang/retrofit/data/vip_card.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/scan.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/utils/location.dart'; import 'package:huixiang/utils/location.dart';
import 'package:huixiang/utils/painter_bg.dart'; import 'package:huixiang/utils/painter_bg.dart';
@ -432,8 +433,25 @@ class _VipDetailPage extends State<VipDetailPage> {
), ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/router/union_detail_page', // Navigator.of(context).pushNamed('/router/union_detail_page',
arguments: {"id": store.id}); // arguments: {"id": store.id});
if(store.posType.code == "NORMALSTORE") {
Scan.toScan(
context,
store.id,
store.tenantCode,
store.storeName,
);
} else {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {
"id": store.id,
"tenant": store.tenantCode,
"storeName": store.storeName
},
);
}
}, },
child: Text( child: Text(
S.of(context).chakan, S.of(context).chakan,

35
lib/order/order_history_page.dart

@ -11,6 +11,7 @@ import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/data/product.dart'; import 'package:huixiang/retrofit/data/product.dart';
import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/scan.dart';
import 'package:huixiang/utils/status_utils.dart'; import 'package:huixiang/utils/status_utils.dart';
import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
@ -442,11 +443,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
orderInfo.refundStatus, orderInfo.refundStatus,
orderInfo.dayFlowCode, (type) { orderInfo.dayFlowCode, (type) {
if (type == 0) { if (type == 0) {
String storeId = (orderInfo != null && aginOrder(orderInfo);
orderInfo.storeVO != null)
? (orderInfo.storeVO.id ?? "")
: "";
aginOrder(storeId);
} else if (type == 1) { } else if (type == 1) {
SmartDialog.show( SmartDialog.show(
widget: Tips( widget: Tips(
@ -539,12 +536,34 @@ class _OrderHistoryList extends State<OrderHistoryList>
} }
} }
aginOrder(storeId) { aginOrder(OrderInfo orderInfo) {
// Navigator.of(context).pushNamed(
// '/router/union_detail_page',
// arguments: {"id": storeId},
// );
// String storeId = (orderInfo != null &&
// orderInfo.storeVO != null)
// ? (orderInfo.storeVO.id ?? "")
// : "";
if(orderInfo.storeVO.posType.code == "NORMALSTORE") {
Scan.toScan(
context,
orderInfo.storeVO.id,
orderInfo.tenantCode,
orderInfo.storeVO.storeName,
);
} else {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/union_detail_page', '/router/store_order',
arguments: {"id": storeId}, arguments: {
"id": orderInfo.storeVO.id,
"tenant": orderInfo.tenantCode,
"storeName": orderInfo.storeVO.storeName
},
); );
} }
}
String totalPrice(orderInfo) { String totalPrice(orderInfo) {
if (orderInfo == null) return ""; if (orderInfo == null) return "";

20
lib/order/order_view/order_address.dart

@ -3,6 +3,7 @@ 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:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/order_info.dart'; import 'package:huixiang/retrofit/data/order_info.dart';
import 'package:huixiang/store/scan.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/border_text.dart'; import 'package:huixiang/view_widget/border_text.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
@ -258,6 +259,25 @@ class _OrderAddress extends State<OrderAddress> {
aginOrder(storeId, storeName) { aginOrder(storeId, storeName) {
Navigator.of(context).pushNamed('/router/union_detail_page', Navigator.of(context).pushNamed('/router/union_detail_page',
arguments: {"id": storeId, "storeName": storeName}); arguments: {"id": storeId, "storeName": storeName});
if(widget.orderInfo.storeVO.posType.code == "NORMALSTORE") {
Scan.toScan(
context,
widget.orderInfo.storeVO.id,
widget.orderInfo.tenantCode,
widget.orderInfo.storeVO.storeName,
);
} else {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {
"id": widget.orderInfo.storeVO.id,
"tenant": widget.orderInfo.tenantCode,
"storeName": widget.orderInfo.storeVO.storeName
},
);
}
} }
// carryOnPay() async { // carryOnPay() async {

53
lib/store/scan.dart

@ -0,0 +1,53 @@
import 'package:flutter/cupertino.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/view_widget/request_permission.dart';
import 'package:permission_handler/permission_handler.dart';
class Scan {
static toScan(context, id, tenantCode, storeName) async {
if (await Permission.camera.isPermanentlyDenied) {
showCupertinoDialog(
context: context,
builder: (context) {
return RequestPermission(
"assets/image/icon_camera_permission_tips.png",
S.of(context).ninxiangjiquanxianweikaiqi,
S.of(context).weilekaipaizhaoxuanzhetouxiang,
S.of(context).kaiqiquanxian,
(result) async {
if (result) {
await openAppSettings();
}
},
heightRatioWithWidth: 0.82,
);
});
} else if (await Permission.camera.isGranted) {
var result = await Navigator.of(context).pushNamed('/router/qr_scan');
if (result != null && result != "") {
Uri uri = Uri.parse(result);
String table = uri.queryParameters["tableId"];
if (table != null && table != "") {
int tableId = int.tryParse(table);
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {
"id": id,
"tenant": tenantCode,
"storeName": storeName,
"tableId": tableId,
},
);
}
}
} else {
await Permission.camera.request();
}
}
}

90
lib/store/store_order.dart

@ -24,7 +24,6 @@ import 'package:huixiang/store/store_view/store_order_list.dart';
import 'package:huixiang/union/union_view/union_coupon.dart'; import 'package:huixiang/union/union_view/union_coupon.dart';
import 'package:huixiang/union/union_view/vip.dart'; import 'package:huixiang/union/union_view/vip.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_tab.dart'; import 'package:huixiang/view_widget/my_tab.dart';
import 'package:huixiang/view_widget/receive_success.dart'; import 'package:huixiang/view_widget/receive_success.dart';
@ -128,10 +127,12 @@ class _StoreOrderPage extends State<StoreOrderPage>
/// ///
getParentInfo() async { getParentInfo() async {
BaseData baseData = await minService.getParentInfo("$tableId") BaseData baseData =
.catchError((error) {debugPrint(error);}); await minService.getParentInfo("$tableId").catchError((error) {
debugPrint(error);
});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
if(baseData.data != null) { if (baseData.data != null) {
parentId = baseData.data["id"]; parentId = baseData.data["id"];
parentCode = baseData.data["parentCode"]; parentCode = baseData.data["parentCode"];
} else { } else {
@ -160,8 +161,10 @@ class _StoreOrderPage extends State<StoreOrderPage>
/// ///
queryStoreInfo() async { queryStoreInfo() async {
BaseData baseData = await apiService.queryStoreInfo(storeId) BaseData baseData =
.catchError((error) {debugPrint(error);}); await apiService.queryStoreInfo(storeId).catchError((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
@ -175,10 +178,21 @@ class _StoreOrderPage extends State<StoreOrderPage>
} }
RefreshController refreshController; RefreshController refreshController;
bool dialogShowing = false;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Stack( return WillPopScope(
onWillPop: () async {
if (dialogShowing) {
debugPrint("ssssasdadsasdadasd");
SmartDialog.dismiss();
return false;
} else {
return true;
}
},
child: Stack(
children: [ children: [
Positioned( Positioned(
left: 0, left: 0,
@ -348,7 +362,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
], ],
controller: tabcontroller, controller: tabcontroller,
), ),
),/*SmartRefresher( ), /*SmartRefresher(
controller: refreshController = controller: refreshController =
RefreshController(initialRefresh: false), RefreshController(initialRefresh: false),
enablePullDown: true, enablePullDown: true,
@ -443,6 +457,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
), ),
), ),
], ],
),
); );
} }
@ -568,19 +583,34 @@ class _StoreOrderPage extends State<StoreOrderPage>
showShoppingCart() { showShoppingCart() {
queryShopCar().then((value) { queryShopCar().then((value) {
this.shopCarGoods = value; this.shopCarGoods = value;
showModalBottomSheet( // showModalBottomSheet(
context: context, // context: context,
backgroundColor: Colors.transparent, // backgroundColor: Colors.transparent,
builder: (context) { // builder: (context) {
return ShopCar( // return ShopCar(
// shopCartKey,
// this.shopCarGoods,
// clearShopCar,
// toDownOrder,
// shopCartAdd,
// shopCartReduce,
// );
// },
// );
dialogShowing = true;
SmartDialog.show(
widget: ShopCar(
shopCartKey, shopCartKey,
this.shopCarGoods, this.shopCarGoods,
clearShopCar, clearShopCar,
toDownOrder, toDownOrder,
shopCartAdd, shopCartAdd,
shopCartReduce, shopCartReduce,
); ),
onDismiss: () {
dialogShowing = false;
}, },
alignmentTemp: Alignment.bottomCenter,
); );
}); });
} }
@ -604,20 +634,20 @@ class _StoreOrderPage extends State<StoreOrderPage>
/// ///
showStoreSelector(MiNiDetail miNiDetail, String id) async { showStoreSelector(MiNiDetail miNiDetail, String id) async {
showModalBottomSheet( dialogShowing = true;
context: context, SmartDialog.show(
backgroundColor: Colors.transparent, widget: ProductSku(
builder: (context) {
return ProductSku(
miNiDetail, miNiDetail,
shopCarGoods, shopCarGoods,
id, id,
_addShopCar, _addShopCar,
add, add,
reduce, reduce,
); ),
onDismiss: () {
dialogShowing = false;
}, },
); alignmentTemp: Alignment.bottomCenter,);
} }
/// ///
@ -687,41 +717,43 @@ class _StoreOrderPage extends State<StoreOrderPage>
} }
///1 ///1
shopCartAdd(ShoppingCartSkuItemListBean cartSkuItem) async { Future<ShoppingCart> shopCartAdd(
ShoppingCartSkuItemListBean cartSkuItem) async {
Map<String, dynamic> shopCarTemp = shopCarGoods.toJson(); Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
cartSkuItem.buyNum += 1; cartSkuItem.buyNum += 1;
shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
BaseData<List<ShoppingCart>> baseDate = BaseData<List<ShoppingCart>> baseDate =
await minService.shoppingCartSingle(shopCarTemp); await minService.shoppingCartSingle(shopCarTemp);
if (baseDate.isSuccess) { if (baseDate.isSuccess) {
queryShopCar().then((value) { this.shopCarGoods = await queryShopCar();
this.shopCarGoods = value;
print("shopingCar111111: ${this.shopCarGoods.toJson()}"); print("shopingCar111111: ${this.shopCarGoods.toJson()}");
if (shopCartKey != null) { if (shopCartKey != null) {
shopCartKey.currentState.setState(() {}); shopCartKey.currentState.setState(() {});
} }
setState(() {}); setState(() {});
});
} }
return this.shopCarGoods;
} }
///1 ///1
shopCartReduce(ShoppingCartSkuItemListBean cartSkuItem) async { Future<ShoppingCart> shopCartReduce(
ShoppingCartSkuItemListBean cartSkuItem) async {
Map<String, dynamic> shopCarTemp = shopCarGoods.toJson(); Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
cartSkuItem.buyNum -= 1; cartSkuItem.buyNum -= 1;
shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
BaseData<List<ShoppingCart>> baseDate = BaseData<List<ShoppingCart>> baseDate =
await minService.shoppingCartSingle(shopCarTemp); await minService.shoppingCartSingle(shopCarTemp);
if (baseDate.isSuccess) { if (baseDate.isSuccess) {
queryShopCar().then((value) { this.shopCarGoods = await queryShopCar();
this.shopCarGoods = value;
print("shopingCar111111: ${this.shopCarGoods.toJson()}"); print("shopingCar111111: ${this.shopCarGoods.toJson()}");
if (shopCartKey != null) { if (shopCartKey != null) {
shopCartKey.currentState.setState(() {}); shopCartKey.currentState.setState(() {});
} }
setState(() {}); setState(() {});
});
} }
return this.shopCarGoods;
} }
///1 ///1

21
lib/store/store_view/product_sku.dart

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/retrofit/data/miNiDetail.dart'; import 'package:huixiang/retrofit/data/miNiDetail.dart';
@ -59,7 +60,6 @@ class _ProductSku extends State<ProductSku> {
if (shopSkuIndex >= 0) { if (shopSkuIndex >= 0) {
count = widget.shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum; count = widget.shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum;
} }
} }
bool skuY(ProductSkuVOListBean productSku, selectSkus) { bool skuY(ProductSkuVOListBean productSku, selectSkus) {
@ -76,7 +76,13 @@ class _ProductSku extends State<ProductSku> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return StatefulBuilder(builder: (context1, state) { return WillPopScope(
onWillPop: () async {
debugPrint("ssssasdadsasdadasd");
SmartDialog.dismiss();
return true;
},
child: StatefulBuilder(builder: (context1, state) {
return Container( return Container(
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
padding: EdgeInsets.only( padding: EdgeInsets.only(
@ -84,6 +90,7 @@ class _ProductSku extends State<ProductSku> {
left: 16, left: 16,
right: 16, right: 16,
), ),
height: MediaQuery.of(context).size.height / 3 * 2,
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFFFAFAFA), color: Color(0xFFFAFAFA),
@ -159,7 +166,8 @@ class _ProductSku extends State<ProductSku> {
Spacer(), Spacer(),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.of(context).pop(); // Navigator.of(context).pop();
SmartDialog.dismiss();
}, },
child: Image.asset( child: Image.asset(
"assets/image/icon_order_cancel.png", "assets/image/icon_order_cancel.png",
@ -177,6 +185,7 @@ class _ProductSku extends State<ProductSku> {
itemCount: widget.miNiDetail.attrList.length, itemCount: widget.miNiDetail.attrList.length,
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
padding: EdgeInsets.zero,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return attrItem( return attrItem(
(index) { (index) {
@ -261,6 +270,8 @@ class _ProductSku extends State<ProductSku> {
backgroup: Color(0xFF32A060), backgroup: Color(0xFF32A060),
fontSize: 16.sp, fontSize: 16.sp,
callback: () { callback: () {
// Navigator.of(context).pop();
SmartDialog.dismiss();
widget.addShopCar(widget.miNiDetail, selectSkus, 1); widget.addShopCar(widget.miNiDetail, selectSkus, 1);
}, },
), ),
@ -270,7 +281,8 @@ class _ProductSku extends State<ProductSku> {
], ],
), ),
); );
}); }),
);
} }
Widget attrItem(Function fc, AttrListBean attrListBean, position) { Widget attrItem(Function fc, AttrListBean attrListBean, position) {
@ -297,6 +309,7 @@ class _ProductSku extends State<ProductSku> {
return GridView.builder( return GridView.builder(
itemCount: arrays.length, itemCount: arrays.length,
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.zero,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
//Widget数量 //Widget数量

41
lib/store/store_view/shop_car.dart

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/shoppingCart.dart'; import 'package:huixiang/retrofit/data/shoppingCart.dart';
import 'package:huixiang/store/store_view/shop_goods.dart'; import 'package:huixiang/store/store_view/shop_goods.dart';
@ -32,10 +33,15 @@ class ShopCar extends StatefulWidget {
} }
class _ShopCar extends State<ShopCar> { class _ShopCar extends State<ShopCar> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return StatefulBuilder( return WillPopScope(
onWillPop: () async {
debugPrint("ssssasdadsasdadasd");
SmartDialog.dismiss();
return true;
},
child: StatefulBuilder(
builder: (context1, state) { builder: (context1, state) {
return Container( return Container(
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
@ -105,16 +111,20 @@ class _ShopCar extends State<ShopCar> {
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return ShopGoods( return ShopGoods(
(ShoppingCartSkuItemListBean cart) { (ShoppingCartSkuItemListBean cart) async {
widget.shopCartAdd(cart); widget.shopingCar =
await widget.shopCartAdd(cart);
setState(() {});
}, },
(ShoppingCartSkuItemListBean cart) { (ShoppingCartSkuItemListBean cart) async {
widget.shopCartReduce(cart); widget.shopingCar =
await widget.shopCartReduce(cart);
setState(() {});
}, },
count: widget.shopingCar count: widget.shopingCar
.shoppingCartSkuItemList[position].buyNum, .shoppingCartSkuItemList[position].buyNum,
shoppingCartSkuItemListBean: shoppingCartSkuItemListBean: widget.shopingCar
widget.shopingCar.shoppingCartSkuItemList[position], .shoppingCartSkuItemList[position],
queryMiNiDetail: widget.queryMiNiDetail, queryMiNiDetail: widget.queryMiNiDetail,
); );
}, },
@ -188,7 +198,8 @@ class _ShopCar extends State<ShopCar> {
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.of(context).pop(); // Navigator.of(context).pop();
SmartDialog.dismiss();
}, },
child: Image.asset( child: Image.asset(
"assets/image/shopp.png", "assets/image/shopp.png",
@ -209,8 +220,8 @@ class _ShopCar extends State<ShopCar> {
fontSize: 12.sp, fontSize: 12.sp,
radius: 100, radius: 100,
callback: () { callback: () {
Navigator.of(context) // Navigator.of(context)
.pushNamed('/router/test_page'); // .pushNamed('/router/test_page');
}, },
), ),
), ),
@ -227,12 +238,16 @@ class _ShopCar extends State<ShopCar> {
), ),
); );
}, },
),
); );
} }
int itemCount() { int itemCount() {
if (widget.shopingCar == null || widget.shopingCar.shoppingCartSkuItemList == null || widget.shopingCar.shoppingCartSkuItemList.length == 0) return 0; if (widget.shopingCar == null ||
int index = widget.shopingCar.shoppingCartSkuItemList.indexWhere((element) => element.buyNum == 0); widget.shopingCar.shoppingCartSkuItemList == null ||
widget.shopingCar.shoppingCartSkuItemList.length == 0) return 0;
int index = widget.shopingCar.shoppingCartSkuItemList
.indexWhere((element) => element.buyNum == 0);
if (index >= 0) { if (index >= 0) {
widget.shopingCar.shoppingCartSkuItemList.removeAt(index); widget.shopingCar.shoppingCartSkuItemList.removeAt(index);
} }

4
lib/store/store_view/store_order_list.dart

@ -1,4 +1,3 @@
import 'package:ai_decimal_accuracy/ai_decimal_accuracy.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/retrofit/data/activity.dart'; import 'package:huixiang/retrofit/data/activity.dart';
@ -11,9 +10,7 @@ import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/store_view/shop_goods.dart'; import 'package:huixiang/store/store_view/shop_goods.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
class StoreOrderListPage extends StatefulWidget { class StoreOrderListPage extends StatefulWidget {
@ -64,6 +61,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
context: context, context: context,
token: minToken, token: minToken,
tenant: tenant, tenant: tenant,
storeId: widget.arguments["id"],
); );
BaseData<List<FindMiNiGroupList>> baseData = BaseData<List<FindMiNiGroupList>> baseData =

64
lib/union/union_page.dart

@ -14,6 +14,7 @@ import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/store.dart'; import 'package:huixiang/retrofit/data/store.dart';
import 'package:huixiang/retrofit/data/store_type.dart'; import 'package:huixiang/retrofit/data/store_type.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/scan.dart';
import 'package:huixiang/utils/event_type.dart'; import 'package:huixiang/utils/event_type.dart';
import 'package:huixiang/utils/location.dart'; import 'package:huixiang/utils/location.dart';
import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/classic_header.dart';
@ -272,10 +273,15 @@ class _UnionPage extends State<UnionPage>
), ),
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return InkWell(
onTap: () { onTap: () {
if(storeList[position].posType.code == "NORMALSTORE") { if (storeList[position].posType.code == "NORMALSTORE") {
toScan(storeList[position]); Scan.toScan(
context,
storeList[position].id,
storeList[position].tenantCode,
storeList[position].storeName,
);
} else { } else {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/store_order', '/router/store_order',
@ -301,58 +307,6 @@ class _UnionPage extends State<UnionPage>
_mapController = controller; _mapController = controller;
} }
toScan(Store store) async {
// Navigator.of(context).pushNamed(
// '/router/store_order',
// arguments: {
// "id": store.id,
// "tenant": store.tenantCode,
// "storeName": store.storeName,
// "tableId": 1315903669597634560,
// },
// );
if (await Permission.camera.isPermanentlyDenied) {
showCupertinoDialog(
context: context,
builder: (context) {
return RequestPermission(
"assets/image/icon_camera_permission_tips.png",
S.of(context).ninxiangjiquanxianweikaiqi,
S.of(context).weilekaipaizhaoxuanzhetouxiang,
S.of(context).kaiqiquanxian,
(result) async {
if (result) {
await openAppSettings();
}
},
heightRatioWithWidth: 0.82,
);
});
} else if (await Permission.camera.isGranted) {
var result = await Navigator.of(context).pushNamed('/router/qr_scan');
if (result != null && result != "") {
Uri uri = Uri.parse(result);
String table = uri.queryParameters["tableId"];
if (table != null && table != "") {
int tableId = int.tryParse(table);
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {
"id": store.id,
"tenant": store.tenantCode,
"storeName": store.storeName,
"tableId": tableId,
},
);
}
}
} else {
await Permission.camera.request();
}
}
Widget buildSearchItem() { Widget buildSearchItem() {
return Container( return Container(
height: 36.h, height: 36.h,

26
lib/view_widget/selector_store_dialog.dart

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/store.dart'; import 'package:huixiang/retrofit/data/store.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/store/scan.dart';
import 'package:huixiang/view_widget/border_text.dart'; import 'package:huixiang/view_widget/border_text.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
@ -101,9 +102,24 @@ class _SelectorStoreWidget extends State<SelectorStoreWidget> {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.of(context).popAndPushNamed( if(widget.stores[selectIndex].posType.code == "NORMALSTORE") {
'/router/union_detail_page', Scan.toScan(
arguments: {"id": widget.stores[selectIndex].id}); context,
widget.stores[selectIndex].id,
widget.stores[selectIndex].tenantCode,
widget.stores[selectIndex].storeName,
);
} else {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {
"id": widget.stores[selectIndex].id,
"tenant": widget.stores[selectIndex].tenantCode,
"storeName": widget.stores[selectIndex].storeName
},
);
}
}, },
child: RoundButton( child: RoundButton(
text: S.of(context).queding, text: S.of(context).queding,
@ -117,9 +133,9 @@ class _SelectorStoreWidget extends State<SelectorStoreWidget> {
horizontal: 42.w, horizontal: 42.w,
), ),
), ),
) ),
], ],
) ),
], ],
), ),
); );

27
lib/web/web_view/web_header.dart

@ -61,13 +61,26 @@ class _WebHeader extends State<WebHeader> {
widget.arguments["source"] == widget.activity.storeId) { widget.arguments["source"] == widget.activity.storeId) {
Navigator.of(context).pop(); Navigator.of(context).pop();
} else { } else {
Navigator.of(context).pushNamed( // Navigator.of(context).pushNamed(
'/router/union_detail_page', // '/router/union_detail_page',
arguments: { // arguments: {
"id": widget.activity.storeId, // "id": widget.activity.storeId,
"source": widget.arguments["activityId"] // "source": widget.arguments["activityId"]
}, // },
); // );
///TODO:
// if(widget.stores[selectIndex].posType.code == "NORMALSTORE") {
// toScan(widget.stores[selectIndex]);
// } else {
// Navigator.of(context).pushNamed(
// '/router/store_order',
// arguments: {
// "id": widget.activity.storeId,
// "tenant": widget.stores[selectIndex].tenantCode,
// "storeName": widget.activity.storeName
// },
// );
// }
} }
} }
}, },

Loading…
Cancel
Save