From 5ac0c3dae777d91129543aa3cad0713527060b50 Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Tue, 12 Sep 2023 18:05:44 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=95=86=E5=AE=B6?= =?UTF-8?q?=E7=AE=A1=E7=90=86api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/retrofit/business_api.dart | 110 +++++++++++++++++++++++++++++++ lib/retrofit/business_api.g.dart | 23 +++++++ 2 files changed, 133 insertions(+) create mode 100644 lib/retrofit/business_api.dart create mode 100644 lib/retrofit/business_api.g.dart diff --git a/lib/retrofit/business_api.dart b/lib/retrofit/business_api.dart new file mode 100644 index 00000000..33cfeac0 --- /dev/null +++ b/lib/retrofit/business_api.dart @@ -0,0 +1,110 @@ +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:retrofit/retrofit.dart'; + +part 'business_api.g.dart'; + +///本地 +const localBaseUrl = "http://admin-api.test.yixinhuixiang.com/"; +///测试 +// const localBaseUrl = "http://test-merchant.lotus-wallet.com/"; +///线上 +const serviceBaseUrl = "http://pos.tenant.lotus-wallet.com/"; + +@RestApi(baseUrl: localBaseUrl) +abstract class BusinessApiService { + factory BusinessApiService( + Dio dio, { + String baseUrl, + BuildContext context, + String token, + bool showLoading = false, + String url, + bool showErrorToast = true, + }) { + Map headers = + (token == null || token == "") ? {} : {'token': "Bearer $token"}; + baseUrl = serviceBaseUrl; + if (url != null) baseUrl = url; + dio.options = BaseOptions( + connectTimeout: 60000, + receiveTimeout: 60000, + headers: headers, + responseType: ResponseType.json, + baseUrl: baseUrl, + ); + dio.interceptors.add( + InterceptorsWrapper(onRequest: + (RequestOptions options) { + debugPrint("\n======================= 请求数据 ======================="); + debugPrint("method = ${options.method.toString()}"); + debugPrint("url = ${options.uri.toString()}"); + debugPrint("headers = ${options.headers}"); + if (showLoading && !EasyLoading.isShow) { + //是否显示loading + EasyLoading.show(status: "正在加载..."); + } + if (options.data is FormData) { + debugPrint("params data = FormData"); + } else { + debugPrint("params data = ${jsonEncode(options.data)}"); + } + debugPrint("params queryParameters = ${options.queryParameters}"); + }, onResponse: (Response response) { + if (showLoading && EasyLoading.isShow) EasyLoading.dismiss(); + debugPrint("\n======================= 响应数据开始 ======================="); + debugPrint("code = ${response.statusCode}"); + p(jsonEncode(response.data)); + + // debugPrint(jsonEncode(response.data), wrapWidth: response.data.toString().length * 10); + + Map map = response.data; + // if (map["code"] != 0) { + // EasyLoading.dismiss(); + // } + // if (map["code"] == 40005 || map["code"] == 40001) { + // if (!LoginTipsDialog().isShow) { + // print("show: ${LoginTipsDialog().isShow}"); + // LoginTipsDialog().show(context); + // } + // } + if (showErrorToast && + map["code"] == 404 && + (map["msg"] ?? map["message"]) != null) { + SmartDialog.showToast(map["msg"] ?? map["message"], + alignment: Alignment.center); + } + debugPrint("======================= 响应数据结束 =======================\n"); + }, onError: (DioError e) { + if (EasyLoading.isShow) EasyLoading.dismiss(); + SmartDialog.showToast("网络错误,请切换网络或稍后再试!", alignment: Alignment.center); + debugPrint("\n======================= 错误响应数据 ======================="); + debugPrint("type = ${e.type}"); + debugPrint("message = ${e.message}"); + debugPrint("\n"); + }), + ); + return _BusinessApiService(dio, baseUrl: baseUrl); + } + + void dispose(); + + static void p(String msg) { + //因为String的length是字符数量不是字节数量所以为了防止中文字符过多, + // 把4*1024的MAX字节打印长度改为1000字符数 + int maxStrLength = 900; + //大于1000时 + while (msg.length > maxStrLength) { + debugPrint(msg.substring(0, maxStrLength), wrapWidth: maxStrLength); + msg = msg.substring(maxStrLength); + } + //剩余部分 + debugPrint(msg, wrapWidth: maxStrLength); + } +} diff --git a/lib/retrofit/business_api.g.dart b/lib/retrofit/business_api.g.dart new file mode 100644 index 00000000..61d7889c --- /dev/null +++ b/lib/retrofit/business_api.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'business_api.dart'; + +// ************************************************************************** +// RetrofitGenerator +// ************************************************************************** + +class _BusinessApiService implements BusinessApiService { + _BusinessApiService(this._dio, {this.baseUrl}) { + ArgumentError.checkNotNull(_dio, '_dio'); + } + + final Dio _dio; + + String baseUrl; + + @override + void dispose() { + _dio.close(force: true); + } + +} From 9e35d601456113feb336bb6041fae5ca217ffcf8 Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Fri, 15 Sep 2023 09:39:46 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=95=86=E5=AE=B6=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=99=BB=E5=BD=95=EF=BC=9B=20=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E9=97=A8=E5=BA=97=EF=BC=8C=E9=A6=96=E9=A1=B5=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=8E=A5=E5=8F=A3=E6=9B=B4=E6=94=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/business_system/business_page.dart | 257 +++---- .../home/business_home_page.dart | 611 +++++++++++------ .../home/home_view/home_sideslip_dialog.dart | 308 +++++---- lib/business_system/home/select_shop.dart | 195 +++--- .../login/business_login_page.dart | 642 ++++++++++++------ lib/main.dart | 2 +- lib/mine/mine_view/mine_item.dart | 322 +++++---- lib/retrofit/business_api.dart | 48 +- lib/retrofit/business_api.g.dart | 92 +++ lib/retrofit/data/business_login_info.dart | 281 ++++++++ lib/retrofit/data/day_count.dart | 177 +++++ lib/retrofit/data/order_trend.dart | 33 + lib/retrofit/data/popular_sales_list.dart | 311 +++++++++ lib/utils/business_instance.dart | 34 + pubspec.lock | 4 +- 15 files changed, 2448 insertions(+), 869 deletions(-) create mode 100644 lib/retrofit/data/business_login_info.dart create mode 100644 lib/retrofit/data/day_count.dart create mode 100644 lib/retrofit/data/order_trend.dart create mode 100644 lib/retrofit/data/popular_sales_list.dart create mode 100644 lib/utils/business_instance.dart diff --git a/lib/business_system/business_page.dart b/lib/business_system/business_page.dart index aa1af9c0..f0101c45 100644 --- a/lib/business_system/business_page.dart +++ b/lib/business_system/business_page.dart @@ -6,6 +6,7 @@ import 'package:huixiang/business_system/order/business_order_page.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import '../retrofit/data/business_login_info.dart'; import 'home/business_home_page.dart'; class BusinessPage extends StatefulWidget { @@ -22,9 +23,14 @@ class BusinessPage extends StatefulWidget { class _BusinessPage extends State with AutomaticKeepAliveClientMixin { int choiceIndex = 0; + BusinessLoginInfo businessLoginInfo; + int selectStoreIndex = 0; + @override void initState() { super.initState(); + businessLoginInfo = widget?.arguments["businessLoginInfo"]; + selectStoreIndex = widget.arguments["selectStoreIndex"] ?? 0; } @override @@ -37,35 +43,30 @@ class _BusinessPage extends State ), Stack( children: [ - if(choiceIndex == 0) - BusinessHomePage(), - - if(choiceIndex == 1) - BusinessOrderPage(), - - if(choiceIndex == 2) - BusinessHomePage(), - - if(choiceIndex == 3) - BusinessGoodsPage(), - - if(choiceIndex == 4) - BusinessMinePage(), - + if (choiceIndex == 0) + BusinessHomePage(businessLoginInfo, selectStoreIndex, (index) { + setState(() { + selectStoreIndex = index; + }); + }), + if (choiceIndex == 1) BusinessOrderPage(), + if (choiceIndex == 2) BusinessOrderPage(), + if (choiceIndex == 3) BusinessGoodsPage(), + if (choiceIndex == 4) BusinessMinePage(), Align( alignment: Alignment.bottomCenter, child: Container( - height:85.h, + height: 85.h, width: double.infinity, color: Colors.white, - padding: EdgeInsets.only(top:20.h), + padding: EdgeInsets.only(top: 20.h), child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: GestureDetector( - behavior: HitTestBehavior.opaque, + behavior: HitTestBehavior.opaque, onTap: () { setState(() { choiceIndex = 0; @@ -80,7 +81,9 @@ class _BusinessPage extends State width: 30, height: 30, ), - SizedBox(height: 5.h,), + SizedBox( + height: 5.h, + ), Text( "首页", style: TextStyle( @@ -96,111 +99,135 @@ class _BusinessPage extends State ), Expanded( child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - choiceIndex = 1; - }); - }, - child: Column( - children: [ - Image.asset( - (choiceIndex == 0 || choiceIndex == 2 || choiceIndex == 3 || choiceIndex == 4) - ? "assets/image/business_order_h.webp" - : "assets/image/business_order.webp", - width: 30, - height: 30, - ), - SizedBox(height: 5.h,), - Text( - "订单", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.semi_bold, - color: (choiceIndex == 0 || choiceIndex == 2 || choiceIndex == 3 || choiceIndex == 4) - ? Color(0xFFACACAC) - : Color(0xFF4C4C4C), - ), - ), - ], + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + choiceIndex = 1; + }); + }, + child: Column( + children: [ + Image.asset( + (choiceIndex == 0 || + choiceIndex == 2 || + choiceIndex == 3 || + choiceIndex == 4) + ? "assets/image/business_order_h.webp" + : "assets/image/business_order.webp", + width: 30, + height: 30, + ), + SizedBox( + height: 5.h, + ), + Text( + "订单", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.semi_bold, + color: (choiceIndex == 0 || + choiceIndex == 2 || + choiceIndex == 3 || + choiceIndex == 4) + ? Color(0xFFACACAC) + : Color(0xFF4C4C4C), + ), ), - )), + ], + ), + )), Expanded( child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - choiceIndex = 2; - }); - }, - child: Image.asset( - "assets/image/business_scan_code.webp", - width: 52, - height: 52, - ), - )), + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + choiceIndex = 2; + }); + }, + child: Image.asset( + "assets/image/business_scan_code.webp", + width: 52, + height: 52, + ), + )), Expanded( child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - choiceIndex = 3; - }); - }, - child: Column( - children: [ - Image.asset( - (choiceIndex == 0 || choiceIndex == 1 || choiceIndex == 2 || choiceIndex == 4) - ? "assets/image/business_goods_h.webp" - : "assets/image/business_goods.webp", - width: 30, - height: 30, - ), - SizedBox(height: 5.h,), - Text( - "商品", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.semi_bold, - color: (choiceIndex == 0 || choiceIndex == 1 || choiceIndex == 2 || choiceIndex == 4) - ? Color(0xFFACACAC) - : Color(0xFF4C4C4C), - ), - ), - ], + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + choiceIndex = 3; + }); + }, + child: Column( + children: [ + Image.asset( + (choiceIndex == 0 || + choiceIndex == 1 || + choiceIndex == 2 || + choiceIndex == 4) + ? "assets/image/business_goods_h.webp" + : "assets/image/business_goods.webp", + width: 30, + height: 30, ), - )), + SizedBox( + height: 5.h, + ), + Text( + "商品", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.semi_bold, + color: (choiceIndex == 0 || + choiceIndex == 1 || + choiceIndex == 2 || + choiceIndex == 4) + ? Color(0xFFACACAC) + : Color(0xFF4C4C4C), + ), + ), + ], + ), + )), Expanded( child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - choiceIndex = 4; - }); - }, - child: Column( - children: [ - Image.asset( - (choiceIndex == 0 || choiceIndex == 1 || choiceIndex == 2 || choiceIndex == 3) - ? "assets/image/business_mine_h.webp" - : "assets/image/business_mine.webp", - width: 30, - height: 30, - ), - SizedBox(height: 5.h,), - Text( - "我的", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.semi_bold, - color: (choiceIndex == 0 || choiceIndex == 1 || choiceIndex == 2 || choiceIndex == 3) - ? Color(0xFFACACAC) - : Color(0xFF4C4C4C), - ), - ), - ], + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + choiceIndex = 4; + }); + }, + child: Column( + children: [ + Image.asset( + (choiceIndex == 0 || + choiceIndex == 1 || + choiceIndex == 2 || + choiceIndex == 3) + ? "assets/image/business_mine_h.webp" + : "assets/image/business_mine.webp", + width: 30, + height: 30, + ), + SizedBox( + height: 5.h, + ), + Text( + "我的", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.semi_bold, + color: (choiceIndex == 0 || + choiceIndex == 1 || + choiceIndex == 2 || + choiceIndex == 3) + ? Color(0xFFACACAC) + : Color(0xFF4C4C4C), + ), ), - )), + ], + ), + )), ], ), ), diff --git a/lib/business_system/home/business_home_page.dart b/lib/business_system/home/business_home_page.dart index ae650ab2..b100f9d2 100644 --- a/lib/business_system/home/business_home_page.dart +++ b/lib/business_system/home/business_home_page.dart @@ -1,15 +1,34 @@ +import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:huixiang/business_system/home/home_view/home_sideslip_dialog.dart'; +import 'package:huixiang/utils/business_instance.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:intl/intl.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import '../../generated/l10n.dart'; +import '../../retrofit/business_api.dart'; +import '../../retrofit/data/base_data.dart'; +import '../../retrofit/data/business_login_info.dart'; +import '../../retrofit/data/day_count.dart'; +import '../../retrofit/data/order_trend.dart'; +import '../../retrofit/data/popular_sales_list.dart'; import '../../utils/font_weight.dart'; import 'home_view/my_line_chart.dart'; class BusinessHomePage extends StatefulWidget { + final BusinessLoginInfo businessLoginInfo; + final int selectStoreIndex; + final Function changeIndex; + + BusinessHomePage( + this.businessLoginInfo, this.selectStoreIndex, this.changeIndex); + @override State createState() { return _BusinessHomePage(); @@ -17,21 +36,28 @@ class BusinessHomePage extends StatefulWidget { } class _BusinessHomePage extends State - with AutomaticKeepAliveClientMixin{ + with AutomaticKeepAliveClientMixin { final RefreshController refreshController = RefreshController(); final ScrollController scrollController = ScrollController(); - List lineChartSample2Data = - [LineChartSample2Data(0,100,"2023-03-09"), - LineChartSample2Data(1,200,"2023-03-10"), - LineChartSample2Data(2,400,"2023-03-11"), - LineChartSample2Data(3,10,"2023-03-12"), - LineChartSample2Data(4,250,"2023-03-13"), - LineChartSample2Data(5,175,"2023-03-14"), - LineChartSample2Data(6,500,"2023-03-15")]; + BusinessApiService businessService; + DayCount dayCount; + int _loadCount = 0; + PopularSalesList popularSalesList; + List orderTrend = []; + List lineChartSample2Data = [ + LineChartSample2Data(0, 100, "2023-03-09"), + LineChartSample2Data(1, 200, "2023-03-10"), + LineChartSample2Data(2, 400, "2023-03-11"), + LineChartSample2Data(3, 10, "2023-03-12"), + LineChartSample2Data(4, 250, "2023-03-13"), + LineChartSample2Data(5, 175, "2023-03-14"), + LineChartSample2Data(6, 500, "2023-03-15") + ]; @override void initState() { super.initState(); + _onRefresh(); } @override @@ -39,6 +65,75 @@ class _BusinessHomePage extends State super.dispose(); } + _onRefresh() async { + EasyLoading.show( + status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); + SharedPreferences.getInstance().then((value) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.businessLoginInfo.storeList[widget.selectStoreIndex] + .name == + "所有门店" + ? "0" + : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id); + queryDayAmount(); + queryPopularList(); + queryPopularList(); + }); + } + + addLoadCount() { + _loadCount += 1; + if (_loadCount == 3) { + _loadCount = 0; + EasyLoading.dismiss(); + if (refreshController.isRefresh) refreshController.refreshCompleted(); + if (mounted) setState(() {}); + } + } + + ///每日营业额/交易笔数/退款金额/退款笔数 + queryDayAmount() async { + try { + BaseData baseData = await businessService.getDayCounts({ + "summaryDate": "${DateFormat("yyyy-MM-dd").format(DateTime.now())}" + }).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + dayCount = baseData.data; + } + } finally { + addLoadCount(); + } + } + + ///热销榜单 + queryPopularList() async { + try { + BaseData baseData = + await businessService.popularList("30").catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + popularSalesList = baseData.data; + } + } finally { + addLoadCount(); + } + } + + ///生意总览 + queryOrderTrend() async { + try { + BaseData> baseData = + await businessService.orderTrend().catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + orderTrend = baseData.data; + } + } finally { + addLoadCount(); + } + } + @override Widget build(BuildContext context) { super.build(context); @@ -58,9 +153,7 @@ class _BusinessHomePage extends State return MyFooter(mode); }, ), - onRefresh: () { - setState(() {}); - }, + onRefresh: _onRefresh, child: SingleChildScrollView( physics: NeverScrollableScrollPhysics(), child: Column( @@ -94,40 +187,59 @@ class _BusinessHomePage extends State right: 16.w), child: Column( children: [ - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: (){ - showAlertDialog(); - //改变导航栏状态栏颜色 - // SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle(statusBarColor: Colors.white), ); - // Navigator.of(context).pushNamed('/router/select_shop'); - }, - child: Row( - children: [ - Image.asset( - "assets/image/bs_more.webp", - width: 16.w, - height: 13.h, - ), - Padding( - padding: EdgeInsets.only(left: 7.w), - child: Text( - "海峽姐妹茶 郑州新田360店", - style: TextStyle( - fontSize: 16.sp, - fontWeight: MyFontWeight.semi_bold, - color: Colors.white, + Row( + children: [ + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + showAlertDialog( + widget.selectStoreIndex, + widget.businessLoginInfo, + ); + //改变导航栏状态栏颜色 + // SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle(statusBarColor: Colors.white), ); + // Navigator.of(context).pushNamed('/router/select_shop'); + }, + child: Row( + children: [ + Image.asset( + "assets/image/bs_more.webp", + width: 16.w, + height: 13.h, ), - ), + Padding( + padding: EdgeInsets.only(left: 7.w), + child: Text( + widget?.businessLoginInfo + ?.storeList[widget.selectStoreIndex].name ?? + "", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.white, + ), + ), + ), + ], ), - ], - ), + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Image.asset( + "assets/image/icon_scan_qr_code.webp", + width: 28.h, + height: 28.h, + ), + ) + ], ), SizedBox( height: 14.h, ), Container( - padding: EdgeInsets.symmetric(horizontal: 23.w, vertical: 12.h), + padding: EdgeInsets.symmetric(vertical: 12.h), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(4), @@ -136,30 +248,33 @@ class _BusinessHomePage extends State crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - Row( - children: [ - Image.asset( - "assets/image/bs_home_bill.webp", - width: 14, - height: 14, - ), - Padding( - padding: EdgeInsets.only(left: 3.w), - child: Text( - "营业额(元)", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xFF30415B), + Padding( + padding: EdgeInsets.symmetric(horizontal: 23.w), + child: Row( + children: [ + Image.asset( + "assets/image/bs_home_bill.webp", + width: 14, + height: 14, ), - ), - ), - ], - ), + Padding( + padding: EdgeInsets.only(left: 3.w), + child: Text( + "营业额(元)", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF30415B), + ), + ), + ), + ], + )), Padding( - padding: EdgeInsets.only(top: 6.h, bottom: 17.h), + padding: EdgeInsets.only( + top: 6.h, bottom: 17.h, left: 23.w, right: 23.w), child: Text( - "1288890.00", + dayCount?.paySum ?? "0", style: TextStyle( fontSize: 24.sp, fontWeight: MyFontWeight.medium, @@ -171,9 +286,10 @@ class _BusinessHomePage extends State children: [ Expanded( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Row( + mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( "assets/image/bs_trade_num.webp", @@ -194,9 +310,10 @@ class _BusinessHomePage extends State ], ), Padding( - padding: EdgeInsets.only(top: 5.h), + padding: EdgeInsets.only( + top: 5.h, left: 20.w, right: 20.w), child: Text( - "12", + (dayCount?.orderNum ?? 0).toString(), style: TextStyle( fontSize: 18.sp, fontWeight: MyFontWeight.medium, @@ -232,9 +349,12 @@ class _BusinessHomePage extends State ], ), Padding( - padding: EdgeInsets.only(top: 5.h), + padding: EdgeInsets.only( + top: 5.h, left: 20.w, right: 20.w), child: Text( - "12999.00", + (dayCount?.refundMoney ?? "0.00") == "0" + ? "0.00" + : (dayCount?.refundMoney ?? "0.00"), style: TextStyle( fontSize: 18.sp, fontWeight: MyFontWeight.medium, @@ -249,7 +369,7 @@ class _BusinessHomePage extends State crossAxisAlignment: CrossAxisAlignment.center, children: [ Row( - mainAxisAlignment: MainAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( "assets/image/bs_refund_num.webp", @@ -270,9 +390,10 @@ class _BusinessHomePage extends State ], ), Padding( - padding: EdgeInsets.only(top: 5.h), + padding: EdgeInsets.only( + top: 5.h, left: 20.w, right: 20.w), child: Text( - "129", + (dayCount?.refundOrderNum ?? 0).toString(), style: TextStyle( fontSize: 18.sp, fontWeight: MyFontWeight.medium, @@ -293,11 +414,22 @@ class _BusinessHomePage extends State } ///侧面弹窗 - showAlertDialog() { - showCupertinoModalPopup( + showAlertDialog( + selectStoreIndex, + businessLoginInfo, + ) async { + int index = await showCupertinoModalPopup( builder: (context) { - return HomeSideslipDialog();}, + return HomeSideslipDialog(selectStoreIndex, businessLoginInfo); + }, context: context); + if (index != null) { + if (index == -1) { + Navigator.of(context).pop(); + return; + } + widget.changeIndex(index); + } } ///生意总览 @@ -333,8 +465,9 @@ class _BusinessHomePage extends State )), GestureDetector( behavior: HitTestBehavior.opaque, - onTap: (){ - Navigator.of(context).pushNamed('/router/trade_overview_page'); + onTap: () { + Navigator.of(context) + .pushNamed('/router/trade_overview_page'); }, child: Row( children: [ @@ -346,7 +479,9 @@ class _BusinessHomePage extends State color: Color(0xFF252626), ), ), - SizedBox(width: 5.w,), + SizedBox( + width: 5.w, + ), Image.asset( "assets/image/bs_right.webp", width: 8.w, @@ -360,7 +495,7 @@ class _BusinessHomePage extends State SizedBox( height: 18.h, ), - LineChartSample2(lineChartSample2Data,"销售量"), + LineChartSample2(lineChartSample2Data, "销售量"), ], ), ); @@ -371,7 +506,8 @@ class _BusinessHomePage extends State return Container( color: Colors.white, margin: EdgeInsets.only(top: 16.h), - padding: EdgeInsets.only(left: 16.w, right: 15.w, top: 12.h, bottom: 12.h), + padding: + EdgeInsets.only(left: 16.w, right: 15.w, top: 12.h, bottom: 12.h), child: Column( children: [ Row( @@ -399,7 +535,7 @@ class _BusinessHomePage extends State children: [ Expanded( child: Container( - padding: EdgeInsets.symmetric(horizontal: 8.w,vertical:6.h), + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h), decoration: BoxDecoration( gradient: LinearGradient( colors: [Color(0xFFFC5A58), Color(0xFFFF716F)], @@ -413,15 +549,17 @@ class _BusinessHomePage extends State children: [ Row( children: [ - Padding(padding: EdgeInsets.only(right: 6.w), - child: Text( - "今日会员充值", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Colors.white, + Padding( + padding: EdgeInsets.only(right: 6.w), + child: Text( + "今日会员充值", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), ), - ),), + ), Image.asset( "assets/image/bs_query_logo.webp", width: 14, @@ -443,100 +581,108 @@ class _BusinessHomePage extends State ], ), )), - SizedBox(width:9.w,), + SizedBox( + width: 9.w, + ), Expanded( child: Container( - padding: EdgeInsets.symmetric(horizontal: 8.w,vertical:6.h), - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Color(0xFFFFA238), Color(0xFFFFBA6D)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - borderRadius: BorderRadius.circular(6.w), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h), + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Color(0xFFFFA238), Color(0xFFFFBA6D)], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + borderRadius: BorderRadius.circular(6.w), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( children: [ - Row( - children: [ - Padding(padding: EdgeInsets.only(right: 6.w), - child: Text( - "今日新增会员", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Colors.white, - ), - ),), - Image.asset( - "assets/image/bs_query_logo.webp", - width: 14, - height: 14, + Padding( + padding: EdgeInsets.only(right: 6.w), + child: Text( + "今日新增会员", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, ), - ], - ), - SizedBox( - height: 7.h, - ), - Text( - "666", - style: TextStyle( - fontSize: 24.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, ), ), + Image.asset( + "assets/image/bs_query_logo.webp", + width: 14, + height: 14, + ), ], ), - )), - SizedBox(width:9.w,), - Expanded( - child: Container( - padding: EdgeInsets.symmetric(horizontal: 8.w,vertical:6.h), - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Color(0xFF4B77FC), Color(0xFF7091FF)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, + SizedBox( + height: 7.h, + ), + Text( + "666", + style: TextStyle( + fontSize: 24.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, ), - borderRadius: BorderRadius.circular(6.w), ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + ], + ), + )), + SizedBox( + width: 9.w, + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h), + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Color(0xFF4B77FC), Color(0xFF7091FF)], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + borderRadius: BorderRadius.circular(6.w), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( children: [ - Row( - children: [ - Padding(padding: EdgeInsets.only(right: 6.w), - child: Text( - "总会员数", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Colors.white, - ), - ),), - Image.asset( - "assets/image/bs_query_logo.webp", - width: 14, - height: 14, + Padding( + padding: EdgeInsets.only(right: 6.w), + child: Text( + "总会员数", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, ), - ], - ), - SizedBox( - height: 7.h, - ), - Text( - "23455", - style: TextStyle( - fontSize: 24.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, ), ), + Image.asset( + "assets/image/bs_query_logo.webp", + width: 14, + height: 14, + ), ], ), - )), + SizedBox( + height: 7.h, + ), + Text( + "23455", + style: TextStyle( + fontSize: 24.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ], + ), + )), ], ) ], @@ -545,18 +691,21 @@ class _BusinessHomePage extends State } ///热销榜单 - Widget hotSellHotCharts(){ + Widget hotSellHotCharts() { return Container( color: Colors.white, margin: EdgeInsets.only(top: 16.h), - padding: EdgeInsets.only(left: 16.w, right: 15.w, top: 12.h, bottom: 16.h), + padding: + EdgeInsets.only(left: 16.w, right: 15.w, top: 12.h, bottom: 16.h), child: Column( children: [ Row( children: [ Container(width: 4.w, height: 16.h, color: Color(0xFF30415B)), Padding( - padding: EdgeInsets.only(left: 12.w,), + padding: EdgeInsets.only( + left: 12.w, + ), child: Text( "热销榜单", style: TextStyle( @@ -568,18 +717,19 @@ class _BusinessHomePage extends State ), ], ), - SizedBox(height:14.h,), + SizedBox( + height: 14.h, + ), Container( - height:25.h, - margin:EdgeInsets.only(bottom:26.h), + height: 25.h, + margin: EdgeInsets.only(bottom: 26.h), child: ListView.builder( scrollDirection: Axis.horizontal, physics: BouncingScrollPhysics(), - itemCount:4, + itemCount: 4, itemBuilder: (context, position) { return GestureDetector( - onTap: () { - }, + onTap: () {}, child: dayItem(), ); }, @@ -587,14 +737,13 @@ class _BusinessHomePage extends State ), ListView.builder( padding: EdgeInsets.zero, - itemCount:5, + itemCount: 5, scrollDirection: Axis.vertical, shrinkWrap: true, physics: BouncingScrollPhysics(), itemBuilder: (context, position) { return GestureDetector( - onTap: () { - }, + onTap: () {}, child: salesVolumeItem(), ); }, @@ -605,11 +754,13 @@ class _BusinessHomePage extends State } ///天数item - Widget dayItem(){ + Widget dayItem() { return Container( - padding: EdgeInsets.symmetric(horizontal:19.w,), + padding: EdgeInsets.symmetric( + horizontal: 19.w, + ), alignment: Alignment.center, - margin: EdgeInsets.only(right:16.w), + margin: EdgeInsets.only(right: 16.w), decoration: BoxDecoration( borderRadius: BorderRadius.circular(2.w), // color: Color(0xFF30415B), @@ -630,15 +781,15 @@ class _BusinessHomePage extends State } ///销量item - Widget salesVolumeItem(){ + Widget salesVolumeItem() { return Container( - padding: EdgeInsets.only(bottom:12.h), + padding: EdgeInsets.only(bottom: 12.h), child: Row( children: [ Image.asset( "assets/image/bs_trophy_one.webp", - width:26, - height:26, + width: 26, + height: 26, ), // Text( // "1", @@ -648,15 +799,19 @@ class _BusinessHomePage extends State // color: Color(0xFF0D0D0D), // ), // ), - SizedBox(width:8.w,), - Expanded(child:Text( - "满杯花青素", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF0D0D0D), + SizedBox( + width: 8.w, + ), + Expanded( + child: Text( + "满杯花青素", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF0D0D0D), + ), ), - ),), + ), Text( "已售", style: TextStyle( @@ -665,40 +820,48 @@ class _BusinessHomePage extends State color: Color(0xFF0D0D0D), ), ), - Padding(padding:EdgeInsets.only(left: 7.w), - child: Text( - "1888件", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF0D0D0D), + Padding( + padding: EdgeInsets.only(left: 7.w), + child: Text( + "1888件", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF0D0D0D), + ), ), - ),) + ) ], ), ); } ///今日流水 - Widget todayFlow(){ + Widget todayFlow() { return Container( color: Colors.white, - margin: EdgeInsets.only(top: 16.h,bottom: 26.h), - padding: EdgeInsets.only(left: 16.w, right:21.w, top: 12.h, bottom: 16.h), - child:Column( + margin: EdgeInsets.only(top: 16.h, bottom: 26.h), + padding: + EdgeInsets.only(left: 16.w, right: 21.w, top: 12.h, bottom: 16.h), + child: Column( children: [ Row( children: [ - Container(width: 4.w, height: 16.h, color: Color(0xFF30415B),margin: EdgeInsets.only(right:12.w),), + Container( + width: 4.w, + height: 16.h, + color: Color(0xFF30415B), + margin: EdgeInsets.only(right: 12.w), + ), Expanded( child: Text( - "今日流水", - style: TextStyle( - fontSize: 15.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xFF0D0D0D), - ), - )), + "今日流水", + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF0D0D0D), + ), + )), GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { @@ -714,7 +877,9 @@ class _BusinessHomePage extends State color: Color(0xFF252626), ), ), - SizedBox(width:5.w,), + SizedBox( + width: 5.w, + ), Image.asset( "assets/image/bs_right.webp", width: 8.w, @@ -725,17 +890,18 @@ class _BusinessHomePage extends State ), ], ), - SizedBox(height:20.h,), + SizedBox( + height: 20.h, + ), ListView.builder( padding: EdgeInsets.zero, - itemCount:5, + itemCount: 5, scrollDirection: Axis.vertical, shrinkWrap: true, physics: BouncingScrollPhysics(), itemBuilder: (context, position) { return GestureDetector( - onTap: () { - }, + onTap: () {}, child: flowItem(), ); }, @@ -746,17 +912,18 @@ class _BusinessHomePage extends State } ///流水item - Widget flowItem(){ + Widget flowItem() { return Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(0.w), color: Color(0xFFF3F7FF), ), margin: EdgeInsets.only(bottom: 12.h), - padding: EdgeInsets.symmetric(horizontal: 17.w, vertical:8.h), - child:Row( + padding: EdgeInsets.symmetric(horizontal: 17.w, vertical: 8.h), + child: Row( children: [ - Expanded(child:Column( + Expanded( + child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( @@ -767,7 +934,9 @@ class _BusinessHomePage extends State color: Color(0xD9000000), ), ), - SizedBox(height:7.h,), + SizedBox( + height: 7.h, + ), Text( "海峽姐妹茶 郑州新田360店", style: TextStyle( @@ -782,7 +951,7 @@ class _BusinessHomePage extends State TextSpan( children: [ TextSpan( - text:"+", + text: "+", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.medium, diff --git a/lib/business_system/home/home_view/home_sideslip_dialog.dart b/lib/business_system/home/home_view/home_sideslip_dialog.dart index 6631666e..2a83a155 100644 --- a/lib/business_system/home/home_view/home_sideslip_dialog.dart +++ b/lib/business_system/home/home_view/home_sideslip_dialog.dart @@ -2,8 +2,20 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/utils/font_weight.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../../../retrofit/data/business_login_info.dart'; +import '../../../utils/flutter_utils.dart'; +import '../../../view_widget/custom_image.dart'; class HomeSideslipDialog extends StatefulWidget { + final int selectStoreIndex; + final BusinessLoginInfo businessLoginInfo; + + HomeSideslipDialog( + this.selectStoreIndex, + this.businessLoginInfo, + ); @override State createState() { @@ -11,9 +23,12 @@ class HomeSideslipDialog extends StatefulWidget { } } -class _HomeSideslipDialog extends State with SingleTickerProviderStateMixin{ +class _HomeSideslipDialog extends State + with SingleTickerProviderStateMixin { AnimationController _animationController; Animation _animation; + int selectIndex = 0; + final ScrollController scrollController = ScrollController(); @override void initState() { @@ -30,6 +45,13 @@ class _HomeSideslipDialog extends State with SingleTickerPro curve: Curves.fastOutSlowIn, )); _animationController.forward(); + selectIndex = widget.selectStoreIndex; + if (selectIndex != 0) + Future.delayed(Duration(milliseconds: 100), () { + scrollController.jumpTo((scrollController.position.maxScrollExtent / + widget.businessLoginInfo.storeList.length) * + selectIndex); + }); } @override @@ -40,143 +62,189 @@ class _HomeSideslipDialog extends State with SingleTickerPro @override Widget build(BuildContext context) { - return SlideTransition(position: _animation, - child: WillPopScope( - ///点击背景不收起弹窗; - onWillPop: () async { - SystemChrome.setSystemUIOverlayStyle( - SystemUiOverlayStyle(statusBarColor: Colors.transparent)); - return true; - }, - child: Container( - width: double.infinity, - margin: EdgeInsets.only(right:61.w), - height: double.infinity, - padding: EdgeInsets.only(top: 55.h), - decoration: new BoxDecoration( - color: Colors.white, - ), - child:Container( - child: - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding:EdgeInsets.only(left:14.w,bottom: 33.h), - child: Row( - children: [ - Image.asset( - "assets/image/default_user.webp", - width:57, - height:57, - ), - SizedBox(width: 10.w,), - Expanded(child: - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children:[ - Text("前进麦味烘焙*海峡姐妹茶", - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 15.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF1A1A1A) - ),), - SizedBox(height: 5.h,), - Text("123****1234", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF4D4D4D) - ),), - ], - )) - ], + return SlideTransition( + position: _animation, + child: WillPopScope( + ///点击背景不收起弹窗; + onWillPop: () async { + SystemChrome.setSystemUIOverlayStyle( + SystemUiOverlayStyle(statusBarColor: Colors.transparent)); + return true; + }, + child: Container( + width: double.infinity, + margin: EdgeInsets.only(right: 61.w), + height: double.infinity, + padding: EdgeInsets.only(top: 55.h), + decoration: new BoxDecoration( + color: Colors.white, + ), + child: Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only(left: 14.w, bottom: 33.h), + child: Row( + children: [ + MImage( + widget?.businessLoginInfo?.avatar ?? "", + fit: BoxFit.cover, + width: 57.h, + height: 57.h, + radius: BorderRadius.circular(100), + errorSrc: "assets/image/default_2_1.webp", + fadeSrc: "assets/image/default_2_1.webp", + ), + SizedBox( + width: 10.w, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget?.businessLoginInfo + ?.storeList[widget.selectStoreIndex].name ?? + "", + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF1A1A1A)), + ), + SizedBox( + height: 5.h, + ), + Text( + AppUtils.phoneEncode( + widget?.businessLoginInfo?.account ?? ""), + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF4D4D4D)), + ), + ], + )) + ], + ), ), - ), - Padding(padding: EdgeInsets.only(left: 16.w,bottom: 22.h), - child: - Row( - children: [ - Image.asset( - "assets/image/bs_switch_shop.webp", - width:24, - height:24, + Padding( + padding: EdgeInsets.only(left: 16.w, bottom: 22.h), + child: Row( + children: [ + Image.asset( + "assets/image/bs_switch_shop.webp", + width: 24, + height: 24, + ), + SizedBox( + width: 4.w, + ), + Text( + "门店切换", + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF1A1A1A)), + ), + ], + ), + ), + Expanded( + child: ListView.builder( + padding: EdgeInsets.zero, + controller: scrollController, + itemCount: widget?.businessLoginInfo?.storeList?.length ?? 0, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + setState(() { + selectIndex = position; + Navigator.of(context).pop(selectIndex); + }); + }, + child: shopItem( + widget.businessLoginInfo.storeList[position], + position), + ); + }, + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + // SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( + // statusBarColor: Colors.transparent)); + SharedPreferences.getInstance().then((value) { + value.setString("account", ""); + value.setString("password", ""); + Navigator.of(context).pop(-1); + }); + }, + child: Container( + alignment: Alignment.center, + width: double.infinity, + padding: EdgeInsets.symmetric(vertical: 9.h), + margin: EdgeInsets.only( + left: 16.w, + right: 16.w, + bottom: (widget.businessLoginInfo.storeList.length > 20) + ? 20.h + : 103.h, + top: 20.h), + decoration: BoxDecoration( + color: Color(0xFF30415B), + borderRadius: BorderRadius.circular(4.w), ), - SizedBox(width: 4.w,), - Text("门店切换", + child: Text( + "退出登录", style: TextStyle( - fontSize: 15.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xFF1A1A1A) - ),), - ], - ),), - Expanded(child:ListView.builder( - padding: EdgeInsets.zero, - itemCount:5, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - }, - child: shopItem(), - ); - }, - )), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: (){ - SystemChrome.setSystemUIOverlayStyle( - SystemUiOverlayStyle(statusBarColor: Colors.transparent)); - }, - child: Container( - alignment: Alignment.center, - width: double.infinity, - padding: EdgeInsets.symmetric(vertical: 9.h), - margin: EdgeInsets.only(left:16.w,right: 16.w,bottom: 103.h,top: 20.h), - decoration: BoxDecoration( - color: Color(0xFF30415B), - borderRadius: BorderRadius.circular(4.w), + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white), + ), ), - child:Text("退出登录", - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white - ),),), - ), - ], + ), + ], + ), ), ), - ),),); + ), + ); } ///门店选择 - Widget shopItem(){ + Widget shopItem(StoreList storeList, index) { return Container( decoration: BoxDecoration( - color: Color(0xFFF8F9FA), + color: selectIndex == index ? Color(0xFFF8F9FA) : Colors.transparent, borderRadius: BorderRadius.circular(4.w), ), - margin:EdgeInsets.only(bottom: 11.h), - padding: EdgeInsets.only(top: 5.h,bottom: 8.h,left: 16.w,right: 17.w), + margin: EdgeInsets.only(bottom: 11.h), + padding: EdgeInsets.only(top: 5.h, bottom: 8.h, left: 16.w, right: 17.w), child: Row( children: [ - Expanded(child:Text("前进麦味烘焙*海峡姐妹茶(哈乐城店)", + Expanded( + child: Text( + storeList?.name ?? "", style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.medium, - color: Color(0xFF30415B) - ),)), - Icon( - Icons.check, - size: 20, - color: Color(0xFF4D4D4D),) + color: selectIndex == index + ? Color(0xFF30415B) + : Color(0xFF4D4D4D)), + )), + if (selectIndex == index) + Icon( + Icons.check, + size: 20, + color: Color(0xFF4D4D4D), + ) ], ), ); diff --git a/lib/business_system/home/select_shop.dart b/lib/business_system/home/select_shop.dart index 9e8e0057..8331b897 100644 --- a/lib/business_system/home/select_shop.dart +++ b/lib/business_system/home/select_shop.dart @@ -5,10 +5,15 @@ import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../../generated/l10n.dart'; +import '../../retrofit/data/business_login_info.dart'; import '../../view_widget/classic_header.dart'; import '../../view_widget/my_footer.dart'; class SelectShop extends StatefulWidget { + final arguments; + + SelectShop({this.arguments}); + @override State createState() { return _SelectShop(); @@ -17,86 +22,107 @@ class SelectShop extends StatefulWidget { class _SelectShop extends State { final RefreshController refreshController = RefreshController(); + BusinessLoginInfo businessLoginInfo; + int selectIndex = 0; @override void initState() { super.initState(); + businessLoginInfo = widget.arguments["businessLoginInfo"]; } @override Widget build(BuildContext context) { - return - Scaffold( - backgroundColor: Colors.white, - appBar: MyAppBar( - title: "选择门店", - titleColor: Colors.black, - background: Colors.white, - leadingColor: Colors.black, - brightness: Brightness.dark, + return Scaffold( + backgroundColor: Colors.white, + appBar: MyAppBar( + title: "选择门店", + titleColor: Colors.black, + background: Colors.white, + leadingColor: Colors.black, + brightness: Brightness.dark, + ), + body: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader( + color: Colors.white, ), - body: SmartRefresher( - controller: refreshController, - enablePullDown: true, - enablePullUp: false, - header: MyHeader( - color: Colors.white, - ), - footer: CustomFooter( - builder: (context, mode) { - return MyFooter(mode); - }, - ), - onRefresh: () { + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); }, - physics: BouncingScrollPhysics(), - scrollController: ScrollController(), - child: Container( - height: double.infinity, - padding: EdgeInsets.only(top: 13.h,left:16.w,right:16.w), - child:Column( - children: [ - Row( - children: [ - Image.asset( - "assets/image/bs_switch_shop.webp", - width:24, - height:24, - ), - SizedBox(width: 4.w,), - Text("门店切换", - style: TextStyle( - fontSize: 15.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xFF1A1A1A) - ),), - ], - ), - SizedBox(height:20.h,), - Expanded(child: ListView.builder( - padding: EdgeInsets.zero, - itemCount:20, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - }, - child: shopsItem(), - ); - }, - )), - Container( + ), + onRefresh: () {}, + physics: BouncingScrollPhysics(), + scrollController: ScrollController(), + child: Container( + height: double.infinity, + padding: EdgeInsets.only(top: 13.h, left: 16.w, right: 16.w), + child: Column( + children: [ + Row( + children: [ + Image.asset( + "assets/image/bs_switch_shop.webp", + width: 24, + height: 24, + ), + SizedBox( + width: 4.w, + ), + Text( + "门店切换", + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF1A1A1A)), + ), + ], + ), + SizedBox( + height: 20.h, + ), + Expanded( + child: ListView.builder( + padding: EdgeInsets.zero, + itemCount: businessLoginInfo?.storeList?.length ?? 0, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + setState(() { + selectIndex = position; + }); + }, + child: shopsItem( + businessLoginInfo?.storeList[position], position), + ); + }, + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context).pushReplacementNamed( + '/router/business_page', + arguments: { + "selectStoreIndex": selectIndex, + "businessLoginInfo": businessLoginInfo, + }); + }, + child: Container( width: double.infinity, - padding: EdgeInsets.symmetric(vertical:16.h), - margin: EdgeInsets.only(bottom:34.h,top: 10.h), + padding: EdgeInsets.symmetric(vertical: 16.h), + margin: EdgeInsets.only(bottom: 34.h, top: 10.h), alignment: Alignment.center, decoration: BoxDecoration( color: Color(0xFF30415B), borderRadius: BorderRadius.circular(27.w), ), - child:Text( + child: Text( S.of(context).queding, style: TextStyle( fontWeight: MyFontWeight.bold, @@ -105,14 +131,15 @@ class _SelectShop extends State { ), ), ), - ], - ), + ), + ], ), ), - ); + ), + ); } - Widget shopsItem(){ + Widget shopsItem(StoreList storeList, index) { return Container( height: 52.h, margin: EdgeInsets.only(bottom: 12), @@ -123,30 +150,34 @@ class _SelectShop extends State { height: 52.h, width: double.infinity, decoration: BoxDecoration( - color: Color(0xFFEFF5FF), + color: selectIndex == index ? Color(0xFFEFF5FF) : Colors.white, borderRadius: BorderRadius.circular(4.w), border: Border.all( - color: Color(0xFF30415B), - width: 1.w, + color: selectIndex == index ? Color(0xFF30415B) : Colors.white, + width: selectIndex == index ? 1.w : 0, ), ), - padding: EdgeInsets.only(top:16.h,bottom:16.h,left: 16.w,right: 17.w), - child: Text("前进麦味烘焙*海峡姐妹茶(哈乐城店)", + padding: EdgeInsets.only( + top: 16.h, bottom: 16.h, left: 16.w, right: 17.w), + child: Text( + storeList?.name ?? "", style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.medium, - color: Color(0xFF30415B) - ),), - ), - Image.asset( - "assets/image/bs_shop.webp", - width: 20, - height: 20, - fit: BoxFit.fill, + color: selectIndex == index + ? Color(0xFF30415B) + : Color(0xFF0D0D0D)), + ), ), + if (selectIndex == index) + Image.asset( + "assets/image/bs_shop.webp", + width: 20, + height: 20, + fit: BoxFit.fill, + ), ], ), ); } - } diff --git a/lib/business_system/login/business_login_page.dart b/lib/business_system/login/business_login_page.dart index 0de7834c..eeb474df 100644 --- a/lib/business_system/login/business_login_page.dart +++ b/lib/business_system/login/business_login_page.dart @@ -1,11 +1,22 @@ +import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/utils/business_instance.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:sharesdk_plugin/sharesdk_interface.dart'; import '../../generated/l10n.dart'; -import '../../retrofit/retrofit_api.dart'; +import '../../retrofit/business_api.dart'; +import '../../retrofit/data/base_data.dart'; +import '../../retrofit/data/business_login_info.dart'; import '../../utils/font_weight.dart'; +import '../../view_widget/border_text.dart'; +import '../../view_widget/round_button.dart'; class BusinessLoginPage extends StatefulWidget { final Map arguments; @@ -21,14 +32,10 @@ class BusinessLoginPage extends StatefulWidget { class _BusinessLoginPage extends State { TextEditingController _userPhoneController = TextEditingController(); TextEditingController _passwordController = TextEditingController(); - bool _isShowPassword = false; - bool _isShowUserNameDel = false; - bool _agree = false; - bool _canClick = true; - DateTime _lastQuitTime; - String _phoneInputTips, _pwdInputTips; + String phoneInputTips, pwdInputTips; final TapGestureRecognizer tapGestureRecognizer = TapGestureRecognizer(); var checkStatus = false; + BusinessApiService businessService; @override void initState() { @@ -48,240 +55,467 @@ class _BusinessLoginPage extends State { setState(() {}); } + login() async { + SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); + if (!sharedPreferences.containsKey("isShowPrivacyPolicy") || + !sharedPreferences.getBool("isShowPrivacyPolicy")) { + showAlertDialog(); + return; + } + if (_userPhoneController.text == "") { + SmartDialog.showToast(S.of(context).qingshurushoujihao, + alignment: Alignment.center); + return; + } + if (_passwordController.text == "") { + SmartDialog.showToast("请输入密码", alignment: Alignment.center); + return; + } + if (!checkStatus) { + SmartDialog.showToast(S.of(context).gouxuanxieyi, + alignment: Alignment.center); + return; + } + + var param = { + "grantType": "password", + "account": _userPhoneController.text, + "password": _passwordController.text, + }; + + EasyLoading.show( + status: S.of(context).zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + businessService = BusinessApiService(Dio(), context: context); + BaseData baseData = + await businessService.annoToken(param).catchError((error) { + print(error.message); + }); + if (baseData != null && baseData.isSuccess) { + var businessLoginInfo = BusinessLoginInfo.fromJson(baseData.data); + businessLoginInfo.storeList.insert(0, StoreList(name: "所有门店")); + BusinessInstance.instance.businessTenant = businessLoginInfo.tenantCode; + BusinessInstance.instance.businessToken = businessLoginInfo.token; + sharedPreferences.setString('account', _userPhoneController.text); + sharedPreferences.setString('password', _passwordController.text); + if (businessLoginInfo.storeList.length > 1) { + Navigator.of(context) + .pushReplacementNamed('/router/select_shop', arguments: { + "businessLoginInfo": businessLoginInfo, + }); + } else { + Navigator.of(context) + .pushReplacementNamed('/router/business_page', arguments: { + "businessLoginInfo": businessLoginInfo, + }); + } + } else { + if (baseData.msg != null) + SmartDialog.showToast(baseData?.msg, alignment: Alignment.center); + } + EasyLoading.dismiss(); + } + @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, resizeToAvoidBottomInset: false, - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), - child: Stack( - children: [ - Container( - padding: EdgeInsets.only(top: 54.h, left: 16.w, right: 17.w), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 5.w), - child: Text("您好!", - style: TextStyle( - fontSize: 26.sp, - color: Color(0xFF30415B), - fontWeight: MyFontWeight.bold)), - ), - Padding( - padding: EdgeInsets.only(left: 5.w, top: 15.h), - child: Text("欢迎使用回乡收银商家APP", - style: TextStyle( - fontSize: 16.sp, - color: Color(0xFF30415B), - fontWeight: MyFontWeight.medium)), - ), - SizedBox(height: 160.h), - Row( + body: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), + child: Stack( + children: [ + Container( + padding: + EdgeInsets.only(top: 54.h, left: 16.w, right: 17.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset( - "assets/image/business_phone.webp", - width:10.w, - height:15.h, + Padding( + padding: EdgeInsets.only(left: 5.w), + child: Text("您好!", + style: TextStyle( + fontSize: 26.sp, + color: Color(0xFF30415B), + fontWeight: MyFontWeight.bold)), ), - SizedBox(width:4.w), - Text("手机号码", + Padding( + padding: EdgeInsets.only(left: 5.w, top: 15.h), + child: Text("欢迎使用回乡收银商家APP", + style: TextStyle( + fontSize: 16.sp, + color: Color(0xFF30415B), + fontWeight: MyFontWeight.medium)), + ), + SizedBox(height: 160.h), + Row( + children: [ + Image.asset( + "assets/image/business_phone.webp", + width: 10.w, + height: 15.h, + ), + SizedBox(width: 4.w), + Text("手机号码", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xD9000000), + fontWeight: MyFontWeight.bold)) + ], + ), + Container( + margin: EdgeInsets.only(top: 13.h, bottom: 24.h), + child: TextField( + controller: _userPhoneController, + keyboardType: TextInputType.phone, style: TextStyle( fontSize: 14.sp, - color: Color(0xD9000000), - fontWeight: MyFontWeight.bold)) - ], - ), - Container( - margin: EdgeInsets.only(top: 13.h, bottom: 24.h), - child: TextField( - controller: _userPhoneController, - keyboardType: TextInputType.phone, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF000000), - fontWeight: MyFontWeight.regular), - decoration: InputDecoration( - hintText: "请输入手机号码", - hintStyle: TextStyle( - fontSize: 14.sp, - color: Color(0xFF262626), - fontWeight: MyFontWeight.regular), - contentPadding: EdgeInsets.only( - left: 12.w, top: 16.h, bottom: 15.h), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(4), - borderSide: BorderSide.none), - filled: true, - fillColor: Color(0xFFF8F9FA), + color: Color(0xFF000000), + fontWeight: MyFontWeight.regular), + decoration: InputDecoration( + hintText: "请输入手机号码", + hintStyle: TextStyle( + fontSize: 14.sp, + color: Color(0xFF262626), + fontWeight: MyFontWeight.regular), + contentPadding: EdgeInsets.only( + left: 12.w, top: 16.h, bottom: 15.h), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(4), + borderSide: BorderSide.none), + filled: true, + fillColor: Color(0xFFF8F9FA), + ), + onChanged: (value) { + if (value.isEmpty) { + phoneInputTips = "请输入手机号码"; + } else { + phoneInputTips = null; + } + refresh(); + }, + inputFormatters: [ + LengthLimitingTextInputFormatter(11) + ], + ), ), - onChanged: (value) { - if (value.isEmpty) { - _phoneInputTips = "请输入手机号码"; - } else { - _phoneInputTips = null; - } - refresh(); - }, - ), - ), - Row( - children: [ - Image.asset( - "assets/image/business_code.webp", - width:12.w, - height:15.h, + Row( + children: [ + Image.asset( + "assets/image/business_code.webp", + width: 12.w, + height: 15.h, + ), + SizedBox(width: 4.w), + Text("密码", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xD9000000), + fontWeight: MyFontWeight.bold)) + ], ), - SizedBox(width:4.w), - Text("密码", + Container( + margin: EdgeInsets.only(top: 12.h, bottom: 75.h), + child: TextField( + controller: _passwordController, + keyboardType: TextInputType.phone, style: TextStyle( fontSize: 14.sp, - color: Color(0xD9000000), - fontWeight: MyFontWeight.bold)) - ], - ), - Container( - margin: EdgeInsets.only(top: 12.h, bottom: 75.h), - child: TextField( - controller: _passwordController, - keyboardType: TextInputType.phone, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF000000), - fontWeight: MyFontWeight.regular), - decoration: InputDecoration( - hintText: "请输入密码", - hintStyle: TextStyle( - fontSize: 14.sp, - color: Color(0xFF262626), - fontWeight: MyFontWeight.regular), - contentPadding: EdgeInsets.only( - left: 12.w, top: 16.h, bottom: 15.h), - border: OutlineInputBorder( + color: Color(0xFF000000), + fontWeight: MyFontWeight.regular), + decoration: InputDecoration( + hintText: "请输入密码", + hintStyle: TextStyle( + fontSize: 14.sp, + color: Color(0xFF262626), + fontWeight: MyFontWeight.regular), + contentPadding: EdgeInsets.only( + left: 12.w, top: 16.h, bottom: 15.h), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(4), + borderSide: BorderSide.none), + filled: true, + fillColor: Color(0xFFF8F9FA), + ), + onChanged: (value) { + if (value.isEmpty) { + pwdInputTips = "请输入密码"; + } else { + pwdInputTips = null; + } + refresh(); + }, + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + login(); + }, + child: Container( + width: double.infinity, + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 15.h), + margin: EdgeInsets.only(bottom: 22.h), + decoration: BoxDecoration( + color: Color(0xFF30415B), borderRadius: BorderRadius.circular(4), - borderSide: BorderSide.none), - filled: true, - fillColor: Color(0xFFF8F9FA), + ), + child: Text(S.of(context).login, + style: TextStyle( + fontSize: 16.sp, + color: Colors.white, + fontWeight: MyFontWeight.bold)), + ), ), - onChanged: (value) { - if (value.isEmpty) { - _pwdInputTips = "请输入密码"; - } else { - _pwdInputTips = null; - } - refresh(); - }, - ), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Navigator.of(context).pushReplacementNamed('/router/business_page'); - }, - child: Container( - width: double.infinity, - alignment: Alignment.center, - padding: EdgeInsets.symmetric(vertical: 15.h), - margin: EdgeInsets.only(bottom: 22.h), - decoration: BoxDecoration( - color: Color(0xFF30415B), - borderRadius: BorderRadius.circular(4), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Checkbox( + value: checkStatus, + onChanged: (a) { + setState(() { + checkStatus = !checkStatus; + }); + }, + checkColor: Color(0xFFFFFFFF), + fillColor: + MaterialStateProperty.all(Color(0xFF30415B)), + ), + Expanded( + child: Text.rich( + TextSpan(children: [ + TextSpan( + text: S.of(context).privacy_policy1, + style: TextStyle( + fontSize: 11.sp, + color: Color(0xFF010101), + ), + ), + TextSpan( + // text: S.of(context).privacy_policy2, + text: "《一心回乡用户协议》", + recognizer: TapGestureRecognizer() + ..onTap = () { + Navigator.of(context).pushNamed( + '/router/user_service_page'); + }, + style: TextStyle( + fontSize: 11.sp, + color: Color(0xFF010101), + ), + ), + TextSpan( + text: "、", + style: TextStyle( + fontSize: 11.sp, + color: Colors.black, + ), + ), + TextSpan( + text: S.of(context).privacy_policy3, + recognizer: tapGestureRecognizer, + style: TextStyle( + fontSize: 11.sp, + color: Color(0xFF010101), + ), + ), + TextSpan( + text: S.of(context).privacy_policy4, + style: TextStyle( + fontSize: 11.sp, + height: 1.2, + color: Color(0xFF010101), + ), + ), + ]), + )), + SizedBox( + width: 30, + ) + ], ), - child: Text(S.of(context).login, - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: MyFontWeight.bold)), - ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 98.h), + child: Image.asset( + "assets/image/business_login.webp", + fit: BoxFit.cover, + width: double.infinity, + height: 199.h, + ), + ) + ], + ), + ), + )), + ); + } + + showAlertDialog() { + //显示对话框 + showDialog( + context: context, + builder: (BuildContext context) { + return WillPopScope( + onWillPop: () async => false, + child: SimpleDialog( + titlePadding: EdgeInsets.all(10), + backgroundColor: Colors.transparent, + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(6), + ), + children: [ + Stack( + alignment: Alignment.bottomCenter, + children: [ + Container( + alignment: Alignment.center, + width: double.infinity, + height: 325.h, + padding: EdgeInsets.only(left: 16.w, right: 16.w), + decoration: new BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, + child: Column( children: [ - Checkbox( - value: checkStatus, - onChanged: (a) { - setState(() { - checkStatus = !checkStatus; - }); - }, - checkColor: Color(0xFFFFFFFF), - fillColor: - MaterialStateProperty.all(Color(0xFF30415B)), + Padding( + padding: EdgeInsets.only(top: 24.h, bottom: 10.h), + child: Text( + S.of(context).xieyitanchuang, + style: TextStyle( + color: Color(0xff4D4D4D), + fontSize: 18.sp, + fontWeight: FontWeight.bold, + ), + ), ), - Expanded( - child: Text.rich( + Text.rich( TextSpan(children: [ TextSpan( - text: S.of(context).privacy_policy1, + text: S.of(context).yinsizhengce1, style: TextStyle( - fontSize: 11.sp, - color: Color(0xFF010101), + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + height: 1.3.h, + color: Color(0xff727272), ), ), TextSpan( - // text: S.of(context).privacy_policy2, - text: "《一心回乡用户协议》", + text: S.of(context).yinsixieyi, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + color: Color(0xff32A060)), recognizer: TapGestureRecognizer() ..onTap = () { Navigator.of(context) - .pushNamed('/router/user_service_page'); + .popAndPushNamed('/router/treaty_page'); }, - style: TextStyle( - fontSize: 11.sp, - color: Color(0xFF010101), - ), - ), - TextSpan( - text: "、", - style: TextStyle( - fontSize: 11.sp, - color: Colors.black, - ), - ), - TextSpan( - text: S.of(context).privacy_policy3, - recognizer: tapGestureRecognizer, - style: TextStyle( - fontSize: 11.sp, - color: Color(0xFF010101), - ), - ), - TextSpan( - text: S.of(context).privacy_policy4, - style: TextStyle( - fontSize: 11.sp, - height: 1.2, - color: Color(0xFF010101), - ), ), ]), - )), + ), SizedBox( - width: 30, - ) + height: 10.h, + ), + Text( + S.of(context).yinsizhengce2, + style: TextStyle( + color: Color(0xff727272), + fontSize: 14.sp, + height: 1.3.h, + fontWeight: MyFontWeight.medium, + ), + ), + SizedBox( + height: 16.h, + ), ], ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 98.h), - child: Image.asset( - "assets/image/business_login.webp", - fit: BoxFit.cover, - width: double.infinity, - height: 199.h, - ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + GestureDetector( + onTap: () { + Navigator.of(context).pop(); + // exit(0); + }, + child: Container( + height: 40.h, + alignment: Alignment.bottomCenter, + margin: EdgeInsets.only(bottom: 20.h), + child: BorderText( + padding: EdgeInsets.only( + top: 10.h, + bottom: 10.h, + left: 36.w, + right: 36.w, + ), + text: S.of(context).jujue, + fontSize: 12.sp, + textColor: Color(0xFF32A060), + borderColor: Color(0xFF32A060), + borderWidth: 1.w, + radius: 23, + ), + ), + ), + SizedBox( + width: 21.w, + ), + Container( + height: 40.h, + margin: EdgeInsets.only(bottom: 20.h), + alignment: Alignment.bottomCenter, + child: RoundButton( + text: S.of(context).tongyibingjixu, + textColor: Colors.white, + fontSize: 12.sp, + callback: () { + SharedPreferences.getInstance().then((value) { + value.setBool("isShowPrivacyPolicy", true); + }); + SharesdkPlugin.uploadPrivacyPermissionStatus( + 1, + (success) => { + Navigator.of(context).pop(), + }, + ); + }, + padding: EdgeInsets.only( + top: 10.h, + bottom: 10.h, + left: 21.5.w, + right: 21.5.w, + ), + backgroup: Color(0xff32A060), + radius: 23, + ), + ), + SizedBox( + height: 20.h, + ), + ], + ), + ], ) ], ), - ), - ), + ); + }, ); } } diff --git a/lib/main.dart b/lib/main.dart index f8bce895..1032f910 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -475,7 +475,7 @@ Map routers = { '/router/flow_page': (context, {arguments}) => FlowPage(), '/router/select_shop': (context, {arguments}) => - SelectShop(), + SelectShop(arguments:arguments), '/router/trade_overview_page': (context, {arguments}) => TradeOverviewPage(), '/router/goods_search_page': (context, {arguments}) => diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index 3d58ad02..493a80ff 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -1,5 +1,8 @@ +import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart'; @@ -7,6 +10,11 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:url_launcher/url_launcher.dart'; +import '../../retrofit/business_api.dart'; +import '../../retrofit/data/base_data.dart'; +import '../../retrofit/data/business_login_info.dart'; +import '../../utils/business_instance.dart'; + class MineItem extends StatefulWidget { @override State createState() { @@ -16,10 +24,50 @@ class MineItem extends StatefulWidget { class _MineItem extends State { var isShowMore = false; + + login(account, password) async { + var param = { + "grantType": "password", + "account": account, + "password": password, + }; + + EasyLoading.show( + status: S.of(context).zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + + BusinessApiService businessService = + BusinessApiService(Dio(), context: context); + BaseData baseData = + await businessService.annoToken(param).catchError((error) { + print(error.message); + }); + if (baseData != null && baseData.isSuccess) { + var businessLoginInfo = BusinessLoginInfo.fromJson(baseData.data); + businessLoginInfo.storeList.insert(0, StoreList(name: "所有门店")); + BusinessInstance.instance.businessTenant = businessLoginInfo.tenantCode; + BusinessInstance.instance.businessToken = businessLoginInfo.token; + if (businessLoginInfo.storeList.length > 1) { + Navigator.of(context) + .pushReplacementNamed('/router/select_shop', arguments: { + "businessLoginInfo": businessLoginInfo, + }); + } else { + Navigator.of(context) + .pushReplacementNamed('/router/business_page', arguments: { + "businessLoginInfo": businessLoginInfo, + }); + } + } else { + Navigator.of(context).pushNamed('/router/business_login_page'); + } + EasyLoading.dismiss(); + } + @override Widget build(BuildContext context) { return Container( - margin: EdgeInsets.fromLTRB(16.w,0.h, 16.w,30.h), + margin: EdgeInsets.fromLTRB(16.w, 0.h, 16.w, 30.h), // padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h), decoration: BoxDecoration( color: Colors.white, @@ -37,8 +85,8 @@ class _MineItem extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - padding: EdgeInsets.only(left: 16,top:16,bottom:13,right: 16), - child:Text( + padding: EdgeInsets.only(left: 16, top: 16, bottom: 13, right: 16), + child: Text( S.of(context).qita, style: TextStyle( color: Color(0xFF353535), @@ -133,76 +181,85 @@ class _MineItem extends State { // ), // ),), ///优惠券 - Expanded(child: - InkWell( - onTap: () { - SharedPreferences.getInstance().then((value) { - if (value.getString("token") == null || - value.getString("token") == "") { - LoginTipsDialog().show(context); - return; - } - Navigator.of(context).pushNamed('/router/coupon_page'); - }); - }, - child: mineItem( - S.of(context).youhuiquan, - "assets/image/coupon.webp", + Expanded( + child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context).pushNamed('/router/coupon_page'); + }); + }, + child: mineItem( + S.of(context).youhuiquan, + "assets/image/coupon.webp", + ), ), ), - ), + ///平台余额 - Expanded(child: InkWell( - onTap: () { - SharedPreferences.getInstance().then((value) { - if (value.getString("token") == null || - value.getString("token") == "") { - LoginTipsDialog().show(context); - return; - } - Navigator.of(context).pushNamed('/router/mine_wallet'); - }); - }, - child: mineItem( - S.of(context).huixiangqianbao, - "assets/image/platform_yue.webp", + Expanded( + child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context).pushNamed('/router/mine_wallet'); + }); + }, + child: mineItem( + S.of(context).huixiangqianbao, + "assets/image/platform_yue.webp", + ), ), - ),), + ), + ///店铺余额 - Expanded(child: InkWell( - onTap: () { - SharedPreferences.getInstance().then((value) { - if (value.getString("token") == null || - value.getString("token") == "") { - LoginTipsDialog().show(context); - return; - } - Navigator.of(context).pushNamed('/router/mine_shop_page'); - }); - }, - child: mineItem( - "店铺充值", - "assets/image/shop_yue.webp", + Expanded( + child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context).pushNamed('/router/mine_shop_page'); + }); + }, + child: mineItem( + "店铺充值", + "assets/image/shop_yue.webp", + ), ), - ),), + ), + ///兑换历史 - Expanded(child: InkWell( - onTap: () { - SharedPreferences.getInstance().then((value) { - if (value.getString("token") == null || - value.getString("token") == "") { - LoginTipsDialog().show(context); - return; - } - Navigator.of(context) - .pushNamed('/router/exchange_history_page'); - }); - }, - child: mineItem( - S.of(context).duihuanlishi, - "assets/image/icon_mine_records_of_consumption.webp", + Expanded( + child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context) + .pushNamed('/router/exchange_history_page'); + }); + }, + child: mineItem( + S.of(context).duihuanlishi, + "assets/image/icon_mine_records_of_consumption.webp", + ), ), - ),), + ), ////我的评价 // Expanded(child: InkWell( // onTap: () { @@ -222,7 +279,9 @@ class _MineItem extends State { // ),), ], ), - SizedBox(height: 12.h,), + SizedBox( + height: 12.h, + ), // if(isShowMore) Row( children: [ @@ -262,36 +321,56 @@ class _MineItem extends State { // ), // ),), ///帮助反馈 - Expanded(child: InkWell( - onTap: () { - Navigator.of(context).pushNamed('/router/help_feedback_page'); - }, - child: mineItem( - S.of(context).bangzhuyufankui, - "assets/image/fan_kui.webp", + Expanded( + child: InkWell( + onTap: () { + Navigator.of(context) + .pushNamed('/router/help_feedback_page'); + }, + child: mineItem( + S.of(context).bangzhuyufankui, + "assets/image/fan_kui.webp", + ), ), - ),), + ), + ///联系客服 - Expanded(child: InkWell( - onTap: () { - showCallMobile(); - }, - child: mineItem( - S.of(context).lianxikefu, - "assets/image/icon_mine_online_service.webp", + Expanded( + child: InkWell( + onTap: () { + showCallMobile(); + }, + child: mineItem( + S.of(context).lianxikefu, + "assets/image/icon_mine_online_service.webp", + ), ), - ),), + ), + ///商家管理 - Expanded(child: InkWell( - onTap: () { - Navigator.of(context).pushNamed('/router/business_login_page'); - }, - child: mineItem( - "商家管理", - "assets/image/business.webp", + Expanded( + child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("account") == "" || + value.getString("password") == "") { + Navigator.of(context) + .pushNamed('/router/business_login_page'); + } else { + login(value.getString("account"), + value.getString("password")); + } + }); + }, + child: mineItem( + "商家管理", + "assets/image/business.webp", + ), ), - ),), - Expanded(child:Container(),), + ), + Expanded( + child: Container(), + ), // ///帮助反馈 // Expanded(child: InkWell( // onTap: () { @@ -311,19 +390,21 @@ class _MineItem extends State { // "assets/image/pin_tuan.webp", // ), // ),), - // Expanded(child:InkWell( - // onTap: () { - // Navigator.of(context).pushNamed('/router/invitation_record', arguments: {}); - // }, - // child: mineItem( - // "邀请记录", - // "assets/image/yao_q.webp", - // ), - // ),), + // Expanded(child:InkWell( + // onTap: () { + // Navigator.of(context).pushNamed('/router/invitation_record', arguments: {}); + // }, + // child: mineItem( + // "邀请记录", + // "assets/image/yao_q.webp", + // ), + // ),), ], - ), + ), // if(isShowMore) - SizedBox(height: 12.h,), + SizedBox( + height: 12.h, + ), // if(isShowMore) Row( children: [ @@ -348,11 +429,18 @@ class _MineItem extends State { // "assets/image/icon_mine_online_service.webp", // ), // ),), - Expanded(child:Container(),), - Expanded(child:Container(),), - Expanded(child:Container(),), + Expanded( + child: Container(), + ), + Expanded( + child: Container(), + ), + Expanded( + child: Container(), + ), ], ), + ///收起展开 // GestureDetector( // behavior: HitTestBehavior.opaque, @@ -386,8 +474,8 @@ class _MineItem extends State { // ], // ),), // ) - ], - ), + ], + ), ); } @@ -396,7 +484,7 @@ class _MineItem extends State { return Container( color: Colors.white, margin: EdgeInsets.symmetric(vertical: 6.h), - child: Column( + child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -428,15 +516,15 @@ class _MineItem extends State { return CupertinoActionSheet( title: Text(S.of(context).bodadianhua), actions: [ - CupertinoActionSheetAction( - child: Text("19947603193"), - onPressed: () { - callMobile("19947603193"); - Navigator.of(context).pop(); - }, - isDefaultAction: true, - isDestructiveAction: false, - ), + CupertinoActionSheetAction( + child: Text("19947603193"), + onPressed: () { + callMobile("19947603193"); + Navigator.of(context).pop(); + }, + isDefaultAction: true, + isDestructiveAction: false, + ), ], cancelButton: CupertinoActionSheetAction( onPressed: () { diff --git a/lib/retrofit/business_api.dart b/lib/retrofit/business_api.dart index 33cfeac0..1001c0e4 100644 --- a/lib/retrofit/business_api.dart +++ b/lib/retrofit/business_api.dart @@ -6,16 +6,24 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/retrofit/data/business_login_info.dart'; +import 'package:huixiang/retrofit/data/day_count.dart'; +import 'package:huixiang/retrofit/data/order_trend.dart'; import 'package:retrofit/retrofit.dart'; +import '../utils/flutter_utils.dart'; +import 'data/base_data.dart'; +import 'data/popular_sales_list.dart'; + part 'business_api.g.dart'; ///本地 -const localBaseUrl = "http://admin-api.test.yixinhuixiang.com/"; +// const localBaseUrl = "http://admin-api.test.yixinhuixiang.com/"; ///测试 -// const localBaseUrl = "http://test-merchant.lotus-wallet.com/"; +const localBaseUrl = "http://test-merchant.lotus-wallet.com/test-merchant/"; + ///线上 -const serviceBaseUrl = "http://pos.tenant.lotus-wallet.com/"; +const serviceBaseUrl = "http://pos.tenant.lotus-wallet.com/test-merchant/"; @RestApi(baseUrl: localBaseUrl) abstract class BusinessApiService { @@ -26,11 +34,19 @@ abstract class BusinessApiService { String token, bool showLoading = false, String url, + String tenant, + String storeId, bool showErrorToast = true, }) { Map headers = (token == null || token == "") ? {} : {'token': "Bearer $token"}; - baseUrl = serviceBaseUrl; + if (tenant != null && tenant != "") { + headers["tenant"] = tenant; + } + if (storeId != null && storeId != "") { + headers["store-id"] = storeId; + } + if (kReleaseMode) baseUrl = serviceBaseUrl; if (url != null) baseUrl = url; dio.options = BaseOptions( connectTimeout: 60000, @@ -40,8 +56,7 @@ abstract class BusinessApiService { baseUrl: baseUrl, ); dio.interceptors.add( - InterceptorsWrapper(onRequest: - (RequestOptions options) { + InterceptorsWrapper(onRequest: (RequestOptions options) { debugPrint("\n======================= 请求数据 ======================="); debugPrint("method = ${options.method.toString()}"); debugPrint("url = ${options.uri.toString()}"); @@ -83,7 +98,9 @@ abstract class BusinessApiService { debugPrint("======================= 响应数据结束 =======================\n"); }, onError: (DioError e) { if (EasyLoading.isShow) EasyLoading.dismiss(); - SmartDialog.showToast("网络错误,请切换网络或稍后再试!", alignment: Alignment.center); + // SmartDialog.showToast("网络错误,请切换网络或稍后再试!", alignment: Alignment.center); + SmartDialog.showToast(AppUtils.dioErrorTypeToString(e.type), + alignment: Alignment.center); debugPrint("\n======================= 错误响应数据 ======================="); debugPrint("type = ${e.type}"); debugPrint("message = ${e.message}"); @@ -107,4 +124,21 @@ abstract class BusinessApiService { //剩余部分 debugPrint(msg, wrapWidth: maxStrLength); } + + /// 获取认证token/管理系统登录 + @POST("anno/token") + Future annoToken(@Body() Map param); + + /// 当日各种金额统计 + @POST("comprehensiveReport/getDayCounts") + Future> getDayCounts(@Body() Map param); + + ///商家概览/热销榜单 + @GET("dashBoard/store/{offsetDay}") + Future> popularList( + @Path("offsetDay") String offsetDay); + + ///生意总览/订单量趋势 + @GET("trend/orderTrend") + Future>> orderTrend(); } diff --git a/lib/retrofit/business_api.g.dart b/lib/retrofit/business_api.g.dart index 61d7889c..a86e9ca5 100644 --- a/lib/retrofit/business_api.g.dart +++ b/lib/retrofit/business_api.g.dart @@ -9,6 +9,7 @@ part of 'business_api.dart'; class _BusinessApiService implements BusinessApiService { _BusinessApiService(this._dio, {this.baseUrl}) { ArgumentError.checkNotNull(_dio, '_dio'); + baseUrl ??= kReleaseMode ? serviceBaseUrl : localBaseUrl; } final Dio _dio; @@ -20,4 +21,95 @@ class _BusinessApiService implements BusinessApiService { _dio.close(force: true); } + @override + Future annoToken(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'anno/token', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json == null ? null : json, + ); + return value; + } + + @override + Future> getDayCounts(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'comprehensiveReport/getDayCounts', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json == "" ? null :DayCount.fromJson(json), + ); + return value; + } + + @override + Future> popularList(offsetDay) async { + ArgumentError.checkNotNull(offsetDay, 'offsetDay'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + 'dashBoard/store/$offsetDay', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => PopularSalesList.fromJson(json), + ); + return value; + } + + @override + Future>> orderTrend() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + 'trend/orderTrend', + 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) => OrderTrend.fromJson(i as Map)) + .toList()); + return value; + } + } diff --git a/lib/retrofit/data/business_login_info.dart b/lib/retrofit/data/business_login_info.dart new file mode 100644 index 00000000..335675d5 --- /dev/null +++ b/lib/retrofit/data/business_login_info.dart @@ -0,0 +1,281 @@ +/// token : "eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX3R5cGUiOiJCVVNJTkVTUyIsIm5hbWUiOiLpg5Hlt57lsI_lkIPooZciLCJ0b2tlbl90eXBlIjoidG9rZW4iLCJ1c2VyaWQiOiIxNjQwMjMzNDAxMzI5OTA5NzYwIiwiYWNjb3VudCI6IjE1ODI3OTkxNzE0IiwiZXhwIjoxNjk3MTY2MzYyLCJuYmYiOjE2OTQ1NzQzNjJ9.PQsXy4c0iIjVuQz2zTq4TmffNnoF_WtFyAfNfodfBNU" +/// tokenType : "token" +/// type : 0 +/// refreshToken : "eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaF90b2tlbiIsInVzZXJpZCI6IjE2NDAyMzM0MDEzMjk5MDk3NjAiLCJleHAiOjE2OTk3NTgzNjIsIm5iZiI6MTY5NDU3NDM2Mn0.VC-zcJc0dR3PTs-oxHx0-Y7ptMDzGhHWcBCNswB2Kn4" +/// name : "郑州小吃街" +/// account : "15827991714" +/// avatar : "" +/// workDescribe : "" +/// userId : "1640233401329909760" +/// userType : "BUSINESS" +/// expire : "2592000" +/// expiration : "2023-10-13 11:06:02" +/// mobile : "13910001000" +/// userList : null +/// tenantCode : "1195" +/// 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}] + +class BusinessLoginInfo { + BusinessLoginInfo({ + String token, + String tokenType, + num type, + String refreshToken, + String name, + String account, + String avatar, + String workDescribe, + String userId, + String userType, + String expire, + String expiration, + String mobile, + dynamic userList, + String tenantCode, + bool isAdmin, + List storeList,}){ + _token = token; + _tokenType = tokenType; + _type = type; + _refreshToken = refreshToken; + _name = name; + _account = account; + _avatar = avatar; + _workDescribe = workDescribe; + _userId = userId; + _userType = userType; + _expire = expire; + _expiration = expiration; + _mobile = mobile; + _userList = userList; + _tenantCode = tenantCode; + _isAdmin = isAdmin; + _storeList = storeList; +} + + BusinessLoginInfo.fromJson(dynamic json) { + _token = json['token']; + _tokenType = json['tokenType']; + _type = json['type']; + _refreshToken = json['refreshToken']; + _name = json['name']; + _account = json['account']; + _avatar = json['avatar']; + _workDescribe = json['workDescribe']; + _userId = json['userId']; + _userType = json['userType']; + _expire = json['expire']; + _expiration = json['expiration']; + _mobile = json['mobile']; + _userList = json['userList']; + _tenantCode = json['tenantCode']; + _isAdmin = json['isAdmin']; + if (json['storeList'] != null) { + _storeList = []; + json['storeList'].forEach((v) { + _storeList.add(StoreList.fromJson(v)); + }); + } + } + String _token; + String _tokenType; + num _type; + String _refreshToken; + String _name; + String _account; + String _avatar; + String _workDescribe; + String _userId; + String _userType; + String _expire; + String _expiration; + String _mobile; + dynamic _userList; + String _tenantCode; + bool _isAdmin; + List _storeList; +BusinessLoginInfo copyWith({ String token, + String tokenType, + num type, + String refreshToken, + String name, + String account, + String avatar, + String workDescribe, + String userId, + String userType, + String expire, + String expiration, + String mobile, + dynamic userList, + String tenantCode, + bool isAdmin, + List storeList, +}) => BusinessLoginInfo( token: token ?? _token, + tokenType: tokenType ?? _tokenType, + type: type ?? _type, + refreshToken: refreshToken ?? _refreshToken, + name: name ?? _name, + account: account ?? _account, + avatar: avatar ?? _avatar, + workDescribe: workDescribe ?? _workDescribe, + userId: userId ?? _userId, + userType: userType ?? _userType, + expire: expire ?? _expire, + expiration: expiration ?? _expiration, + mobile: mobile ?? _mobile, + userList: userList ?? _userList, + tenantCode: tenantCode ?? _tenantCode, + isAdmin: isAdmin ?? _isAdmin, + storeList: storeList ?? _storeList, +); + String get token => _token; + String get tokenType => _tokenType; + num get type => _type; + String get refreshToken => _refreshToken; + String get name => _name; + String get account => _account; + String get avatar => _avatar; + String get workDescribe => _workDescribe; + String get userId => _userId; + String get userType => _userType; + String get expire => _expire; + String get expiration => _expiration; + String get mobile => _mobile; + dynamic get userList => _userList; + String get tenantCode => _tenantCode; + bool get isAdmin => _isAdmin; + List get storeList => _storeList; + + Map toJson() { + final map = {}; + map['token'] = _token; + map['tokenType'] = _tokenType; + map['type'] = _type; + map['refreshToken'] = _refreshToken; + map['name'] = _name; + map['account'] = _account; + map['avatar'] = _avatar; + map['workDescribe'] = _workDescribe; + map['userId'] = _userId; + map['userType'] = _userType; + map['expire'] = _expire; + map['expiration'] = _expiration; + map['mobile'] = _mobile; + map['userList'] = _userList; + map['tenantCode'] = _tenantCode; + map['isAdmin'] = _isAdmin; + if (_storeList != null) { + map['storeList'] = _storeList.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// id : "1645316356192600064" +/// name : "士林鲜果&牛奶" +/// posType : "FASTSTORE" +/// useErp : false +/// pickupType : {"dineInTakeStatus":false,"takeawayStatus":false,"expressDeliveryStatus":false} + +class StoreList { + StoreList({ + String id, + String name, + String posType, + bool useErp, + PickupType pickupType,}){ + _id = id; + _name = name; + _posType = posType; + _useErp = useErp; + _pickupType = pickupType; +} + + StoreList.fromJson(dynamic json) { + _id = json['id']; + _name = json['name']; + _posType = json['posType']; + _useErp = json['useErp']; + _pickupType = json['pickupType'] != null ? PickupType.fromJson(json['pickupType']) : null; + } + String _id; + String _name; + String _posType; + bool _useErp; + PickupType _pickupType; +StoreList copyWith({ String id, + String name, + String posType, + bool useErp, + PickupType pickupType, +}) => StoreList( id: id ?? _id, + name: name ?? _name, + posType: posType ?? _posType, + useErp: useErp ?? _useErp, + pickupType: pickupType ?? _pickupType, +); + String get id => _id; + String get name => _name; + String get posType => _posType; + bool get useErp => _useErp; + PickupType get pickupType => _pickupType; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['name'] = _name; + map['posType'] = _posType; + map['useErp'] = _useErp; + if (_pickupType != null) { + map['pickupType'] = _pickupType.toJson(); + } + return map; + } + +} + +/// dineInTakeStatus : false +/// takeawayStatus : false +/// expressDeliveryStatus : false + +class PickupType { + PickupType({ + bool dineInTakeStatus, + bool takeawayStatus, + bool expressDeliveryStatus,}){ + _dineInTakeStatus = dineInTakeStatus; + _takeawayStatus = takeawayStatus; + _expressDeliveryStatus = expressDeliveryStatus; +} + + PickupType.fromJson(dynamic json) { + _dineInTakeStatus = json['dineInTakeStatus']; + _takeawayStatus = json['takeawayStatus']; + _expressDeliveryStatus = json['expressDeliveryStatus']; + } + bool _dineInTakeStatus; + bool _takeawayStatus; + bool _expressDeliveryStatus; +PickupType copyWith({ bool dineInTakeStatus, + bool takeawayStatus, + bool expressDeliveryStatus, +}) => PickupType( dineInTakeStatus: dineInTakeStatus ?? _dineInTakeStatus, + takeawayStatus: takeawayStatus ?? _takeawayStatus, + expressDeliveryStatus: expressDeliveryStatus ?? _expressDeliveryStatus, +); + bool get dineInTakeStatus => _dineInTakeStatus; + bool get takeawayStatus => _takeawayStatus; + bool get expressDeliveryStatus => _expressDeliveryStatus; + + Map toJson() { + final map = {}; + map['dineInTakeStatus'] = _dineInTakeStatus; + map['takeawayStatus'] = _takeawayStatus; + map['expressDeliveryStatus'] = _expressDeliveryStatus; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/day_count.dart b/lib/retrofit/data/day_count.dart new file mode 100644 index 00000000..aafd50b3 --- /dev/null +++ b/lib/retrofit/data/day_count.dart @@ -0,0 +1,177 @@ +/// summaryDate : "2023-09-14" +/// dayMoney : "0" +/// discountSum : "0.00" +/// paySum : "0" +/// rechargeMoney : "0" +/// refundMoney : "0" +/// orderNum : 0 +/// rechargeOrderNum : 0 +/// refundOrderNum : 0 +/// payOrderNum : 0 +/// discountOrderNum : 0 +/// startDate : null +/// endDate : null +/// tablePerConsumption : null +/// numberOfPeople : 0 +/// peoplePerConsumption : "0" +/// realDiscountPer : null +/// tableRate : null + +class DayCount { + DayCount({ + String summaryDate, + String dayMoney, + String discountSum, + String paySum, + String rechargeMoney, + String refundMoney, + num orderNum, + num rechargeOrderNum, + num refundOrderNum, + num payOrderNum, + num discountOrderNum, + dynamic startDate, + dynamic endDate, + dynamic tablePerConsumption, + num numberOfPeople, + String peoplePerConsumption, + dynamic realDiscountPer, + dynamic tableRate,}){ + _summaryDate = summaryDate; + _dayMoney = dayMoney; + _discountSum = discountSum; + _paySum = paySum; + _rechargeMoney = rechargeMoney; + _refundMoney = refundMoney; + _orderNum = orderNum; + _rechargeOrderNum = rechargeOrderNum; + _refundOrderNum = refundOrderNum; + _payOrderNum = payOrderNum; + _discountOrderNum = discountOrderNum; + _startDate = startDate; + _endDate = endDate; + _tablePerConsumption = tablePerConsumption; + _numberOfPeople = numberOfPeople; + _peoplePerConsumption = peoplePerConsumption; + _realDiscountPer = realDiscountPer; + _tableRate = tableRate; +} + + DayCount.fromJson(dynamic json) { + _summaryDate = json['summaryDate']; + _dayMoney = json['dayMoney']; + _discountSum = json['discountSum']; + _paySum = json['paySum']; + _rechargeMoney = json['rechargeMoney']; + _refundMoney = json['refundMoney']; + _orderNum = json['orderNum']; + _rechargeOrderNum = json['rechargeOrderNum']; + _refundOrderNum = json['refundOrderNum']; + _payOrderNum = json['payOrderNum']; + _discountOrderNum = json['discountOrderNum']; + _startDate = json['startDate']; + _endDate = json['endDate']; + _tablePerConsumption = json['tablePerConsumption']; + _numberOfPeople = json['numberOfPeople']; + _peoplePerConsumption = json['peoplePerConsumption']; + _realDiscountPer = json['realDiscountPer']; + _tableRate = json['tableRate']; + } + String _summaryDate; + String _dayMoney; + String _discountSum; + String _paySum; + String _rechargeMoney; + String _refundMoney; + num _orderNum; + num _rechargeOrderNum; + num _refundOrderNum; + num _payOrderNum; + num _discountOrderNum; + dynamic _startDate; + dynamic _endDate; + dynamic _tablePerConsumption; + num _numberOfPeople; + String _peoplePerConsumption; + dynamic _realDiscountPer; + dynamic _tableRate; +DayCount copyWith({ String summaryDate, + String dayMoney, + String discountSum, + String paySum, + String rechargeMoney, + String refundMoney, + num orderNum, + num rechargeOrderNum, + num refundOrderNum, + num payOrderNum, + num discountOrderNum, + dynamic startDate, + dynamic endDate, + dynamic tablePerConsumption, + num numberOfPeople, + String peoplePerConsumption, + dynamic realDiscountPer, + dynamic tableRate, +}) => DayCount( summaryDate: summaryDate ?? _summaryDate, + dayMoney: dayMoney ?? _dayMoney, + discountSum: discountSum ?? _discountSum, + paySum: paySum ?? _paySum, + rechargeMoney: rechargeMoney ?? _rechargeMoney, + refundMoney: refundMoney ?? _refundMoney, + orderNum: orderNum ?? _orderNum, + rechargeOrderNum: rechargeOrderNum ?? _rechargeOrderNum, + refundOrderNum: refundOrderNum ?? _refundOrderNum, + payOrderNum: payOrderNum ?? _payOrderNum, + discountOrderNum: discountOrderNum ?? _discountOrderNum, + startDate: startDate ?? _startDate, + endDate: endDate ?? _endDate, + tablePerConsumption: tablePerConsumption ?? _tablePerConsumption, + numberOfPeople: numberOfPeople ?? _numberOfPeople, + peoplePerConsumption: peoplePerConsumption ?? _peoplePerConsumption, + realDiscountPer: realDiscountPer ?? _realDiscountPer, + tableRate: tableRate ?? _tableRate, +); + String get summaryDate => _summaryDate; + String get dayMoney => _dayMoney; + String get discountSum => _discountSum; + String get paySum => _paySum; + String get rechargeMoney => _rechargeMoney; + String get refundMoney => _refundMoney; + num get orderNum => _orderNum; + num get rechargeOrderNum => _rechargeOrderNum; + num get refundOrderNum => _refundOrderNum; + num get payOrderNum => _payOrderNum; + num get discountOrderNum => _discountOrderNum; + dynamic get startDate => _startDate; + dynamic get endDate => _endDate; + dynamic get tablePerConsumption => _tablePerConsumption; + num get numberOfPeople => _numberOfPeople; + String get peoplePerConsumption => _peoplePerConsumption; + dynamic get realDiscountPer => _realDiscountPer; + dynamic get tableRate => _tableRate; + + Map toJson() { + final map = {}; + map['summaryDate'] = _summaryDate; + map['dayMoney'] = _dayMoney; + map['discountSum'] = _discountSum; + map['paySum'] = _paySum; + map['rechargeMoney'] = _rechargeMoney; + map['refundMoney'] = _refundMoney; + map['orderNum'] = _orderNum; + map['rechargeOrderNum'] = _rechargeOrderNum; + map['refundOrderNum'] = _refundOrderNum; + map['payOrderNum'] = _payOrderNum; + map['discountOrderNum'] = _discountOrderNum; + map['startDate'] = _startDate; + map['endDate'] = _endDate; + map['tablePerConsumption'] = _tablePerConsumption; + map['numberOfPeople'] = _numberOfPeople; + map['peoplePerConsumption'] = _peoplePerConsumption; + map['realDiscountPer'] = _realDiscountPer; + map['tableRate'] = _tableRate; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/order_trend.dart b/lib/retrofit/data/order_trend.dart new file mode 100644 index 00000000..0cce029b --- /dev/null +++ b/lib/retrofit/data/order_trend.dart @@ -0,0 +1,33 @@ +/// date : "2023-09-08" +/// number : 0 + +class OrderTrend { + OrderTrend({ + String date, + num number,}){ + _date = date; + _number = number; +} + + OrderTrend.fromJson(dynamic json) { + _date = json['date']; + _number = json['number']; + } + String _date; + num _number; +OrderTrend copyWith({ String date, + num number, +}) => OrderTrend( date: date ?? _date, + number: number ?? _number, +); + String get date => _date; + num get number => _number; + + Map toJson() { + final map = {}; + map['date'] = _date; + map['number'] = _number; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/popular_sales_list.dart b/lib/retrofit/data/popular_sales_list.dart new file mode 100644 index 00000000..37bebde4 --- /dev/null +++ b/lib/retrofit/data/popular_sales_list.dart @@ -0,0 +1,311 @@ +/// dashMemberList : [{"id":"1645357356843794432","name":"哈哈哈","phone":"15623342902","balance":"817.21"},{"id":"1688728183219683328","name":"","phone":"17612711844","balance":"470.00"},{"id":"1693535584301088768","name":"西瓜太郎","phone":"18716285488","balance":"104.00"},{"id":"1645691116772655104","name":"丙阳测试环境","phone":"15827991714","balance":"0.88"},{"id":"1645348000345620480","name":"璇","phone":"15871490290","balance":"0.02"},{"id":"1685233051375763456","name":"","phone":"18672789329","balance":"0.00"},{"id":"1696812803165257728","name":"","phone":"15723456545","balance":"0.00"},{"id":"1652214301991108608","name":"","phone":"18573164593","balance":"0.00"},{"id":"1646037740963233792","name":"","phone":"13517240850","balance":"0.00"},{"id":"1650818734501134336","name":"","phone":"15172398708","balance":"0.00"},{"id":"1652493162733633536","name":"","phone":"15013675571","balance":"0.00"},{"id":"1646067749123784704","name":"","phone":"13720233327","balance":"0.00"}] +/// saleProductList : [{"product_id":"1646055704735252480","saleNum":12,"product_name":"香蕉牛乳"},{"product_id":"1645714721178910720","saleNum":8,"product_name":"红薯牛乳"},{"product_id":"1645991124428390400","saleNum":3,"product_name":"南瓜牛乳"},{"product_id":"1645722834221137920","saleNum":3,"product_name":"原味豆腐"},{"product_id":"1645992331242897408","saleNum":3,"product_name":"炸鲜香菇"},{"product_id":"1646449156648075264","saleNum":2,"product_name":"桑葚牛乳"},{"product_id":"1645724097411284992","saleNum":2,"product_name":"泡菜"},{"product_id":"1646449942484484096","saleNum":1,"product_name":"芒果牛乳"},{"product_id":"1645667029320990720","saleNum":1,"product_name":"木瓜牛奶"},{"product_id":"1645732366896857088","saleNum":1,"product_name":"酱烤玉米"}] +/// avgPrice : "11.43" +/// orderNum : 21 +/// storeDailyStatistics : [] +/// orderSum : "259.04" +/// changeData : {"addCartChangeRate":0.0,"payCountChangeRate":0.0,"sumAddCartCount":"0","sumSettleCount":"0","sumPaySuccessCount":"0","sumPV":"0","totalChangeRate":0.0,"sumPayCount":"0","settleChangeRate":0.0,"paySuccessChangeRate":0.0} +/// paySum : "240.00" + +class PopularSalesList { + PopularSalesList({ + List dashMemberList, + List saleProductList, + String avgPrice, + num orderNum, + // List storeDailyStatistics, + String orderSum, + ChangeData changeData, + String paySum,}){ + _dashMemberList = dashMemberList; + _saleProductList = saleProductList; + _avgPrice = avgPrice; + _orderNum = orderNum; + // _storeDailyStatistics = storeDailyStatistics; + _orderSum = orderSum; + _changeData = changeData; + _paySum = paySum; +} + + PopularSalesList.fromJson(dynamic json) { + if (json['dashMemberList'] != null) { + _dashMemberList = []; + json['dashMemberList'].forEach((v) { + _dashMemberList.add(DashMemberList.fromJson(v)); + }); + } + if (json['saleProductList'] != null) { + _saleProductList = []; + json['saleProductList'].forEach((v) { + _saleProductList.add(SaleProductList.fromJson(v)); + }); + } + _avgPrice = json['avgPrice']; + _orderNum = json['orderNum']; + // if (json['storeDailyStatistics'] != null) { + // _storeDailyStatistics = []; + // json['storeDailyStatistics'].forEach((v) { + // _storeDailyStatistics.add(Dynamic.fromJson(v)); + // }); + // } + _orderSum = json['orderSum']; + _changeData = json['changeData'] != null ? ChangeData.fromJson(json['changeData']) : null; + _paySum = json['paySum']; + } + List _dashMemberList; + List _saleProductList; + String _avgPrice; + num _orderNum; + // List _storeDailyStatistics; + String _orderSum; + ChangeData _changeData; + String _paySum; +PopularSalesList copyWith({ List dashMemberList, + List saleProductList, + String avgPrice, + num orderNum, + // List storeDailyStatistics, + String orderSum, + ChangeData changeData, + String paySum, +}) => PopularSalesList( dashMemberList: dashMemberList ?? _dashMemberList, + saleProductList: saleProductList ?? _saleProductList, + avgPrice: avgPrice ?? _avgPrice, + orderNum: orderNum ?? _orderNum, + // storeDailyStatistics: storeDailyStatistics ?? _storeDailyStatistics, + orderSum: orderSum ?? _orderSum, + changeData: changeData ?? _changeData, + paySum: paySum ?? _paySum, +); + List get dashMemberList => _dashMemberList; + List get saleProductList => _saleProductList; + String get avgPrice => _avgPrice; + num get orderNum => _orderNum; + // List get storeDailyStatistics => _storeDailyStatistics; + String get orderSum => _orderSum; + ChangeData get changeData => _changeData; + String get paySum => _paySum; + + Map toJson() { + final map = {}; + if (_dashMemberList != null) { + map['dashMemberList'] = _dashMemberList.map((v) => v.toJson()).toList(); + } + if (_saleProductList != null) { + map['saleProductList'] = _saleProductList.map((v) => v.toJson()).toList(); + } + map['avgPrice'] = _avgPrice; + map['orderNum'] = _orderNum; + // if (_storeDailyStatistics != null) { + // map['storeDailyStatistics'] = _storeDailyStatistics.map((v) => v.toJson()).toList(); + // } + map['orderSum'] = _orderSum; + if (_changeData != null) { + map['changeData'] = _changeData.toJson(); + } + map['paySum'] = _paySum; + return map; + } + +} + +/// addCartChangeRate : 0.0 +/// payCountChangeRate : 0.0 +/// sumAddCartCount : "0" +/// sumSettleCount : "0" +/// sumPaySuccessCount : "0" +/// sumPV : "0" +/// totalChangeRate : 0.0 +/// sumPayCount : "0" +/// settleChangeRate : 0.0 +/// paySuccessChangeRate : 0.0 + +class ChangeData { + ChangeData({ + num addCartChangeRate, + num payCountChangeRate, + String sumAddCartCount, + String sumSettleCount, + String sumPaySuccessCount, + String sumPV, + num totalChangeRate, + String sumPayCount, + num settleChangeRate, + num paySuccessChangeRate,}){ + _addCartChangeRate = addCartChangeRate; + _payCountChangeRate = payCountChangeRate; + _sumAddCartCount = sumAddCartCount; + _sumSettleCount = sumSettleCount; + _sumPaySuccessCount = sumPaySuccessCount; + _sumPV = sumPV; + _totalChangeRate = totalChangeRate; + _sumPayCount = sumPayCount; + _settleChangeRate = settleChangeRate; + _paySuccessChangeRate = paySuccessChangeRate; +} + + ChangeData.fromJson(dynamic json) { + _addCartChangeRate = json['addCartChangeRate']; + _payCountChangeRate = json['payCountChangeRate']; + _sumAddCartCount = json['sumAddCartCount']; + _sumSettleCount = json['sumSettleCount']; + _sumPaySuccessCount = json['sumPaySuccessCount']; + _sumPV = json['sumPV']; + _totalChangeRate = json['totalChangeRate']; + _sumPayCount = json['sumPayCount']; + _settleChangeRate = json['settleChangeRate']; + _paySuccessChangeRate = json['paySuccessChangeRate']; + } + num _addCartChangeRate; + num _payCountChangeRate; + String _sumAddCartCount; + String _sumSettleCount; + String _sumPaySuccessCount; + String _sumPV; + num _totalChangeRate; + String _sumPayCount; + num _settleChangeRate; + num _paySuccessChangeRate; +ChangeData copyWith({ num addCartChangeRate, + num payCountChangeRate, + String sumAddCartCount, + String sumSettleCount, + String sumPaySuccessCount, + String sumPV, + num totalChangeRate, + String sumPayCount, + num settleChangeRate, + num paySuccessChangeRate, +}) => ChangeData( addCartChangeRate: addCartChangeRate ?? _addCartChangeRate, + payCountChangeRate: payCountChangeRate ?? _payCountChangeRate, + sumAddCartCount: sumAddCartCount ?? _sumAddCartCount, + sumSettleCount: sumSettleCount ?? _sumSettleCount, + sumPaySuccessCount: sumPaySuccessCount ?? _sumPaySuccessCount, + sumPV: sumPV ?? _sumPV, + totalChangeRate: totalChangeRate ?? _totalChangeRate, + sumPayCount: sumPayCount ?? _sumPayCount, + settleChangeRate: settleChangeRate ?? _settleChangeRate, + paySuccessChangeRate: paySuccessChangeRate ?? _paySuccessChangeRate, +); + num get addCartChangeRate => _addCartChangeRate; + num get payCountChangeRate => _payCountChangeRate; + String get sumAddCartCount => _sumAddCartCount; + String get sumSettleCount => _sumSettleCount; + String get sumPaySuccessCount => _sumPaySuccessCount; + String get sumPV => _sumPV; + num get totalChangeRate => _totalChangeRate; + String get sumPayCount => _sumPayCount; + num get settleChangeRate => _settleChangeRate; + num get paySuccessChangeRate => _paySuccessChangeRate; + + Map toJson() { + final map = {}; + map['addCartChangeRate'] = _addCartChangeRate; + map['payCountChangeRate'] = _payCountChangeRate; + map['sumAddCartCount'] = _sumAddCartCount; + map['sumSettleCount'] = _sumSettleCount; + map['sumPaySuccessCount'] = _sumPaySuccessCount; + map['sumPV'] = _sumPV; + map['totalChangeRate'] = _totalChangeRate; + map['sumPayCount'] = _sumPayCount; + map['settleChangeRate'] = _settleChangeRate; + map['paySuccessChangeRate'] = _paySuccessChangeRate; + return map; + } + +} + +/// product_id : "1646055704735252480" +/// saleNum : 12 +/// product_name : "香蕉牛乳" + +class SaleProductList { + SaleProductList({ + String productId, + num saleNum, + String productName,}){ + _productId = productId; + _saleNum = saleNum; + _productName = productName; +} + + SaleProductList.fromJson(dynamic json) { + _productId = json['product_id']; + _saleNum = json['saleNum']; + _productName = json['product_name']; + } + String _productId; + num _saleNum; + String _productName; +SaleProductList copyWith({ String productId, + num saleNum, + String productName, +}) => SaleProductList( productId: productId ?? _productId, + saleNum: saleNum ?? _saleNum, + productName: productName ?? _productName, +); + String get productId => _productId; + num get saleNum => _saleNum; + String get productName => _productName; + + Map toJson() { + final map = {}; + map['product_id'] = _productId; + map['saleNum'] = _saleNum; + map['product_name'] = _productName; + return map; + } + +} + +/// id : "1645357356843794432" +/// name : "哈哈哈" +/// phone : "15623342902" +/// balance : "817.21" + +class DashMemberList { + DashMemberList({ + String id, + String name, + String phone, + String balance,}){ + _id = id; + _name = name; + _phone = phone; + _balance = balance; +} + + DashMemberList.fromJson(dynamic json) { + _id = json['id']; + _name = json['name']; + _phone = json['phone']; + _balance = json['balance']; + } + String _id; + String _name; + String _phone; + String _balance; +DashMemberList copyWith({ String id, + String name, + String phone, + String balance, +}) => DashMemberList( id: id ?? _id, + name: name ?? _name, + phone: phone ?? _phone, + balance: balance ?? _balance, +); + String get id => _id; + String get name => _name; + String get phone => _phone; + String get balance => _balance; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['name'] = _name; + map['phone'] = _phone; + map['balance'] = _balance; + return map; + } + +} \ No newline at end of file diff --git a/lib/utils/business_instance.dart b/lib/utils/business_instance.dart new file mode 100644 index 00000000..114e0354 --- /dev/null +++ b/lib/utils/business_instance.dart @@ -0,0 +1,34 @@ +class BusinessInstance { + factory BusinessInstance() => _getInstance(); + + static BusinessInstance get instance => _getInstance(); + + static BusinessInstance _instance; + + String _businessToken; + + String _businessTenant; + + String get businessToken => _businessToken; + + set businessToken(String value) { + _businessToken = value; + } + + BusinessInstance._internal() { + //单例初始化 + } + + static BusinessInstance _getInstance() { + if (_instance == null) { + _instance = BusinessInstance._internal(); + } + return _instance; + } + + String get businessTenant => _businessTenant; + + set businessTenant(String value) { + _businessTenant = value; + } +} diff --git a/pubspec.lock b/pubspec.lock index 21ba12e6..9f3eb3cb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -433,7 +433,7 @@ packages: name: image_pickers url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.4+1" + version: "2.0.0" intl: dependency: "direct main" description: @@ -879,7 +879,7 @@ packages: name: tobias url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.2" + version: "2.4.1" tpns_flutter_plugin: dependency: "direct main" description: From cfe17babae00f247180c2ea31677f5a4947ecba6 Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Fri, 15 Sep 2023 11:10:47 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E5=90=88=E5=B9=B6map=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mine/mine_view/mine_item.dart | 37 ++++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index 67b6e9de..89c369b2 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -1,5 +1,8 @@ +import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart'; @@ -34,9 +37,9 @@ class _MineItem extends State { maskType: EasyLoadingMaskType.black); BusinessApiService businessService = - BusinessApiService(Dio(), context: context); + BusinessApiService(Dio(), context: context); BaseData baseData = - await businessService.annoToken(param).catchError((error) { + await businessService.annoToken(param).catchError((error) { print(error.message); }); if (baseData != null && baseData.isSuccess) { @@ -218,20 +221,22 @@ class _MineItem extends State { ), ///店铺余额 - Expanded(child: InkWell( - onTap: () { - SharedPreferences.getInstance().then((value) { - if (value.getString("token") == null || - value.getString("token") == "") { - LoginTipsDialog().show(context); - return; - } - Navigator.of(context).pushNamed('/router/mine_shop_page'); - }); - }, - child: mineItem( - S.of(context).dianpuchongzhi, - "assets/image/shop_yue.webp", + Expanded( + child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context).pushNamed('/router/mine_shop_page'); + }); + }, + child: mineItem( + S.of(context).dianpuchongzhi, + "assets/image/shop_yue.webp", + ), ), ), From 0542533a3917dd1752956735c1abc0bccd164ad5 Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Fri, 15 Sep 2023 23:30:17 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9B=20=E5=BC=B9=E7=AA=97ui=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=EF=BC=9B=20=E4=BC=9A=E5=91=98=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5=EF=BC=8C=E7=94=9F=E6=84=8F=E6=80=BB=E8=A7=88?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5=EF=BC=8C=E7=83=AD=E9=94=80?= =?UTF-8?q?=E6=A6=9C=E5=8D=95=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/image/2x/icon_new_vip.webp | Bin 0 -> 1114 bytes assets/image/2x/icon_vip_total.webp | Bin 0 -> 1126 bytes assets/image/2x/ion_vip_recharge.webp | Bin 0 -> 1140 bytes assets/image/3x/icon_new_vip.webp | Bin 0 -> 3184 bytes assets/image/3x/icon_vip_total.webp | Bin 0 -> 3124 bytes assets/image/3x/ion_vip_recharge.webp | Bin 0 -> 3000 bytes assets/image/icon_new_vip.webp | Bin 0 -> 758 bytes assets/image/icon_vip_total.webp | Bin 0 -> 760 bytes assets/image/ion_vip_recharge.webp | Bin 0 -> 780 bytes .../home/business_home_page.dart | 25 +++- lib/mine/mine_view/mine_item.dart | 4 +- lib/retrofit/business_api.dart | 16 +- lib/retrofit/business_api.g.dart | 24 ++- lib/retrofit/data/vip_counts_info.dart | 141 ++++++++++++++++++ 14 files changed, 194 insertions(+), 16 deletions(-) create mode 100644 assets/image/2x/icon_new_vip.webp create mode 100644 assets/image/2x/icon_vip_total.webp create mode 100644 assets/image/2x/ion_vip_recharge.webp create mode 100644 assets/image/3x/icon_new_vip.webp create mode 100644 assets/image/3x/icon_vip_total.webp create mode 100644 assets/image/3x/ion_vip_recharge.webp create mode 100644 assets/image/icon_new_vip.webp create mode 100644 assets/image/icon_vip_total.webp create mode 100644 assets/image/ion_vip_recharge.webp create mode 100644 lib/retrofit/data/vip_counts_info.dart diff --git a/assets/image/2x/icon_new_vip.webp b/assets/image/2x/icon_new_vip.webp new file mode 100644 index 0000000000000000000000000000000000000000..e864fc116d2ed7d90c2438ee3920b1e6fc9305b9 GIT binary patch literal 1114 zcmWIYbaM-0VPFV%bqWXzu!!JdU|=u+Vs$X`baoCn!3g9sFrEOBEI_H;ypp0IcPE92 z$S4K&2Mmlr2nLDC#RU)+RuZV{+ck*V%eq)q;1}dfNi9wWD)|7!Dn&rcfo>83vPIG% zYz+`Q3BtAkvCB&eN`PttK=2?(*InG6iuTNxN6ZXv`}7BDdI zw=ghlJC6`Ugh@eSQ6ktlU~DijrKK@2d|J-Hz#GZHAbf#=fh!s;2PAN~O#vt+19VqD z5T-NaFr+dlFnBWLF(fnS0a-@CNHt_I1IDmVG7|%XzWM=9f%%7aD6ganyYfti{ zxf%x-S^>S{$NG}%27_veKxxAQ2E$3Ym#^)~zr8K@_P_Gy@@Hz(AK&3o`gQ(5?rjUV z^K&C}((8dft1_3b@7g~5rWlaTP!P`Bt^@@CySHlXEz?yhD~w&bwqr-G=6>_P>_0Nk z9oyn@L2YxP$RiDDeZ_g3KgKFqP3-+I;A*y0DKY!(ktnt@l5p9 z&+px^v*X>G1uq{j$Pc-Yx%~78U-b*u?2WEmop9AIC%*C7Qgz+-#s7ND^7Ur7z0`ld z_?)#9&yCVt>l06pJG2Cfp4H81z4ND(?NU|1y|;;a&9AqoeLrRWxV!CBU(dFzn{#c< z|9qQ%$&=qAuIgIh73Kgl->C_ImKEd#J`TOTC-`U~J8%B2WxUfL8F{-`T@qNZuU>A4 zz(nJSPr?NU0;(>_8O&sQ(a;tzSlRU3;b>~avx`^iT;y_={%GNspY5|kyoYi1E}7Vs z?M{MIyB)taou2Y%{(rGkHY+XOJv@Hg`z}M@yWPJVN?%|4?(pI4ogb_Q8*_#B%Ny85 z$F2CAruAw@pVG_y^@-2lt^M%oN;6l&MmzPQQY+iot!2EvXLQ!C+jenv_9Z`Q9-GXU z$FCXRkB~U1o+iAL_okfeKjW2`?wEub6d&(=zG&qa83vPIG% zYz+`Q3BtAkvCB&eN`PttK=2?(*InG6iuTNxN6ZXv`}7BDdI zw=ghlJC6`Ugh@eSQ6ktlU~DijrKK@2d|J-Hz#GZHAbf#=fh!s;2PAN~O#vt+19VqD z5T-NaFr+dlFnBWLF(fnS0a-@CNHt_I1IDmV0TTm*zWM=9f#Zj^O;pjm+HP=i<{ZIm z+cOO^q)$$K|Bk!q`R6~HTP<>KpP2Y!=au^H^0q9KwpBc5vwF{}XA>jOepmjeRs5fW z!L?r&7p$1CURKqukn`yRmq2~Jm`v`Ma33u-E-8UW#}}#9J3L!_`p$v<#;PmMxF0u} z6LR{6n~MDICki}=`dypb+&H>AU6VM2m3S60GB7mddbceJziPWJ_x85jqyNf-CQp|R-k_yp2Y1_R#H;>WIcIm76z2H%SCsj5#nXa`t>T=P2`2yLEjmvi?pg3BA0O zD|PywibIBCk6-o8bNTu7p zJxe1~J!%seBCfpk__{H@qg7__>gd`BIx7EvZ=a^*uhpmh!|(HldX#gY(wKNAe{_=j(i0{dd~Zqu(UH+_&6Y`SZ{8SHb354U&6nuf6Ok5zV=L z$JoSh_l^kn+3!51OD~kJUMe4bUZl)q<@SJ^0e9}ay|{0_M(8fHsX}Ra7Ct*OZ2tJ1 Sx>5J;)7S5x6Y~{z@d5xign>o? literal 0 HcmV?d00001 diff --git a/assets/image/2x/ion_vip_recharge.webp b/assets/image/2x/ion_vip_recharge.webp new file mode 100644 index 0000000000000000000000000000000000000000..64131bdc3de32c29315ca2fe7eb9a1a935ee5c44 GIT binary patch literal 1140 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 C%~h2E literal 0 HcmV?d00001 diff --git a/assets/image/3x/icon_vip_total.webp b/assets/image/3x/icon_vip_total.webp new file mode 100644 index 0000000000000000000000000000000000000000..c79134cfd56b8686003f52be8dddca7d3dfcb789 GIT binary patch literal 3124 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 literal 0 HcmV?d00001 diff --git a/assets/image/3x/ion_vip_recharge.webp b/assets/image/3x/ion_vip_recharge.webp new file mode 100644 index 0000000000000000000000000000000000000000..3d9f6b2ccd767250b307b5761e1c63243b233579 GIT binary patch literal 3000 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 literal 0 HcmV?d00001 diff --git a/assets/image/icon_vip_total.webp b/assets/image/icon_vip_total.webp new file mode 100644 index 0000000000000000000000000000000000000000..e513436255342785b7afd89028361d03b833e8fb GIT binary patch literal 760 zcmWIYbaVT_#J~{l>J$(bU=hK^z`$St#KK_Y>FgYEf)U7NU_1dLS%6Zxc_l?b?oJ93 zkx>fl4;UDM5DXHNiwhtutRzs?w`&l!mvynKz%R&|l3JV$RPq6cRf>R?1KlJ7WQ(Lj z*cu>q5`=97VwaZ`lmOKPfY?PLLC!#S3XrXlj>JwvVkZ|AfzZ zZ((5Ab{-*y2$O=uqC~K9EI^VeEscTU({cs|-bi3XTwq|}iU!L82^?-y07}UK-IWi7 z=?pmxsSFAXo(y>m$qafxmJu*g4H?XUG3>*{$iSd4e1JtD{@{vSWyf=RAD`B|56;xc zxP9VeZ#~=j=Rbp^9B*&SUGcBJVEK&1+a6uT>~{N}^K<0)FSV}e|GeXKx&2H#AKss9 zwaeb?->P6_7um3{Af20a=ZV{oQ*&H+IXH3zZ%H`5N?>4UIP5VgG_|n&`uk%~~Gk?S7q@^Na+1I-lUcOm1OZJ^-=czE^#Xl`IB7{F&y}3F|ixU7pZ^)?t literal 0 HcmV?d00001 diff --git a/assets/image/ion_vip_recharge.webp b/assets/image/ion_vip_recharge.webp new file mode 100644 index 0000000000000000000000000000000000000000..4f848639d7c8e21ea8918d6041502463714ac781 GIT binary patch literal 780 zcmWIYbaP{2W?%?+bqWXzu!!JdU|=u+Vqq}ybaoCn!3g9sFrEOBEI_H;ypp0IcPE92 z$S4K&2Mmlr2nLDC#RU)+RuZV{+ck*V%eq)q;1}dfNi9wWD)|7!Dn&rcfo>83vPIG% zYz+`Q3BtAkvCB&eN`PttK=2?(*InG6iuTNxN6ZXv`}7BDdI zw=ghlJC6`Ugh@eSQ6ktl79h!#md3#FX*mM}ZzM1xE-)}~MT6yl1P-?;0HtJr?#c(k zbcP&;R0ahGPlh~(WClGT%Lo{$h74xF81@lmWMI%2KENVSzHmXWO6t6mUuM@B_NZOh zmMgvLzx*A|vSJicG~d}6Jd%WTCqlhy)Z>4~;o7Vq~&%oGchh*r3f*3nqbbmQm-MxO_V z6H{(`6?by$6(0Wk?S9;$>iJUyF4ni^-Zo>pWII)#fx+-3C`y&)sd%1qIC)!w@2C6J zKd$RG_88Ba+u7T7Y0p~0z(`~FUKRfn%hq PopularSalesList popularSalesList; List orderTrend = []; List lineChartSample2Data = [ - LineChartSample2Data(0, 100, "2023-03-09"), - LineChartSample2Data(1, 200, "2023-03-10"), - LineChartSample2Data(2, 400, "2023-03-11"), - LineChartSample2Data(3, 10, "2023-03-12"), - LineChartSample2Data(4, 250, "2023-03-13"), - LineChartSample2Data(5, 175, "2023-03-14"), - LineChartSample2Data(6, 500, "2023-03-15") + LineChartSample2Data(0, 0, "2023-03-09"), + LineChartSample2Data(1, 0, "2023-03-10"), + LineChartSample2Data(2, 0, "2023-03-11"), + LineChartSample2Data(3, 0, "2023-03-12"), + LineChartSample2Data(4, 0, "2023-03-13"), + LineChartSample2Data(5, 0, "2023-03-14"), + LineChartSample2Data(6, 0, "2023-03-15") ]; @override @@ -80,7 +80,7 @@ class _BusinessHomePage extends State : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id); queryDayAmount(); queryPopularList(); - queryPopularList(); + queryOrderTrend(); }); } @@ -127,7 +127,15 @@ class _BusinessHomePage extends State BaseData> baseData = await businessService.orderTrend().catchError((error) {}); if (baseData != null && baseData.isSuccess) { + double index = 0; + if(baseData.data.isNotEmpty){ + orderTrend.clear(); + } orderTrend = baseData.data; + orderTrend.forEach((element) { + lineChartSample2Data.add(LineChartSample2Data(index,element.number,element.date)); + index += 1; + }); } } finally { addLoadCount(); @@ -495,6 +503,7 @@ class _BusinessHomePage extends State SizedBox( height: 18.h, ), + if(lineChartSample2Data.isNotEmpty) LineChartSample2(lineChartSample2Data, "销售量"), ], ), diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index 89c369b2..4fd4e75a 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -49,12 +49,12 @@ class _MineItem extends State { BusinessInstance.instance.businessToken = businessLoginInfo.token; if (businessLoginInfo.storeList.length > 1) { Navigator.of(context) - .pushReplacementNamed('/router/select_shop', arguments: { + .pushNamed('/router/select_shop', arguments: { "businessLoginInfo": businessLoginInfo, }); } else { Navigator.of(context) - .pushReplacementNamed('/router/business_page', arguments: { + .pushNamed('/router/business_page', arguments: { "businessLoginInfo": businessLoginInfo, }); } diff --git a/lib/retrofit/business_api.dart b/lib/retrofit/business_api.dart index 1001c0e4..ba598b42 100644 --- a/lib/retrofit/business_api.dart +++ b/lib/retrofit/business_api.dart @@ -9,6 +9,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/retrofit/data/business_login_info.dart'; import 'package:huixiang/retrofit/data/day_count.dart'; import 'package:huixiang/retrofit/data/order_trend.dart'; +import 'package:huixiang/retrofit/data/vip_counts_info.dart'; import 'package:retrofit/retrofit.dart'; import '../utils/flutter_utils.dart'; @@ -18,9 +19,9 @@ import 'data/popular_sales_list.dart'; part 'business_api.g.dart'; ///本地 -// const localBaseUrl = "http://admin-api.test.yixinhuixiang.com/"; +const localBaseUrl = "http://admin-api.test.yixinhuixiang.com/"; ///测试 -const localBaseUrl = "http://test-merchant.lotus-wallet.com/test-merchant/"; +// const localBaseUrl = "http://test-merchant.lotus-wallet.com/test-merchant/"; ///线上 const serviceBaseUrl = "http://pos.tenant.lotus-wallet.com/test-merchant/"; @@ -99,8 +100,8 @@ abstract class BusinessApiService { }, onError: (DioError e) { if (EasyLoading.isShow) EasyLoading.dismiss(); // SmartDialog.showToast("网络错误,请切换网络或稍后再试!", alignment: Alignment.center); - SmartDialog.showToast(AppUtils.dioErrorTypeToString(e.type), - alignment: Alignment.center); + // SmartDialog.showToast(AppUtils.dioErrorTypeToString(e.type), + // alignment: Alignment.center); debugPrint("\n======================= 错误响应数据 ======================="); debugPrint("type = ${e.type}"); debugPrint("message = ${e.message}"); @@ -134,11 +135,16 @@ abstract class BusinessApiService { Future> getDayCounts(@Body() Map param); ///商家概览/热销榜单 - @GET("dashBoard/store/{offsetDay}") + @GET("dashBoard/store/?offsetDay={offsetDay}") Future> popularList( @Path("offsetDay") String offsetDay); ///生意总览/订单量趋势 @GET("trend/orderTrend") Future>> orderTrend(); + + ///会员数量统计/用户概览 + @GET("largeScreenReport/getDayCounts?date={date}") + Future> vipCounts( + @Path("date") String date); } diff --git a/lib/retrofit/business_api.g.dart b/lib/retrofit/business_api.g.dart index a86e9ca5..59638941 100644 --- a/lib/retrofit/business_api.g.dart +++ b/lib/retrofit/business_api.g.dart @@ -74,7 +74,7 @@ class _BusinessApiService implements BusinessApiService { final queryParameters = {}; final _data = {}; final _result = await _dio.request>( - 'dashBoard/store/$offsetDay', + 'dashBoard/store/?offsetDay=$offsetDay', queryParameters: queryParameters, options: RequestOptions( method: 'GET', @@ -112,4 +112,26 @@ class _BusinessApiService implements BusinessApiService { return value; } + @override + Future> vipCounts(date) async { + ArgumentError.checkNotNull(date, 'date'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + 'largeScreenReport/getDayCounts?date=$date', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => VipCountsInfo.fromJson(json), + ); + return value; + } + } diff --git a/lib/retrofit/data/vip_counts_info.dart b/lib/retrofit/data/vip_counts_info.dart new file mode 100644 index 00000000..48dc0af0 --- /dev/null +++ b/lib/retrofit/data/vip_counts_info.dart @@ -0,0 +1,141 @@ +/// dayMoney : "0" +/// yesterdayMoney : "0" +/// paySum : "0" +/// yesterdayPaySum : "0" +/// rechargeMoney : "0" +/// weekRechargeMoney : "0" +/// lastWeekRechargeMoney : "0" +/// orderNum : 0 +/// yesterdayOrderNum : 0 +/// memberNum : 21800 +/// lastWeekMemberNum : 4 +/// weekMemberNum : 1 +/// newMemberNum : 0 +/// yesterdayNewMemberNum : 0 + +class VipCountsInfo { + VipCountsInfo({ + String dayMoney, + String yesterdayMoney, + String paySum, + String yesterdayPaySum, + String rechargeMoney, + String weekRechargeMoney, + String lastWeekRechargeMoney, + num orderNum, + num yesterdayOrderNum, + num memberNum, + num lastWeekMemberNum, + num weekMemberNum, + num newMemberNum, + num yesterdayNewMemberNum,}){ + _dayMoney = dayMoney; + _yesterdayMoney = yesterdayMoney; + _paySum = paySum; + _yesterdayPaySum = yesterdayPaySum; + _rechargeMoney = rechargeMoney; + _weekRechargeMoney = weekRechargeMoney; + _lastWeekRechargeMoney = lastWeekRechargeMoney; + _orderNum = orderNum; + _yesterdayOrderNum = yesterdayOrderNum; + _memberNum = memberNum; + _lastWeekMemberNum = lastWeekMemberNum; + _weekMemberNum = weekMemberNum; + _newMemberNum = newMemberNum; + _yesterdayNewMemberNum = yesterdayNewMemberNum; +} + + VipCountsInfo.fromJson(dynamic json) { + _dayMoney = json['dayMoney']; + _yesterdayMoney = json['yesterdayMoney']; + _paySum = json['paySum']; + _yesterdayPaySum = json['yesterdayPaySum']; + _rechargeMoney = json['rechargeMoney']; + _weekRechargeMoney = json['weekRechargeMoney']; + _lastWeekRechargeMoney = json['lastWeekRechargeMoney']; + _orderNum = json['orderNum']; + _yesterdayOrderNum = json['yesterdayOrderNum']; + _memberNum = json['memberNum']; + _lastWeekMemberNum = json['lastWeekMemberNum']; + _weekMemberNum = json['weekMemberNum']; + _newMemberNum = json['newMemberNum']; + _yesterdayNewMemberNum = json['yesterdayNewMemberNum']; + } + String _dayMoney; + String _yesterdayMoney; + String _paySum; + String _yesterdayPaySum; + String _rechargeMoney; + String _weekRechargeMoney; + String _lastWeekRechargeMoney; + num _orderNum; + num _yesterdayOrderNum; + num _memberNum; + num _lastWeekMemberNum; + num _weekMemberNum; + num _newMemberNum; + num _yesterdayNewMemberNum; +VipCountsInfo copyWith({ String dayMoney, + String yesterdayMoney, + String paySum, + String yesterdayPaySum, + String rechargeMoney, + String weekRechargeMoney, + String lastWeekRechargeMoney, + num orderNum, + num yesterdayOrderNum, + num memberNum, + num lastWeekMemberNum, + num weekMemberNum, + num newMemberNum, + num yesterdayNewMemberNum, +}) => VipCountsInfo( dayMoney: dayMoney ?? _dayMoney, + yesterdayMoney: yesterdayMoney ?? _yesterdayMoney, + paySum: paySum ?? _paySum, + yesterdayPaySum: yesterdayPaySum ?? _yesterdayPaySum, + rechargeMoney: rechargeMoney ?? _rechargeMoney, + weekRechargeMoney: weekRechargeMoney ?? _weekRechargeMoney, + lastWeekRechargeMoney: lastWeekRechargeMoney ?? _lastWeekRechargeMoney, + orderNum: orderNum ?? _orderNum, + yesterdayOrderNum: yesterdayOrderNum ?? _yesterdayOrderNum, + memberNum: memberNum ?? _memberNum, + lastWeekMemberNum: lastWeekMemberNum ?? _lastWeekMemberNum, + weekMemberNum: weekMemberNum ?? _weekMemberNum, + newMemberNum: newMemberNum ?? _newMemberNum, + yesterdayNewMemberNum: yesterdayNewMemberNum ?? _yesterdayNewMemberNum, +); + String get dayMoney => _dayMoney; + String get yesterdayMoney => _yesterdayMoney; + String get paySum => _paySum; + String get yesterdayPaySum => _yesterdayPaySum; + String get rechargeMoney => _rechargeMoney; + String get weekRechargeMoney => _weekRechargeMoney; + String get lastWeekRechargeMoney => _lastWeekRechargeMoney; + num get orderNum => _orderNum; + num get yesterdayOrderNum => _yesterdayOrderNum; + num get memberNum => _memberNum; + num get lastWeekMemberNum => _lastWeekMemberNum; + num get weekMemberNum => _weekMemberNum; + num get newMemberNum => _newMemberNum; + num get yesterdayNewMemberNum => _yesterdayNewMemberNum; + + Map toJson() { + final map = {}; + map['dayMoney'] = _dayMoney; + map['yesterdayMoney'] = _yesterdayMoney; + map['paySum'] = _paySum; + map['yesterdayPaySum'] = _yesterdayPaySum; + map['rechargeMoney'] = _rechargeMoney; + map['weekRechargeMoney'] = _weekRechargeMoney; + map['lastWeekRechargeMoney'] = _lastWeekRechargeMoney; + map['orderNum'] = _orderNum; + map['yesterdayOrderNum'] = _yesterdayOrderNum; + map['memberNum'] = _memberNum; + map['lastWeekMemberNum'] = _lastWeekMemberNum; + map['weekMemberNum'] = _weekMemberNum; + map['newMemberNum'] = _newMemberNum; + map['yesterdayNewMemberNum'] = _yesterdayNewMemberNum; + return map; + } + +} \ No newline at end of file