Browse Source

safety

master
fmk 3 years ago
parent
commit
e61ab8f86b
  1. 82
      lib/mine/mine_view/mine_view.dart
  2. 22
      lib/mine/vip_detail_page.dart
  3. 39
      lib/order/order_history_page.dart
  4. 20
      lib/order/order_view/order_address.dart
  5. 53
      lib/store/scan.dart
  6. 572
      lib/store/store_order.dart
  7. 369
      lib/store/store_view/product_sku.dart
  8. 365
      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

82
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();
} }
@ -107,31 +122,31 @@ class _MineView extends State<MineView> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
widget.toUserInfo(); widget.toUserInfo();
}, },
child: Stack( child: Stack(
children: [ children: [
MImage( MImage(
widget.userInfo == null ? "" : widget.userInfo.headimg, widget.userInfo == null ? "" : widget.userInfo.headimg,
isCircle: true, isCircle: true,
width: 50, width: 50,
height: 50, height: 50,
fit: BoxFit.cover, fit: BoxFit.cover,
errorSrc: "assets/image/default_user.png", errorSrc: "assets/image/default_user.png",
fadeSrc: "assets/image/default_user.png", fadeSrc: "assets/image/default_user.png",
), ),
Positioned( Positioned(
bottom: 0, bottom: 0,
right: 2.w, right: 2.w,
child: Image.asset( child: Image.asset(
"assets/image/icon_mine_edit.png", "assets/image/icon_mine_edit.png",
width: 17.w, width: 17.w,
height: 17.w, height: 17.w,
),
), ),
], ),
), ],
),
), ),
SizedBox( SizedBox(
width: 10.w, width: 10.w,
@ -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(
S.of(context).denglu, child: Text(
style: TextStyle( S.of(context).denglu,
fontSize: 16.sp, style: TextStyle(
fontWeight: MyFontWeight.medium, fontSize: 16.sp,
color: Color(0xFF353535), fontWeight: MyFontWeight.medium,
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,

39
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,11 +536,33 @@ class _OrderHistoryList extends State<OrderHistoryList>
} }
} }
aginOrder(storeId) { aginOrder(OrderInfo orderInfo) {
Navigator.of(context).pushNamed( // Navigator.of(context).pushNamed(
'/router/union_detail_page', // '/router/union_detail_page',
arguments: {"id": storeId}, // 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) { String totalPrice(orderInfo) {

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();
}
}
}

572
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,180 +178,191 @@ 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(
children: [ onWillPop: () async {
Positioned( if (dialogShowing) {
left: 0, debugPrint("ssssasdadsasdadasd");
right: 0, SmartDialog.dismiss();
top: 0, return false;
bottom: 54.h, } else {
child: NestedScrollView( return true;
controller: controller, }
dragStartBehavior: DragStartBehavior.start, },
physics: BouncingScrollPhysics(), child: Stack(
headerSliverBuilder: (BuildContext context, bool innerScrolled) { children: [
return [ Positioned(
SliverOverlapAbsorber( left: 0,
handle: NestedScrollView.sliverOverlapAbsorberHandleFor( right: 0,
context), top: 0,
sliver: SliverAppBar( bottom: 54.h,
expandedHeight: child: NestedScrollView(
(storeInfo != null && storeInfo.couponVOList != null) controller: controller,
? 470.h dragStartBehavior: DragStartBehavior.start,
: 365.h, physics: BouncingScrollPhysics(),
floating: false, headerSliverBuilder: (BuildContext context, bool innerScrolled) {
snap: false, return [
pinned: true, SliverOverlapAbsorber(
stretch: false, handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
brightness: Brightness.light, context),
leading: GestureDetector( sliver: SliverAppBar(
onTap: () { expandedHeight:
Navigator.of(context).pop(); (storeInfo != null && storeInfo.couponVOList != null)
}, ? 470.h
child: Container( : 365.h,
alignment: Alignment.centerRight, floating: false,
margin: EdgeInsets.only(left: 10), snap: false,
padding: EdgeInsets.all(6), pinned: true,
child: Icon( stretch: false,
Icons.arrow_back_ios, brightness: Brightness.light,
color: Colors.black, leading: GestureDetector(
size: 24, 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(
flexibleSpace: FlexibleSpaceBar( title: Title(
title: Title( controller,
controller, storeInfo != null ? storeInfo.storeName : '',
storeInfo != null ? storeInfo.storeName : '', ),
), collapseMode: CollapseMode.pin,
collapseMode: CollapseMode.pin, stretchModes: [
stretchModes: [ StretchMode.zoomBackground,
StretchMode.zoomBackground, StretchMode.fadeTitle,
StretchMode.fadeTitle, StretchMode.blurBackground,
StretchMode.blurBackground, ],
], background: Stack(
background: Stack( children: [
children: [ Positioned(
Positioned(
child: Column(
children: [
buildSwiper(),
Expanded(
child: Container(
color: Colors.transparent,
),
flex: 1,
),
],
),
top: 0,
bottom: 0,
left: 0,
right: 0,
),
Positioned(
child: Container(
child: Column( child: Column(
children: [ children: [
/// buildSwiper(),
StoreInfoView(storeInfo), Expanded(
child: Container(
/// color: Colors.transparent,
if (storeInfo != null &&
storeInfo.couponVOList != null)
UnionCoupon(
storeInfo,
_receiveCoupon,
coupon: true,
),
if (storeInfo == null ||
storeInfo.couponVOList == null)
SizedBox(
height: 8,
), ),
flex: 1,
///VIP信息 ),
Vip(storeInfo, () {}, false),
], ],
), ),
top: 0,
bottom: 0,
left: 0,
right: 0,
), ),
top: 110.h, Positioned(
bottom: 0, child: Container(
left: 0, child: Column(
right: 0, children: [
), ///
], StoreInfoView(storeInfo),
),
), ///
backgroundColor: Color(0x33FAFAFA), if (storeInfo != null &&
centerTitle: false, storeInfo.couponVOList != null)
elevation: 0, UnionCoupon(
bottom: PreferredSize( storeInfo,
preferredSize: Size( _receiveCoupon,
MediaQuery.of(context).size.width, coupon: true,
38, ),
if (storeInfo == null ||
storeInfo.couponVOList == null)
SizedBox(
height: 8,
),
///VIP信息
Vip(storeInfo, () {}, false),
],
),
),
top: 110.h,
bottom: 0,
left: 0,
right: 0,
),
],
),
), ),
child: Container( backgroundColor: Color(0x33FAFAFA),
padding: EdgeInsets.symmetric(horizontal: 10.w), centerTitle: false,
width: MediaQuery.of(context).size.width, elevation: 0,
child: TabBar( bottom: PreferredSize(
controller: tabcontroller, preferredSize: Size(
automaticIndicatorColorAdjustment: true, MediaQuery.of(context).size.width,
isScrollable: true, 38,
indicatorWeight: 1, ),
indicatorColor: Color(0xFFFAFAFA), child: Container(
labelPadding: EdgeInsets.only( padding: EdgeInsets.symmetric(horizontal: 10.w),
left: 8.w, width: MediaQuery.of(context).size.width,
right: 8.w, child: TabBar(
), controller: tabcontroller,
indicatorSize: TabBarIndicatorSize.label, automaticIndicatorColorAdjustment: true,
unselectedLabelStyle: TextStyle( isScrollable: true,
fontSize: 15.sp, indicatorWeight: 1,
fontWeight: FontWeight.w400, indicatorColor: Color(0xFFFAFAFA),
), labelPadding: EdgeInsets.only(
labelStyle: TextStyle( left: 8.w,
color: Colors.black, right: 8.w,
fontSize: 18.sp, ),
fontWeight: FontWeight.bold, 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(
body: TabBarView( physics: NeverScrollableScrollPhysics(),
physics: NeverScrollableScrollPhysics(), children: [
children: [ ///
/// StoreOrderListPage(
StoreOrderListPage( widget.arguments,
widget.arguments, activitys,
activitys, storeInfo,
storeInfo, shopCarGoods,
shopCarGoods, controller,
controller, _queryMiNiDetail,
_queryMiNiDetail, ),
),
///, ///,
StoreActivity( StoreActivity(
widget.arguments, widget.arguments,
activitys, activitys,
), ),
], ],
controller: tabcontroller, controller: tabcontroller,
), ),
),/*SmartRefresher( ), /*SmartRefresher(
controller: refreshController = controller: refreshController =
RefreshController(initialRefresh: false), RefreshController(initialRefresh: false),
enablePullDown: true, enablePullDown: true,
@ -360,89 +374,90 @@ class _StoreOrderPage extends State<StoreOrderPage>
}, },
child: child:
),*/ ),*/
), ),
Positioned( Positioned(
bottom: 0, bottom: 0,
left: 0, left: 0,
right: 0, right: 0,
child: Stack( child: Stack(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
children: [ children: [
Container( Container(
height: 54.h, height: 54.h,
color: Color(0xFFFAFAFA), color: Color(0xFFFAFAFA),
child: Row( child: Row(
children: [ children: [
Spacer(), Spacer(),
Text( Text(
S.of(context).heji, S.of(context).heji,
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: Colors.black, color: Colors.black,
),
), ),
), Text(
Text( "${shopCarGoods != null ? shopCarGoods.cartSum : "0.0"}",
"${shopCarGoods != null ? shopCarGoods.cartSum : "0.0"}", style: TextStyle(
style: TextStyle( fontSize: 20.sp,
fontSize: 20.sp, fontWeight: MyFontWeight.medium,
fontWeight: MyFontWeight.medium, color: Color(0xFF32A060),
color: Color(0xFF32A060), ),
), ),
), Spacer(),
Spacer(), GestureDetector(
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: () { onTap: () {
toDownOrder(); showShoppingCart();
}, },
child: Image.asset(
"assets/image/shopp.png",
width: 88,
height: 88,
fit: BoxFit.fitWidth,
),
),
Positioned(
right: 15,
top: 14,
child: RoundButton( child: RoundButton(
width: 103.w, width: 17,
height: 54.h, height: 17,
text: S.current.jiesuan, text: "${count()}",
textColor: Colors.white, textColor: Colors.white,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
backgroup: Color(0xFF32A060), backgroup: Color(0xFF32A060),
radius: 0, fontSize: 12.sp,
fontSize: 16.sp, radius: 100,
padding: EdgeInsets.symmetric(vertical: 5.h),
), ),
), ),
], ],
), ),
), ],
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<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, // shopCartKey,
this.shopCarGoods, // this.shopCarGoods,
clearShopCar, // clearShopCar,
toDownOrder, // toDownOrder,
shopCartAdd, // shopCartAdd,
shopCartReduce, // 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<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

369
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,201 +76,213 @@ class _ProductSku extends State<ProductSku> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return StatefulBuilder(builder: (context1, state) { return WillPopScope(
return Container( onWillPop: () async {
alignment: Alignment.topCenter, debugPrint("ssssasdadsasdadasd");
padding: EdgeInsets.only( SmartDialog.dismiss();
top: 16, return true;
left: 16, },
right: 16, child: StatefulBuilder(builder: (context1, state) {
), return Container(
width: double.infinity, alignment: Alignment.topCenter,
decoration: BoxDecoration( padding: EdgeInsets.only(
color: Color(0xFFFAFAFA), top: 16,
borderRadius: BorderRadius.only( left: 16,
topLeft: Radius.circular(8), right: 16,
topRight: Radius.circular(8),
), ),
), height: MediaQuery.of(context).size.height / 3 * 2,
child: Column( width: double.infinity,
mainAxisAlignment: MainAxisAlignment.start, decoration: BoxDecoration(
crossAxisAlignment: CrossAxisAlignment.start, color: Color(0xFFFAFAFA),
children: [ borderRadius: BorderRadius.only(
Row( topLeft: Radius.circular(8),
mainAxisAlignment: MainAxisAlignment.start, topRight: Radius.circular(8),
crossAxisAlignment: CrossAxisAlignment.start, ),
children: [ ),
MImage( child: Column(
widget.miNiDetail.imgs[0], mainAxisAlignment: MainAxisAlignment.start,
width: 70, crossAxisAlignment: CrossAxisAlignment.start,
height: 70, children: [
fit: BoxFit.cover, Row(
errorSrc: "assets/image/default_1.png", mainAxisAlignment: MainAxisAlignment.start,
fadeSrc: "assets/image/default_1.png", crossAxisAlignment: CrossAxisAlignment.start,
), children: [
SizedBox( MImage(
width: 10, widget.miNiDetail.imgs[0],
), width: 70,
Column( height: 70,
crossAxisAlignment: CrossAxisAlignment.start, fit: BoxFit.cover,
children: [ errorSrc: "assets/image/default_1.png",
Text( fadeSrc: "assets/image/default_1.png",
widget.miNiDetail.productName, ),
style: TextStyle( SizedBox(
color: Colors.black, width: 10,
fontSize: 16.sp, ),
fontWeight: MyFontWeight.medium, Column(
), crossAxisAlignment: CrossAxisAlignment.start,
), children: [
Padding( Text(
padding: EdgeInsets.only(top: 4, bottom: 7), widget.miNiDetail.productName,
child: Text(
"已选: " +
(selectSkus.map((e) => "$e").toList().toString()),
style: TextStyle( style: TextStyle(
color: Color(0xFF727272), color: Colors.black,
fontSize: 11.sp, fontSize: 16.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.medium,
), ),
), ),
), Padding(
Row( padding: EdgeInsets.only(top: 4, bottom: 7),
children: [ child: Text(
Text( "已选: " +
S.of(context).huiyuanjia, (selectSkus.map((e) => "$e").toList().toString()),
style: TextStyle( style: TextStyle(
color: Color(0xFFFF7A1A), color: Color(0xFF727272),
fontSize: 13.sp, fontSize: 11.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.regular,
), ),
), ),
Text( ),
widget.miNiDetail.price, Row(
style: TextStyle( children: [
color: Color(0xFFFF7A1A), Text(
fontSize: 14.sp, S.of(context).huiyuanjia,
fontWeight: MyFontWeight.medium, 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(
SizedBox( height: 24,
height: 24, ),
), Row(
Row( mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, children: [
children: [ Expanded(
Expanded( child: Text(
child: Text( "数量",
"数量", style: TextStyle(
style: TextStyle( color: Colors.black,
color: Colors.black, fontSize: 14.sp,
fontSize: 14.sp, fontWeight: MyFontWeight.regular,
fontWeight: MyFontWeight.regular, ),
), ),
), ),
), InkWell(
InkWell( onTap: () {
onTap: () { if (count > 1)
if (count > 1) setState(() {
setState(() { count -= 1;
count -= 1; });
}); widget.reduce(widget.miNiDetail, selectSkus);
widget.reduce(widget.miNiDetail, selectSkus); },
}, child: Image.asset(
child: Image.asset( "assets/image/reduce.png",
"assets/image/reduce.png", width: 22,
width: 22, height: 22,
height: 22, ),
), ),
), Padding(
Padding( padding: EdgeInsets.only(left: 8, right: 8),
padding: EdgeInsets.only(left: 8, right: 8), child: Text(
child: Text( "$count",
"$count", style: TextStyle(
style: TextStyle( color: Colors.black,
color: Colors.black, fontSize: 14.sp,
fontSize: 14.sp, fontWeight: MyFontWeight.medium,
fontWeight: MyFontWeight.medium, ),
), ),
), ),
), InkWell(
InkWell( onTap: () {
onTap: () { setState(() {
setState(() { count += 1;
count += 1; });
}); widget.add(widget.miNiDetail, selectSkus);
widget.add(widget.miNiDetail, selectSkus); },
}, child: Image.asset(
child: Image.asset( "assets/image/add.png",
"assets/image/add.png", width: 22,
width: 22, height: 22,
height: 22, ),
), ),
), ],
], ),
), SizedBox(
SizedBox( height: 24,
height: 24, ),
), RoundButton(
RoundButton( width: double.infinity,
width: double.infinity, height: 54.h,
height: 54.h, text: "加入购物车",
text: "加入购物车", textColor: Colors.white,
textColor: Colors.white, fontWeight: MyFontWeight.semi_bold,
fontWeight: MyFontWeight.semi_bold, radius: 27,
radius: 27, backgroup: Color(0xFF32A060),
backgroup: Color(0xFF32A060), fontSize: 16.sp,
fontSize: 16.sp, callback: () {
callback: () { // Navigator.of(context).pop();
widget.addShopCar(widget.miNiDetail, selectSkus, 1); SmartDialog.dismiss();
}, widget.addShopCar(widget.miNiDetail, selectSkus, 1);
), },
SizedBox( ),
height: 21.h, SizedBox(
), height: 21.h,
], ),
), ],
); ),
}); );
}),
);
} }
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数量

365
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,207 +33,221 @@ 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(
builder: (context1, state) { onWillPop: () async {
return Container( debugPrint("ssssasdadsasdadasd");
alignment: Alignment.topCenter, SmartDialog.dismiss();
width: double.infinity, return true;
height: MediaQuery.of(context).size.height / 2, },
decoration: BoxDecoration( child: StatefulBuilder(
color: Colors.white, builder: (context1, state) {
borderRadius: BorderRadius.only( return Container(
topLeft: Radius.circular(8), alignment: Alignment.topCenter,
topRight: Radius.circular(8), 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(
child: Column( mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Container(
Container( padding: EdgeInsets.only(
padding: EdgeInsets.only( top: 16,
top: 16, left: 16,
left: 16, right: 16,
right: 16, bottom: 8,
bottom: 8, ),
), child: Row(
child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Text(
Text( "已选商品",
"已选商品", style: TextStyle(
style: TextStyle( color: Colors.black,
color: Colors.black, fontSize: 14.sp,
fontSize: 14.sp, fontWeight: MyFontWeight.medium,
fontWeight: MyFontWeight.medium, ),
), ),
), InkWell(
InkWell( onTap: () {
onTap: () { widget.shopingCar.shoppingCartSkuItemList.clear();
widget.shopingCar.shoppingCartSkuItemList.clear(); state(() {});
state(() {}); widget.clearShopCar();
widget.clearShopCar(); },
}, child: Image.asset(
child: Image.asset( "assets/image/delete.png",
"assets/image/delete.png", width: 22,
width: 22, height: 22,
height: 22, ),
), ),
), ],
], ),
), ),
), Expanded(
Expanded( child: Stack(
child: Stack( children: [
children: [ Positioned(
Positioned( top: 0,
top: 0, left: 0,
left: 0, right: 0,
right: 0, bottom: 54,
bottom: 54, child: Container(
child: Container( padding: EdgeInsets.only(
padding: EdgeInsets.only( top: 8,
top: 8, left: 16,
left: 16, right: 16,
right: 16, ),
), child: ListView.builder(
child: ListView.builder( itemCount: itemCount(),
itemCount: itemCount(), physics: BouncingScrollPhysics(),
physics: BouncingScrollPhysics(), itemBuilder: (context, position) {
itemBuilder: (context, position) { return ShopGoods(
return ShopGoods( (ShoppingCartSkuItemListBean cart) async {
(ShoppingCartSkuItemListBean cart) { widget.shopingCar =
widget.shopCartAdd(cart); await widget.shopCartAdd(cart);
}, setState(() {});
(ShoppingCartSkuItemListBean cart) { },
widget.shopCartReduce(cart); (ShoppingCartSkuItemListBean cart) async {
}, widget.shopingCar =
count: widget.shopingCar await widget.shopCartReduce(cart);
.shoppingCartSkuItemList[position].buyNum, setState(() {});
shoppingCartSkuItemListBean: },
widget.shopingCar.shoppingCartSkuItemList[position], count: widget.shopingCar
queryMiNiDetail: widget.queryMiNiDetail, .shoppingCartSkuItemList[position].buyNum,
); shoppingCartSkuItemListBean: widget.shopingCar
}, .shoppingCartSkuItemList[position],
queryMiNiDetail: widget.queryMiNiDetail,
);
},
),
), ),
), ),
), Positioned(
Positioned( bottom: 0,
bottom: 0, left: 0,
left: 0, right: 0,
right: 0, child: Stack(
child: Stack( alignment: Alignment.bottomLeft,
alignment: Alignment.bottomLeft, children: [
children: [ Container(
Container( height: 54.h,
height: 54.h, decoration: BoxDecoration(
decoration: BoxDecoration( color: Color(0xFFFAFAFA),
color: Color(0xFFFAFAFA), boxShadow: [
boxShadow: [ BoxShadow(
BoxShadow( color: Colors.black.withAlpha(8),
color: Colors.black.withAlpha(8), offset: Offset(0, -1),
offset: Offset(0, -1), blurRadius: 3,
blurRadius: 3, spreadRadius: 0,
spreadRadius: 0,
),
],
),
child: Row(
children: [
Spacer(),
Text(
S.of(context).heji,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
), ),
), ],
Text( ),
"" + child: Row(
(widget.shopingCar == null children: [
? "0.0" Spacer(),
: widget.shopingCar.cartSum), Text(
style: TextStyle( S.of(context).heji,
fontSize: 20.sp, style: TextStyle(
fontWeight: MyFontWeight.medium, fontSize: 12.sp,
color: Color(0xFF32A060), fontWeight: MyFontWeight.regular,
color: Colors.black,
),
), ),
), Text(
Spacer(), "" +
GestureDetector( (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: () { 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( child: RoundButton(
width: 103.w, width: 17,
height: 54.h, height: 17,
text: S.current.jiesuan, text: "${count()}",
textColor: Colors.white, textColor: Colors.white,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
backgroup: Color(0xFF32A060), backgroup: Color(0xFF32A060),
radius: 0, fontSize: 12.sp,
fontSize: 16.sp, radius: 100,
padding: callback: () {
EdgeInsets.symmetric(vertical: 5.h), // 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() { 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