diff --git a/lib/mine/mine_view/mine_view.dart b/lib/mine/mine_view/mine_view.dart index f75b1af5..ac4a545e 100644 --- a/lib/mine/mine_view/mine_view.dart +++ b/lib/mine/mine_view/mine_view.dart @@ -23,7 +23,6 @@ class MineView extends StatefulWidget { } class _MineView extends State { - @override Widget build(BuildContext context) { return Column( @@ -91,7 +90,23 @@ class _MineView extends State { ); }); } 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 { await Permission.camera.request(); } @@ -107,31 +122,31 @@ class _MineView extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ InkWell( - onTap: () { - widget.toUserInfo(); - }, - child: Stack( - children: [ - MImage( - widget.userInfo == null ? "" : widget.userInfo.headimg, - isCircle: true, - width: 50, - height: 50, - fit: BoxFit.cover, - errorSrc: "assets/image/default_user.png", - fadeSrc: "assets/image/default_user.png", - ), - Positioned( - bottom: 0, - right: 2.w, - child: Image.asset( - "assets/image/icon_mine_edit.png", - width: 17.w, - height: 17.w, - ), + onTap: () { + widget.toUserInfo(); + }, + child: Stack( + children: [ + MImage( + widget.userInfo == null ? "" : widget.userInfo.headimg, + isCircle: true, + width: 50, + height: 50, + fit: BoxFit.cover, + errorSrc: "assets/image/default_user.png", + fadeSrc: "assets/image/default_user.png", + ), + Positioned( + bottom: 0, + right: 2.w, + child: Image.asset( + "assets/image/icon_mine_edit.png", + width: 17.w, + height: 17.w, ), - ], - ), + ), + ], + ), ), SizedBox( width: 10.w, @@ -145,13 +160,16 @@ class _MineView extends State { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ widget.userInfo == null - ? Text( - S.of(context).denglu, - style: TextStyle( - fontSize: 16.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF353535), + ? InkWell( + child: Text( + S.of(context).denglu, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF353535), + ), ), + onTap: widget.toUserInfo, ) : Row( children: [ diff --git a/lib/mine/vip_detail_page.dart b/lib/mine/vip_detail_page.dart index d6e0794a..a9dc9c4e 100644 --- a/lib/mine/vip_detail_page.dart +++ b/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/vip_card.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/location.dart'; import 'package:huixiang/utils/painter_bg.dart'; @@ -432,8 +433,25 @@ class _VipDetailPage extends State { ), GestureDetector( onTap: () { - Navigator.of(context).pushNamed('/router/union_detail_page', - arguments: {"id": store.id}); + // Navigator.of(context).pushNamed('/router/union_detail_page', + // 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( S.of(context).chakan, diff --git a/lib/order/order_history_page.dart b/lib/order/order_history_page.dart index 3c221b8a..3a8477c0 100644 --- a/lib/order/order_history_page.dart +++ b/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/min_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/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/custom_image.dart'; @@ -442,11 +443,7 @@ class _OrderHistoryList extends State orderInfo.refundStatus, orderInfo.dayFlowCode, (type) { if (type == 0) { - String storeId = (orderInfo != null && - orderInfo.storeVO != null) - ? (orderInfo.storeVO.id ?? "") - : ""; - aginOrder(storeId); + aginOrder(orderInfo); } else if (type == 1) { SmartDialog.show( widget: Tips( @@ -539,11 +536,33 @@ class _OrderHistoryList extends State } } - aginOrder(storeId) { - Navigator.of(context).pushNamed( - '/router/union_detail_page', - arguments: {"id": 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( + '/router/store_order', + arguments: { + "id": orderInfo.storeVO.id, + "tenant": orderInfo.tenantCode, + "storeName": orderInfo.storeVO.storeName + }, + ); + } } String totalPrice(orderInfo) { diff --git a/lib/order/order_view/order_address.dart b/lib/order/order_view/order_address.dart index f1928911..ce4e50f5 100644 --- a/lib/order/order_view/order_address.dart +++ b/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:huixiang/generated/l10n.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/view_widget/border_text.dart'; import 'package:huixiang/view_widget/round_button.dart'; @@ -258,6 +259,25 @@ class _OrderAddress extends State { aginOrder(storeId, storeName) { Navigator.of(context).pushNamed('/router/union_detail_page', 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 { diff --git a/lib/store/scan.dart b/lib/store/scan.dart new file mode 100644 index 00000000..be947359 --- /dev/null +++ b/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(); + } + + } + +} \ No newline at end of file diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index b821c434..2f1987ad 100644 --- a/lib/store/store_order.dart +++ b/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/vip.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/my_tab.dart'; import 'package:huixiang/view_widget/receive_success.dart'; @@ -128,10 +127,12 @@ class _StoreOrderPage extends State ///获取父订单(火锅订单加菜前调用) getParentInfo() async { - BaseData baseData = await minService.getParentInfo("$tableId") - .catchError((error) {debugPrint(error);}); + BaseData baseData = + await minService.getParentInfo("$tableId").catchError((error) { + debugPrint(error); + }); if (baseData != null && baseData.isSuccess) { - if(baseData.data != null) { + if (baseData.data != null) { parentId = baseData.data["id"]; parentCode = baseData.data["parentCode"]; } else { @@ -160,8 +161,10 @@ class _StoreOrderPage extends State /// 查询店铺信息 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 @@ -175,180 +178,191 @@ class _StoreOrderPage extends State } RefreshController refreshController; + bool dialogShowing = false; @override Widget build(BuildContext context) { - return Stack( - children: [ - Positioned( - left: 0, - right: 0, - top: 0, - bottom: 54.h, - child: NestedScrollView( - controller: controller, - dragStartBehavior: DragStartBehavior.start, - physics: BouncingScrollPhysics(), - headerSliverBuilder: (BuildContext context, bool innerScrolled) { - return [ - SliverOverlapAbsorber( - handle: NestedScrollView.sliverOverlapAbsorberHandleFor( - context), - sliver: SliverAppBar( - expandedHeight: - (storeInfo != null && storeInfo.couponVOList != null) - ? 470.h - : 365.h, - floating: false, - snap: false, - pinned: true, - stretch: false, - brightness: Brightness.light, - leading: GestureDetector( - onTap: () { - Navigator.of(context).pop(); - }, - child: Container( - alignment: Alignment.centerRight, - margin: EdgeInsets.only(left: 10), - padding: EdgeInsets.all(6), - child: Icon( - Icons.arrow_back_ios, - color: Colors.black, - size: 24, + return WillPopScope( + onWillPop: () async { + if (dialogShowing) { + debugPrint("ssssasdadsasdadasd"); + SmartDialog.dismiss(); + return false; + } else { + return true; + } + }, + child: Stack( + children: [ + Positioned( + left: 0, + right: 0, + top: 0, + bottom: 54.h, + child: NestedScrollView( + controller: controller, + dragStartBehavior: DragStartBehavior.start, + physics: BouncingScrollPhysics(), + headerSliverBuilder: (BuildContext context, bool innerScrolled) { + return [ + SliverOverlapAbsorber( + handle: NestedScrollView.sliverOverlapAbsorberHandleFor( + context), + sliver: SliverAppBar( + expandedHeight: + (storeInfo != null && storeInfo.couponVOList != null) + ? 470.h + : 365.h, + floating: false, + snap: false, + pinned: true, + stretch: false, + brightness: Brightness.light, + leading: GestureDetector( + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + alignment: Alignment.centerRight, + margin: EdgeInsets.only(left: 10), + padding: EdgeInsets.all(6), + child: Icon( + Icons.arrow_back_ios, + color: Colors.black, + size: 24, + ), ), ), - ), - flexibleSpace: FlexibleSpaceBar( - title: Title( - controller, - storeInfo != null ? storeInfo.storeName : '', - ), - collapseMode: CollapseMode.pin, - stretchModes: [ - StretchMode.zoomBackground, - StretchMode.fadeTitle, - StretchMode.blurBackground, - ], - background: Stack( - children: [ - Positioned( - child: Column( - children: [ - buildSwiper(), - Expanded( - child: Container( - color: Colors.transparent, - ), - flex: 1, - ), - ], - ), - top: 0, - bottom: 0, - left: 0, - right: 0, - ), - Positioned( - child: Container( + flexibleSpace: FlexibleSpaceBar( + title: Title( + controller, + storeInfo != null ? storeInfo.storeName : '', + ), + collapseMode: CollapseMode.pin, + stretchModes: [ + StretchMode.zoomBackground, + StretchMode.fadeTitle, + StretchMode.blurBackground, + ], + background: Stack( + children: [ + Positioned( child: Column( children: [ - ///门店信息 - StoreInfoView(storeInfo), - - ///门店对应优惠券 - if (storeInfo != null && - storeInfo.couponVOList != null) - UnionCoupon( - storeInfo, - _receiveCoupon, - coupon: true, - ), - - if (storeInfo == null || - storeInfo.couponVOList == null) - SizedBox( - height: 8, + buildSwiper(), + Expanded( + child: Container( + color: Colors.transparent, ), - - ///门店对应VIP信息 - Vip(storeInfo, () {}, false), + flex: 1, + ), ], ), + top: 0, + bottom: 0, + left: 0, + right: 0, ), - top: 110.h, - bottom: 0, - left: 0, - right: 0, - ), - ], - ), - ), - backgroundColor: Color(0x33FAFAFA), - centerTitle: false, - elevation: 0, - bottom: PreferredSize( - preferredSize: Size( - MediaQuery.of(context).size.width, - 38, + Positioned( + child: Container( + child: Column( + children: [ + ///门店信息 + StoreInfoView(storeInfo), + + ///门店对应优惠券 + if (storeInfo != null && + storeInfo.couponVOList != null) + UnionCoupon( + storeInfo, + _receiveCoupon, + coupon: true, + ), + + if (storeInfo == null || + storeInfo.couponVOList == null) + SizedBox( + height: 8, + ), + + ///门店对应VIP信息 + Vip(storeInfo, () {}, false), + ], + ), + ), + top: 110.h, + bottom: 0, + left: 0, + right: 0, + ), + ], + ), ), - child: Container( - padding: EdgeInsets.symmetric(horizontal: 10.w), - width: MediaQuery.of(context).size.width, - child: TabBar( - controller: tabcontroller, - automaticIndicatorColorAdjustment: true, - isScrollable: true, - indicatorWeight: 1, - indicatorColor: Color(0xFFFAFAFA), - labelPadding: EdgeInsets.only( - left: 8.w, - right: 8.w, - ), - indicatorSize: TabBarIndicatorSize.label, - unselectedLabelStyle: TextStyle( - fontSize: 15.sp, - fontWeight: FontWeight.w400, - ), - labelStyle: TextStyle( - color: Colors.black, - fontSize: 18.sp, - fontWeight: FontWeight.bold, + backgroundColor: Color(0x33FAFAFA), + centerTitle: false, + elevation: 0, + bottom: PreferredSize( + preferredSize: Size( + MediaQuery.of(context).size.width, + 38, + ), + child: Container( + padding: EdgeInsets.symmetric(horizontal: 10.w), + width: MediaQuery.of(context).size.width, + child: TabBar( + controller: tabcontroller, + automaticIndicatorColorAdjustment: true, + isScrollable: true, + indicatorWeight: 1, + indicatorColor: Color(0xFFFAFAFA), + labelPadding: EdgeInsets.only( + left: 8.w, + right: 8.w, + ), + indicatorSize: TabBarIndicatorSize.label, + unselectedLabelStyle: TextStyle( + fontSize: 15.sp, + fontWeight: FontWeight.w400, + ), + labelStyle: TextStyle( + color: Colors.black, + fontSize: 18.sp, + fontWeight: FontWeight.bold, + ), + labelColor: Colors.black, + tabs: [ + MyTab(text: S.of(context).diancan), + MyTab(text: S.of(context).xindianhuodong), + ], ), - labelColor: Colors.black, - tabs: [ - MyTab(text: S.of(context).diancan), - MyTab(text: S.of(context).xindianhuodong), - ], ), ), ), ), - ), - ]; - }, - body: TabBarView( - physics: NeverScrollableScrollPhysics(), - children: [ - ///点餐 - StoreOrderListPage( - widget.arguments, - activitys, - storeInfo, - shopCarGoods, - controller, - _queryMiNiDetail, - ), + ]; + }, + body: TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + ///点餐 + StoreOrderListPage( + widget.arguments, + activitys, + storeInfo, + shopCarGoods, + controller, + _queryMiNiDetail, + ), - ///星店活动, - StoreActivity( - widget.arguments, - activitys, - ), - ], - controller: tabcontroller, - ), - ),/*SmartRefresher( + ///星店活动, + StoreActivity( + widget.arguments, + activitys, + ), + ], + controller: tabcontroller, + ), + ), /*SmartRefresher( controller: refreshController = RefreshController(initialRefresh: false), enablePullDown: true, @@ -360,89 +374,90 @@ class _StoreOrderPage extends State }, child: ),*/ - ), - Positioned( - bottom: 0, - left: 0, - right: 0, - child: Stack( - alignment: Alignment.bottomLeft, - children: [ - Container( - height: 54.h, - color: Color(0xFFFAFAFA), - child: Row( - children: [ - Spacer(), - Text( - S.of(context).heji, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Colors.black, + ), + Positioned( + bottom: 0, + left: 0, + right: 0, + child: Stack( + alignment: Alignment.bottomLeft, + children: [ + Container( + height: 54.h, + color: Color(0xFFFAFAFA), + child: Row( + children: [ + Spacer(), + Text( + S.of(context).heji, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.black, + ), ), - ), - Text( - "¥${shopCarGoods != null ? shopCarGoods.cartSum : "0.0"}", - style: TextStyle( - fontSize: 20.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF32A060), + Text( + "¥${shopCarGoods != null ? shopCarGoods.cartSum : "0.0"}", + style: TextStyle( + fontSize: 20.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), ), - ), - Spacer(), - GestureDetector( + Spacer(), + GestureDetector( + onTap: () { + toDownOrder(); + }, + child: RoundButton( + width: 103.w, + height: 54.h, + text: S.current.jiesuan, + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFF32A060), + radius: 0, + fontSize: 16.sp, + padding: EdgeInsets.symmetric(vertical: 5.h), + ), + ), + ], + ), + ), + Stack( + children: [ + InkWell( onTap: () { - toDownOrder(); + showShoppingCart(); }, + child: Image.asset( + "assets/image/shopp.png", + width: 88, + height: 88, + fit: BoxFit.fitWidth, + ), + ), + Positioned( + right: 15, + top: 14, child: RoundButton( - width: 103.w, - height: 54.h, - text: S.current.jiesuan, + width: 17, + height: 17, + text: "${count()}", textColor: Colors.white, fontWeight: MyFontWeight.regular, backgroup: Color(0xFF32A060), - radius: 0, - fontSize: 16.sp, - padding: EdgeInsets.symmetric(vertical: 5.h), + fontSize: 12.sp, + radius: 100, ), ), ], ), - ), - Stack( - children: [ - InkWell( - onTap: () { - showShoppingCart(); - }, - child: Image.asset( - "assets/image/shopp.png", - width: 88, - height: 88, - fit: BoxFit.fitWidth, - ), - ), - Positioned( - right: 15, - top: 14, - child: RoundButton( - width: 17, - height: 17, - text: "${count()}", - textColor: Colors.white, - fontWeight: MyFontWeight.regular, - backgroup: Color(0xFF32A060), - fontSize: 12.sp, - radius: 100, - ), - ), - ], - ), - ], + ], + ), ), - ), - ], + ], + ), ); } @@ -568,19 +583,34 @@ class _StoreOrderPage extends State showShoppingCart() { queryShopCar().then((value) { this.shopCarGoods = value; - showModalBottomSheet( - context: context, - backgroundColor: Colors.transparent, - builder: (context) { - return ShopCar( - shopCartKey, - this.shopCarGoods, - clearShopCar, - toDownOrder, - shopCartAdd, - shopCartReduce, - ); + // showModalBottomSheet( + // context: context, + // backgroundColor: Colors.transparent, + // builder: (context) { + // return ShopCar( + // shopCartKey, + // this.shopCarGoods, + // clearShopCar, + // toDownOrder, + // shopCartAdd, + // shopCartReduce, + // ); + // }, + // ); + dialogShowing = true; + SmartDialog.show( + widget: ShopCar( + shopCartKey, + this.shopCarGoods, + clearShopCar, + toDownOrder, + shopCartAdd, + shopCartReduce, + ), + onDismiss: () { + dialogShowing = false; }, + alignmentTemp: Alignment.bottomCenter, ); }); } @@ -604,20 +634,20 @@ class _StoreOrderPage extends State ///选规格弹窗 showStoreSelector(MiNiDetail miNiDetail, String id) async { - showModalBottomSheet( - context: context, - backgroundColor: Colors.transparent, - builder: (context) { - return ProductSku( + dialogShowing = true; + SmartDialog.show( + widget: ProductSku( miNiDetail, shopCarGoods, id, _addShopCar, add, reduce, - ); - }, - ); + ), + onDismiss: () { + dialogShowing = false; + }, + alignmentTemp: Alignment.bottomCenter,); } ///添加购物车 @@ -687,41 +717,43 @@ class _StoreOrderPage extends State } ///购物车➕1 - shopCartAdd(ShoppingCartSkuItemListBean cartSkuItem) async { + Future shopCartAdd( + ShoppingCartSkuItemListBean cartSkuItem) async { Map shopCarTemp = shopCarGoods.toJson(); cartSkuItem.buyNum += 1; shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; BaseData> baseDate = await minService.shoppingCartSingle(shopCarTemp); if (baseDate.isSuccess) { - queryShopCar().then((value) { - this.shopCarGoods = value; - print("shopingCar111111: ${this.shopCarGoods.toJson()}"); - if (shopCartKey != null) { - shopCartKey.currentState.setState(() {}); - } - setState(() {}); - }); + this.shopCarGoods = await queryShopCar(); + + print("shopingCar111111: ${this.shopCarGoods.toJson()}"); + if (shopCartKey != null) { + shopCartKey.currentState.setState(() {}); + } + setState(() {}); } + return this.shopCarGoods; } ///购物车➖1 - shopCartReduce(ShoppingCartSkuItemListBean cartSkuItem) async { + Future shopCartReduce( + ShoppingCartSkuItemListBean cartSkuItem) async { Map shopCarTemp = shopCarGoods.toJson(); cartSkuItem.buyNum -= 1; shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; BaseData> baseDate = await minService.shoppingCartSingle(shopCarTemp); if (baseDate.isSuccess) { - queryShopCar().then((value) { - this.shopCarGoods = value; - print("shopingCar111111: ${this.shopCarGoods.toJson()}"); - if (shopCartKey != null) { - shopCartKey.currentState.setState(() {}); - } - setState(() {}); - }); + this.shopCarGoods = await queryShopCar(); + + print("shopingCar111111: ${this.shopCarGoods.toJson()}"); + if (shopCartKey != null) { + shopCartKey.currentState.setState(() {}); + } + setState(() {}); } + return this.shopCarGoods; } ///商品➕1 diff --git a/lib/store/store_view/product_sku.dart b/lib/store/store_view/product_sku.dart index 7d8a6a59..829745ae 100644 --- a/lib/store/store_view/product_sku.dart +++ b/lib/store/store_view/product_sku.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/retrofit/data/miNiDetail.dart'; @@ -59,7 +60,6 @@ class _ProductSku extends State { if (shopSkuIndex >= 0) { count = widget.shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum; } - } bool skuY(ProductSkuVOListBean productSku, selectSkus) { @@ -76,201 +76,213 @@ class _ProductSku extends State { @override Widget build(BuildContext context) { - return StatefulBuilder(builder: (context1, state) { - return Container( - alignment: Alignment.topCenter, - padding: EdgeInsets.only( - top: 16, - left: 16, - right: 16, - ), - width: double.infinity, - decoration: BoxDecoration( - color: Color(0xFFFAFAFA), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - topRight: Radius.circular(8), + return WillPopScope( + onWillPop: () async { + debugPrint("ssssasdadsasdadasd"); + SmartDialog.dismiss(); + return true; + }, + child: StatefulBuilder(builder: (context1, state) { + return Container( + alignment: Alignment.topCenter, + padding: EdgeInsets.only( + top: 16, + left: 16, + right: 16, ), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - MImage( - widget.miNiDetail.imgs[0], - width: 70, - height: 70, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ), - SizedBox( - width: 10, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.miNiDetail.productName, - style: TextStyle( - color: Colors.black, - fontSize: 16.sp, - fontWeight: MyFontWeight.medium, - ), - ), - Padding( - padding: EdgeInsets.only(top: 4, bottom: 7), - child: Text( - "已选: " + - (selectSkus.map((e) => "$e").toList().toString()), + height: MediaQuery.of(context).size.height / 3 * 2, + width: double.infinity, + decoration: BoxDecoration( + color: Color(0xFFFAFAFA), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), + ), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MImage( + widget.miNiDetail.imgs[0], + width: 70, + height: 70, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + SizedBox( + width: 10, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.miNiDetail.productName, style: TextStyle( - color: Color(0xFF727272), - fontSize: 11.sp, - fontWeight: MyFontWeight.regular, + color: Colors.black, + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, ), ), - ), - Row( - children: [ - Text( - S.of(context).huiyuanjia, + Padding( + padding: EdgeInsets.only(top: 4, bottom: 7), + child: Text( + "已选: " + + (selectSkus.map((e) => "$e").toList().toString()), style: TextStyle( - color: Color(0xFFFF7A1A), - fontSize: 13.sp, - fontWeight: MyFontWeight.medium, + color: Color(0xFF727272), + fontSize: 11.sp, + fontWeight: MyFontWeight.regular, ), ), - Text( - widget.miNiDetail.price, - style: TextStyle( - color: Color(0xFFFF7A1A), - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, + ), + Row( + children: [ + Text( + S.of(context).huiyuanjia, + style: TextStyle( + color: Color(0xFFFF7A1A), + fontSize: 13.sp, + fontWeight: MyFontWeight.medium, + ), ), - ), - ], + Text( + widget.miNiDetail.price, + style: TextStyle( + color: Color(0xFFFF7A1A), + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ], + ), + ], + ), + Spacer(), + InkWell( + onTap: () { + // Navigator.of(context).pop(); + SmartDialog.dismiss(); + }, + child: Image.asset( + "assets/image/icon_order_cancel.png", + width: 22, + height: 22, ), - ], - ), - Spacer(), - InkWell( - onTap: () { - Navigator.of(context).pop(); - }, - child: Image.asset( - "assets/image/icon_order_cancel.png", - width: 22, - height: 22, ), + ], + ), + SizedBox( + height: 23, + ), + Expanded( + child: ListView.builder( + itemCount: widget.miNiDetail.attrList.length, + scrollDirection: Axis.vertical, + physics: BouncingScrollPhysics(), + padding: EdgeInsets.zero, + itemBuilder: (context, position) { + return attrItem( + (index) { + state(() { + selectSkus[position] = widget.miNiDetail + .attrList[position].attrValueList[index].attrValue; + buildCount(); + }); + }, + widget.miNiDetail.attrList[position], + position, + ); + }, ), - ], - ), - SizedBox( - height: 23, - ), - Expanded( - child: ListView.builder( - itemCount: widget.miNiDetail.attrList.length, - scrollDirection: Axis.vertical, - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return attrItem( - (index) { - state(() { - selectSkus[position] = widget.miNiDetail - .attrList[position].attrValueList[index].attrValue; - buildCount(); - }); - }, - widget.miNiDetail.attrList[position], - position, - ); - }, ), - ), - SizedBox( - height: 24, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Text( - "数量", - style: TextStyle( - color: Colors.black, - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, + SizedBox( + height: 24, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Text( + "数量", + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), ), ), - ), - InkWell( - onTap: () { - if (count > 1) - setState(() { - count -= 1; - }); - widget.reduce(widget.miNiDetail, selectSkus); - }, - child: Image.asset( - "assets/image/reduce.png", - width: 22, - height: 22, + InkWell( + onTap: () { + if (count > 1) + setState(() { + count -= 1; + }); + widget.reduce(widget.miNiDetail, selectSkus); + }, + child: Image.asset( + "assets/image/reduce.png", + width: 22, + height: 22, + ), ), - ), - Padding( - padding: EdgeInsets.only(left: 8, right: 8), - child: Text( - "$count", - style: TextStyle( - color: Colors.black, - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, + Padding( + padding: EdgeInsets.only(left: 8, right: 8), + child: Text( + "$count", + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), ), ), - ), - InkWell( - onTap: () { - setState(() { - count += 1; - }); - widget.add(widget.miNiDetail, selectSkus); - }, - child: Image.asset( - "assets/image/add.png", - width: 22, - height: 22, + InkWell( + onTap: () { + setState(() { + count += 1; + }); + widget.add(widget.miNiDetail, selectSkus); + }, + child: Image.asset( + "assets/image/add.png", + width: 22, + height: 22, + ), ), - ), - ], - ), - SizedBox( - height: 24, - ), - RoundButton( - width: double.infinity, - height: 54.h, - text: "加入购物车", - textColor: Colors.white, - fontWeight: MyFontWeight.semi_bold, - radius: 27, - backgroup: Color(0xFF32A060), - fontSize: 16.sp, - callback: () { - widget.addShopCar(widget.miNiDetail, selectSkus, 1); - }, - ), - SizedBox( - height: 21.h, - ), - ], - ), - ); - }); + ], + ), + SizedBox( + height: 24, + ), + RoundButton( + width: double.infinity, + height: 54.h, + text: "加入购物车", + textColor: Colors.white, + fontWeight: MyFontWeight.semi_bold, + radius: 27, + backgroup: Color(0xFF32A060), + fontSize: 16.sp, + callback: () { + // Navigator.of(context).pop(); + SmartDialog.dismiss(); + widget.addShopCar(widget.miNiDetail, selectSkus, 1); + }, + ), + SizedBox( + height: 21.h, + ), + ], + ), + ); + }), + ); } Widget attrItem(Function fc, AttrListBean attrListBean, position) { @@ -297,6 +309,7 @@ class _ProductSku extends State { return GridView.builder( itemCount: arrays.length, shrinkWrap: true, + padding: EdgeInsets.zero, physics: NeverScrollableScrollPhysics(), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( //一行的Widget数量 diff --git a/lib/store/store_view/shop_car.dart b/lib/store/store_view/shop_car.dart index 3dbd5624..d706f898 100644 --- a/lib/store/store_view/shop_car.dart +++ b/lib/store/store_view/shop_car.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/shoppingCart.dart'; import 'package:huixiang/store/store_view/shop_goods.dart'; @@ -32,207 +33,221 @@ class ShopCar extends StatefulWidget { } class _ShopCar extends State { - @override Widget build(BuildContext context) { - return StatefulBuilder( - builder: (context1, state) { - return Container( - alignment: Alignment.topCenter, - width: double.infinity, - height: MediaQuery.of(context).size.height / 2, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - topRight: Radius.circular(8), + return WillPopScope( + onWillPop: () async { + debugPrint("ssssasdadsasdadasd"); + SmartDialog.dismiss(); + return true; + }, + child: StatefulBuilder( + builder: (context1, state) { + return Container( + alignment: Alignment.topCenter, + width: double.infinity, + height: MediaQuery.of(context).size.height / 2, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), + ), ), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.only( - top: 16, - left: 16, - right: 16, - bottom: 8, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "已选商品", - style: TextStyle( - color: Colors.black, - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only( + top: 16, + left: 16, + right: 16, + bottom: 8, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "已选商品", + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), ), - ), - InkWell( - onTap: () { - widget.shopingCar.shoppingCartSkuItemList.clear(); - state(() {}); - widget.clearShopCar(); - }, - child: Image.asset( - "assets/image/delete.png", - width: 22, - height: 22, + InkWell( + onTap: () { + widget.shopingCar.shoppingCartSkuItemList.clear(); + state(() {}); + widget.clearShopCar(); + }, + child: Image.asset( + "assets/image/delete.png", + width: 22, + height: 22, + ), ), - ), - ], + ], + ), ), - ), - Expanded( - child: Stack( - children: [ - Positioned( - top: 0, - left: 0, - right: 0, - bottom: 54, - child: Container( - padding: EdgeInsets.only( - top: 8, - left: 16, - right: 16, - ), - child: ListView.builder( - itemCount: itemCount(), - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return ShopGoods( - (ShoppingCartSkuItemListBean cart) { - widget.shopCartAdd(cart); - }, - (ShoppingCartSkuItemListBean cart) { - widget.shopCartReduce(cart); - }, - count: widget.shopingCar - .shoppingCartSkuItemList[position].buyNum, - shoppingCartSkuItemListBean: - widget.shopingCar.shoppingCartSkuItemList[position], - queryMiNiDetail: widget.queryMiNiDetail, - ); - }, + Expanded( + child: Stack( + children: [ + Positioned( + top: 0, + left: 0, + right: 0, + bottom: 54, + child: Container( + padding: EdgeInsets.only( + top: 8, + left: 16, + right: 16, + ), + child: ListView.builder( + itemCount: itemCount(), + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return ShopGoods( + (ShoppingCartSkuItemListBean cart) async { + widget.shopingCar = + await widget.shopCartAdd(cart); + setState(() {}); + }, + (ShoppingCartSkuItemListBean cart) async { + widget.shopingCar = + await widget.shopCartReduce(cart); + setState(() {}); + }, + count: widget.shopingCar + .shoppingCartSkuItemList[position].buyNum, + shoppingCartSkuItemListBean: widget.shopingCar + .shoppingCartSkuItemList[position], + queryMiNiDetail: widget.queryMiNiDetail, + ); + }, + ), ), ), - ), - Positioned( - bottom: 0, - left: 0, - right: 0, - child: Stack( - alignment: Alignment.bottomLeft, - children: [ - Container( - height: 54.h, - decoration: BoxDecoration( - color: Color(0xFFFAFAFA), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(8), - offset: Offset(0, -1), - blurRadius: 3, - spreadRadius: 0, - ), - ], - ), - child: Row( - children: [ - Spacer(), - Text( - S.of(context).heji, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Colors.black, + Positioned( + bottom: 0, + left: 0, + right: 0, + child: Stack( + alignment: Alignment.bottomLeft, + children: [ + Container( + height: 54.h, + decoration: BoxDecoration( + color: Color(0xFFFAFAFA), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(8), + offset: Offset(0, -1), + blurRadius: 3, + spreadRadius: 0, ), - ), - Text( - "¥" + - (widget.shopingCar == null - ? "0.0" - : widget.shopingCar.cartSum), - style: TextStyle( - fontSize: 20.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF32A060), + ], + ), + child: Row( + children: [ + Spacer(), + Text( + S.of(context).heji, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.black, + ), ), - ), - Spacer(), - GestureDetector( + Text( + "¥" + + (widget.shopingCar == null + ? "0.0" + : widget.shopingCar.cartSum), + style: TextStyle( + fontSize: 20.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + Spacer(), + GestureDetector( + onTap: () { + widget.toDownOrder(); + }, + child: RoundButton( + width: 103.w, + height: 54.h, + text: S.current.jiesuan, + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFF32A060), + radius: 0, + fontSize: 16.sp, + padding: + EdgeInsets.symmetric(vertical: 5.h), + ), + ), + ], + ), + ), + Stack( + children: [ + InkWell( onTap: () { - widget.toDownOrder(); + // Navigator.of(context).pop(); + SmartDialog.dismiss(); }, + child: Image.asset( + "assets/image/shopp.png", + width: 88, + height: 88, + ), + ), + Positioned( + right: 15, + top: 14, child: RoundButton( - width: 103.w, - height: 54.h, - text: S.current.jiesuan, + width: 17, + height: 17, + text: "${count()}", textColor: Colors.white, fontWeight: MyFontWeight.regular, backgroup: Color(0xFF32A060), - radius: 0, - fontSize: 16.sp, - padding: - EdgeInsets.symmetric(vertical: 5.h), + fontSize: 12.sp, + radius: 100, + callback: () { + // Navigator.of(context) + // .pushNamed('/router/test_page'); + }, ), ), ], ), - ), - Stack( - children: [ - InkWell( - onTap: () { - Navigator.of(context).pop(); - }, - child: Image.asset( - "assets/image/shopp.png", - width: 88, - height: 88, - ), - ), - Positioned( - right: 15, - top: 14, - child: RoundButton( - width: 17, - height: 17, - text: "${count()}", - textColor: Colors.white, - fontWeight: MyFontWeight.regular, - backgroup: Color(0xFF32A060), - fontSize: 12.sp, - radius: 100, - callback: () { - Navigator.of(context) - .pushNamed('/router/test_page'); - }, - ), - ), - ], - ), - ], + ], + ), ), - ), - ], + ], + ), + flex: 1, ), - flex: 1, - ), - ], - ), - ); - }, + ], + ), + ); + }, + ), ); } int itemCount() { - if (widget.shopingCar == null || widget.shopingCar.shoppingCartSkuItemList == null || widget.shopingCar.shoppingCartSkuItemList.length == 0) return 0; - int index = widget.shopingCar.shoppingCartSkuItemList.indexWhere((element) => element.buyNum == 0); + if (widget.shopingCar == null || + widget.shopingCar.shoppingCartSkuItemList == null || + widget.shopingCar.shoppingCartSkuItemList.length == 0) return 0; + int index = widget.shopingCar.shoppingCartSkuItemList + .indexWhere((element) => element.buyNum == 0); if (index >= 0) { widget.shopingCar.shoppingCartSkuItemList.removeAt(index); } diff --git a/lib/store/store_view/store_order_list.dart b/lib/store/store_view/store_order_list.dart index 07f8fa29..dbbbb617 100644 --- a/lib/store/store_view/store_order_list.dart +++ b/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:flutter/material.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/utils/font_weight.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:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; class StoreOrderListPage extends StatefulWidget { @@ -64,6 +61,7 @@ class _StoreOrderListPage extends State { context: context, token: minToken, tenant: tenant, + storeId: widget.arguments["id"], ); BaseData> baseData = diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 8f26aeaa..b976bd82 100644 --- a/lib/union/union_page.dart +++ b/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_type.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/location.dart'; import 'package:huixiang/view_widget/classic_header.dart'; @@ -272,10 +273,15 @@ class _UnionPage extends State ), physics: NeverScrollableScrollPhysics(), itemBuilder: (context, position) { - return GestureDetector( + return InkWell( onTap: () { - if(storeList[position].posType.code == "NORMALSTORE") { - toScan(storeList[position]); + if (storeList[position].posType.code == "NORMALSTORE") { + Scan.toScan( + context, + storeList[position].id, + storeList[position].tenantCode, + storeList[position].storeName, + ); } else { Navigator.of(context).pushNamed( '/router/store_order', @@ -301,58 +307,6 @@ class _UnionPage extends State _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() { return Container( height: 36.h, diff --git a/lib/view_widget/selector_store_dialog.dart b/lib/view_widget/selector_store_dialog.dart index 29eee8e0..ea8582a5 100644 --- a/lib/view_widget/selector_store_dialog.dart +++ b/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/retrofit/data/store.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/custom_image.dart'; import 'package:huixiang/view_widget/round_button.dart'; @@ -101,9 +102,24 @@ class _SelectorStoreWidget extends State { ), InkWell( onTap: () { - Navigator.of(context).popAndPushNamed( - '/router/union_detail_page', - arguments: {"id": widget.stores[selectIndex].id}); + if(widget.stores[selectIndex].posType.code == "NORMALSTORE") { + Scan.toScan( + 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( text: S.of(context).queding, @@ -117,9 +133,9 @@ class _SelectorStoreWidget extends State { horizontal: 42.w, ), ), - ) + ), ], - ) + ), ], ), ); diff --git a/lib/web/web_view/web_header.dart b/lib/web/web_view/web_header.dart index a4e355de..ae67f404 100644 --- a/lib/web/web_view/web_header.dart +++ b/lib/web/web_view/web_header.dart @@ -61,13 +61,26 @@ class _WebHeader extends State { widget.arguments["source"] == widget.activity.storeId) { Navigator.of(context).pop(); } else { - Navigator.of(context).pushNamed( - '/router/union_detail_page', - arguments: { - "id": widget.activity.storeId, - "source": widget.arguments["activityId"] - }, - ); + // Navigator.of(context).pushNamed( + // '/router/union_detail_page', + // arguments: { + // "id": widget.activity.storeId, + // "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 + // }, + // ); + // } } } },