diff --git a/assets/image/2x/bus_goods_add.webp b/assets/image/2x/bus_goods_add.webp new file mode 100644 index 00000000..68c9f4e1 Binary files /dev/null and b/assets/image/2x/bus_goods_add.webp differ diff --git a/assets/image/3x/bus_goods_add.webp b/assets/image/3x/bus_goods_add.webp new file mode 100644 index 00000000..8ef59cf6 Binary files /dev/null and b/assets/image/3x/bus_goods_add.webp differ diff --git a/assets/image/bus_goods_add.webp b/assets/image/bus_goods_add.webp new file mode 100644 index 00000000..aa5cdd84 Binary files /dev/null and b/assets/image/bus_goods_add.webp differ diff --git a/lib/business_system/business_page.dart b/lib/business_system/business_page.dart index 1b1f3db6..41241254 100644 --- a/lib/business_system/business_page.dart +++ b/lib/business_system/business_page.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:huixiang/business_system/goods/business_goods_page.dart'; @@ -8,6 +10,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../retrofit/data/business_login_info.dart'; import 'home/business_home_page.dart'; +import 'home/home_view/home_sideslip_dialog.dart'; class BusinessPage extends StatefulWidget { final arguments; @@ -25,6 +28,13 @@ class _BusinessPage extends State int choiceIndex = 0; BusinessLoginInfo businessLoginInfo; int selectStoreIndex = 0; + int switchStore = 0; + GlobalKey homePageKey = GlobalKey(); + GlobalKey orderPageKey = GlobalKey(); + GlobalKey goodsPageKey = GlobalKey(); + GlobalKey minePageKey = GlobalKey(); + var clickIndex = 0; + final PageController pageController = PageController(); @override void initState() { @@ -36,204 +46,205 @@ class _BusinessPage extends State @override Widget build(BuildContext context) { super.build(context); - return Stack( - children: [ - Container( - color: Color(0xFFF7F7F7), - ), - Stack( - children: [ - if (choiceIndex == 0) - BusinessHomePage(businessLoginInfo, selectStoreIndex, (index) { + return Scaffold( + resizeToAvoidBottomInset: false, + body: Stack( + alignment: Alignment.bottomRight, + children: [ + Container( + child: PageView( + controller: pageController, + children: [ + BusinessHomePage( + homePageKey, businessLoginInfo, selectStoreIndex, showAlertDialog, + (index) { + setState(() { + pageController.jumpToPage(2); + }); + }), + BusinessOrderPage(orderPageKey, + businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"), + BusinessGoodsPage(goodsPageKey, + businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"), + BusinessMinePage(minePageKey, businessLoginInfo, + businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"), + ], + physics: NeverScrollableScrollPhysics(), + onPageChanged: (index) { + clickIndex = index; + setState(() {}); + }, + ), + ), + if (switchStore == 0) + GestureDetector( + onTap: () { setState(() { - selectStoreIndex = index; + switchStore = 1; + showAlertDialog(); }); - },(index){ - setState((){ - choiceIndex = 3; - }); - }), - if (choiceIndex == 1) BusinessOrderPage(businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"), - // if (choiceIndex == 2) BusinessScanCode(businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"), - if (choiceIndex == 3) BusinessGoodsPage(businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"), - if (choiceIndex == 4) BusinessMinePage(businessLoginInfo,businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"), - Align( - alignment: Alignment.bottomCenter, + }, child: Container( - height: 85.h, - width: double.infinity, - color: Colors.white, - padding: EdgeInsets.only(top: 20.h), + width: 97.w, + decoration: BoxDecoration( + color: Color(0xFFEBEFF6), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(111), + bottomLeft: Radius.circular(111), + ), + ), + padding: EdgeInsets.only(left: 12.w, top: 10.h, bottom: 10.h), + margin: EdgeInsets.only(bottom: 170.h), child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - choiceIndex = 0; - }); - }, - child: Column( - children: [ - Image.asset( - choiceIndex == 0 - ? "assets/image/business_home.webp" - : "assets/image/business_ home_h.webp", - width: 30, - height: 30, - ), - SizedBox( - height: 5.h, - ), - Text( - "首页", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.semi_bold, - color: choiceIndex == 0 - ? Color(0xFF4C4C4C) - : Color(0xFFACACAC), - ), - ), - ], - )), - ), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - choiceIndex = 1; - }); - }, - child: Column( - children: [ - Image.asset( - (choiceIndex == 0 || - choiceIndex == 3 || - choiceIndex == 4) - ? "assets/image/business_order_h.webp" - : "assets/image/business_order.webp", - width: 30, - height: 30, - ), - SizedBox( - height: 5.h, - ), - Text( - "订单", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.semi_bold, - color: (choiceIndex == 0 || - choiceIndex == 3 || - choiceIndex == 4) - ? Color(0xFFACACAC) - : Color(0xFF4C4C4C), - ), - ), - ], - ), - )), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Navigator.of(context).pushNamed('/router/scan_code_page', arguments:{"storeId":businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"}); - }, - child: Image.asset( - "assets/image/business_scan_code.webp", - width: 52, - height: 52, + Padding( + padding: EdgeInsets.only(right: 4.w), + child: Image.asset( + "assets/image/bs_switch.webp", + width: 12.w, + height: 15.h, + )), + Text( + "切换门店", + textAlign: TextAlign.center, + style: TextStyle( + color: Color(0xFF30415B), + fontSize: 12.sp, + fontWeight: MyFontWeight.semi_bold, ), - )), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - choiceIndex = 3; - }); - }, - child: Column( - children: [ - Image.asset( - (choiceIndex == 0 || - choiceIndex == 1 || - choiceIndex == 4) - ? "assets/image/business_goods_h.webp" - : "assets/image/business_goods.webp", - width: 30, - height: 30, - ), - SizedBox( - height: 5.h, - ), - Text( - "商品", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.semi_bold, - color: (choiceIndex == 0 || - choiceIndex == 1 || - choiceIndex == 4) - ? Color(0xFFACACAC) - : Color(0xFF4C4C4C), - ), - ), - ], - ), - )), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - choiceIndex = 4; - }); - }, - child: Column( - children: [ - Image.asset( - (choiceIndex == 0 || - choiceIndex == 1 || - choiceIndex == 3) - ? "assets/image/business_mine_h.webp" - : "assets/image/business_mine.webp", - width: 30, - height: 30, - ), - SizedBox( - height: 5.h, - ), - Text( - "我的", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.semi_bold, - color: (choiceIndex == 0 || - choiceIndex == 1 || - choiceIndex == 3) - ? Color(0xFFACACAC) - : Color(0xFF4C4C4C), - ), - ), - ], - ), - )), + ), ], ), ), ), + ], + ), + extendBody: true, + bottomNavigationBar: Container( + alignment: Platform.isAndroid ? Alignment.center : Alignment.topCenter, + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ) ], + borderRadius: BorderRadius.vertical( + top: Radius.circular(4), + ), ), - ], + height: 82.h, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + bottomNavigationItem("首页", 0, "assets/image/business_home.webp", + "assets/image/business_ home_h.webp"), + bottomNavigationItem("订单", 1, "assets/image/business_order.webp", + "assets/image/business_order_h.webp"), + // bottomNavigationItem("", 2,"assets/image/business_scan_code.webp","assets/image/business_scan_code.webp"), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context) + .pushNamed('/router/scan_code_page', arguments: { + "storeId": + businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0" + }); + }, + child: Container( + padding: EdgeInsets.only(top: 10.h), + child: Image.asset( + "assets/image/business_scan_code.webp", + width: 52.h, + height: 52.h, + ), + ), + ), + bottomNavigationItem("商品", 2, "assets/image/business_goods.webp", + "assets/image/business_goods_h.webp"), + bottomNavigationItem("我的", 3, "assets/image/business_mine.webp", + "assets/image/business_mine_h.webp"), + ], + ), + ), + ); + } + + Widget bottomNavigationItem(text, index, image, unImage) { + var isSelected = index == clickIndex; + return Expanded( + child: InkWell( + onTap: () { + setState(() { + clickIndex = index; + pageController.jumpToPage(clickIndex); + }); + }, + child: Container( + width: 45.w, + child: Column( + mainAxisAlignment: Platform.isAndroid + ? MainAxisAlignment.center + : MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + if (Platform.isIOS) + SizedBox( + height: 4.h, + ), + Image.asset( + isSelected ? image : unImage, + width: 30.h, + height: 30.h, + ), + Text( + text, + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.semi_bold, + color: isSelected ? Color(0xFF4C4C4C) : Color(0xFFACACAC), + ), + ), + ], + ), + ), + ), + flex: 1, ); } + ///侧面弹窗 + showAlertDialog() async { + try { + int index = await showCupertinoModalPopup( + builder: (context) { + return HomeSideslipDialog(selectStoreIndex, businessLoginInfo); + }, + context: context); + if (index != null) { + if (index == -1) { + Navigator.of(context).pop(); + return; + } + setState(() { + selectStoreIndex = index; + homePageKey = GlobalKey(); + orderPageKey = GlobalKey(); + goodsPageKey = GlobalKey(); + minePageKey = GlobalKey(); + }); + } + } finally { + setState(() { + switchStore = 0; + }); + } + } + @override bool get wantKeepAlive => true; } diff --git a/lib/business_system/goods/business_goods_page.dart b/lib/business_system/goods/business_goods_page.dart index 7f2b92bc..4016e689 100644 --- a/lib/business_system/goods/business_goods_page.dart +++ b/lib/business_system/goods/business_goods_page.dart @@ -1,17 +1,19 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:huixiang/business_system/goods/off_shelf/off_shelf_page.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import '../../utils/font_weight.dart'; import '../../view_widget/my_appbar.dart'; import '../../view_widget/my_tab.dart'; +import '../order/ticket/ticket_tab.dart'; +import 'off_shelf/off_shelf_page.dart'; import 'on_sale/on_sale_page.dart'; class BusinessGoodsPage extends StatefulWidget { final String storeId; - BusinessGoodsPage(this.storeId); + BusinessGoodsPage(Key key,this.storeId): super(key: key); @override State createState() { @@ -19,12 +21,11 @@ class BusinessGoodsPage extends StatefulWidget { } } -class _BusinessGoodsPage extends State - with AutomaticKeepAliveClientMixin { +class _BusinessGoodsPage extends State { final RefreshController refreshController = RefreshController(); - final ScrollController scrollController = ScrollController(); String offShelfTotal; String onSaleTotal; + int goodsIndex = 0; @override void initState() { @@ -33,59 +34,93 @@ class _BusinessGoodsPage extends State @override Widget build(BuildContext context) { - super.build(context); return Column( children: [ - Expanded(child: - DefaultTabController( - length: 2, - child: Scaffold( - appBar: MyAppBar( - title:"", - leading: false, - background: Colors.white, - toolbarHeight: MediaQuery.of(context).size.height >= 750 ? (kToolbarHeight + 15.h) : kToolbarHeight, - bottom: TabBar( - // isScrollable: true, //可滚动 - //去掉按钮阴影 - overlayColor: MaterialStateProperty.all(Colors.white), - indicatorColor: Color(0xFF30415B), - labelColor: Colors.black, - labelStyle: TextStyle( - fontSize: 15.sp, - fontWeight: FontWeight.bold, + Expanded( + child: + DefaultTabController( + length: 3, + child: Scaffold( + appBar: MyAppBar( + title:"", + leading: false, + background: Colors.white, + toolbarHeight: MediaQuery.of(context).size.height >= 750 ? (kToolbarHeight + 15.h) : kToolbarHeight, + bottom: TabBar( + // isScrollable: true, //可滚动 + //去掉按钮阴影 + overlayColor: MaterialStateProperty.all(Colors.white), + indicatorColor: Color(0xFF30415B), + labelColor: Colors.black, + labelStyle: TextStyle( + fontSize: 15.sp, + fontWeight: FontWeight.bold, + ), + unselectedLabelStyle: TextStyle( + fontSize: 15.sp, + fontWeight: FontWeight.normal, + color: Color(0xFF666666) + ), + indicator: const TicketTab( + width: 33, + borderSide: BorderSide( + width: 2.0, color: Color(0xFF30415B))), + // controller: tabController, + //未选中文字颜色 + unselectedLabelColor: Color(0xffA29E9E), + indicatorSize: TabBarIndicatorSize.label, + //指示器与文字等宽 + tabs: [ + MyTab(text:"在售中(${onSaleTotal ?? "0"})"), + MyTab(text: "已下架(${offShelfTotal ?? "0"})"), + GestureDetector( + onTap: (){ + Navigator.of(context).pushNamed( + '/router/add_goods_page', + arguments: { + "storeId":widget.storeId ?? "", + }); + }, + child:Row(children: [Padding( + padding: EdgeInsets.only(right: 5.w), + child: Text( + "新增商品", + textAlign: TextAlign.center, + style: TextStyle( + height: 1.5, + color: Color(0xFF2E3552), + fontSize: 16.sp, + fontWeight: MyFontWeight.bold, + ), + )), Image.asset( + "assets/image/bus_goods_add.webp", + width: 14.w, + height: 15.h, + ), + ]), + ), + ], + ), + ), + body: TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + OnSalePage(widget.storeId,(value){ + setState((){ + onSaleTotal = value; + }); + }), + OffShelfPage(widget.storeId,(value){ + setState((){ + offShelfTotal = value; + }); + }), + Container() + ], + ), + ), ), - unselectedLabelStyle: TextStyle( - fontSize: 15.sp, - fontWeight: FontWeight.normal, - color: Color(0xFF666666) - ), - // controller: tabController, - //未选中文字颜色 - unselectedLabelColor: Color(0xffA29E9E), - indicatorSize: TabBarIndicatorSize.label, - //指示器与文字等宽 - tabs: [ - MyTab(text:"在售中(${onSaleTotal ?? "0"})"), - MyTab(text: "已下架(${offShelfTotal ?? "0"})"), - ], - ), - ), - body: TabBarView( - children: [ - OnSalePage(widget.storeId,(value){ - setState((){ - onSaleTotal = value; - }); - }), - OffShelfPage(widget.storeId,(value){ - setState((){ - offShelfTotal = value; - }); - })], - ), - ), - ),), + ), SizedBox( height: 76.h, ), @@ -93,6 +128,4 @@ class _BusinessGoodsPage extends State ); } - @override - bool get wantKeepAlive => true; } diff --git a/lib/business_system/home/business_home_page.dart b/lib/business_system/home/business_home_page.dart index bbcbe3dd..a84c2a12 100644 --- a/lib/business_system/home/business_home_page.dart +++ b/lib/business_system/home/business_home_page.dart @@ -3,7 +3,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:huixiang/business_system/home/home_view/home_sideslip_dialog.dart'; import 'package:huixiang/utils/business_instance.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/my_footer.dart'; @@ -19,7 +18,6 @@ import '../../retrofit/data/business_login_info.dart'; import '../../retrofit/data/day_count.dart'; import '../../utils/flutter_utils.dart'; import '../../utils/font_weight.dart'; -import '../../view_widget/settlement_tips_dialog.dart'; class BusinessHomePage extends StatefulWidget { final BusinessLoginInfo businessLoginInfo; @@ -27,8 +25,8 @@ class BusinessHomePage extends StatefulWidget { final Function changeIndex; final Function changeTab; - BusinessHomePage( - this.businessLoginInfo, this.selectStoreIndex, this.changeIndex,this.changeTab); + BusinessHomePage(Key key,this.businessLoginInfo, this.selectStoreIndex, + this.changeIndex, this.changeTab): super(key: key); @override State createState() { @@ -36,8 +34,7 @@ class BusinessHomePage extends StatefulWidget { } } -class _BusinessHomePage extends State - with AutomaticKeepAliveClientMixin { +class _BusinessHomePage extends State { final RefreshController refreshController = RefreshController(); final ScrollController scrollController = ScrollController(); BusinessApiService businessService; @@ -48,30 +45,32 @@ class _BusinessHomePage extends State void initState() { super.initState(); _onRefresh(); - } @override void dispose() { super.dispose(); + refreshController.dispose(); } + _onRefresh({int index, isLoading = true}) async { if (isLoading) EasyLoading.show( status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); SharedPreferences.getInstance().then((value) { + if (!mounted) return; businessService = BusinessApiService(Dio(), context: context, token: BusinessInstance.instance.businessToken, tenant: BusinessInstance.instance.businessTenant, storeId: widget.businessLoginInfo - .storeList[index ?? widget.selectStoreIndex].name == - "所有门店" + .storeList[index ?? widget.selectStoreIndex].name == + "所有门店" ? "0" : widget.businessLoginInfo - .storeList[index ?? widget.selectStoreIndex].id); - queryDayAmount(); + .storeList[index ?? widget.selectStoreIndex].id); + queryDayAmount(); }); } @@ -106,7 +105,6 @@ class _BusinessHomePage extends State @override Widget build(BuildContext context) { - super.build(context); return Column( children: [ Expanded( @@ -140,6 +138,68 @@ class _BusinessHomePage extends State ), ), ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context) + .pushNamed('/router/service_subscription_page', arguments: { + "storeId": widget.businessLoginInfo + .storeList[widget.selectStoreIndex].name == + "所有门店" + ? "0" + : widget + .businessLoginInfo.storeList[widget.selectStoreIndex].id + }); + }, + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.only( + top: 20.h, bottom: 28.h, left: 20.w, right: 23.w), + color: Color(0xFFDCE8FC), + child: Row( + children: [ + Expanded( + child: Text.rich( + TextSpan( + children: [ + TextSpan( + text: "试用期到期时间:", + style: TextStyle( + color: Color(0xFF252626), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + ), + TextSpan( + text: "2024-01-02", + style: TextStyle( + color: Color(0xFFFF8F1F), + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + ), + ], + ), + ), + ), + Padding( + padding: EdgeInsets.only(right: 2.w), + child: Text( + "去购买服务", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF30415B), + fontWeight: MyFontWeight.regular), + )), + Image.asset( + "assets/image/icon_right_z.webp", + width: 14.h, + height: 14.h, + color: Color(0xFF30415B), + ), + ], + )), + ), SizedBox( height: 76.h, ), @@ -165,10 +225,7 @@ class _BusinessHomePage extends State child: GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { - showAlertDialog( - widget.selectStoreIndex, - widget.businessLoginInfo, - ); + widget.changeIndex(); //改变导航栏状态栏颜色 // SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle(statusBarColor: Colors.white), ); // Navigator.of(context).pushNamed('/router/select_shop'); @@ -407,26 +464,6 @@ class _BusinessHomePage extends State ); } - ///侧面弹窗 - showAlertDialog( - selectStoreIndex, - businessLoginInfo, - ) async { - int index = await showCupertinoModalPopup( - builder: (context) { - return HomeSideslipDialog(selectStoreIndex, businessLoginInfo); - }, - context: context); - if (index != null) { - if (index == -1) { - Navigator.of(context).pop(); - return; - } - widget.changeIndex(index); - _onRefresh(index: index); - } - } - ///用户身份切换 showIdentitySwitchDialog() async { SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); @@ -488,8 +525,9 @@ class _BusinessHomePage extends State Widget commonFunctions() { return Container( color: Colors.white, - margin: EdgeInsets.only(bottom:16.h), - padding: EdgeInsets.only(left: 16.w, right: 15.w, top: 12.h, bottom: 16.h), + margin: EdgeInsets.only(bottom: 16.h), + padding: + EdgeInsets.only(left: 16.w, right: 15.w, top: 12.h, bottom: 16.h), child: Column( children: [ Row( @@ -511,13 +549,13 @@ class _BusinessHomePage extends State ], ), GridView.builder( - itemCount:commonFunctionsList.length ?? 0, - padding: EdgeInsets.only(top:24.h), + itemCount: commonFunctionsList.length ?? 0, + padding: EdgeInsets.only(top: 24.h), shrinkWrap: true, physics: NeverScrollableScrollPhysics(), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 4, - crossAxisSpacing:15.w, + crossAxisSpacing: 15.w, mainAxisSpacing: 12.w, ), itemBuilder: (context, index) { @@ -538,119 +576,144 @@ class _BusinessHomePage extends State commonFunctionsIndex(index) async { switch (index) { case 0: - if ((widget.businessLoginInfo - .storeList[widget.selectStoreIndex].name == - "所有门店" - ? "0" - : widget.businessLoginInfo - .storeList[widget.selectStoreIndex].id) == "0") { - SmartDialog.show( - widget: SettlementTips( - () {}, - text: "请选择门店进行收银操作", - color: Color(0xFF30415B), - )); - }else{ + if ((widget.businessLoginInfo.storeList[widget.selectStoreIndex].name == + "所有门店" + ? "0" + : widget + .businessLoginInfo.storeList[widget.selectStoreIndex].id) == + "0") { + widget.changeIndex(); + } else { Navigator.of(context).pushNamed('/router/cashier_page', arguments: { "storeId": widget.businessLoginInfo - .storeList[widget.selectStoreIndex].name == - "所有门店" + .storeList[widget.selectStoreIndex].name == + "所有门店" ? "0" - : widget.businessLoginInfo - .storeList[widget.selectStoreIndex].id, + : widget + .businessLoginInfo.storeList[widget.selectStoreIndex].id, }); } break; case 1: Navigator.of(context) .pushNamed('/router/vip_recharge_page', arguments: { - "storeId": widget.businessLoginInfo - .storeList[widget.selectStoreIndex].name == - "所有门店" + "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex] + .name == + "所有门店" ? "0" - : widget.businessLoginInfo - .storeList[widget.selectStoreIndex].id, + : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id, }); break; case 2: - Navigator.of(context) - .pushNamed('/router/add_vip', arguments: { - "storeId": widget.businessLoginInfo - .storeList[widget.selectStoreIndex].name == - "所有门店" + Navigator.of(context).pushNamed('/router/add_vip', arguments: { + "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex] + .name == + "所有门店" ? "0" - : widget.businessLoginInfo - .storeList[widget.selectStoreIndex].id, + : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id, }); break; case 3: Navigator.of(context) .pushNamed('/router/trade_overview_page', arguments: { - "storeId": widget.businessLoginInfo - .storeList[widget.selectStoreIndex].name == - "所有门店" + "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex] + .name == + "所有门店" ? "0" - : widget.businessLoginInfo - .storeList[widget.selectStoreIndex].id, + : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id, }); break; case 4: Navigator.of(context) .pushNamed('/router/business_vip_page', arguments: { - "storeId": widget.businessLoginInfo - .storeList[widget.selectStoreIndex].name == - "所有门店" + "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex] + .name == + "所有门店" ? "0" - : widget.businessLoginInfo - .storeList[widget.selectStoreIndex].id, + : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id, }); break; case 5: - Navigator.of(context) - .pushNamed('/router/hot_selling_page', arguments: { - "storeId": widget.businessLoginInfo - .storeList[widget.selectStoreIndex].name == - "所有门店" + Navigator.of(context).pushNamed('/router/hot_selling_page', arguments: { + "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex] + .name == + "所有门店" ? "0" - : widget.businessLoginInfo - .storeList[widget.selectStoreIndex].id, + : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id, }); break; case 6: - Navigator.of(context) - .pushNamed('/router/flow_page', arguments: { + Navigator.of(context).pushNamed('/router/flow_page', arguments: { "storeName": widget?.businessLoginInfo - ?.storeList[widget.selectStoreIndex].name ?? + ?.storeList[widget.selectStoreIndex].name ?? "", - "storeId": widget.businessLoginInfo - .storeList[widget.selectStoreIndex].name == - "所有门店" + "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex] + .name == + "所有门店" ? "0" - : widget.businessLoginInfo - .storeList[widget.selectStoreIndex].id, + : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id, }); break; case 7: widget.changeTab(3); break; - } } ///常用功能板块 - List> commonFunctionsList = [ - {"image":"assets/image/bus_home_syt.webp","commonName":"收银台","imageWidth":"26","imageHeight":"23"}, - {"image":"assets/image/bus_home_cz.webp","commonName":"充值","imageWidth":"22","imageHeight":"19"}, - {"image":"assets/image/bus_home_bhy.webp","commonName":"办会员","imageWidth":"24","imageHeight":"21"}, - {"image":"assets/image/bus_home_syzl.webp","commonName":"生意总览","imageWidth":"22","imageHeight":"23"}, - {"image":"assets/image/bus_home_hygl.webp","commonName":"会员管理","imageWidth":"23","imageHeight":"25"}, - {"image":"assets/image/bus_home_rxbd.webp","commonName":"热销榜单","imageWidth":"20","imageHeight":"26"}, - {"image":"assets/image/bus_home_jrls.webp","commonName":"今日流水","imageWidth":"22","imageHeight":"23"}, - {"image":"assets/image/bus_home_goods.webp","commonName":"商品","imageWidth":"21","imageHeight":"23"}, + List> commonFunctionsList = [ + { + "image": "assets/image/bus_home_syt.webp", + "commonName": "收银台", + "imageWidth": "26", + "imageHeight": "23" + }, + { + "image": "assets/image/bus_home_cz.webp", + "commonName": "充值", + "imageWidth": "22", + "imageHeight": "19" + }, + { + "image": "assets/image/bus_home_bhy.webp", + "commonName": "办会员", + "imageWidth": "24", + "imageHeight": "21" + }, + { + "image": "assets/image/bus_home_syzl.webp", + "commonName": "生意总览", + "imageWidth": "22", + "imageHeight": "23" + }, + { + "image": "assets/image/bus_home_hygl.webp", + "commonName": "会员管理", + "imageWidth": "23", + "imageHeight": "25" + }, + { + "image": "assets/image/bus_home_rxbd.webp", + "commonName": "热销榜单", + "imageWidth": "20", + "imageHeight": "26" + }, + { + "image": "assets/image/bus_home_jrls.webp", + "commonName": "今日流水", + "imageWidth": "22", + "imageHeight": "23" + }, + { + "image": "assets/image/bus_home_goods.webp", + "commonName": "商品", + "imageWidth": "21", + "imageHeight": "23" + }, ]; ///常用功能Item - Widget commonFunctionsItem(index){ + Widget commonFunctionsItem(index) { return Column( children: [ Image.asset( @@ -659,7 +722,8 @@ class _BusinessHomePage extends State height: double.tryParse(commonFunctionsList[index]["imageHeight"]).h, fit: BoxFit.fill, ), - Padding(padding: EdgeInsets.only(top: 12.h), + Padding( + padding: EdgeInsets.only(top: 12.h), child: Text( commonFunctionsList[index]["commonName"], textAlign: TextAlign.center, @@ -677,8 +741,9 @@ class _BusinessHomePage extends State Widget homeStatistics() { return Container( color: Colors.white, - margin: EdgeInsets.only(bottom:16.h), - padding: EdgeInsets.only(left: 16.w, right: 15.w, top: 12.h, bottom: 16.h), + margin: EdgeInsets.only(bottom: 16.h), + padding: + EdgeInsets.only(left: 16.w, right: 15.w, top: 12.h, bottom: 16.h), child: Column( children: [ Row( @@ -700,13 +765,13 @@ class _BusinessHomePage extends State ], ), GridView.builder( - itemCount:homeStatisticsList.length ?? 0, - padding: EdgeInsets.only(top:24.h), + itemCount: homeStatisticsList.length ?? 0, + padding: EdgeInsets.only(top: 24.h), shrinkWrap: true, physics: NeverScrollableScrollPhysics(), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 4, - crossAxisSpacing:15.w, + crossAxisSpacing: 15.w, mainAxisSpacing: 12.w, ), itemBuilder: (context, index) { @@ -729,89 +794,113 @@ class _BusinessHomePage extends State case 0: Navigator.of(context) .pushNamed('/router/trade_overview_page', arguments: { - "storeId": widget.businessLoginInfo - .storeList[widget.selectStoreIndex].name == - "所有门店" + "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex] + .name == + "所有门店" ? "0" - : widget.businessLoginInfo - .storeList[widget.selectStoreIndex].id, + : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id, }); break; case 1: Navigator.of(context) .pushNamed('/router/business_vip_page', arguments: { - "storeId": widget.businessLoginInfo - .storeList[widget.selectStoreIndex].name == - "所有门店" + "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex] + .name == + "所有门店" ? "0" - : widget.businessLoginInfo - .storeList[widget.selectStoreIndex].id, - "index":2 + : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id, + "index": 2 }); break; case 2: Navigator.of(context) .pushNamed('/router/business_vip_page', arguments: { - "storeId": widget.businessLoginInfo - .storeList[widget.selectStoreIndex].name == - "所有门店" + "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex] + .name == + "所有门店" ? "0" - : widget.businessLoginInfo - .storeList[widget.selectStoreIndex].id, - "index":1 + : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id, + "index": 1 }); break; case 3: Navigator.of(context) .pushNamed('/router/consumer_ranking_page', arguments: { - "storeId": widget.businessLoginInfo - .storeList[widget.selectStoreIndex].name == - "所有门店" + "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex] + .name == + "所有门店" ? "0" - : widget.businessLoginInfo - .storeList[widget.selectStoreIndex].id, - "titleName":"会员余额统计" + : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id, + "titleName": "会员余额统计" }); break; case 4: Navigator.of(context) .pushNamed('/router/consumer_ranking_page', arguments: { - "storeId": widget.businessLoginInfo - .storeList[widget.selectStoreIndex].name == - "所有门店" + "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex] + .name == + "所有门店" ? "0" - : widget.businessLoginInfo - .storeList[widget.selectStoreIndex].id, - "titleName":"消费排名" + : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id, + "titleName": "消费排名" }); break; case 5: Navigator.of(context) .pushNamed('/router/trade_overview_page', arguments: { - "storeId": widget.businessLoginInfo - .storeList[widget.selectStoreIndex].name == - "所有门店" + "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex] + .name == + "所有门店" ? "0" - : widget.businessLoginInfo - .storeList[widget.selectStoreIndex].id, - "index":2 + : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id, + "index": 2 }); break; } } ///统计板块 - List> homeStatisticsList = [ - {"image":"assets/image/bus_home_yytj.webp","commonName":"营业统计","imageWidth":"21","imageHeight":"20"}, - {"image":"assets/image/bus_home_xfjl.webp","commonName":"消费记录","imageWidth":"22","imageHeight":"21"}, - {"image":"assets/image/bus_home_czjl.webp","commonName":"充值记录","imageWidth":"19","imageHeight":"22"}, - {"image":"assets/image/bus_home_hyyetj.webp","commonName":"会员余额统计","imageWidth":"23","imageHeight":"23"}, - {"image":"assets/image/bus_home_xfpm.webp","commonName":"消费排名","imageWidth":"26","imageHeight":"22"}, - {"image":"assets/image/bus_home_goods_ssfx.webp","commonName":"商品销售分析","imageWidth":"26","imageHeight":"23"}, + List> homeStatisticsList = [ + { + "image": "assets/image/bus_home_yytj.webp", + "commonName": "营业统计", + "imageWidth": "21", + "imageHeight": "20" + }, + { + "image": "assets/image/bus_home_xfjl.webp", + "commonName": "消费记录", + "imageWidth": "22", + "imageHeight": "21" + }, + { + "image": "assets/image/bus_home_czjl.webp", + "commonName": "充值记录", + "imageWidth": "19", + "imageHeight": "22" + }, + { + "image": "assets/image/bus_home_hyyetj.webp", + "commonName": "会员余额统计", + "imageWidth": "23", + "imageHeight": "23" + }, + { + "image": "assets/image/bus_home_xfpm.webp", + "commonName": "消费排名", + "imageWidth": "26", + "imageHeight": "22" + }, + { + "image": "assets/image/bus_home_goods_ssfx.webp", + "commonName": "商品销售分析", + "imageWidth": "26", + "imageHeight": "23" + }, ]; ///统计Item - Widget homeStatisticsItem(index){ + Widget homeStatisticsItem(index) { return Column( children: [ Image.asset( @@ -820,7 +909,8 @@ class _BusinessHomePage extends State height: double.tryParse(homeStatisticsList[index]["imageHeight"]).h, fit: BoxFit.fill, ), - Padding(padding: EdgeInsets.only(top: 12.h), + Padding( + padding: EdgeInsets.only(top: 12.h), child: Text( homeStatisticsList[index]["commonName"], textAlign: TextAlign.center, @@ -833,7 +923,4 @@ class _BusinessHomePage extends State ], ); } - - @override - bool get wantKeepAlive => true; } diff --git a/lib/business_system/home/select_shop.dart b/lib/business_system/home/select_shop.dart index 28e28833..da038c3f 100644 --- a/lib/business_system/home/select_shop.dart +++ b/lib/business_system/home/select_shop.dart @@ -1,12 +1,18 @@ +import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../../generated/l10n.dart'; +import '../../retrofit/business_api.dart'; +import '../../retrofit/data/base_data.dart'; import '../../retrofit/data/business_login_info.dart'; import '../../retrofit/data/business_store_list.dart'; +import '../../utils/business_instance.dart'; import '../../view_widget/classic_header.dart'; import '../../view_widget/my_footer.dart'; @@ -24,6 +30,7 @@ class SelectShop extends StatefulWidget { class _SelectShop extends State { final RefreshController refreshController = RefreshController(); BusinessLoginInfo businessLoginInfo; + BusinessApiService businessService; List records = []; int selectIndex = 0; @@ -31,7 +38,43 @@ class _SelectShop extends State { void initState() { super.initState(); businessLoginInfo = widget.arguments["businessLoginInfo"]; + if(widget.arguments["routeSource"] == "单门店") records = widget.arguments["records"]; + if(widget.arguments["routeSource"] == "门店设置") + queryStoreList(); + } + + ///门店设置列表 + queryStoreList() async { + try{ + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: "0"); + } + BaseData baseData = await businessService + .getStoreList(BusinessInstance.instance.businessTenant, "1", "100") + .catchError((error) { + refreshController.refreshFailed(); + refreshController.loadFailed(); + }); + if (!mounted) return; + if (baseData != null && baseData.isSuccess) { + records.clear(); + records.addAll((baseData?.data?.records ?? []).reversed); + refreshController.refreshCompleted(); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + }finally{ + EasyLoading.dismiss(); + setState((){}); + } } @override diff --git a/lib/business_system/home/vip/vip_recharge_page.dart b/lib/business_system/home/vip/vip_recharge_page.dart index 43f9bdd3..7b0592f2 100644 --- a/lib/business_system/home/vip/vip_recharge_page.dart +++ b/lib/business_system/home/vip/vip_recharge_page.dart @@ -684,7 +684,6 @@ class _VipRechargePage extends State { bottom: 34.h), child: Container( alignment: Alignment.center, - padding: EdgeInsets.symmetric(vertical: 16.h), decoration: BoxDecoration( color: Color(0xFF30415B), borderRadius: BorderRadius.circular(27), diff --git a/lib/business_system/mine/business_mine_page.dart b/lib/business_system/mine/business_mine_page.dart index 8581d97e..94b479ef 100644 --- a/lib/business_system/mine/business_mine_page.dart +++ b/lib/business_system/mine/business_mine_page.dart @@ -7,20 +7,19 @@ import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/my_footer.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:visibility_detector/visibility_detector.dart'; import '../../retrofit/business_api.dart'; import '../../retrofit/data/base_data.dart'; import '../../retrofit/data/business_login_info.dart'; import '../../retrofit/data/business_store_list.dart'; import '../../utils/business_instance.dart'; -import '../../utils/flutter_utils.dart'; import '../../utils/font_weight.dart'; class BusinessMinePage extends StatefulWidget { final BusinessLoginInfo businessLoginInfo; final String storeId; - BusinessMinePage(this.businessLoginInfo, this.storeId); + BusinessMinePage(Key key, this.businessLoginInfo, this.storeId) + : super(key: key); @override State createState() { @@ -28,17 +27,18 @@ class BusinessMinePage extends StatefulWidget { } } -class _BusinessMinePage extends State - with AutomaticKeepAliveClientMixin { +class _BusinessMinePage extends State { final RefreshController refreshController = RefreshController(); BusinessApiService businessService; List records = []; - double visiblePercentage; int networkStatus = 0; @override void initState() { super.initState(); + if (widget.businessLoginInfo.storeList.length == 1) { + queryStoreList(); + } } @override @@ -49,9 +49,6 @@ class _BusinessMinePage extends State ///门店设置列表 queryStoreList() async { - // EasyLoading.show( - // status: S.current.zhengzaijiazai, - // maskType: EasyLoadingMaskType.black); if (businessService == null) { businessService = BusinessApiService(Dio(), context: context, @@ -62,18 +59,14 @@ class _BusinessMinePage extends State BaseData baseData = await businessService .getStoreList(BusinessInstance.instance.businessTenant, "1", "100") .catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); - networkStatus = -1; refreshController.refreshFailed(); refreshController.loadFailed(); }); if (!mounted) return; if (baseData != null && baseData.isSuccess) { - records = baseData.data.records ?? []; + records.clear(); + records.addAll((baseData.data.records ?? []).reversed); refreshController.refreshCompleted(); - networkStatus = 1; - // EasyLoading.dismiss(); } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } @@ -81,140 +74,178 @@ class _BusinessMinePage extends State @override Widget build(BuildContext context) { - super.build(context); - return VisibilityDetector( - key: Key('my-widget-key'), - onVisibilityChanged: (visibilityInfo) { - visiblePercentage = visibilityInfo.visibleFraction; - if (visiblePercentage == 1) queryStoreList(); - }, - child: Column( - children: [ - Expanded( - child: Container( - child: SmartRefresher( - controller: refreshController, - enablePullDown: true, - enablePullUp: false, - header: MyHeader(color: Color(0xFF30415B)), - physics: BouncingScrollPhysics(), - footer: CustomFooter( - builder: (context, mode) { - return MyFooter(mode); - }, + return Column( + children: [ + Expanded( + child: Container( + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(color: Color(0xFF30415B)), + physics: BouncingScrollPhysics(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: () { + if (widget.businessLoginInfo != null) { + queryStoreList(); + } else + refreshController.refreshFailed(); + }, + child: SingleChildScrollView( + physics: NeverScrollableScrollPhysics(), + child: Container( + child: Column( + children: [ + mineInfo(), + commonFunctions(), + otherFunctions(), + SizedBox( + height: 54.h, + ), + Text( + "@回乡信息公司", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF30415B), + fontWeight: MyFontWeight.medium), + ), + ], + ), + )), + ), + ), + ), + SizedBox( + height: 76.h, + ), + ], + ); + } + + Widget mineInfo() { + return Container( + child: Stack( + alignment: Alignment.bottomCenter, + children: [ + Stack( + children: [ + Container( + width: double.infinity, + height: 238.h, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage( + "assets/image/bs_mine_bg.webp", + ), + fit: BoxFit.cover, ), - onRefresh: () { - if (widget.businessLoginInfo != null) { - queryStoreList(); - } else - refreshController.refreshFailed(); - }, - child: SingleChildScrollView( - physics: NeverScrollableScrollPhysics(), - child: Container( + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context) + .pushNamed('/router/account_information', arguments: { + "businessLoginInfo": widget.businessLoginInfo, + }); + }, + child: Container( + padding: EdgeInsets.only( + top: MediaQuery.of(context).padding.top + 50, left: 16.w), + child: Row( + children: [ + (widget?.businessLoginInfo?.avatar != "") + ? MImage( + widget?.businessLoginInfo?.avatar ?? "", + fit: BoxFit.cover, + width: 69.h, + height: 69.h, + radius: BorderRadius.circular(100), + errorSrc: "assets/image/default_2_1.webp", + fadeSrc: "assets/image/default_2_1.webp", + ) + : Image.asset( + "assets/image/bs_mine_heading.webp", + width: 69, + height: 69, + fit: BoxFit.fill, + ), + SizedBox( + width: 10.w, + ), + Container( + height: 69.h, child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - mineInfo(), - commonFunctions(), - otherFunctions(), - SizedBox( - height: 54.h, + Text( + widget?.businessLoginInfo?.name ?? "", + style: TextStyle( + fontSize: 18.sp, + color: Color(0xFF374C6C), + fontWeight: MyFontWeight.semi_bold), ), Text( - "@回乡信息公司", + 'ID:${widget?.businessLoginInfo?.account ?? ""}', style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF30415B), - fontWeight: MyFontWeight.medium), + fontSize: 16.sp, + color: Color(0xFF374C6C), + fontWeight: MyFontWeight.regular), ), ], ), - )), - ), - ), - ), - SizedBox( - height: 76.h, - ), - ], - )); - } - - Widget mineInfo() { - return Container( - child: Stack( - children: [ - Container( - width: double.infinity, - height: 238.h, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage( - "assets/image/bs_mine_bg.webp", + ) + ], + ), ), - fit: BoxFit.cover, ), - ), + ], ), GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { Navigator.of(context) - .pushNamed('/router/account_information', arguments: { - "businessLoginInfo": widget.businessLoginInfo, + .pushNamed('/router/service_subscription_page', arguments: { + "storeId": widget.storeId ?? "", }); }, child: Container( - padding: EdgeInsets.only( - top: MediaQuery.of(context).padding.top + 50, left: 16.w), + padding: EdgeInsets.only(bottom: 12.h, left: 16.w), child: Row( children: [ - (widget?.businessLoginInfo?.avatar != "") - ? MImage( - widget?.businessLoginInfo?.avatar ?? "", - fit: BoxFit.cover, - width: 69.h, - height: 69.h, - radius: BorderRadius.circular(100), - errorSrc: "assets/image/default_2_1.webp", - fadeSrc: "assets/image/default_2_1.webp", - ) - : Image.asset( - "assets/image/bs_mine_heading.webp", - width: 69, - height: 69, - fit: BoxFit.fill, - ), - SizedBox( - width: 10.w, + Padding( + padding: EdgeInsets.only(right: 14.w), + child: Text( + "服务有效期:2029-12-23", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF353535), + fontWeight: MyFontWeight.regular), + )), + Padding( + padding: EdgeInsets.only(right: 4.w), + child: Text( + "去续费", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF353535), + fontWeight: MyFontWeight.regular), + )), + Image.asset( + "assets/image/icon_right_z.webp", + width: 16.h, + height: 16.h, + color: Color(0xFF353535), ), - Container( - height: 69.h, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Text( - widget?.businessLoginInfo?.name ?? "", - style: TextStyle( - fontSize: 18.sp, - color: Color(0xFF374C6C), - fontWeight: MyFontWeight.semi_bold), - ), - Text( - 'ID:${widget?.businessLoginInfo?.account ?? ""}', - style: TextStyle( - fontSize: 16.sp, - color: Color(0xFF374C6C), - fontWeight: MyFontWeight.regular), - ), - ], - ), - ) ], ), ), - ), + ) ], ), ); @@ -249,24 +280,26 @@ class _BusinessMinePage extends State GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { - if(networkStatus == -1){ + if (networkStatus == -1) { queryStoreList(); return; - } - else if (widget.businessLoginInfo.storeList.length > 1) { - Navigator.of(context).pushNamed('/router/select_shop', - arguments: {"routeSource": "门店设置", "records": records}); + } else if (widget.businessLoginInfo.storeList.length > 1) { + Navigator.of(context) + .pushNamed('/router/select_shop', arguments: { + "routeSource": "门店设置", + }); } else { Navigator.of(context) .pushNamed('/router/merchant_info', arguments: { "storeId": widget.storeId, "storeName": records[0].storeName, "records": records[0], + "routeSource": "单门店" }); } }, child: commonFunctionsItem( - "assets/image/bs_shop_logo.webp", "门店设置", "",20,20), + "assets/image/bs_shop_logo.webp", "门店设置", "", 20, 20), ), Container( width: double.infinity, @@ -282,7 +315,7 @@ class _BusinessMinePage extends State SmartDialog.showToast("该功能暂未开放!", alignment: Alignment.center); }, child: commonFunctionsItem( - "assets/image/bs_mine_code.webp", "门店预约二维码", "",18,18), + "assets/image/bs_mine_code.webp", "门店预约二维码", "", 18, 18), ), Container( width: double.infinity, @@ -300,7 +333,7 @@ class _BusinessMinePage extends State }); }, child: commonFunctionsItem( - "assets/image/bs_secure.webp", "安全设置", "登录手机号/密码",18,22)), + "assets/image/bs_secure.webp", "安全设置", "登录手机号/密码", 18, 22)), Container( width: double.infinity, height: 1.h, @@ -316,14 +349,15 @@ class _BusinessMinePage extends State }); }, child: commonFunctionsItem( - "assets/image/bs_mine_clerk.webp", "店员管理", "",18,20), + "assets/image/bs_mine_clerk.webp", "店员管理", "", 18, 20), ), ], ), ); } - Widget commonFunctionsItem(icon, leftText, rightText,double width,double height) { + Widget commonFunctionsItem( + icon, leftText, rightText, double width, double height) { return Container( margin: EdgeInsets.only(bottom: 14.h), child: Row( @@ -336,7 +370,7 @@ class _BusinessMinePage extends State fit: BoxFit.fill, ), SizedBox( - width:11.w, + width: 11.w, ), Expanded( child: Text( @@ -397,13 +431,11 @@ class _BusinessMinePage extends State onTap: () { Navigator.of(context).pushNamed('/router/user_service_page'); }, - child: - commonFunctionsItem("assets/image/bs_user.webp", "关于我们", "",24,24)) + child: commonFunctionsItem( + "assets/image/bs_user.webp", "关于我们", "", 24, 24)) ], ), ); } - @override - bool get wantKeepAlive => true; } diff --git a/lib/business_system/order/business_order_page.dart b/lib/business_system/order/business_order_page.dart index 2b187cd2..56fbf718 100644 --- a/lib/business_system/order/business_order_page.dart +++ b/lib/business_system/order/business_order_page.dart @@ -10,7 +10,7 @@ import 'order_list_page.dart'; class BusinessOrderPage extends StatefulWidget { final String storeId; - BusinessOrderPage(this.storeId); + BusinessOrderPage(Key key,this.storeId): super(key: key); @override State createState() { @@ -19,7 +19,7 @@ class BusinessOrderPage extends StatefulWidget { } class _BusinessOrderPage extends State - with AutomaticKeepAliveClientMixin,SingleTickerProviderStateMixin{ + with SingleTickerProviderStateMixin{ final RefreshController refreshController = RefreshController(); final ScrollController scrollController = ScrollController(); TabController tabController; @@ -37,7 +37,6 @@ class _BusinessOrderPage extends State @override Widget build(BuildContext context) { - super.build(context); return Column( children: [ Expanded(child: @@ -86,7 +85,4 @@ class _BusinessOrderPage extends State ], ); } - - @override - bool get wantKeepAlive => true; } diff --git a/lib/business_system/order/order_write_off.dart b/lib/business_system/order/order_write_off.dart index cd1b79ad..0d54d0a5 100644 --- a/lib/business_system/order/order_write_off.dart +++ b/lib/business_system/order/order_write_off.dart @@ -100,114 +100,120 @@ class _OrderWriteOff extends State { }, physics: BouncingScrollPhysics(), scrollController: ScrollController(), - child: SingleChildScrollView( - physics: NeverScrollableScrollPhysics(), - child: Container( - margin: EdgeInsets.only(top: 16.h, left: 16.w, right: 16.w), - child: Column( - children: [ - basicInfo(), - writeOffInfo(), - GestureDetector( - onTap: () { - if (tickets != null - ? (widget.arguments["ticketStatus"] == false) - : (ticketDetails.state == 9)) { - return; - } else { - List ticketWipedBatch = []; - if (widget.arguments["tickets"] != null) { - tickets.forEach((element) { - List skuTickets = []; - element.ticketItemList.forEach((ele) { - if (ele.isSelect) { - skuTickets.add({ - "number": 1, - "skuTicket": ele.name, - "state": ele.state, - }); - } - }); - if (skuTickets.isNotEmpty) { - ticketWipedBatch.add({ - "itemMap": [ - { - "productSkuld": element.productSkuId, - "ticketExchangeName": element.name, - "ticketId": element.id, - "skuTickets": skuTickets - } - ], - "ticketCode": element.code, - }); - } - }); - } else { - List skuTickets = []; - ticketDetails.ticketItemList.forEach((element) { - if (element.isSelect) { - skuTickets.add({ - "number": 1, - "skuTicket": element.name, - "state": element.state, - }); - } - }); - if (skuTickets.isNotEmpty) { - ticketWipedBatch.add({ - "itemMap": [ - { - "productSkuld": ticketDetails.productSkuId, - "ticketExchangeName": ticketDetails.name, - "ticketId": ticketDetails.id, - "skuTickets": skuTickets - } - ], - "ticketCode": ticketDetails.code, + child: Stack( + children: [ + SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.only(top: 16.h, left: 16.w, right: 16.w,bottom:100.h), + child: Column( + children: [ + basicInfo(), + writeOffInfo(), + ], + ), + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: GestureDetector( + onTap: () { + if (tickets != null + ? (widget.arguments["ticketStatus"] == false) + : (ticketDetails.state == 9)) { + return; + } else { + List ticketWipedBatch = []; + if (widget.arguments["tickets"] != null) { + tickets.forEach((element) { + List skuTickets = []; + element.ticketItemList.forEach((ele) { + if (ele.isSelect) { + skuTickets.add({ + "number": 1, + "skuTicket": ele.name, + "state": ele.state, }); } + }); + if (skuTickets.isNotEmpty) { + ticketWipedBatch.add({ + "itemMap": [ + { + "productSkuld": element.productSkuId, + "ticketExchangeName": element.name, + "ticketId": element.id, + "skuTickets": skuTickets + } + ], + "ticketCode": element.code, + }); } - if (ticketWipedBatch.length == 0) { - SmartDialog.showToast("请选择要核销的商品", - alignment: Alignment.center); - return; - } else { - severalWiped(ticketWipedBatch); + }); + } else { + List skuTickets = []; + ticketDetails.ticketItemList.forEach((element) { + if (element.isSelect) { + skuTickets.add({ + "number": 1, + "skuTicket": element.name, + "state": element.state, + }); } + }); + if (skuTickets.isNotEmpty) { + ticketWipedBatch.add({ + "itemMap": [ + { + "productSkuld": ticketDetails.productSkuId, + "ticketExchangeName": ticketDetails.name, + "ticketId": ticketDetails.id, + "skuTickets": skuTickets + } + ], + "ticketCode": ticketDetails.code, + }); } - }, + } + if (ticketWipedBatch.length == 0) { + SmartDialog.showToast("请选择要核销的商品", + alignment: Alignment.center); + return; + } else { + severalWiped(ticketWipedBatch); + } + } + }, + child: Container( + color: Colors.white, + width: double.infinity, + padding: EdgeInsets.only( + top: 10.h, + left: 16.w, + right: 16.w, + bottom: 34.h), child: Container( - width: double.infinity, - alignment: Alignment.center, - margin: EdgeInsets.only( - bottom: 55.h, - top: (tickets != null - ? tickets.length - : ticketDetails.ticketItemList.length) <= - 1 - ? 125.h - : 10.h), - padding: EdgeInsets.symmetric(vertical: 16.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(27), - color: (tickets != null - ? (widget.arguments["ticketStatus"] == true) - : (ticketDetails.state != 9)) - ? Color(0xFF30415B) - : Color(0xFFABACAB)), - child: Text( - "确认核销", - style: TextStyle( - fontWeight: MyFontWeight.semi_bold, - fontSize: 16.sp, - color: Colors.white, - ), - ), + width: double.infinity, + alignment: Alignment.center, + height: 54.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(27), + color: (tickets != null + ? (widget.arguments["ticketStatus"] == true) + : (ticketDetails.state != 9)) + ? Color(0xFF30415B) + : Color(0xFFABACAB)), + child: Text( + "确认核销", + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 16.sp, + color: Colors.white, ), - ) - ], - ), - ), + ), + )), + )) + ], ), ), ); @@ -253,10 +259,10 @@ class _OrderWriteOff extends State { SizedBox( height: 12.h, ), - basicInfoItem("用户名称::", + basicInfoItem("用户名称:", widget?.arguments["userName"] ?? ticketDetails?.userName ?? ""), basicInfoItem( - "订单编号::", + "订单编号:", widget?.arguments["orderCode"] ?? (ticketDetails.code.replaceAll("T", "")) ?? ""),