From 0656f12c8e416938e08cf0cffeb41212261fd6f0 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Wed, 10 Jan 2024 09:40:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=8E=A5=E5=8F=A3=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E6=8A=A5=E9=94=99=E4=BC=98=E5=8C=96=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9B=20=E9=A6=96=E9=A1=B5ui=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=9C=8D=E5=8A=A1=E5=A5=97=E9=A4=90=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E6=9C=9F=EF=BC=8C=E5=B9=B6=E6=95=B0=E6=8D=AE=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E8=B0=83=E8=AF=95=EF=BC=9B=20=E5=AE=9E=E5=88=97=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=EF=BC=9A=E6=9C=8D=E5=8A=A1=E5=A5=97=E9=A4=90=E6=97=B6?= =?UTF-8?q?=E9=97=B4=EF=BC=8C=E6=9C=8D=E5=8A=A1=E7=8A=B6=E6=80=81=EF=BC=9B?= =?UTF-8?q?=20=E7=99=BB=E5=BD=95=E6=8E=A5=E5=8F=A3=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E7=B1=BB=E6=96=B0=E5=A2=9E=E9=83=A8=E5=88=86=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=EF=BC=9B=20=E5=95=86=E5=AE=B6=E7=AB=AF=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=9B=B4=E6=94=B9=EF=BC=9B=20=E6=88=91?= =?UTF-8?q?=E7=9A=84=E9=A1=B5=E9=9D=A2=E6=96=B0=E5=A2=9E=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=A5=97=E9=A4=90=E8=B4=AD=E4=B9=B0=E5=85=A5=E5=8F=A3=EF=BC=9B?= =?UTF-8?q?(=E6=95=B0=E6=8D=AE=E6=B5=81=E7=A8=8B=E5=B7=B2=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5)=20=E6=88=91=E7=9A=84=E9=A1=B5=E9=9D=A2=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96=EF=BC=9B=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=9C=8D=E5=8A=A1=E5=A5=97=E9=A4=90?= =?UTF-8?q?=E8=B4=AD=E4=B9=B0=E9=A1=B5=E9=9D=A2=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=95=86=E5=93=81=E9=A1=B5=E9=9D=A2=EF=BC=8C=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=95=86=E5=93=81=E8=A7=84=E6=A0=BC=E9=A1=B5=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=A7=84=E6=A0=BC=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E8=AE=BE=E7=BD=AE=E5=A5=97=E9=A4=90=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=EF=BC=9B=20=E9=97=A8=E5=BA=97=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=95=B0=E6=8D=AE=E4=BC=98=E5=8C=96=EF=BC=9B?= =?UTF-8?q?=20=E9=80=89=E6=8B=A9=E9=97=A8=E5=BA=97=E9=A1=B5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=BC=98=E5=8C=96=EF=BC=9B=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=E5=AE=9E?= =?UTF-8?q?=E4=BD=93=E7=B1=BB=EF=BC=9B=20=E6=96=B0=E5=A2=9E=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E7=B1=BB=EF=BC=9B=20=E6=96=B0=E5=A2=9E=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=A5=97=E9=A4=90=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3=E5=AE=9E?= =?UTF-8?q?=E4=BD=93=E7=B1=BB=EF=BC=9B=20=E6=96=B0=E5=A2=9E=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=A5=97=E9=A4=90=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E7=B1=BB=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/business_home_page.dart | 17 +- lib/business_system/home/select_shop.dart | 36 - .../login/business_login_page.dart | 11 +- .../mine/business_mine_page.dart | 315 ++--- lib/business_system/mine/merchant_info.dart | 2 +- .../service_subscription_page.dart | 1185 +++++++++++++++++ lib/home/welfare_page.dart | 1 - lib/login/new_login_page.dart | 2 + lib/main.dart | 15 + lib/mine/mine_view/mine_item.dart | 2 + lib/retrofit/business_api.dart | 78 +- lib/retrofit/business_api.g.dart | 133 ++ lib/retrofit/data/business_login_info.dart | 64 +- lib/retrofit/data/goods_category_list.dart | 123 ++ lib/retrofit/data/tenant_info.dart | 366 +++++ .../tenant_package_calculate_details.dart | 51 + lib/retrofit/data/tenant_package_list.dart | 245 ++++ lib/utils/business_instance.dart | 16 + 18 files changed, 2450 insertions(+), 212 deletions(-) create mode 100644 lib/business_system/mine/service_subscription/service_subscription_page.dart create mode 100644 lib/retrofit/data/goods_category_list.dart create mode 100644 lib/retrofit/data/tenant_info.dart create mode 100644 lib/retrofit/data/tenant_package_calculate_details.dart create mode 100644 lib/retrofit/data/tenant_package_list.dart diff --git a/lib/business_system/home/business_home_page.dart b/lib/business_system/home/business_home_page.dart index a84c2a12..9057cd76 100644 --- a/lib/business_system/home/business_home_page.dart +++ b/lib/business_system/home/business_home_page.dart @@ -18,6 +18,7 @@ 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; @@ -90,8 +91,13 @@ class _BusinessHomePage extends State { BaseData baseData = await businessService.getDayCounts({ "summaryDate": "${DateFormat("yyyy-MM-dd").format(DateTime.now())}" }).catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); + SmartDialog.show( + clickBgDismissTemp: false, + widget: SettlementTips( + () {}, + text: AppUtils.dioErrorTypeToString(error.type), + color: Color(0xFF30415B), + )); refreshController.refreshFailed(); refreshController.loadFailed(); }); @@ -138,6 +144,7 @@ class _BusinessHomePage extends State { ), ), ), + if(BusinessInstance.instance.serviceStatus == "试用") GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { @@ -149,6 +156,10 @@ class _BusinessHomePage extends State { ? "0" : widget .businessLoginInfo.storeList[widget.selectStoreIndex].id + }).then((value){ + if(value == 1){ + setState((){}); + } }); }, child: Container( @@ -171,7 +182,7 @@ class _BusinessHomePage extends State { ), ), TextSpan( - text: "2024-01-02", + text: "${(widget?.businessLoginInfo?.expirationTime ?? "").length > 9 ? (widget?.businessLoginInfo?.expirationTime ?? "").substring(0, 10) : ""}", style: TextStyle( color: Color(0xFFFF8F1F), fontSize: 14.sp, diff --git a/lib/business_system/home/select_shop.dart b/lib/business_system/home/select_shop.dart index da038c3f..98092caf 100644 --- a/lib/business_system/home/select_shop.dart +++ b/lib/business_system/home/select_shop.dart @@ -38,43 +38,7 @@ 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/login/business_login_page.dart b/lib/business_system/login/business_login_page.dart index 980adeb3..fc8b99c2 100644 --- a/lib/business_system/login/business_login_page.dart +++ b/lib/business_system/login/business_login_page.dart @@ -17,6 +17,7 @@ import '../../retrofit/data/business_login_info.dart'; import '../../utils/font_weight.dart'; import '../../view_widget/border_text.dart'; import '../../view_widget/round_button.dart'; +import '../../view_widget/settlement_tips_dialog.dart'; class BusinessLoginPage extends StatefulWidget { final Map arguments; @@ -98,6 +99,8 @@ class _BusinessLoginPage extends State { } BusinessInstance.instance.businessTenant = businessLoginInfo.tenantCode; BusinessInstance.instance.businessToken = businessLoginInfo.token; + BusinessInstance.instance.expirationTime = businessLoginInfo.expirationTime; + BusinessInstance.instance.serviceStatus = businessLoginInfo.status.desc; sharedPreferences.setString('account', _userPhoneController.text); sharedPreferences.setString('password', _passwordController.text); sharedPreferences.setString('identitySwitch', "1"); @@ -113,7 +116,13 @@ class _BusinessLoginPage extends State { } } else { if (baseData.msg != null) - SmartDialog.showToast(baseData?.msg, alignment: Alignment.center); + SmartDialog.show( + clickBgDismissTemp: false, + widget: SettlementTips( + () {}, + text: baseData.msg, + color: Color(0xFF30415B), + )); } EasyLoading.dismiss(); } diff --git a/lib/business_system/mine/business_mine_page.dart b/lib/business_system/mine/business_mine_page.dart index 94b479ef..028826be 100644 --- a/lib/business_system/mine/business_mine_page.dart +++ b/lib/business_system/mine/business_mine_page.dart @@ -7,19 +7,21 @@ 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'; +import '../../view_widget/settlement_tips_dialog.dart'; class BusinessMinePage extends StatefulWidget { final BusinessLoginInfo businessLoginInfo; final String storeId; - BusinessMinePage(Key key, this.businessLoginInfo, this.storeId) - : super(key: key); + BusinessMinePage(Key key,this.businessLoginInfo, this.storeId): super(key: key); @override State createState() { @@ -27,18 +29,16 @@ class BusinessMinePage extends StatefulWidget { } } -class _BusinessMinePage extends State { +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 @@ -59,14 +59,22 @@ class _BusinessMinePage extends State { BaseData baseData = await businessService .getStoreList(BusinessInstance.instance.businessTenant, "1", "100") .catchError((error) { + SmartDialog.show( + clickBgDismissTemp: false, + widget: SettlementTips( + () {}, + text: AppUtils.dioErrorTypeToString(error.type), + color: Color(0xFF30415B), + )); + networkStatus = -1; refreshController.refreshFailed(); refreshController.loadFailed(); }); if (!mounted) return; if (baseData != null && baseData.isSuccess) { - records.clear(); records.addAll((baseData.data.records ?? []).reversed); refreshController.refreshCompleted(); + networkStatus = 1; } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } @@ -74,161 +82,171 @@ class _BusinessMinePage extends State { @override Widget build(BuildContext context) { - 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), + 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); + }, + ), + 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, - ), - ], - ); + SizedBox( + height: 76.h, + ), + ], + )); } Widget mineInfo() { return Container( child: Stack( - alignment: Alignment.bottomCenter, + 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, + 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, - }); - }, - 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, + ), + 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: [ + 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), + ), + ], ), - 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), - ), - ], - ), - ) - ], - ), + ) + ], ), ), - ], - ), + ), + ], + ), + if(BusinessInstance.instance.serviceStatus == "正常") GestureDetector( behavior: HitTestBehavior.opaque, - onTap: () { - Navigator.of(context) - .pushNamed('/router/service_subscription_page', arguments: { - "storeId": widget.storeId ?? "", + onTap: (){ + Navigator.of(context).pushNamed( + '/router/service_subscription_page', + arguments: { + "storeId":widget.storeId ?? "", + }).then((value){ + if(value == 1){ + setState((){}); + } }); }, child: Container( - padding: EdgeInsets.only(bottom: 12.h, left: 16.w), + padding: EdgeInsets.only(bottom:12.h,left: 16.w), child: Row( children: [ - Padding( - padding: EdgeInsets.only(right: 14.w), + Padding(padding:EdgeInsets.only(right: 14.w), child: Text( - "服务有效期:2029-12-23", + "服务有效期:${(BusinessInstance.instance.expirationTime ?? "").length > 9 ? (BusinessInstance.instance.expirationTime ?? "").substring(0, 10) : ""}", style: TextStyle( fontSize: 14.sp, color: Color(0xFF353535), fontWeight: MyFontWeight.regular), )), - Padding( - padding: EdgeInsets.only(right: 4.w), + Padding(padding:EdgeInsets.only(right:4.w), child: Text( "去续费", style: TextStyle( @@ -280,26 +298,24 @@ 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": "门店设置", - }); + } + else if (widget.businessLoginInfo.storeList.length > 1) { + Navigator.of(context).pushNamed('/router/select_shop', + arguments: {"routeSource": "门店设置", "records": records}); } 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, @@ -315,7 +331,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, @@ -333,7 +349,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, @@ -349,15 +365,14 @@ 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( @@ -370,7 +385,7 @@ class _BusinessMinePage extends State { fit: BoxFit.fill, ), SizedBox( - width: 11.w, + width:11.w, ), Expanded( child: Text( @@ -431,8 +446,8 @@ 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)) ], ), ); diff --git a/lib/business_system/mine/merchant_info.dart b/lib/business_system/mine/merchant_info.dart index fdaedd33..8b3c95f5 100644 --- a/lib/business_system/mine/merchant_info.dart +++ b/lib/business_system/mine/merchant_info.dart @@ -134,7 +134,7 @@ class _MerchantInfo extends State { showShopType(); }, child: textItems( - "店铺类型", serviceType == null ? shopType() : serviceType), + "店铺类型", serviceType == null ? shopType()??"" : serviceType??""), ), Container( width: double.infinity, diff --git a/lib/business_system/mine/service_subscription/service_subscription_page.dart b/lib/business_system/mine/service_subscription/service_subscription_page.dart new file mode 100644 index 00000000..41b57385 --- /dev/null +++ b/lib/business_system/mine/service_subscription/service_subscription_page.dart @@ -0,0 +1,1185 @@ +import 'dart:io'; + +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:fluwx/fluwx.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shimmer/shimmer.dart'; +import '../../../generated/l10n.dart'; +import '../../../retrofit/business_api.dart'; +import '../../../retrofit/data/base_data.dart'; +import '../../../retrofit/data/tenant_info.dart'; +import '../../../retrofit/data/tenant_package_calculate_details.dart'; +import '../../../retrofit/data/tenant_package_list.dart'; +import '../../../retrofit/data/wx_pay.dart'; +import '../../../utils/business_instance.dart'; +import '../../../utils/flutter_utils.dart'; +import '../../../utils/font_weight.dart'; +import '../../../utils/min.dart'; +import '../../../view_widget/classic_header.dart'; +import '../../../view_widget/my_footer.dart'; +import '../../../view_widget/no_data_view.dart'; +import '../../../view_widget/settlement_tips_dialog.dart'; +import 'package:tobias/tobias.dart' as tobias; + +class ServiceSubscriptionPage extends StatefulWidget { + final Map arguments; + + ServiceSubscriptionPage({this.arguments}); + + @override + State createState() { + return _ServiceSubscriptionPage(); + } +} + +class _ServiceSubscriptionPage extends State { + final RefreshController refreshController = RefreshController(); + BusinessApiService businessService; + String networkError = ""; + int networkStatus = 0; + int selectIndex = 0; + int serviceType = 0; + int payType = 1; + TenantInfo tenantInfo; + List tenantPackageList = []; + TenantPackageCalculateDetails tenantPackageCalculateDetails; + dynamic payListen; + + @override + void initState() { + super.initState(); + queryTenantList(); + payListen = weChatResponseEventHandler.listen((event) async { + print("payCallback: ${event.errCode}"); + if (event.errCode == 0) { + queryTenantInfo(); + } else { + SmartDialog.showToast("购买服务失败", alignment: Alignment.center); + return; + } + }); + } + + ///服务套餐列表 + queryTenantList({isSing = true}) async { + if (isSing) + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + try { + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.arguments["storeId"]); + } + BaseData> baseData = + await businessService.tenantPackage().catchError((error) { + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; + setState(() {}); + refreshController.refreshFailed(); + refreshController.loadFailed(); + }); + if (baseData != null && baseData.isSuccess) { + tenantPackageList = baseData.data; + queryTenantCalculate(isSing: false); + networkStatus = 1; + refreshController.refreshCompleted(); + refreshController.loadComplete(); + } + } finally { + if (isSing) { + setState(() {}); + EasyLoading.dismiss(); + } + } + } + + ///服务套餐计算 + queryTenantCalculate({isSing: true}) async { + try { + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.arguments["storeId"]); + } + BaseData baseData = + await businessService.tenantPackageCalculate({ + "packageId": int.tryParse(tenantPackageList[serviceType]?.id ?? 0), + "payChannel": payType, + "packageSale": { + "packagePrice": tenantPackageList[serviceType] + ?.tenantPackageSale[selectIndex] + ?.packagePrice ?? + "", + "originalPackagePrice": tenantPackageList[serviceType] + ?.tenantPackageSale[selectIndex] + ?.originalPackagePrice ?? + "", + "duration": tenantPackageList[serviceType] + ?.tenantPackageSale[selectIndex] + ?.duration ?? + 0, + "packageDiscount": tenantPackageList[serviceType] + ?.tenantPackageSale[selectIndex] + ?.packageDiscount ?? + 0, + "isRecommend": tenantPackageList[serviceType] + ?.tenantPackageSale[selectIndex] + ?.isRecommend ?? + false, + "saleName": tenantPackageList[serviceType] + ?.tenantPackageSale[selectIndex] + ?.saleName ?? + "", + "canDiscount": tenantPackageList[serviceType] + ?.tenantPackageSale[selectIndex] + ?.canDiscount ?? + false, + } + }).catchError((error) { + if (isSing) { + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; + setState(() {}); + refreshController.refreshFailed(); + refreshController.loadFailed(); + } + }); + if (!mounted) return; + if (baseData != null && baseData.isSuccess) { + tenantPackageCalculateDetails = baseData.data; + networkStatus = 1; + if (isSing) { + refreshController.refreshCompleted(); + refreshController.loadComplete(); + } + } + } finally { + setState(() {}); + } + } + + ///服务套餐支付 + tenantPay() async { + try { + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + businessService = BusinessApiService(Dio(), + context: context, + pay: true, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.arguments["storeId"]); + BaseData baseData = await businessService.tenantApplyPay({ + "packageId": + int.tryParse(tenantPackageCalculateDetails?.packageId ?? 0), + "payChannel": payType, + "packageSale": { + "packagePrice": tenantPackageCalculateDetails?.totalFee ?? "", + "expirationTime": tenantPackageCalculateDetails?.expirationTime ?? "", + "duration": tenantPackageCalculateDetails?.duration ?? 0 + } + }).catchError((error) { + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; + setState(() {});}); + if (baseData != null && baseData.isSuccess) { + if (payType == 1) { + if (Platform.isAndroid) { + if (!(await Min.isInitialize())) { + // 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, + // 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, + // 故而在此初始化一下 + await Min.initialize(); + } + } + WxPay wxPay = WxPay.fromJson(baseData.data); + await registerWxApi( + appId: wxPay.appId, + doOnAndroid: true, + universalLink: "https://hx.lotus-wallet.com/app/", + ); + payWithWeChat( + appId: wxPay.appId, + partnerId: wxPay.partnerId, + prepayId: wxPay.prepayId, + packageValue: wxPay.packageValue, + nonceStr: wxPay.nonceStr, + timeStamp: int.tryParse(wxPay.timeStamp), + sign: wxPay.sign, + ); + } else { + tobias.isAliPayInstalled().then((value) => { + // 判断是否安装了支付宝 + if (!value) + {SmartDialog.showToast("请安装支付宝", alignment: Alignment.center)} + else + { + tobias.aliPay(baseData.data["body"]).then((payRes) { + if (payRes['resultStatus'] == 9000 || + payRes['resultStatus'] == '9000') { + queryTenantInfo(); + } else { + if(payRes['memo'] != "") + SmartDialog.showToast(payRes['memo'], + alignment: Alignment.center); + } + }) + } + }); + } + networkStatus =1; + } else { + SmartDialog.show( + clickBgDismissTemp: false, + widget: SettlementTips( + () {}, + text: baseData.msg, + color: Color(0xFF30415B), + )); + } + } finally { + EasyLoading.dismiss(); + setState(() {}); + } + } + + ///查询商户信息 + queryTenantInfo() async { + try { + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.arguments["storeId"]); + } + BaseData baseData = await businessService + .tenantInfo(BusinessInstance.instance.businessTenant) + .catchError((error) { + networkStatus = -1; + networkError = AppUtils.dioErrorTypeToString(error.type); + }); + if (baseData != null && baseData.isSuccess) { + tenantInfo = baseData.data; + BusinessInstance.instance.expirationTime = baseData.data.expirationTime; + BusinessInstance.instance.serviceStatus = baseData.data.status.desc; + networkStatus = 1; + Navigator.of(context).pop(1); + SmartDialog.showToast("购买服务成功", alignment: Alignment.center); + } + } finally { + setState(() {}); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: MyAppBar( + title: "服务订购", + titleColor: Colors.black, + background: Colors.white, + leadingColor: Colors.black, + brightness: Brightness.dark, + ), + body: networkStatus == -1 + ? noNetwork() + : (networkStatus == 0 + ? serviceSm() + : SmartRefresher( + enablePullDown: true, + enablePullUp: false, + header: MyHeader( + color: Color(0xFF30415B), + ), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + controller: refreshController, + onRefresh: () { + queryTenantList(isSing: false); + }, + physics: BouncingScrollPhysics(), + child: Stack( + children: [ + SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ///续费时间 + Container( + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x0F06152E), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ) + ], + borderRadius: BorderRadius.circular(8), + ), + padding: EdgeInsets.only( + top: 16.h, bottom: 16.h, left: 16.w), + margin: EdgeInsets.only( + bottom: 16.h, right: 16.w, left: 16.w), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: + EdgeInsets.only(bottom: 16.h), + child: Text( + "你的到期时间是: ${(tenantPackageCalculateDetails?.expirationTime ?? "").length > 9 ? (tenantPackageCalculateDetails?.expirationTime ?? "").substring(0, 10) : ""}", + style: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: + MyFontWeight.regular, + ), + )), + Text( + "购买后到期时间: ${(tenantPackageCalculateDetails?.expirationTime ?? "").length > 9 ? (tenantPackageCalculateDetails?.expirationTime ?? "").substring(0, 10) : ""}", + style: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + ) + ], + )), + + ///服务套餐 + Column( + children: [ + Padding( + padding: EdgeInsets.symmetric( + horizontal: 16.w), + child: Row( + children: [ + Expanded( + child: Text( + "请选择购买", + style: TextStyle( + fontSize: 15.sp, + color: Color(0xFF0D0D0D), + fontWeight: MyFontWeight.bold), + )), + Padding( + padding: + EdgeInsets.only(right: 2.w), + child: Text( + "功能版本介绍", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: + MyFontWeight.regular), + )), + Image.asset( + "assets/image/icon_right_z.webp", + width: 14.h, + height: 14.h, + color: Color(0xFF1A1A1A), + ), + ], + ), + ), + serviceTypeList(), + ], + ), + ], + ), + )), + + ///确认充值 + Align( + alignment: Alignment.bottomCenter, + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + payMode(); + }, + 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( + alignment: Alignment.center, + height: 54.h, + decoration: BoxDecoration( + color: Color(0xFF30415B), + borderRadius: BorderRadius.circular(27), + ), + child: Text( + "确认", + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: MyFontWeight.bold, + ), + ), + ), + ), + )) + ], + ), + )), + ); + } + + ///服务套餐分类 + Widget serviceTypeList() { + return (tenantPackageList != null && (tenantPackageList?.length ?? 0) > 0) + ? Column( + children: [ + Container( + height: 59.h, + alignment: Alignment.centerLeft, + child: ListView.builder( + padding: EdgeInsets.zero, + itemCount: tenantPackageList?.length ?? 0, + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + serviceType = position; + queryTenantCalculate(); + }); + }, + child: serviceTypeItem( + tenantPackageList[position], position)); + }, + )), + serviceList(), + ], + ) + : NoDataView( + src: "assets/image/xiao_fei.webp", + isShowBtn: false, + text: "暂无服务套餐~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 20.h, left: 60.w, right: 60.w), + ); + } + + ///服务套餐分类列表 + Widget serviceTypeItem(TenantPackageList tenantPackageList, index) { + return Container( + padding: EdgeInsets.only(right: 18.w, left: 16.w, top: 19.h), + child: Column( + children: [ + Text( + tenantPackageList?.name ?? "", + style: TextStyle( + fontSize: 14.sp, + color: serviceType == index + ? Color(0xFF30415B) + : Color(0xFF302F3A), + fontWeight: serviceType == index + ? MyFontWeight.bold + : MyFontWeight.regular), + ), + if (serviceType == index) + Container( + margin: EdgeInsets.only(top: 5.h), + width: 24.w, + height: 2.h, + color: Color(0xFF30415B), + ), + ], + ), + ); + } + + ///服务套餐选择 + Widget serviceList() { + return Container( + child: (tenantPackageList != null && + (tenantPackageList[serviceType]?.tenantPackageSale?.length ?? + 0) > + 0) + ? GridView.builder( + itemCount: + tenantPackageList[serviceType]?.tenantPackageSale?.length ?? + 0, + padding: EdgeInsets.only( + top: 12.h, right: 16.w, left: 16.w, bottom: 120.h), + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + crossAxisSpacing: 13.w, + mainAxisSpacing: 14.h, + childAspectRatio: 0.8), + itemBuilder: (context, index) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + selectIndex = index; + queryTenantCalculate(); + }); + }, + child: serviceItem( + tenantPackageList[serviceType] + .tenantPackageSale[index], + index)); + }, + ) + : NoDataView( + src: "assets/image/xiao_fei.webp", + isShowBtn: false, + text: "暂无服务套餐~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 20.h, left: 60.w, right: 60.w), + )); + } + + ///服务套餐选择列表 + Widget serviceItem(TenantPackageSale tenantPackageSale, index) { + return Stack( + alignment: Alignment.topRight, + children: [ + Stack( + children: [ + Container( + alignment: Alignment.center, + width: double.infinity, + padding: EdgeInsets.only(top: 18.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + border: Border.all( + color: selectIndex == index + ? Color(0xFF30415B) + : Color(0x29C5C5C5), + width: 2, + ), + color: selectIndex == index + ? Color(0XFFEBF3FF) + : Color(0xFFF9FAF8)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "${tenantPackageSale?.duration ?? 0}年", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF302F3A), + fontWeight: MyFontWeight.bold), + ), + Padding( + padding: EdgeInsets.only(bottom: 18.h, top: 10.h), + child: Text.rich( + TextSpan(children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.bold, + color: Color(0xFF30415B), + ), + ), + TextSpan( + text: ((tenantPackageSale?.canDiscount ?? false) == + true) + ? (tenantPackageSale?.packagePrice ?? "") + : (tenantPackageSale?.originalPackagePrice ?? + ""), + style: TextStyle( + fontSize: 24.sp, + fontWeight: FontWeight.bold, + color: Color(0xFF30415B), + ), + ), + ]), + )), + if (AppUtils.calculateDouble(((tenantPackageSale + ?.canDiscount ?? + false) == + true) + ? (double.tryParse( + (tenantPackageSale?.packagePrice ?? "0")) / + ((tenantPackageSale?.duration ?? 0) * 12)) + : (double.tryParse( + (tenantPackageSale?.originalPackagePrice ?? + "0")) / + ((tenantPackageSale?.duration ?? 0) * 12))) != + "0") + Text( + "¥${AppUtils.calculateDouble(((tenantPackageSale?.canDiscount ?? false) == true) ? (double.tryParse((tenantPackageSale?.packagePrice ?? "0")) / ((tenantPackageSale?.duration ?? 0) * 12)) : (double.tryParse((tenantPackageSale?.originalPackagePrice ?? "0")) / ((tenantPackageSale?.duration ?? 0) * 12)))}/月", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF302F3A), + fontWeight: MyFontWeight.bold), + ), + ], + ), + ), + if ((tenantPackageSale?.canDiscount ?? false) == true) + Container( + decoration: BoxDecoration( + color: Color(0xFFFF8F1F), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(4), + bottomRight: Radius.circular(4), + ), + ), + padding: EdgeInsets.symmetric(horizontal: 4.w), + child: Text( + "${(tenantPackageSale?.packageDiscount ?? 0) / 100}折", + style: TextStyle( + fontSize: 12.sp, + color: Colors.white, + fontWeight: MyFontWeight.regular), + ), + ) + ], + ), + if (selectIndex == index) + Image.asset( + "assets/image/bus_vip_j.webp", + width: 32.h, + height: 32.h, + fit: BoxFit.fill, + ), + ], + ); + } + + ///支付方式弹窗 + payMode() { + showModalBottomSheet( + context: context, + backgroundColor: Colors.transparent, + builder: (context) { + return StatefulBuilder(builder: ( + context, + state, + ) { + return Container( + width: double.infinity, + height: 302.h, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), + ), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Container( + alignment: Alignment.center, + margin: EdgeInsets.only( + top: 12.h, bottom: 12.h, left: 41.w), + child: Text( + "支付方式", + style: TextStyle( + fontWeight: MyFontWeight.bold, + fontSize: 16.sp, + color: Color(0xFF1A1A1A), + ), + ), + )), + GestureDetector( + onTap: () { + state(() { + Navigator.of(context).pop(); + }); + }, + child: Padding( + padding: EdgeInsets.only(right: 16.w), + child: Image.asset( + "assets/image/cancel.webp", + width: 25.h, + height: 25.h, + ), + ), + ), + ], + ), + Column( + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + state(() { + payType = 1; + }); + }, + child: Container( + alignment: Alignment.center, + width: double.infinity, + padding: EdgeInsets.only( + top: 16.h, bottom: 16.h, left: 18.w), + margin: EdgeInsets.symmetric(horizontal: 14.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6), + border: Border.all( + color: payType == 1 + ? Color(0xFF30415B) + : Color(0x29C5C5C5), + width: 1, + ), + color: payType == 1 + ? Color(0XFFEBF3FF) + : Color(0xFFF9FAF8)), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/image/bus_vip_wx.webp", + width: 20.w, + height: 18.h, + ), + Padding( + padding: EdgeInsets.only(left: 5.w), + child: Text( + "微信支付", + style: TextStyle( + fontSize: 14.sp, + color: payType == 1 + ? Color(0xFF30415B) + : Color(0xFF0D0D0D), + fontWeight: MyFontWeight.bold), + )), + ], + ), + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + state(() { + payType = 2; + }); + }, + child: Container( + alignment: Alignment.center, + width: double.infinity, + padding: EdgeInsets.only( + top: 16.h, bottom: 16.h, left: 18.w), + margin: EdgeInsets.symmetric( + horizontal: 14.w, vertical: 12.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6), + border: Border.all( + color: payType == 2 + ? Color(0xFF30415B) + : Color(0x29C5C5C5), + width: 1, + ), + color: payType == 2 + ? Color(0XFFEBF3FF) + : Color(0xFFF9FAF8)), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/image/bus_vip_alipay.webp", + width: 20.h, + height: 20.h, + ), + Padding( + padding: EdgeInsets.only(left: 5.w), + child: Text( + "支付宝", + style: TextStyle( + fontSize: 14.sp, + color: payType == 2 + ? Color(0xFF30415B) + : Color(0xFF0D0D0D), + fontWeight: MyFontWeight.bold), + )), + ], + ), + ), + ), + ], + ), + GestureDetector( + onTap: () { + setState(() { + Navigator.of(context).pop(); + tenantPay(); + }); + }, + child: Container( + width: double.infinity, + alignment: Alignment.center, + margin: EdgeInsets.symmetric( + vertical: 25.h, horizontal: 16.w), + padding: EdgeInsets.symmetric(vertical: 16.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(27), + color: Color(0xFF30415B)), + child: Text( + S.of(context).queren, + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 16.sp, + color: Colors.white, + ), + ), + ), + ) + ], + ), + ); + }); + }); + } + + Widget serviceSm() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.symmetric(horizontal: 16.w), + padding: EdgeInsets.only(top: 17.h, bottom: 16.h, left: 16.w), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x0F06152E), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ) + ], + borderRadius: BorderRadius.circular(8), + ), + child: Column( + children: [ + Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + margin: EdgeInsets.only(right: 10.w), + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 112.w, + height: 20.h, + ), + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 85.w, + height: 20.h, + ), + ), + ], + ), + SizedBox( + height: 16.h, + ), + Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + margin: EdgeInsets.only(right: 10.w), + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 112.w, + height: 20.h, + ), + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 85.w, + height: 20.h, + ), + ), + ], + ) + ], + ), + ), + SizedBox( + height: 12.h, + ), + Expanded( + child: Container( + padding: + EdgeInsets.only(top: 17.h, bottom: 16.h, left: 16.w, right: 16.w), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x0F06152E), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ) + ], + ), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + margin: EdgeInsets.only(right: 10.w), + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 75.w, + height: 20.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 72.w, + height: 17.h, + ), + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + margin: EdgeInsets.only(left: 5.w, right: 16.w), + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 16.w, + height: 17.h, + ), + ), + ], + ), + SizedBox( + height: 19.h, + ), + Container( + height: 25.h, + margin: EdgeInsets.only(bottom: 27.h), + child: ListView.builder( + padding: EdgeInsets.zero, + itemCount: 10, + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + margin: EdgeInsets.only(right: 10.w), + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 59.w, + ), + ); + }, + ), + ), + Expanded( + child: GridView.builder( + itemCount: 5, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + crossAxisSpacing: 13.w, + mainAxisSpacing: 14.h, + childAspectRatio: 0.8), + itemBuilder: (context, index) { + return Container( + alignment: Alignment.center, + width: double.infinity, + padding: EdgeInsets.only(top: 18.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + border: Border.all( + color: Color(0x29C5C5C5), + width: 2, + ), + color: Color(0xFFF9FAF8)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + margin: EdgeInsets.only(right: 10.w), + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 21.w, + height: 20.h, + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 18.h, top: 10.h), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + margin: EdgeInsets.only(right: 10.w), + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 60.w, + height: 25.h, + ), + ), + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + margin: EdgeInsets.only(right: 10.w), + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 68.w, + height: 20.h, + ), + ), + ], + ), + ); + }, + )), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + margin: EdgeInsets.only(bottom: 34.h), + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(27), + ), + width: double.infinity, + height: 54.h, + ), + ), + ], + ), + )) + ], + ); + } + + ///网络错误 + Widget noNetwork() { + return Container( + color: Colors.white, + width: double.infinity, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + networkError.substring(0, networkError.indexOf(",")), + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF0D0D0D), + fontWeight: MyFontWeight.bold), + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 10.h), + child: Text( + "请检查网络设置或稍后重试", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + queryTenantList(); + }, + child: Container( + decoration: BoxDecoration( + color: Color(0xFF30415B), + borderRadius: BorderRadius.circular(15), + ), + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h), + child: Text( + "重试", + style: TextStyle( + fontSize: 14.sp, + color: Colors.white, + fontWeight: MyFontWeight.regular), + )), + ) + ], + ), + ); + } +} diff --git a/lib/home/welfare_page.dart b/lib/home/welfare_page.dart index 9277c070..c3fdf164 100644 --- a/lib/home/welfare_page.dart +++ b/lib/home/welfare_page.dart @@ -19,7 +19,6 @@ import 'package:huixiang/view_widget/custom_image.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_footer.dart'; -import 'package:huixiang/view_widget/new_coupon_widget.dart'; import 'package:huixiang/view_widget/no_data_view.dart'; import 'package:huixiang/view_widget/receive_success.dart'; import 'package:huixiang/view_widget/selector_store_dialog.dart'; diff --git a/lib/login/new_login_page.dart b/lib/login/new_login_page.dart index 8f71bf9b..c9b09c8d 100644 --- a/lib/login/new_login_page.dart +++ b/lib/login/new_login_page.dart @@ -311,6 +311,8 @@ class _NewLoginPage extends State { } BusinessInstance.instance.businessTenant = businessLoginInfo.tenantCode; BusinessInstance.instance.businessToken = businessLoginInfo.token; + BusinessInstance.instance.expirationTime = businessLoginInfo.expirationTime; + BusinessInstance.instance.serviceStatus = businessLoginInfo.status.desc; if (businessLoginInfo.storeList.length > 1) { Navigator.of(context) .popAndPushNamed('/router/select_shop', arguments: { diff --git a/lib/main.dart b/lib/main.dart index 64ee5667..2073baa6 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -90,6 +90,10 @@ import 'business_system/date_select/custom_page.dart'; import 'business_system/date_select/day_report_page.dart'; import 'business_system/date_select/monthly_report_page.dart'; import 'business_system/date_select/week_report_page.dart'; +import 'business_system/goods/add_goods/add_goods_page.dart'; +import 'business_system/goods/add_goods/edit_specs_detail.dart'; +import 'business_system/goods/add_goods/set_goods_specs.dart'; +import 'business_system/goods/add_goods/set_meal.dart'; import 'business_system/goods/goods_search_page.dart'; import 'business_system/goods/on_sale/add_assort.dart'; import 'business_system/goods/on_sale/batch_shelf.dart'; @@ -114,6 +118,7 @@ import 'business_system/mine/clerk_manage/add_new_clerk_page.dart'; import 'business_system/mine/clerk_manage/clerk_manage_page.dart'; import 'business_system/mine/merchant_info.dart'; import 'business_system/mine/security_setting.dart'; +import 'business_system/mine/service_subscription/service_subscription_page.dart'; import 'business_system/mine/shop_image_info.dart'; import 'business_system/mine/shop_reservation_code.dart'; import 'business_system/order/business_order_detail.dart'; @@ -551,4 +556,14 @@ Map routers = { MemberDetailsPage(arguments:arguments), '/router/record_details': (context, {arguments}) => RecordDetails(arguments:arguments), + '/router/service_subscription_page': (context, {arguments}) => + ServiceSubscriptionPage(arguments:arguments), + '/router/add_goods_page': (context, {arguments}) => + AddGoodsPage(arguments:arguments), + '/router/set_goods_specs': (context, {arguments}) => + SetGoodsSpecs(arguments:arguments), + '/router/edit_specs_detail': (context, {arguments}) => + EditSpecsDetail(arguments:arguments), + '/router/set_meal': (context, {arguments}) => + SetMeal(arguments:arguments), }; diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index ca201563..305e9044 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -49,6 +49,8 @@ class _MineItem extends State { } BusinessInstance.instance.businessTenant = businessLoginInfo.tenantCode; BusinessInstance.instance.businessToken = businessLoginInfo.token; + BusinessInstance.instance.expirationTime = businessLoginInfo.expirationTime; + BusinessInstance.instance.serviceStatus = businessLoginInfo.status.desc; sharedPreferences.setString('identitySwitch', "1"); if (businessLoginInfo.storeList.length > 1) { Navigator.of(context) diff --git a/lib/retrofit/business_api.dart b/lib/retrofit/business_api.dart index 200e1ab4..2cb39df0 100644 --- a/lib/retrofit/business_api.dart +++ b/lib/retrofit/business_api.dart @@ -24,6 +24,7 @@ import 'data/business_store_list.dart'; import 'data/business_vip_list.dart'; import 'data/clerk_manage_list.dart'; import 'data/day_flow_list.dart'; +import 'data/goods_category_list.dart'; import 'data/goods_type_sales_list.dart'; import 'data/order_user_detail.dart'; import 'data/phone_query_member_info.dart'; @@ -34,6 +35,9 @@ import 'data/refund_reason_list.dart'; import 'data/single_sales_list.dart'; import 'data/store_time_info_list.dart'; import 'data/store_total_money_info.dart'; +import 'data/tenant_info.dart'; +import 'data/tenant_package_calculate_details.dart'; +import 'data/tenant_package_list.dart'; import 'data/ticket_details.dart'; import 'data/ticket_record.dart'; import 'data/ticket_show.dart'; @@ -66,9 +70,13 @@ abstract class BusinessApiService { String tenant, String storeId, bool showErrorToast = true, + bool pay = false, }) { Map headers = (token == null || token == "") ? {} : {'token': "Bearer $token"}; + if (pay == true) { + headers["Environment"] = "app"; + } if (tenant != null && tenant != "") { headers["tenant"] = tenant; } @@ -280,7 +288,8 @@ abstract class BusinessApiService { ///票券核销记录 @POST("ticket/wipedRecord") - Future> wipedRecord(@Body() Map param); + Future> wipedRecord( + @Body() Map param); ///票券核销统计 @POST("ticket/wipedStats") @@ -289,19 +298,23 @@ abstract class BusinessApiService { ///会员列表 @POST("member/page") - Future> vipDataList(@Body() Map param); + Future> vipDataList( + @Body() Map param); ///会员充值流水 @POST("audit/memberSourceRechargeDetial") - Future> rechargeFlow(@Body() Map param); + Future> rechargeFlow( + @Body() Map param); ///会员余额变动 @POST("member/getTenantMemberBill") - Future> getTenantMemberBill(@Body() Map param); + Future> getTenantMemberBill( + @Body() Map param); ///预约设置/店铺信息开启关闭时间 @GET("store/storeOpenTime/{storeId}") - Future> storeOpenTime(@Path("storeId") String storeId); + Future> storeOpenTime( + @Path("storeId") String storeId); ///预约信息保存 @POST("product/updateSubscribe") @@ -313,15 +326,18 @@ abstract class BusinessApiService { ///订单列表获取用户金额详情 @GET("order/getOrderUserDetail?orderId={orderId}") - Future> getOrderUserDetail(@Path("orderId") String storeId); + Future> getOrderUserDetail( + @Path("orderId") String storeId); ///根据手机号查询会员信息 @POST("member/queryMemberInfo") - Future> queryMemberInfo(@Body() Map param); + Future> queryMemberInfo( + @Body() Map param); ///会员充值列表 @POST("rechargePreferential/get") - Future> getRechargePreferential(@Body() Map param); + Future> getRechargePreferential( + @Body() Map param); ///会员充值支付 @POST("member/posMemberRecharge") @@ -333,11 +349,13 @@ abstract class BusinessApiService { ///新增会员 @GET("member/createMemberSourceByMobile?mobile={mobile}&nickName={nickName}") - Future> createMemberSourceByMobile(@Path("mobile") String mobile,@Path("nickName") String nickName); + Future> createMemberSourceByMobile( + @Path("mobile") String mobile, @Path("nickName") String nickName); ///店员列表 @POST("user/userPage") - Future> clerkList(@Body() Map param); + Future> clerkList( + @Body() Map param); ///添加新店员,店员信息编辑 @POST("user") @@ -353,11 +371,13 @@ abstract class BusinessApiService { ///会员余额统计/消费排名 @POST("dashBoard/storeMoney") - Future> storeMoney(@Body() Map param); + Future> storeMoney( + @Body() Map param); ///会员余额统计(总会员数,总余额数)查询/消费排名(消费会员数量,销售金额)查询 @POST("dashBoard/storeTotalMoney") - Future> storeTotalMoney(@Body() Map param); + Future> storeTotalMoney( + @Body() Map param); ///收银台创建直付订单 @POST("order/createOrder") @@ -368,11 +388,39 @@ abstract class BusinessApiService { Future prePayOrder(@Body() Map param); ///收银台直付订单手动查询 - @POST("order/queryOrder/{orderId}?login={login}") - Future queryCashierOrder(@Path("orderId") String orderId,@Path("login") bool login); + @GET("order/queryOrder/{orderId}?login={login}") + Future queryCashierOrder( + @Path("orderId") String orderId, @Path("login") bool login); ///会员详情-查询会员消费/充值记录 @POST("member/getMemberSourceBillDetials") - Future> getMemberSourceBillDetails(@Body() Map param); + Future> getMemberSourceBillDetails( + @Body() Map param); + + ///新建商品 + @POST("product/save") + Future productSave(@Body() Map param); + + ///分类查询 + @GET("productCategory/findCategoryListByDepth/1") + Future>> findCategoryListByDepth(); + + ///服务套餐列表 + @GET("tenantApply/tenantPackageList") + Future>> tenantPackage(); + + ///服务套餐包优惠计算 + @POST("tenantApply/tenantPackageCalculate") + Future> tenantPackageCalculate( + @Body() Map param); + + ///服务套餐支付 + @POST("tenantApply/tenantApplyPay") + Future tenantApplyPay( + @Body() Map param); + ///查询商户信息 + @GET("tenant/tenantInfo/{tenantId}") + Future> tenantInfo( + @Path("tenantId") String tenantId); } diff --git a/lib/retrofit/business_api.g.dart b/lib/retrofit/business_api.g.dart index f1bc00f7..d753fab4 100644 --- a/lib/retrofit/business_api.g.dart +++ b/lib/retrofit/business_api.g.dart @@ -1186,4 +1186,137 @@ class _BusinessApiService implements BusinessApiService { return value; } + @override + Future productSave(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _result = await _dio.request>( + 'product/save', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: param); + final value = BaseData.fromJson( + _result.data, + (json) => (json ?? "") == "" ? null : json, + ); + return value; + } + + @override + Future>> findCategoryListByDepth() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + 'productCategory/findCategoryListByDepth/1', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => (json as List) + .map( + (i) => GoodsCategoryList.fromJson(i as Map)) + .toList()); + return value; + } + + @override + Future>> tenantPackage() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + 'tenantApply/tenantPackageList', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => (json as List) + .map( + (i) => TenantPackageList.fromJson(i as Map)) + .toList()); + return value; + } + + @override + Future> tenantPackageCalculate(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'tenantApply/tenantPackageCalculate', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => (json ?? "") == "" ? null : TenantPackageCalculateDetails.fromJson(json), + ); + return value; + } + + @override + Future tenantApplyPay(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _result = await _dio.request>( + 'tenantApply/tenantApplyPay', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: param); + final value = BaseData.fromJson( + _result.data, + (json) => (json ?? "") == "" ? null : json, + ); + return value; + } + + @override + Future> tenantInfo(tenantId) async { + ArgumentError.checkNotNull(tenantId, 'tenantId'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + 'tenant/tenantInfo/$tenantId', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => (json ?? "") == "" ? null : TenantInfo.fromJson(json), + ); + return value; + } + } diff --git a/lib/retrofit/data/business_login_info.dart b/lib/retrofit/data/business_login_info.dart index 335675d5..a7e9f94a 100644 --- a/lib/retrofit/data/business_login_info.dart +++ b/lib/retrofit/data/business_login_info.dart @@ -1,7 +1,7 @@ -/// token : "eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX3R5cGUiOiJCVVNJTkVTUyIsIm5hbWUiOiLpg5Hlt57lsI_lkIPooZciLCJ0b2tlbl90eXBlIjoidG9rZW4iLCJ1c2VyaWQiOiIxNjQwMjMzNDAxMzI5OTA5NzYwIiwiYWNjb3VudCI6IjE1ODI3OTkxNzE0IiwiZXhwIjoxNjk3MTY2MzYyLCJuYmYiOjE2OTQ1NzQzNjJ9.PQsXy4c0iIjVuQz2zTq4TmffNnoF_WtFyAfNfodfBNU" +/// token : "eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX3R5cGUiOiJCVVNJTkVTUyIsIm5hbWUiOiLpg5Hlt57lsI_lkIPooZciLCJ0b2tlbl90eXBlIjoidG9rZW4iLCJ1c2VyaWQiOiIxNjQwMjMzNDAxMzI5OTA5NzYwIiwiYWNjb3VudCI6IjE1ODI3OTkxNzE0IiwiZXhwIjoxNzA3Mzc3Nzc4LCJuYmYiOjE3MDQ3ODU3Nzh9.ZXBnkiDGSsL5K_PUKXH4I0qq5x6CctkHPeuE9gqdrKQ" /// tokenType : "token" -/// type : 0 -/// refreshToken : "eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaF90b2tlbiIsInVzZXJpZCI6IjE2NDAyMzM0MDEzMjk5MDk3NjAiLCJleHAiOjE2OTk3NTgzNjIsIm5iZiI6MTY5NDU3NDM2Mn0.VC-zcJc0dR3PTs-oxHx0-Y7ptMDzGhHWcBCNswB2Kn4" +/// type : 1 +/// refreshToken : "eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaF90b2tlbiIsInVzZXJpZCI6IjE2NDAyMzM0MDEzMjk5MDk3NjAiLCJleHAiOjE3MDk5Njk3NzgsIm5iZiI6MTcwNDc4NTc3OH0.zoCQ5bJKJlDb9NL13NXs1WGNxCxt6OimnJqOpdhkdCw" /// name : "郑州小吃街" /// account : "15827991714" /// avatar : "" @@ -9,12 +9,14 @@ /// userId : "1640233401329909760" /// userType : "BUSINESS" /// expire : "2592000" -/// expiration : "2023-10-13 11:06:02" +/// expiration : "2024-02-08 15:36:18" /// mobile : "13910001000" /// userList : null /// tenantCode : "1195" +/// expirationTime : null +/// status : {"desc":"正常","code":"NORMAL"} /// isAdmin : true -/// storeList : [{"id":"1645316356192600064","name":"士林鲜果&牛奶","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645317547899224064","name":"深坑卤水臭豆腐","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645317671987707904","name":"彰化烤玉米","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645317921456521216","name":"桃园铁板麻辣豆腐","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645318098540036096","name":"台南四神汤","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645318285786349568","name":"阿嫲炸菇菇","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645318425783828480","name":"阿Ya剉冰店","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645318527105630208","name":"锅烧意面","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645318745612091392","name":"冈山羊肉炉","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645318946187902976","name":"民歌西餐厅","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645319131278344192","name":"台北牛肉面","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645319215739043840","name":"甜不辣+淡水阿给","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645319318184919040","name":"筒仔米糕+排骨酥汤","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645321493476802560","name":"鱿鱼羹","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645321721634357248","name":"度小月担仔面","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645321921190952960","name":"前进麦味","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645324215450075136","name":"永康街芒果冰","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645325613776502784","name":"刈包+碗粿+四神汤","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645326136193843200","name":"蚵仔煎","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645326226061000704","name":"大肠面线","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645326338908749824","name":"排骨酥羹","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645326403631054848","name":"台北米粉汤","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645327436839124992","name":"台湾烤串","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645689802072260608","name":"三妈臭臭锅","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645690919204159488","name":"农场煮意","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645691756009750528","name":"海峡姐妹茶(奶茶)","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645691900562243584","name":"杉菜爸爸炒米粉","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645692068967743488","name":"海峡姐妹茶(洛神)","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645692156444147712","name":"铁路便当","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645692262354518016","name":"嘉义火鸡肉饭","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645692486699450368","name":"焢肉饭","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645694158347698176","name":"彰化肉圆","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645694248827224064","name":"手工汤圆","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645695120688807936","name":"杏仁油条","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645695186774261760","name":"豆花妈妈","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645695531587993600","name":"古早红茶冰","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645695622973489152","name":"回乡智慧糕","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645698130097733632","name":"烤鸟蛋","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645698860804210688","name":"QQ地瓜球","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645698953653518336","name":"鸡蛋糕","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645701214400151552","name":"炸元宝","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645701282909913088","name":"红薯饼","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645701372395388928","name":"润饼卷","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645701459838238720","name":"大肠包小肠","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645701540310155264","name":"炸鸡排","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645701593900777472","name":"盐酥鸡","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645701646107279360","name":"炸蚵嗲","posType":"FASTSTORE","useErp":false,"pickupType":null},{"id":"1645701718517743616","name":"热卤味","posType":"FASTSTORE","useErp":false,"pickupType":null}] +/// storeList : [{"id":"1645316356192600064","name":"士林鲜果&牛奶","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645317547899224064","name":"深坑卤水臭豆腐","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645317671987707904","name":"彰化烤玉米","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645317921456521216","name":"桃园铁板麻辣豆腐","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645318098540036096","name":"台南古早味粽","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645318285786349568","name":"庙口阿嫲炸菇菇","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645318425783828480","name":"屏东剉冰店(烧冷冰)","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645318527105630208","name":"台南锅烧意面","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645318745612091392","name":"冈山羊肉炉","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645318946187902976","name":"九号飞船西餐厅","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645319131278344192","name":"台北牛肉面","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645319215739043840","name":"淡水阿给","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645319318184919040","name":"丰原排骨酥焿","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645321493476802560","name":"高雄鱿鱼羹/筒仔米糕/担仔面","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645321921190952960","name":"前进麦味","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645324215450075136","name":"永康街芒果冰","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645325613776502784","name":"虎咬猪","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645326136193843200","name":"台南湾蚵仔煎","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645326338908749824","name":"台式披萨","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645326403631054848","name":"台北米粉汤","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645689802072260608","name":"台式小火锅","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645690919204159488","name":"农场煮意","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645691756009750528","name":"海峡姐妹茶(奶茶)","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645691900562243584","name":"杉菜爸爸贡丸","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645692068967743488","name":"海峡姐妹茶(洛神)","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645692262354518016","name":"嘉义鸡肉饭","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645694248827224064","name":"手工汤圆","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645695120688807936","name":"杏仁油条","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645695186774261760","name":"豆花妈妈","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645695531587993600","name":"古早味红茶冰","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645695622973489152","name":"蒸食记","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645698130097733632","name":"烤鹌鹑蛋","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645698860804210688","name":"QQ地瓜球","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645698953653518336","name":"鸡蛋糕","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645701214400151552","name":"炸元宝","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645701282909913088","name":"南投红薯饼","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645701372395388928","name":"润饼卷","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645701459838238720","name":"大肠包小肠","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645701540310155264","name":"台式夯肉","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645701593900777472","name":"菇菇盐酥鸡","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1645701646107279360","name":"炸蚵嗲/元宝","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1692382652344041472","name":"彰化肉丸","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1698928683340791808","name":"文创市集","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1699018850630107136","name":"饱岛盲盒","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}},{"id":"1707273867153637376","name":"活动权益","posType":"FASTSTORE","useErp":false,"pickupType":{"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false}}] class BusinessLoginInfo { BusinessLoginInfo({ @@ -33,6 +35,8 @@ class BusinessLoginInfo { String mobile, dynamic userList, String tenantCode, + dynamic expirationTime, + Status status, bool isAdmin, List storeList,}){ _token = token; @@ -50,6 +54,8 @@ class BusinessLoginInfo { _mobile = mobile; _userList = userList; _tenantCode = tenantCode; + _expirationTime = expirationTime; + _status = status; _isAdmin = isAdmin; _storeList = storeList; } @@ -70,6 +76,8 @@ class BusinessLoginInfo { _mobile = json['mobile']; _userList = json['userList']; _tenantCode = json['tenantCode']; + _expirationTime = json['expirationTime']; + _status = json['status'] != null ? Status.fromJson(json['status']) : null; _isAdmin = json['isAdmin']; if (json['storeList'] != null) { _storeList = []; @@ -93,6 +101,8 @@ class BusinessLoginInfo { String _mobile; dynamic _userList; String _tenantCode; + dynamic _expirationTime; + Status _status; bool _isAdmin; List _storeList; BusinessLoginInfo copyWith({ String token, @@ -110,6 +120,8 @@ BusinessLoginInfo copyWith({ String token, String mobile, dynamic userList, String tenantCode, + dynamic expirationTime, + Status status, bool isAdmin, List storeList, }) => BusinessLoginInfo( token: token ?? _token, @@ -127,6 +139,8 @@ BusinessLoginInfo copyWith({ String token, mobile: mobile ?? _mobile, userList: userList ?? _userList, tenantCode: tenantCode ?? _tenantCode, + expirationTime: expirationTime ?? _expirationTime, + status: status ?? _status, isAdmin: isAdmin ?? _isAdmin, storeList: storeList ?? _storeList, ); @@ -145,6 +159,8 @@ BusinessLoginInfo copyWith({ String token, String get mobile => _mobile; dynamic get userList => _userList; String get tenantCode => _tenantCode; + dynamic get expirationTime => _expirationTime; + Status get status => _status; bool get isAdmin => _isAdmin; List get storeList => _storeList; @@ -165,6 +181,10 @@ BusinessLoginInfo copyWith({ String token, map['mobile'] = _mobile; map['userList'] = _userList; map['tenantCode'] = _tenantCode; + map['expirationTime'] = _expirationTime; + if (_status != null) { + map['status'] = _status.toJson(); + } map['isAdmin'] = _isAdmin; if (_storeList != null) { map['storeList'] = _storeList.map((v) => v.toJson()).toList(); @@ -278,4 +298,38 @@ PickupType copyWith({ bool dineInTakeStatus, return map; } +} + +/// desc : "正常" +/// code : "NORMAL" + +class Status { + Status({ + String desc, + String code,}){ + _desc = desc; + _code = code; +} + + Status.fromJson(dynamic json) { + _desc = json['desc']; + _code = json['code']; + } + String _desc; + String _code; +Status copyWith({ String desc, + String code, +}) => Status( desc: desc ?? _desc, + code: code ?? _code, +); + String get desc => _desc; + String get code => _code; + + Map toJson() { + final map = {}; + map['desc'] = _desc; + map['code'] = _code; + return map; + } + } \ No newline at end of file diff --git a/lib/retrofit/data/goods_category_list.dart b/lib/retrofit/data/goods_category_list.dart new file mode 100644 index 00000000..93320b74 --- /dev/null +++ b/lib/retrofit/data/goods_category_list.dart @@ -0,0 +1,123 @@ +/// id : "1300687829071822848" +/// categoryName : "火锅餐饮" +/// categoryPath : "" +/// categoryImg : null +/// depth : 1 +/// parentName : null +/// parentId : null +/// sortOrder : 1 +/// status : 1 +/// isDelete : 0 +/// childs : null +/// posType : null + +class GoodsCategoryList { + GoodsCategoryList({ + String id, + String categoryName, + String categoryPath, + dynamic categoryImg, + num depth, + dynamic parentName, + dynamic parentId, + num sortOrder, + num status, + num isDelete, + dynamic childs, + dynamic posType,}){ + _id = id; + _categoryName = categoryName; + _categoryPath = categoryPath; + _categoryImg = categoryImg; + _depth = depth; + _parentName = parentName; + _parentId = parentId; + _sortOrder = sortOrder; + _status = status; + _isDelete = isDelete; + _childs = childs; + _posType = posType; +} + + GoodsCategoryList.fromJson(dynamic json) { + _id = json['id']; + _categoryName = json['categoryName']; + _categoryPath = json['categoryPath']; + _categoryImg = json['categoryImg']; + _depth = json['depth']; + _parentName = json['parentName']; + _parentId = json['parentId']; + _sortOrder = json['sortOrder']; + _status = json['status']; + _isDelete = json['isDelete']; + _childs = json['childs']; + _posType = json['posType']; + } + String _id; + String _categoryName; + String _categoryPath; + dynamic _categoryImg; + num _depth; + dynamic _parentName; + dynamic _parentId; + num _sortOrder; + num _status; + num _isDelete; + dynamic _childs; + dynamic _posType; +GoodsCategoryList copyWith({ String id, + String categoryName, + String categoryPath, + dynamic categoryImg, + num depth, + dynamic parentName, + dynamic parentId, + num sortOrder, + num status, + num isDelete, + dynamic childs, + dynamic posType, +}) => GoodsCategoryList( id: id ?? _id, + categoryName: categoryName ?? _categoryName, + categoryPath: categoryPath ?? _categoryPath, + categoryImg: categoryImg ?? _categoryImg, + depth: depth ?? _depth, + parentName: parentName ?? _parentName, + parentId: parentId ?? _parentId, + sortOrder: sortOrder ?? _sortOrder, + status: status ?? _status, + isDelete: isDelete ?? _isDelete, + childs: childs ?? _childs, + posType: posType ?? _posType, +); + String get id => _id; + String get categoryName => _categoryName; + String get categoryPath => _categoryPath; + dynamic get categoryImg => _categoryImg; + num get depth => _depth; + dynamic get parentName => _parentName; + dynamic get parentId => _parentId; + num get sortOrder => _sortOrder; + num get status => _status; + num get isDelete => _isDelete; + dynamic get childs => _childs; + dynamic get posType => _posType; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['categoryName'] = _categoryName; + map['categoryPath'] = _categoryPath; + map['categoryImg'] = _categoryImg; + map['depth'] = _depth; + map['parentName'] = _parentName; + map['parentId'] = _parentId; + map['sortOrder'] = _sortOrder; + map['status'] = _status; + map['isDelete'] = _isDelete; + map['childs'] = _childs; + map['posType'] = _posType; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/tenant_info.dart b/lib/retrofit/data/tenant_info.dart new file mode 100644 index 00000000..bc95d863 --- /dev/null +++ b/lib/retrofit/data/tenant_info.dart @@ -0,0 +1,366 @@ +/// id : "1739884282001752064" +/// createTime : "2023-12-27 13:41:53" +/// createUser : "1" +/// updateTime : "2023-12-27 13:41:53" +/// updateUser : "1" +/// code : "1197" +/// name : "fff" +/// type : {"desc":"创建","code":"CREATE"} +/// status : {"desc":"正常","code":"NORMAL"} +/// readonly : false +/// usePlatformPay : false +/// usePlatformVip : false +/// money : "0" +/// duty : "fxz" +/// address : "洪山区光谷一路天成美景" +/// expireLimitYear : 3 +/// startTime : "2023-12-27 13:41:53" +/// expirationTime : null +/// contactTel : "15827991715" +/// logo : "" +/// describe : "" +/// account : null +/// dianwodaId : "" +/// dadaId : "" +/// showVipCard : true +/// packageId : "1552543966157602816" +/// posType : {"desc":"普通餐饮","code":"NORMALSTORE"} + +class TenantInfo { + TenantInfo({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String code, + String name, + Type type, + Status status, + bool readonly, + bool usePlatformPay, + bool usePlatformVip, + String money, + String duty, + String address, + num expireLimitYear, + String startTime, + dynamic expirationTime, + String contactTel, + String logo, + String describe, + dynamic account, + String dianwodaId, + String dadaId, + bool showVipCard, + String packageId, + PosType posType,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _code = code; + _name = name; + _type = type; + _status = status; + _readonly = readonly; + _usePlatformPay = usePlatformPay; + _usePlatformVip = usePlatformVip; + _money = money; + _duty = duty; + _address = address; + _expireLimitYear = expireLimitYear; + _startTime = startTime; + _expirationTime = expirationTime; + _contactTel = contactTel; + _logo = logo; + _describe = describe; + _account = account; + _dianwodaId = dianwodaId; + _dadaId = dadaId; + _showVipCard = showVipCard; + _packageId = packageId; + _posType = posType; +} + + TenantInfo.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _code = json['code']; + _name = json['name']; + _type = json['type'] != null ? Type.fromJson(json['type']) : null; + _status = json['status'] != null ? Status.fromJson(json['status']) : null; + _readonly = json['readonly']; + _usePlatformPay = json['usePlatformPay']; + _usePlatformVip = json['usePlatformVip']; + _money = json['money']; + _duty = json['duty']; + _address = json['address']; + _expireLimitYear = json['expireLimitYear']; + _startTime = json['startTime']; + _expirationTime = json['expirationTime']; + _contactTel = json['contactTel']; + _logo = json['logo']; + _describe = json['describe']; + _account = json['account']; + _dianwodaId = json['dianwodaId']; + _dadaId = json['dadaId']; + _showVipCard = json['showVipCard']; + _packageId = json['packageId']; + _posType = json['posType'] != null ? PosType.fromJson(json['posType']) : null; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _code; + String _name; + Type _type; + Status _status; + bool _readonly; + bool _usePlatformPay; + bool _usePlatformVip; + String _money; + String _duty; + String _address; + num _expireLimitYear; + String _startTime; + dynamic _expirationTime; + String _contactTel; + String _logo; + String _describe; + dynamic _account; + String _dianwodaId; + String _dadaId; + bool _showVipCard; + String _packageId; + PosType _posType; +TenantInfo copyWith({ String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String code, + String name, + Type type, + Status status, + bool readonly, + bool usePlatformPay, + bool usePlatformVip, + String money, + String duty, + String address, + num expireLimitYear, + String startTime, + dynamic expirationTime, + String contactTel, + String logo, + String describe, + dynamic account, + String dianwodaId, + String dadaId, + bool showVipCard, + String packageId, + PosType posType, +}) => TenantInfo( id: id ?? _id, + createTime: createTime ?? _createTime, + createUser: createUser ?? _createUser, + updateTime: updateTime ?? _updateTime, + updateUser: updateUser ?? _updateUser, + code: code ?? _code, + name: name ?? _name, + type: type ?? _type, + status: status ?? _status, + readonly: readonly ?? _readonly, + usePlatformPay: usePlatformPay ?? _usePlatformPay, + usePlatformVip: usePlatformVip ?? _usePlatformVip, + money: money ?? _money, + duty: duty ?? _duty, + address: address ?? _address, + expireLimitYear: expireLimitYear ?? _expireLimitYear, + startTime: startTime ?? _startTime, + expirationTime: expirationTime ?? _expirationTime, + contactTel: contactTel ?? _contactTel, + logo: logo ?? _logo, + describe: describe ?? _describe, + account: account ?? _account, + dianwodaId: dianwodaId ?? _dianwodaId, + dadaId: dadaId ?? _dadaId, + showVipCard: showVipCard ?? _showVipCard, + packageId: packageId ?? _packageId, + posType: posType ?? _posType, +); + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get code => _code; + String get name => _name; + Type get type => _type; + Status get status => _status; + bool get readonly => _readonly; + bool get usePlatformPay => _usePlatformPay; + bool get usePlatformVip => _usePlatformVip; + String get money => _money; + String get duty => _duty; + String get address => _address; + num get expireLimitYear => _expireLimitYear; + String get startTime => _startTime; + dynamic get expirationTime => _expirationTime; + String get contactTel => _contactTel; + String get logo => _logo; + String get describe => _describe; + dynamic get account => _account; + String get dianwodaId => _dianwodaId; + String get dadaId => _dadaId; + bool get showVipCard => _showVipCard; + String get packageId => _packageId; + PosType get posType => _posType; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['code'] = _code; + map['name'] = _name; + if (_type != null) { + map['type'] = _type.toJson(); + } + if (_status != null) { + map['status'] = _status.toJson(); + } + map['readonly'] = _readonly; + map['usePlatformPay'] = _usePlatformPay; + map['usePlatformVip'] = _usePlatformVip; + map['money'] = _money; + map['duty'] = _duty; + map['address'] = _address; + map['expireLimitYear'] = _expireLimitYear; + map['startTime'] = _startTime; + map['expirationTime'] = _expirationTime; + map['contactTel'] = _contactTel; + map['logo'] = _logo; + map['describe'] = _describe; + map['account'] = _account; + map['dianwodaId'] = _dianwodaId; + map['dadaId'] = _dadaId; + map['showVipCard'] = _showVipCard; + map['packageId'] = _packageId; + if (_posType != null) { + map['posType'] = _posType.toJson(); + } + return map; + } + +} + +/// desc : "普通餐饮" +/// code : "NORMALSTORE" + +class PosType { + PosType({ + String desc, + String code,}){ + _desc = desc; + _code = code; +} + + PosType.fromJson(dynamic json) { + _desc = json['desc']; + _code = json['code']; + } + String _desc; + String _code; +PosType copyWith({ String desc, + String code, +}) => PosType( desc: desc ?? _desc, + code: code ?? _code, +); + String get desc => _desc; + String get code => _code; + + Map toJson() { + final map = {}; + map['desc'] = _desc; + map['code'] = _code; + return map; + } + +} + +/// desc : "正常" +/// code : "NORMAL" + +class Status { + Status({ + String desc, + String code,}){ + _desc = desc; + _code = code; +} + + Status.fromJson(dynamic json) { + _desc = json['desc']; + _code = json['code']; + } + String _desc; + String _code; +Status copyWith({ String desc, + String code, +}) => Status( desc: desc ?? _desc, + code: code ?? _code, +); + String get desc => _desc; + String get code => _code; + + Map toJson() { + final map = {}; + map['desc'] = _desc; + map['code'] = _code; + return map; + } + +} + +/// desc : "创建" +/// code : "CREATE" + +class Type { + Type({ + String desc, + String code,}){ + _desc = desc; + _code = code; +} + + Type.fromJson(dynamic json) { + _desc = json['desc']; + _code = json['code']; + } + String _desc; + String _code; +Type copyWith({ String desc, + String code, +}) => Type( desc: desc ?? _desc, + code: code ?? _code, +); + String get desc => _desc; + String get code => _code; + + Map toJson() { + final map = {}; + map['desc'] = _desc; + map['code'] = _code; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/tenant_package_calculate_details.dart b/lib/retrofit/data/tenant_package_calculate_details.dart new file mode 100644 index 00000000..f550a138 --- /dev/null +++ b/lib/retrofit/data/tenant_package_calculate_details.dart @@ -0,0 +1,51 @@ +/// totalFee : "100" +/// expirationTime : "2034-01-05 11:16:07" +/// duration : 10 +/// packageId : "1742842291845857280" + +class TenantPackageCalculateDetails { + TenantPackageCalculateDetails({ + String totalFee, + String expirationTime, + num duration, + String packageId,}){ + _totalFee = totalFee; + _expirationTime = expirationTime; + _duration = duration; + _packageId = packageId; +} + + TenantPackageCalculateDetails.fromJson(dynamic json) { + _totalFee = json['totalFee']; + _expirationTime = json['expirationTime']; + _duration = json['duration']; + _packageId = json['packageId']; + } + String _totalFee; + String _expirationTime; + num _duration; + String _packageId; +TenantPackageCalculateDetails copyWith({ String totalFee, + String expirationTime, + num duration, + String packageId, +}) => TenantPackageCalculateDetails( totalFee: totalFee ?? _totalFee, + expirationTime: expirationTime ?? _expirationTime, + duration: duration ?? _duration, + packageId: packageId ?? _packageId, +); + String get totalFee => _totalFee; + String get expirationTime => _expirationTime; + num get duration => _duration; + String get packageId => _packageId; + + Map toJson() { + final map = {}; + map['totalFee'] = _totalFee; + map['expirationTime'] = _expirationTime; + map['duration'] = _duration; + map['packageId'] = _packageId; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/tenant_package_list.dart b/lib/retrofit/data/tenant_package_list.dart new file mode 100644 index 00000000..f41708ff --- /dev/null +++ b/lib/retrofit/data/tenant_package_list.dart @@ -0,0 +1,245 @@ +/// id : "1742842291845857280" +/// createTime : "2024-01-04 17:35:57" +/// createUser : "1" +/// updateTime : "2024-01-04 17:35:57" +/// updateUser : "1" +/// name : "测试啊" +/// status : 1 +/// remark : "" +/// packagePrice : null +/// packageDiscount : null +/// duration : null +/// enableSale : true +/// sort : 1 +/// isDefault : false +/// isDelete : 0 +/// tenantPackageSale : [{"packagePrice":"100","originalPackagePrice":"200","duration":10,"packageDiscount":50,"isRecommend":false,"saleName":"销售套餐1","canDiscount":true},{"packagePrice":"300","originalPackagePrice":"600","duration":5,"packageDiscount":50,"isRecommend":true,"saleName":"销售套餐2","canDiscount":true}] + +class TenantPackageList { + TenantPackageList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String name, + num status, + String remark, + dynamic packagePrice, + dynamic packageDiscount, + dynamic duration, + bool enableSale, + num sort, + bool isDefault, + num isDelete, + List tenantPackageSale,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _name = name; + _status = status; + _remark = remark; + _packagePrice = packagePrice; + _packageDiscount = packageDiscount; + _duration = duration; + _enableSale = enableSale; + _sort = sort; + _isDefault = isDefault; + _isDelete = isDelete; + _tenantPackageSale = tenantPackageSale; +} + + TenantPackageList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _name = json['name']; + _status = json['status']; + _remark = json['remark']; + _packagePrice = json['packagePrice']; + _packageDiscount = json['packageDiscount']; + _duration = json['duration']; + _enableSale = json['enableSale']; + _sort = json['sort']; + _isDefault = json['isDefault']; + _isDelete = json['isDelete']; + if (json['tenantPackageSale'] != null) { + _tenantPackageSale = []; + json['tenantPackageSale'].forEach((v) { + _tenantPackageSale.add(TenantPackageSale.fromJson(v)); + }); + } + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _name; + num _status; + String _remark; + dynamic _packagePrice; + dynamic _packageDiscount; + dynamic _duration; + bool _enableSale; + num _sort; + bool _isDefault; + num _isDelete; + List _tenantPackageSale; +TenantPackageList copyWith({ String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String name, + num status, + String remark, + dynamic packagePrice, + dynamic packageDiscount, + dynamic duration, + bool enableSale, + num sort, + bool isDefault, + num isDelete, + List tenantPackageSale, +}) => TenantPackageList( id: id ?? _id, + createTime: createTime ?? _createTime, + createUser: createUser ?? _createUser, + updateTime: updateTime ?? _updateTime, + updateUser: updateUser ?? _updateUser, + name: name ?? _name, + status: status ?? _status, + remark: remark ?? _remark, + packagePrice: packagePrice ?? _packagePrice, + packageDiscount: packageDiscount ?? _packageDiscount, + duration: duration ?? _duration, + enableSale: enableSale ?? _enableSale, + sort: sort ?? _sort, + isDefault: isDefault ?? _isDefault, + isDelete: isDelete ?? _isDelete, + tenantPackageSale: tenantPackageSale ?? _tenantPackageSale, +); + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get name => _name; + num get status => _status; + String get remark => _remark; + dynamic get packagePrice => _packagePrice; + dynamic get packageDiscount => _packageDiscount; + dynamic get duration => _duration; + bool get enableSale => _enableSale; + num get sort => _sort; + bool get isDefault => _isDefault; + num get isDelete => _isDelete; + List get tenantPackageSale => _tenantPackageSale; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['name'] = _name; + map['status'] = _status; + map['remark'] = _remark; + map['packagePrice'] = _packagePrice; + map['packageDiscount'] = _packageDiscount; + map['duration'] = _duration; + map['enableSale'] = _enableSale; + map['sort'] = _sort; + map['isDefault'] = _isDefault; + map['isDelete'] = _isDelete; + if (_tenantPackageSale != null) { + map['tenantPackageSale'] = _tenantPackageSale.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// packagePrice : "100" +/// originalPackagePrice : "200" +/// duration : 10 +/// packageDiscount : 50 +/// isRecommend : false +/// saleName : "销售套餐1" +/// canDiscount : true + +class TenantPackageSale { + TenantPackageSale({ + String packagePrice, + String originalPackagePrice, + num duration, + num packageDiscount, + bool isRecommend, + String saleName, + bool canDiscount,}){ + _packagePrice = packagePrice; + _originalPackagePrice = originalPackagePrice; + _duration = duration; + _packageDiscount = packageDiscount; + _isRecommend = isRecommend; + _saleName = saleName; + _canDiscount = canDiscount; +} + + TenantPackageSale.fromJson(dynamic json) { + _packagePrice = json['packagePrice']; + _originalPackagePrice = json['originalPackagePrice']; + _duration = json['duration']; + _packageDiscount = json['packageDiscount']; + _isRecommend = json['isRecommend']; + _saleName = json['saleName']; + _canDiscount = json['canDiscount']; + } + String _packagePrice; + String _originalPackagePrice; + num _duration; + num _packageDiscount; + bool _isRecommend; + String _saleName; + bool _canDiscount; +TenantPackageSale copyWith({ String packagePrice, + String originalPackagePrice, + num duration, + num packageDiscount, + bool isRecommend, + String saleName, + bool canDiscount, +}) => TenantPackageSale( packagePrice: packagePrice ?? _packagePrice, + originalPackagePrice: originalPackagePrice ?? _originalPackagePrice, + duration: duration ?? _duration, + packageDiscount: packageDiscount ?? _packageDiscount, + isRecommend: isRecommend ?? _isRecommend, + saleName: saleName ?? _saleName, + canDiscount: canDiscount ?? _canDiscount, +); + String get packagePrice => _packagePrice; + String get originalPackagePrice => _originalPackagePrice; + num get duration => _duration; + num get packageDiscount => _packageDiscount; + bool get isRecommend => _isRecommend; + String get saleName => _saleName; + bool get canDiscount => _canDiscount; + + Map toJson() { + final map = {}; + map['packagePrice'] = _packagePrice; + map['originalPackagePrice'] = _originalPackagePrice; + map['duration'] = _duration; + map['packageDiscount'] = _packageDiscount; + map['isRecommend'] = _isRecommend; + map['saleName'] = _saleName; + map['canDiscount'] = _canDiscount; + return map; + } + +} \ No newline at end of file diff --git a/lib/utils/business_instance.dart b/lib/utils/business_instance.dart index 114e0354..72f10f76 100644 --- a/lib/utils/business_instance.dart +++ b/lib/utils/business_instance.dart @@ -9,6 +9,10 @@ class BusinessInstance { String _businessTenant; + String _expirationTime; + + String _serviceStatus; + String get businessToken => _businessToken; set businessToken(String value) { @@ -31,4 +35,16 @@ class BusinessInstance { set businessTenant(String value) { _businessTenant = value; } + + String get expirationTime => _expirationTime; + + set expirationTime(String value) { + _expirationTime = value; + } + + String get serviceStatus => _serviceStatus; + + set serviceStatus(String value) { + _serviceStatus = value; + } }