diff --git a/assets/image/2x/bs_query_logo.webp b/assets/image/2x/bs_query_logo.webp deleted file mode 100644 index 08efe8e5..00000000 Binary files a/assets/image/2x/bs_query_logo.webp and /dev/null differ diff --git a/assets/image/2x/bs_trophy_one.webp b/assets/image/2x/bs_trophy_one.webp deleted file mode 100644 index e7a1ee2e..00000000 Binary files a/assets/image/2x/bs_trophy_one.webp and /dev/null differ diff --git a/assets/image/2x/bs_trophy_three.webp b/assets/image/2x/bs_trophy_three.webp deleted file mode 100644 index 003b2384..00000000 Binary files a/assets/image/2x/bs_trophy_three.webp and /dev/null differ diff --git a/assets/image/2x/bs_trophy_two.webp b/assets/image/2x/bs_trophy_two.webp deleted file mode 100644 index 937ad45a..00000000 Binary files a/assets/image/2x/bs_trophy_two.webp and /dev/null differ diff --git a/assets/image/2x/bus_calculator_enter.webp b/assets/image/2x/bus_calculator_enter.webp new file mode 100644 index 00000000..3d4c5852 Binary files /dev/null and b/assets/image/2x/bus_calculator_enter.webp differ diff --git a/assets/image/bs_query_logo.webp b/assets/image/2x/bus_calculator_plus.webp similarity index 62% rename from assets/image/bs_query_logo.webp rename to assets/image/2x/bus_calculator_plus.webp index dd06fe6f..34e74b15 100644 Binary files a/assets/image/bs_query_logo.webp and b/assets/image/2x/bus_calculator_plus.webp differ diff --git a/assets/image/2x/bus_cashier_balance.webp b/assets/image/2x/bus_cashier_balance.webp new file mode 100644 index 00000000..69357372 Binary files /dev/null and b/assets/image/2x/bus_cashier_balance.webp differ diff --git a/assets/image/2x/bus_cashier_pt.webp b/assets/image/2x/bus_cashier_pt.webp new file mode 100644 index 00000000..fa31cdb8 Binary files /dev/null and b/assets/image/2x/bus_cashier_pt.webp differ diff --git a/assets/image/2x/bus_cashier_scan_code.webp b/assets/image/2x/bus_cashier_scan_code.webp new file mode 100644 index 00000000..e78b6f37 Binary files /dev/null and b/assets/image/2x/bus_cashier_scan_code.webp differ diff --git a/assets/image/2x/bus_cashier_xj.webp b/assets/image/2x/bus_cashier_xj.webp new file mode 100644 index 00000000..1861ca13 Binary files /dev/null and b/assets/image/2x/bus_cashier_xj.webp differ diff --git a/assets/image/icon_vip_recharge.webp b/assets/image/2x/bus_coupon.webp similarity index 52% rename from assets/image/icon_vip_recharge.webp rename to assets/image/2x/bus_coupon.webp index 4f848639..b863ffa9 100644 Binary files a/assets/image/icon_vip_recharge.webp and b/assets/image/2x/bus_coupon.webp differ diff --git a/assets/image/2x/bus_integral.webp b/assets/image/2x/bus_integral.webp new file mode 100644 index 00000000..5ca48426 Binary files /dev/null and b/assets/image/2x/bus_integral.webp differ diff --git a/assets/image/2x/bus_vip_balance.webp b/assets/image/2x/bus_vip_balance.webp new file mode 100644 index 00000000..8f0baf46 Binary files /dev/null and b/assets/image/2x/bus_vip_balance.webp differ diff --git a/assets/image/2x/icon_new_vip.webp b/assets/image/2x/icon_new_vip.webp deleted file mode 100644 index e864fc11..00000000 Binary files a/assets/image/2x/icon_new_vip.webp and /dev/null differ diff --git a/assets/image/2x/icon_vip_recharge.webp b/assets/image/2x/icon_vip_recharge.webp deleted file mode 100644 index 64131bdc..00000000 Binary files a/assets/image/2x/icon_vip_recharge.webp and /dev/null differ diff --git a/assets/image/2x/icon_vip_total.webp b/assets/image/2x/icon_vip_total.webp deleted file mode 100644 index 36173261..00000000 Binary files a/assets/image/2x/icon_vip_total.webp and /dev/null differ diff --git a/assets/image/3x/bs_query_logo.webp b/assets/image/3x/bs_query_logo.webp deleted file mode 100644 index f4d420d9..00000000 Binary files a/assets/image/3x/bs_query_logo.webp and /dev/null differ diff --git a/assets/image/3x/bs_trophy_one.webp b/assets/image/3x/bs_trophy_one.webp deleted file mode 100644 index c3eb848a..00000000 Binary files a/assets/image/3x/bs_trophy_one.webp and /dev/null differ diff --git a/assets/image/3x/bs_trophy_three.webp b/assets/image/3x/bs_trophy_three.webp deleted file mode 100644 index a9690c67..00000000 Binary files a/assets/image/3x/bs_trophy_three.webp and /dev/null differ diff --git a/assets/image/3x/bs_trophy_two.webp b/assets/image/3x/bs_trophy_two.webp deleted file mode 100644 index 4cde57cd..00000000 Binary files a/assets/image/3x/bs_trophy_two.webp and /dev/null differ diff --git a/assets/image/3x/bus_calculator_enter.webp b/assets/image/3x/bus_calculator_enter.webp new file mode 100644 index 00000000..45dce11c Binary files /dev/null and b/assets/image/3x/bus_calculator_enter.webp differ diff --git a/assets/image/icon_new_vip.webp b/assets/image/3x/bus_calculator_plus.webp similarity index 53% rename from assets/image/icon_new_vip.webp rename to assets/image/3x/bus_calculator_plus.webp index a434d2d0..798524be 100644 Binary files a/assets/image/icon_new_vip.webp and b/assets/image/3x/bus_calculator_plus.webp differ diff --git a/assets/image/3x/bus_cashier_balance.webp b/assets/image/3x/bus_cashier_balance.webp new file mode 100644 index 00000000..abe83407 Binary files /dev/null and b/assets/image/3x/bus_cashier_balance.webp differ diff --git a/assets/image/3x/bus_cashier_pt.webp b/assets/image/3x/bus_cashier_pt.webp new file mode 100644 index 00000000..a7e95976 Binary files /dev/null and b/assets/image/3x/bus_cashier_pt.webp differ diff --git a/assets/image/3x/bus_cashier_scan_code.webp b/assets/image/3x/bus_cashier_scan_code.webp new file mode 100644 index 00000000..27ac8e4a Binary files /dev/null and b/assets/image/3x/bus_cashier_scan_code.webp differ diff --git a/assets/image/3x/bus_cashier_xj.webp b/assets/image/3x/bus_cashier_xj.webp new file mode 100644 index 00000000..1ac8d4dd Binary files /dev/null and b/assets/image/3x/bus_cashier_xj.webp differ diff --git a/assets/image/3x/bus_coupon.webp b/assets/image/3x/bus_coupon.webp new file mode 100644 index 00000000..5b280bc8 Binary files /dev/null and b/assets/image/3x/bus_coupon.webp differ diff --git a/assets/image/3x/bus_integral.webp b/assets/image/3x/bus_integral.webp new file mode 100644 index 00000000..0c646dcd Binary files /dev/null and b/assets/image/3x/bus_integral.webp differ diff --git a/assets/image/3x/bus_vip_balance.webp b/assets/image/3x/bus_vip_balance.webp new file mode 100644 index 00000000..e2b0125f Binary files /dev/null and b/assets/image/3x/bus_vip_balance.webp differ diff --git a/assets/image/3x/icon_new_vip.webp b/assets/image/3x/icon_new_vip.webp deleted file mode 100644 index 262388d7..00000000 Binary files a/assets/image/3x/icon_new_vip.webp and /dev/null differ diff --git a/assets/image/3x/icon_vip_recharge.webp b/assets/image/3x/icon_vip_recharge.webp deleted file mode 100644 index 3d9f6b2c..00000000 Binary files a/assets/image/3x/icon_vip_recharge.webp and /dev/null differ diff --git a/assets/image/3x/icon_vip_total.webp b/assets/image/3x/icon_vip_total.webp deleted file mode 100644 index c79134cf..00000000 Binary files a/assets/image/3x/icon_vip_total.webp and /dev/null differ diff --git a/assets/image/bs_trophy_one.webp b/assets/image/bs_trophy_one.webp deleted file mode 100644 index 9aa12528..00000000 Binary files a/assets/image/bs_trophy_one.webp and /dev/null differ diff --git a/assets/image/bs_trophy_three.webp b/assets/image/bs_trophy_three.webp deleted file mode 100644 index 063b494c..00000000 Binary files a/assets/image/bs_trophy_three.webp and /dev/null differ diff --git a/assets/image/bs_trophy_two.webp b/assets/image/bs_trophy_two.webp deleted file mode 100644 index 9cae39c8..00000000 Binary files a/assets/image/bs_trophy_two.webp and /dev/null differ diff --git a/assets/image/icon_vip_total.webp b/assets/image/bus_calculator_enter.webp similarity index 53% rename from assets/image/icon_vip_total.webp rename to assets/image/bus_calculator_enter.webp index e5134362..610c3352 100644 Binary files a/assets/image/icon_vip_total.webp and b/assets/image/bus_calculator_enter.webp differ diff --git a/assets/image/bus_calculator_plus.webp b/assets/image/bus_calculator_plus.webp new file mode 100644 index 00000000..b7560f77 Binary files /dev/null and b/assets/image/bus_calculator_plus.webp differ diff --git a/assets/image/bus_cashier_balance.webp b/assets/image/bus_cashier_balance.webp new file mode 100644 index 00000000..3fe13ab7 Binary files /dev/null and b/assets/image/bus_cashier_balance.webp differ diff --git a/assets/image/bus_cashier_pt.webp b/assets/image/bus_cashier_pt.webp new file mode 100644 index 00000000..02a0a2b7 Binary files /dev/null and b/assets/image/bus_cashier_pt.webp differ diff --git a/assets/image/bus_cashier_scan_code.webp b/assets/image/bus_cashier_scan_code.webp new file mode 100644 index 00000000..48a59625 Binary files /dev/null and b/assets/image/bus_cashier_scan_code.webp differ diff --git a/assets/image/bus_cashier_xj.webp b/assets/image/bus_cashier_xj.webp new file mode 100644 index 00000000..ee5ba9b0 Binary files /dev/null and b/assets/image/bus_cashier_xj.webp differ diff --git a/assets/image/bus_coupon.webp b/assets/image/bus_coupon.webp new file mode 100644 index 00000000..c0ca9d4c Binary files /dev/null and b/assets/image/bus_coupon.webp differ diff --git a/assets/image/bus_integral.webp b/assets/image/bus_integral.webp new file mode 100644 index 00000000..aa6672f7 Binary files /dev/null and b/assets/image/bus_integral.webp differ diff --git a/assets/image/bus_vip_balance.webp b/assets/image/bus_vip_balance.webp new file mode 100644 index 00000000..c05387ce Binary files /dev/null and b/assets/image/bus_vip_balance.webp differ diff --git a/lib/business_system/business_page.dart b/lib/business_system/business_page.dart index 49017aba..1b1f3db6 100644 --- a/lib/business_system/business_page.dart +++ b/lib/business_system/business_page.dart @@ -48,6 +48,10 @@ class _BusinessPage extends State setState(() { selectStoreIndex = index; }); + },(index){ + setState((){ + choiceIndex = 3; + }); }), if (choiceIndex == 1) BusinessOrderPage(businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"), // if (choiceIndex == 2) BusinessScanCode(businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"), diff --git a/lib/business_system/home/business_home_page.dart b/lib/business_system/home/business_home_page.dart index 5fd086a2..bbcbe3dd 100644 --- a/lib/business_system/home/business_home_page.dart +++ b/lib/business_system/home/business_home_page.dart @@ -4,7 +4,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/business_system/home/home_view/home_sideslip_dialog.dart'; -import 'package:huixiang/retrofit/data/day_flow_list.dart'; import 'package:huixiang/utils/business_instance.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/my_footer.dart'; @@ -17,24 +16,19 @@ import '../../generated/l10n.dart'; import '../../retrofit/business_api.dart'; import '../../retrofit/data/base_data.dart'; import '../../retrofit/data/business_login_info.dart'; -import '../../retrofit/data/business_vip_list.dart' as vip; import '../../retrofit/data/day_count.dart'; -import '../../retrofit/data/order_trend.dart'; -import '../../retrofit/data/popular_sales_list.dart'; -import '../../retrofit/data/recharge_flow_list.dart'; -import '../../retrofit/data/vip_counts_info.dart'; import '../../utils/flutter_utils.dart'; import '../../utils/font_weight.dart'; -import '../../view_widget/no_data_view.dart'; -import 'home_view/my_line_chart.dart'; +import '../../view_widget/settlement_tips_dialog.dart'; class BusinessHomePage extends StatefulWidget { final BusinessLoginInfo businessLoginInfo; final int selectStoreIndex; final Function changeIndex; + final Function changeTab; BusinessHomePage( - this.businessLoginInfo, this.selectStoreIndex, this.changeIndex); + this.businessLoginInfo, this.selectStoreIndex, this.changeIndex,this.changeTab); @override State createState() { @@ -49,35 +43,18 @@ class _BusinessHomePage extends State BusinessApiService businessService; DayCount dayCount; int _loadCount = 0; - PopularSalesList popularSalesList; - List records = []; - List rechargeFlowList = []; - List orderTrend = []; - VipCountsInfo vipCountsInfo; - int daySelectIndex = 0; - int vipIndex = 0; - List dayFlowList = []; - List lineChartSample2Data = [ - 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 void initState() { super.initState(); _onRefresh(); + } @override void dispose() { super.dispose(); } - _onRefresh({int index, isLoading = true}) async { if (isLoading) EasyLoading.show( @@ -89,28 +66,18 @@ class _BusinessHomePage extends State token: BusinessInstance.instance.businessToken, tenant: BusinessInstance.instance.businessTenant, storeId: widget.businessLoginInfo - .storeList[index ?? widget.selectStoreIndex].name == - "所有门店" + .storeList[index ?? widget.selectStoreIndex].name == + "所有门店" ? "0" : widget.businessLoginInfo - .storeList[index ?? widget.selectStoreIndex].id); - if(vipIndex != 1 && vipIndex != 2){ + .storeList[index ?? widget.selectStoreIndex].id); queryDayAmount(); - queryPopularList(isSing: false); - queryOrderTrend(); - queryVipCounts(); - queryDayFlow(); - } - if(vipIndex == 1) - queryVipList(); - if(vipIndex == 2) - queryRechargeFlow(); }); } addLoadCount() { _loadCount += 1; - if (_loadCount == 5) { + if (_loadCount == 1) { _loadCount = 0; EasyLoading.dismiss(); if (refreshController.isRefresh) refreshController.refreshCompleted(); @@ -137,123 +104,6 @@ class _BusinessHomePage extends State } } - ///热销榜单 - queryPopularList({isSing = true}) async { - try { - if (isSing) - EasyLoading.show( - status: S.current.zhengzaijiazai, - maskType: EasyLoadingMaskType.black); - BaseData baseData = await businessService - .popularList(daySelectIndex.toString()) - .catchError((error) {}); - if (baseData != null && baseData.isSuccess) { - popularSalesList = baseData.data; - } - } finally { - if (isSing) { - setState(() {}); - EasyLoading.dismiss(); - } else { - addLoadCount(); - } - } - } - - ///生意总览 - queryOrderTrend() async { - try { - BaseData> baseData = - await businessService.orderTrend().catchError((error) {}); - if (baseData != null && baseData.isSuccess) { - double index = 0; - if (baseData.data.isNotEmpty) { - lineChartSample2Data.clear(); - } - orderTrend = baseData.data; - orderTrend.forEach((element) { - lineChartSample2Data.add(LineChartSample2Data( - index, double.tryParse(element.number.toString()), element.date)); - index += 1; - }); - } - } finally { - addLoadCount(); - } - } - - ///用户总览/会员统计数据 - queryVipCounts() async { - try { - BaseData baseData = await businessService - .vipCounts("${DateFormat("yyyy-MM-dd").format(DateTime.now())}") - .catchError((error) {}); - if (baseData != null && baseData.isSuccess) { - vipCountsInfo = baseData.data; - } - } finally { - addLoadCount(); - } - } - - ///今日流水/isMonth=0(当月数据),isMonth=1(当日数据) - queryDayFlow() async { - try { - BaseData> baseData = await businessService - .dayFlow(DateFormat("yyyy-MM-dd").format(DateTime.now()), "1") - .catchError((error) {}); - if (baseData != null && baseData.isSuccess) { - dayFlowList = baseData.data; - } - } finally { - addLoadCount(); - } - } - - ///会员列表 - queryVipList() async { - try { - BaseData baseData = await businessService.vipDataList({ - "map": {"nickname": "", "phone": "", "source": "", "hasMoney": "2"}, - "model": {"tenantCode": null}, - "date": "", - "sort": "id", - "size": 12, - "current": 1 - }).catchError((error) {}); - if (baseData != null && baseData.isSuccess) { - records.clear(); - records.addAll(baseData?.data?.records ?? []); - setState((){}); - } - } finally { - EasyLoading.dismiss(); - } - } - - ///会员充值流水 - queryRechargeFlow() async { - try { - BaseData baseData = await businessService.rechargeFlow({ - "size": 10, - "pageSize": 10, - "current": 1, - "currentPage": 1, - "sort": "id", - "order": "descending", - "model": {"id":""}, - "timeRange": null - }).catchError((error) {}); - if (baseData != null && baseData.isSuccess) { - rechargeFlowList.clear(); - rechargeFlowList.addAll(baseData?.data?.records ?? []); - setState((){}); - } - } finally { - EasyLoading.dismiss(); - } - } - @override Widget build(BuildContext context) { super.build(context); @@ -283,10 +133,8 @@ class _BusinessHomePage extends State child: Column( children: [ homeTop(), - tradeOverview(), - vipManage(), - hotSellHotCharts(), - todayFlow(), + commonFunctions(), + homeStatistics(), ], )), ), @@ -636,21 +484,23 @@ class _BusinessHomePage extends State ); } - ///生意总览 - Widget tradeOverview() { + ///常用功能 + Widget commonFunctions() { return Container( - padding: - EdgeInsets.only(left: 16.w, right: 21.w, top: 12.h, bottom: 16.h), color: Colors.white, + margin: EdgeInsets.only(bottom:16.h), + padding: EdgeInsets.only(left: 16.w, right: 15.w, top: 12.h, bottom: 16.h), child: Column( children: [ Row( children: [ Container(width: 4.w, height: 16.h, color: Color(0xFF30415B)), Padding( - padding: EdgeInsets.only(left: 12.w, right: 8.w), + padding: EdgeInsets.only( + left: 12.w, + ), child: Text( - "生意总览", + "常用功能", style: TextStyle( fontSize: 15.sp, fontWeight: MyFontWeight.semi_bold, @@ -658,626 +508,177 @@ class _BusinessHomePage extends State ), ), ), - Expanded( - child: Text( - "近一周订单量趋势", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0x99000000), - ), - )), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Navigator.of(context) - .pushNamed('/router/trade_overview_page', arguments: { - "storeId": widget.businessLoginInfo - .storeList[widget.selectStoreIndex].name == - "所有门店" - ? "0" - : widget.businessLoginInfo - .storeList[widget.selectStoreIndex].id, - }); - }, - child: Row( - children: [ - Text( - "更多数据", - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF252626), - ), - ), - SizedBox( - width: 5.w, - ), - Image.asset( - "assets/image/bs_right.webp", - width: 8.w, - height: 12.h, - ), - ], - ), - ) ], ), - SizedBox( - height: 18.h, + GridView.builder( + itemCount:commonFunctionsList.length ?? 0, + padding: EdgeInsets.only(top:24.h), + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 4, + crossAxisSpacing:15.w, + mainAxisSpacing: 12.w, + ), + itemBuilder: (context, index) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + commonFunctionsIndex(index); + }, + child: commonFunctionsItem(index)); + }, ), - LineChartSample2(lineChartSample2Data, "销售量"), ], ), ); } - ///会员概览 - Widget userOverview() { - return Container( - color: Colors.white, - margin: EdgeInsets.only(bottom: 16.h), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - showVipTipDialog(1); - }, - child: Container( - padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h), - margin: EdgeInsets.symmetric(horizontal: 4.w), - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Color(0xFFFC5A58), Color(0xFFFF716F)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - borderRadius: BorderRadius.circular(6.w), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - 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, - ), - ], - ), - SizedBox( - height: 7.h, - ), - Text( - vipCountsInfo?.rechargeMoney ?? "0", - style: TextStyle( - fontSize: 24.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, - ), - ), - ], - ), - ), - )), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - showVipTipDialog(2); - }, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 8.w, vertical: 6.h), - margin: EdgeInsets.symmetric(horizontal: 4.w), - 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: [ - 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, - ), - ], - ), - SizedBox( - height: 7.h, - ), - Text( - (vipCountsInfo?.newMemberNum ?? 0).toString(), - style: TextStyle( - fontSize: 24.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, - ), - ), - ], - ), - ))), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - showVipTipDialog(3); - }, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 8.w, vertical: 6.h), - margin: EdgeInsets.symmetric(horizontal: 4.w), - 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: [ - 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, - ), - ], - ), - SizedBox( - height: 7.h, - ), - Text( - (vipCountsInfo?.memberNum ?? 0).toString(), - style: TextStyle( - fontSize: 24.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, - ), - ), - ], - ), - ))), - ], - ) - ], - ), - ); - } + ///常用功能跳转 + commonFunctionsIndex(index) async { + switch (index) { + case 0: + if ((widget.businessLoginInfo + .storeList[widget.selectStoreIndex].name == + "所有门店" + ? "0" + : widget.businessLoginInfo + .storeList[widget.selectStoreIndex].id) == "0") { + SmartDialog.show( + widget: SettlementTips( + () {}, + text: "请选择门店进行收银操作", + color: Color(0xFF30415B), + )); + }else{ + Navigator.of(context).pushNamed('/router/cashier_page', arguments: { + "storeId": widget.businessLoginInfo + .storeList[widget.selectStoreIndex].name == + "所有门店" + ? "0" + : widget.businessLoginInfo + .storeList[widget.selectStoreIndex].id, + }); + } + break; + case 1: + Navigator.of(context) + .pushNamed('/router/vip_recharge_page', arguments: { + "storeId": widget.businessLoginInfo + .storeList[widget.selectStoreIndex].name == + "所有门店" + ? "0" + : widget.businessLoginInfo + .storeList[widget.selectStoreIndex].id, + }); + break; + case 2: + Navigator.of(context) + .pushNamed('/router/add_vip', arguments: { + "storeId": widget.businessLoginInfo + .storeList[widget.selectStoreIndex].name == + "所有门店" + ? "0" + : widget.businessLoginInfo + .storeList[widget.selectStoreIndex].id, + }); + break; + case 3: + Navigator.of(context) + .pushNamed('/router/trade_overview_page', arguments: { + "storeId": widget.businessLoginInfo + .storeList[widget.selectStoreIndex].name == + "所有门店" + ? "0" + : widget.businessLoginInfo + .storeList[widget.selectStoreIndex].id, + }); + break; + case 4: + Navigator.of(context) + .pushNamed('/router/business_vip_page', arguments: { + "storeId": widget.businessLoginInfo + .storeList[widget.selectStoreIndex].name == + "所有门店" + ? "0" + : widget.businessLoginInfo + .storeList[widget.selectStoreIndex].id, + }); + break; + case 5: + Navigator.of(context) + .pushNamed('/router/hot_selling_page', arguments: { + "storeId": widget.businessLoginInfo + .storeList[widget.selectStoreIndex].name == + "所有门店" + ? "0" + : widget.businessLoginInfo + .storeList[widget.selectStoreIndex].id, + }); + break; + case 6: + Navigator.of(context) + .pushNamed('/router/flow_page', arguments: { + "storeName": widget?.businessLoginInfo + ?.storeList[widget.selectStoreIndex].name ?? + "", + "storeId": widget.businessLoginInfo + .storeList[widget.selectStoreIndex].name == + "所有门店" + ? "0" + : widget.businessLoginInfo + .storeList[widget.selectStoreIndex].id, + }); + break; + case 7: + widget.changeTab(3); + break; - ///会员管理 - Widget vipManage() { - return Container( - color: Colors.white, - margin: EdgeInsets.only(top: 16.h), - padding: EdgeInsets.only(bottom: 12.h), - child: Column( - children: [ - Padding( - padding: EdgeInsets.only(left: 16.w), - child: Row( - children: [ - Container(width: 4.w, height: 16.h, color: Color(0xFF30415B),margin: EdgeInsets.only(right: 12.w,top: 12.h),), - Expanded( - child: Padding( - padding: EdgeInsets.only(top: 12.h), - child: Text( - "会员管理", - style: TextStyle( - fontSize: 15.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xFF0D0D0D), - ), - ), - ), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Navigator.of(context).pushNamed( - '/router/business_vip_page', - arguments: {"storeId": widget.businessLoginInfo - .storeList[widget.selectStoreIndex].name == - "所有门店" - ? "0" - : widget.businessLoginInfo - .storeList[widget.selectStoreIndex].id,}, - ); - }, - child: Container( - // color: Colors.red, - padding: EdgeInsets.only(left: 20.w,right: 20.w,top: 12.h), - child: Row( - children: [ - Text( - "更多数据", - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF252626), - ), - ), - SizedBox( - width: 5.w, - ), - Image.asset( - "assets/image/bs_right.webp", - width: 8.w, - height: 12.h, - ), - ], - ), - ), - ) - ], - )), - Padding( - padding: EdgeInsets.only(left: 16.w), - child: Row( - children: [ - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - vipIndex = 0; - }); - }, - child: Container( - padding: - EdgeInsets.only(right: 20.w, top: 15.h, bottom: 18.h), - alignment: Alignment.center, - child: Text( - "会员概览", - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.bold, - color: vipIndex == 0 - ? Color(0xFF30415B) - : Color(0XFF262626), - ), - ), - ), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - vipIndex = 1; - _onRefresh(); - }); - }, - child: Container( - padding: - EdgeInsets.only(right: 20.w, top: 15.h, bottom: 18.h), - alignment: Alignment.center, - child: Text( - "会员列表", - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.bold, - color: vipIndex == 1 - ? Color(0xFF30415B) - : Color(0XFF262626), - ), - ), - ), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - vipIndex = 2; - _onRefresh(); - }); - }, - child: Container( - padding: - EdgeInsets.only(right: 20.w, top: 15.h, bottom: 18.h), - alignment: Alignment.center, - child: Text( - "会员充值流水", - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.bold, - color: vipIndex == 2 - ? Color(0xFF30415B) - : Color(0XFF262626), - ), - ), - ), - ), - ], - )), - if (vipIndex == 0) userOverview(), - if (vipIndex == 1 || vipIndex == 2) - Padding( - padding: EdgeInsets.only(left: 16.w), - child: Row( - children: [ - Expanded( - child: Text( - "昵称", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF30415B), - ), - ), - ), - Expanded( - child: Text( - "手机号", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF30415B), - ), - ), - ), - Expanded( - child: Text( - "商户余额", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF30415B), - ), - ), - ), - ], - )), - if (vipIndex == 1) - Container( - height: 310.h, - padding: EdgeInsets.only(left: 16.w), - child: - (records == null || - records.length == 0) - ? NoDataView( - src: "assets/image/bs_no data_logo.webp", - isShowBtn: false, - text: "暂无数据", - fontSize: 16.sp, - margin: EdgeInsets.all(20.h), - ) : - ListView.builder( - padding: EdgeInsets.zero, - itemCount: records?.length ?? 0, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () {}, - child: busVipItem(records[position]), - ); - }, - ), - ), - if (vipIndex == 2) - Container( - height: 310.h, - padding: EdgeInsets.only(left: 16.w), - child: - (rechargeFlowList == null || - rechargeFlowList.length == 0) - ? NoDataView( - src: "assets/image/bs_no data_logo.webp", - isShowBtn: false, - text: "暂无数据", - fontSize: 16.sp, - margin: EdgeInsets.all(20.h), - ) : - ListView.builder( - padding: EdgeInsets.zero, - itemCount: rechargeFlowList?.length ?? 0, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () {}, - child: busRechargeFlowItem(rechargeFlowList[position]), - ); - }, - ), - ), - ], - ), - ); + } } - ///会员列表 - Widget busVipItem(vip.Records records) { - return Container( - margin: EdgeInsets.only(top: 17.h, bottom: 20.h), - child: Row( - children: [ - Expanded( - child: Text( - records?.nickname ?? "", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xD9000000), - ), - ), - ), - Expanded( - child: Text( - records?.phone ?? "", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xD9000000), - ), - ), - ), - Expanded( - child: Text( - records?.balance ?? "", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xD9000000), - ), - ), - ), - ], - ), - ); - } + ///常用功能板块 + List> commonFunctionsList = [ + {"image":"assets/image/bus_home_syt.webp","commonName":"收银台","imageWidth":"26","imageHeight":"23"}, + {"image":"assets/image/bus_home_cz.webp","commonName":"充值","imageWidth":"22","imageHeight":"19"}, + {"image":"assets/image/bus_home_bhy.webp","commonName":"办会员","imageWidth":"24","imageHeight":"21"}, + {"image":"assets/image/bus_home_syzl.webp","commonName":"生意总览","imageWidth":"22","imageHeight":"23"}, + {"image":"assets/image/bus_home_hygl.webp","commonName":"会员管理","imageWidth":"23","imageHeight":"25"}, + {"image":"assets/image/bus_home_rxbd.webp","commonName":"热销榜单","imageWidth":"20","imageHeight":"26"}, + {"image":"assets/image/bus_home_jrls.webp","commonName":"今日流水","imageWidth":"22","imageHeight":"23"}, + {"image":"assets/image/bus_home_goods.webp","commonName":"商品","imageWidth":"21","imageHeight":"23"}, + ]; - ///会员充值流水 - Widget busRechargeFlowItem(Records rechargeFlowList) { - return Container( - margin: EdgeInsets.only(top: 17.h, bottom: 20.h), - child: Row( - children: [ - Expanded( - child: Text( - rechargeFlowList?.createPerson ?? "", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xD9000000), - ), - ), - ), - Expanded( - child: Text( - rechargeFlowList?.phone ?? "", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xD9000000), - ), - ), - ), - Expanded( + ///常用功能Item + Widget commonFunctionsItem(index){ + return Column( + children: [ + Image.asset( + commonFunctionsList[index]["image"], + width: double.tryParse(commonFunctionsList[index]["imageWidth"]).w, + height: double.tryParse(commonFunctionsList[index]["imageHeight"]).h, + fit: BoxFit.fill, + ), + Padding(padding: EdgeInsets.only(top: 12.h), child: Text( - rechargeFlowList?.balance ?? "", + commonFunctionsList[index]["commonName"], + textAlign: TextAlign.center, style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xD9000000), - ), - ), - ), - ], - ), - ); - } - - ///用户概览弹窗提示 - showVipTipDialog(index) { - showDialog( - context: context, - builder: (context) { - return AlertDialog( - content: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - index == 1 - ? "assets/image/icon_vip_recharge.webp" - : (index == 2 - ? "assets/image/icon_new_vip.webp" - : "assets/image/icon_vip_total.webp"), - width: 20.h, - height: 20.h, - ), - SizedBox( - height: 6.h, - ), - Text( - index == 1 ? "今日会员充值" : (index == 2 ? "今日新增会员" : "总会员数"), - style: TextStyle( - color: Color(0xFF0D0D0D), - fontSize: 15.sp, - fontWeight: MyFontWeight.bold, - ), - ), - SizedBox( - height: 13.h, - ), - Text( - index == 1 - ? "今日会员充值指今天所选门店会员充值额度" - : (index == 2 ? "今日新增会员指今天所选门店新增会员" : "总会员数指所选门店会员总会员人数"), - textAlign: TextAlign.center, - style: TextStyle( - color: Color(0xFF666666), - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - ), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF252626), ), - ], - ), - ); - }, + )), + ], ); } - ///热销榜单 - Widget hotSellHotCharts() { + ///统计 + Widget homeStatistics() { 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), + margin: EdgeInsets.only(bottom:16.h), + padding: EdgeInsets.only(left: 16.w, right: 15.w, top: 12.h, bottom: 16.h), child: Column( children: [ Row( @@ -1288,7 +689,7 @@ class _BusinessHomePage extends State left: 12.w, ), child: Text( - "热销榜单", + "统计", style: TextStyle( fontSize: 15.sp, fontWeight: MyFontWeight.semi_bold, @@ -1298,397 +699,138 @@ class _BusinessHomePage extends State ), ], ), - SizedBox( - height: 14.h, - ), - Row( - children: [ - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - daySelectIndex = 0; - queryPopularList(); - }, - child: Container( - padding: - EdgeInsets.symmetric(horizontal: 19.w, vertical: 5.h), - alignment: Alignment.center, - margin: EdgeInsets.only(right: 16.w, bottom: 16.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2.w), - color: daySelectIndex == 0 - ? Color(0xFF30415B) - : Colors.transparent, - border: Border.all( - color: Color(0xFF30415B), - width: 1.w, - ), - ), - child: Text( - "今天", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: daySelectIndex == 0 - ? Colors.white - : Color(0XFF30415B), - ), - ), - ), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - daySelectIndex = 1; - queryPopularList(); - }, - child: Container( - padding: - EdgeInsets.symmetric(horizontal: 19.w, vertical: 5.h), - alignment: Alignment.center, - margin: EdgeInsets.only(right: 16.w, bottom: 16.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2.w), - color: daySelectIndex == 1 - ? Color(0xFF30415B) - : Colors.transparent, - border: Border.all( - color: Color(0xFF30415B), - width: 1.w, - ), - ), - child: Text( - "昨天", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: daySelectIndex == 1 - ? Colors.white - : Color(0XFF30415B), - ), - ), - )), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - daySelectIndex = 7; - queryPopularList(); - }, - child: Container( - padding: - EdgeInsets.symmetric(horizontal: 10.w, vertical: 5.h), - alignment: Alignment.center, - margin: EdgeInsets.only(right: 16.w, bottom: 16.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2.w), - color: daySelectIndex == 7 - ? Color(0xFF30415B) - : Colors.transparent, - border: Border.all( - color: Color(0xFF30415B), - width: 1.w, - ), - ), - child: Text( - "最近7天", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: daySelectIndex == 7 - ? Colors.white - : Color(0XFF30415B), - ), - ), - )), - GestureDetector( + GridView.builder( + itemCount:homeStatisticsList.length ?? 0, + padding: EdgeInsets.only(top:24.h), + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 4, + crossAxisSpacing:15.w, + mainAxisSpacing: 12.w, + ), + itemBuilder: (context, index) { + return GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { - daySelectIndex = 30; - queryPopularList(); + homeStatisticsIndex(index); }, - child: Container( - padding: - EdgeInsets.symmetric(horizontal: 10.w, vertical: 5.h), - alignment: Alignment.center, - margin: EdgeInsets.only(right: 16.w, bottom: 16.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2.w), - color: daySelectIndex == 30 - ? Color(0xFF30415B) - : Colors.transparent, - border: Border.all( - color: Color(0xFF30415B), - width: 1.w, - ), - ), - child: Text( - "最近30天", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: daySelectIndex == 30 - ? Colors.white - : Color(0XFF30415B), - ), - ), - )), - ], - ), - Container( - height: 310.h, - child: (popularSalesList == null || - popularSalesList.saleProductList.length == 0) - ? NoDataView( - src: "assets/image/bs_no data_logo.webp", - isShowBtn: false, - text: "暂无数据", - fontSize: 16.sp, - margin: EdgeInsets.all(20.h), - ) - : ListView.builder( - padding: EdgeInsets.zero, - itemCount: popularSalesList?.saleProductList?.length ?? 0, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () {}, - child: salesVolumeItem( - popularSalesList.saleProductList[position], - position), - ); - }, - ), + child: homeStatisticsItem(index)); + }, ), ], ), ); } - ///销量item - Widget salesVolumeItem(SaleProductList saleProductList, index) { - return Container( - padding: EdgeInsets.only(bottom: 12.h), - child: Row( - children: [ - if (index == 0 || index == 1 || index == 2) - Image.asset( - index == 0 - ? "assets/image/bs_trophy_one.webp" - : (index == 1 - ? "assets/image/bs_trophy_two.webp" - : "assets/image/bs_trophy_three.webp"), - width: 26.h, - height: 26.h, - ), - if (index != 0 && index != 1 && index != 2) - Padding( - padding: EdgeInsets.symmetric(horizontal: 8.w), - child: Text( - (index + 1).toString(), - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF0D0D0D), - ), - ), - ), - SizedBox( - width: 8.w, - ), - Expanded( - child: Text( - saleProductList?.productName ?? "", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF0D0D0D), - ), - ), - ), - Text( - "已售", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF0D0D0D), - ), - ), - Padding( - padding: EdgeInsets.only(left: 7.w), - child: Text( - "${(saleProductList?.saleNum ?? 0).toString()}件", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF0D0D0D), - ), - ), - ) - ], - ), - ); + ///统计跳转 + homeStatisticsIndex(index) async { + switch (index) { + case 0: + Navigator.of(context) + .pushNamed('/router/trade_overview_page', arguments: { + "storeId": widget.businessLoginInfo + .storeList[widget.selectStoreIndex].name == + "所有门店" + ? "0" + : widget.businessLoginInfo + .storeList[widget.selectStoreIndex].id, + }); + break; + case 1: + Navigator.of(context) + .pushNamed('/router/business_vip_page', arguments: { + "storeId": widget.businessLoginInfo + .storeList[widget.selectStoreIndex].name == + "所有门店" + ? "0" + : widget.businessLoginInfo + .storeList[widget.selectStoreIndex].id, + "index":2 + }); + break; + case 2: + Navigator.of(context) + .pushNamed('/router/business_vip_page', arguments: { + "storeId": widget.businessLoginInfo + .storeList[widget.selectStoreIndex].name == + "所有门店" + ? "0" + : widget.businessLoginInfo + .storeList[widget.selectStoreIndex].id, + "index":1 + }); + break; + case 3: + Navigator.of(context) + .pushNamed('/router/consumer_ranking_page', arguments: { + "storeId": widget.businessLoginInfo + .storeList[widget.selectStoreIndex].name == + "所有门店" + ? "0" + : widget.businessLoginInfo + .storeList[widget.selectStoreIndex].id, + "titleName":"会员余额统计" + }); + break; + case 4: + Navigator.of(context) + .pushNamed('/router/consumer_ranking_page', arguments: { + "storeId": widget.businessLoginInfo + .storeList[widget.selectStoreIndex].name == + "所有门店" + ? "0" + : widget.businessLoginInfo + .storeList[widget.selectStoreIndex].id, + "titleName":"消费排名" + }); + break; + case 5: + Navigator.of(context) + .pushNamed('/router/trade_overview_page', arguments: { + "storeId": widget.businessLoginInfo + .storeList[widget.selectStoreIndex].name == + "所有门店" + ? "0" + : widget.businessLoginInfo + .storeList[widget.selectStoreIndex].id, + "index":2 + }); + break; + } } - ///今日流水 - 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( - children: [ - Row( - children: [ - 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), - ), - )), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Navigator.of(context) - .pushNamed('/router/flow_page', arguments: { - "storeName": widget?.businessLoginInfo - ?.storeList[widget.selectStoreIndex].name ?? - "", - "storeId": widget.businessLoginInfo - .storeList[widget.selectStoreIndex].name == - "所有门店" - ? "0" - : widget.businessLoginInfo - .storeList[widget.selectStoreIndex].id, - }); - }, - child: Row( - children: [ - Text( - "更多数据", - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF252626), - ), - ), - SizedBox( - width: 5.w, - ), - Image.asset( - "assets/image/bs_right.webp", - width: 8.w, - height: 12.h, - ), - ], - ), - ), - ], - ), - SizedBox( - height: 20.h, - ), - Container( - height: 360.h, - child: (dayFlowList.length == null || dayFlowList?.length == 0) - ? NoDataView( - src: "assets/image/bs_no data_logo.webp", - isShowBtn: false, - text: "暂无数据", - fontSize: 16.sp, - margin: EdgeInsets.all(20.h), - ) - : ListView.builder( - padding: EdgeInsets.zero, - itemCount: dayFlowList?.length ?? 0, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () {}, - child: flowItem(dayFlowList[position]), - ); - }, - )) - ], - ), - ); - } + ///统计板块 + List> homeStatisticsList = [ + {"image":"assets/image/bus_home_yytj.webp","commonName":"营业统计","imageWidth":"21","imageHeight":"20"}, + {"image":"assets/image/bus_home_xfjl.webp","commonName":"消费记录","imageWidth":"22","imageHeight":"21"}, + {"image":"assets/image/bus_home_czjl.webp","commonName":"充值记录","imageWidth":"19","imageHeight":"22"}, + {"image":"assets/image/bus_home_hyyetj.webp","commonName":"会员余额统计","imageWidth":"23","imageHeight":"23"}, + {"image":"assets/image/bus_home_xfpm.webp","commonName":"消费排名","imageWidth":"26","imageHeight":"22"}, + {"image":"assets/image/bus_home_goods_ssfx.webp","commonName":"商品销售分析","imageWidth":"26","imageHeight":"23"}, + ]; - ///流水item - Widget flowItem(DayFlowList dayFlowList) { - 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( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - dayFlowList?.localDateTime ?? "", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xD9000000), - ), - ), - SizedBox( - height: 7.h, - ), - Text( - dayFlowList?.storeName ?? "", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0x99000000), - ), + ///统计Item + Widget homeStatisticsItem(index){ + return Column( + children: [ + Image.asset( + homeStatisticsList[index]["image"], + width: double.tryParse(homeStatisticsList[index]["imageWidth"]).w, + height: double.tryParse(homeStatisticsList[index]["imageHeight"]).h, + fit: BoxFit.fill, + ), + Padding(padding: EdgeInsets.only(top: 12.h), + child: Text( + homeStatisticsList[index]["commonName"], + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF252626), ), - ], - )), - Text.rich( - TextSpan( - children: [ - TextSpan( - text: (dayFlowList?.amount != "0.00") ? "+" : "-", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xD9000000), - ), - ), - TextSpan( - text: (dayFlowList?.amount != "0.00") - ? (dayFlowList?.amount ?? "") - : (dayFlowList?.refundAmount ?? ""), - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xD9000000), - ), - ), - ], - ), - ), - ], - ), + )), + ], ); } diff --git a/lib/business_system/home/cashier/cashier_page.dart b/lib/business_system/home/cashier/cashier_page.dart index 06c14c27..a2403d22 100644 --- a/lib/business_system/home/cashier/cashier_page.dart +++ b/lib/business_system/home/cashier/cashier_page.dart @@ -1,8 +1,23 @@ +import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:intl/intl.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; + +import '../../../generated/l10n.dart'; +import '../../../retrofit/business_api.dart'; +import '../../../retrofit/data/base_data.dart'; +import '../../../retrofit/data/phone_query_member_info.dart'; +import '../../../utils/business_instance.dart'; +import '../../../utils/flutter_utils.dart'; +import '../../../view_widget/border_text.dart'; +import '../../../view_widget/classic_header.dart'; +import '../../../view_widget/my_footer.dart'; +import '../../../view_widget/round_button.dart'; +import '../../../view_widget/settlement_tips_dialog.dart'; class CashierPage extends StatefulWidget { final Map arguments; @@ -16,45 +31,1281 @@ class CashierPage extends StatefulWidget { } class _CashierPage extends State { + final TextEditingController editingController = TextEditingController(); + final RefreshController refreshController = RefreshController(); + FocusNode _focusNode = FocusNode(); + bool isKeyBoardShow = false; + BusinessApiService businessService; + String networkError = ""; + int networkStatus = 0; + PhoneQueryMemberInfo phoneQueryMemberInfo; + String cashierOrderId; + String _display = ""; + double _displayTotal = 0; + List manualQueryInfo; + bool isDisplayVipInfo = false; + + + ///离开页面记着销毁和清除 + @override + void dispose() { + super.dispose(); + refreshController.dispose(); + _focusNode.unfocus(); + } @override void initState() { super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) { + setState(() { + print("object: ${MediaQuery.of(context).viewInsets.bottom}"); + if (MediaQuery.of(context).viewInsets.bottom == 0) { + if (isKeyBoardShow) { + isKeyBoardShow = false; + //关闭键盘 软键盘关闭了, 清除输入控件的焦点, 否则重新进入页面会导致软键盘再弹出问题 + FocusScope.of(context).requestFocus(FocusNode()); + } + } else { + isKeyBoardShow = true; + } + }); + }); } + ///根据手机号搜索用户信息 + queryMemberPhoneInfo(phoneNum, {isShow = true}) async { + try { + if (isShow) + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.arguments["storeId"]); + } + BaseData baseData = await businessService + .queryMemberInfo( + {"phoneNum": phoneNum, "isNewUser": false}).catchError((error) { + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; + setState(() {}); + refreshController.refreshFailed(); + refreshController.loadFailed(); + }); + if (!mounted) return; + if (baseData != null && baseData.isSuccess) { + phoneQueryMemberInfo = baseData.data; + refreshController.loadComplete(); + refreshController.refreshCompleted(); + networkStatus = 1; + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + refreshController.refreshFailed(); + refreshController.loadFailed(); + } + } finally { + if (isShow) + EasyLoading.dismiss(); + setState((){}); + } + } + + ///收银台创建直付订单 + cashierCreateOrder(payChannel) async { + try { + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.arguments["storeId"]); + } + BaseData baseData = await businessService.createOrder({ + "createOrderType": "DIRECT",// 创建订单类型 DIRECT 直接下单 ASSIGN 指定商品下单 + "orderAmount": _displayTotal.toStringAsFixed(2), + "virtualProductId":-2, + "mid":phoneQueryMemberInfo?.sid ?? "" + }).catchError((error) { + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; + setState(() {}); + refreshController.refreshFailed(); + refreshController.loadFailed(); + }); + if (!mounted) return; + if (baseData != null && baseData.isSuccess) { + cashierOrderId = baseData.data; + if(payChannel == 1|| payChannel == 2){ + Navigator.of(context).pushNamed( + '/router/scan_code_page', + arguments: { + "storeId": widget.arguments["storeId"], + "scanCodeType": "收银台支付", + "mid":phoneQueryMemberInfo?.sid ??"", + "orderId": cashierOrderId, + "payChannel":payChannel + }).then((value) { + if (value == 1) { + _display = ""; + _displayTotal = 0; + }else{ + manualQueryInfo = value; + showPayQueryDialog(manualQueryInfo[0], manualQueryInfo[1]); + } + }); + }else{ + await cashierPayOrder(cashierOrderId,payChannel,phoneQueryMemberInfo?.sid ?? ""); + } + networkStatus = 1; + setState(() {}); + } + } finally { + EasyLoading.dismiss(); + } + } + + ///支付接口 + cashierPayOrder(orderId, payChannel,mid) async { + try { + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.arguments["storeId"]); + } + BaseData baseData = await businessService.prePayOrder({ + "orderId": orderId, + "payChannel": payChannel, + "mid":mid, + "authCode":(payChannel ==1 || payChannel == 2) ?"": null, + }).catchError((error) { + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; + setState(() {}); + refreshController.refreshFailed(); + refreshController.loadFailed(); + }); + if (!mounted) return; + if (baseData != null && baseData.isSuccess) { + _display = ""; + _displayTotal = 0; + await queryMemberPhoneInfo(editingController?.text ?? "",isShow: false); + SmartDialog.show( + widget: SettlementTips( + () {}, + text: baseData.data ??"", + color: Color(0xFF30415B), + )); + networkStatus = 1; + setState(() {}); + } else { + SmartDialog.show( + widget: SettlementTips( + () {}, + text: baseData.msg, + color: Color(0xFF30415B), + )); + } + } finally { + } + } + + ///手动查询充值订单状态 + manualQueryCashierOrder(orderId) async { + try { + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.arguments["storeId"]); + } + BaseData baseData = await businessService.queryCashierOrder(cashierOrderId,true).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + _display = ""; + _displayTotal = 0; + Navigator.of(context).pop(); + SmartDialog.show( + widget: SettlementTips( + () {}, + text: baseData.data ??"", + color: Color(0xFF30415B), + )); + } else { + if (baseData.msg != "需要用户输入支付密码") Navigator.of(context).pop(); + SmartDialog.show( + widget: SettlementTips( + () {}, + text: baseData.msg, + color: Color(0xFF30415B), + )); + } + } finally { + EasyLoading.dismiss(); + } + } @override Widget build(BuildContext context) { - return Scaffold( - appBar: MyAppBar( - title: "收银", - titleColor: Colors.black, - background: Colors.white, - leadingColor: Colors.black, - brightness: Brightness.dark, + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: Scaffold( + appBar: MyAppBar( + title: "收银", + titleColor: Colors.black, + background: Colors.white, + leadingColor: Colors.black, + brightness: Brightness.dark, + ), + body: Container( + child: SmartRefresher( + enablePullDown: true, + enablePullUp: false, + header: MyHeader( + color: Color(0xFF30415B), + ), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + controller: refreshController, + onRefresh: () { + if(editingController.text != "") + queryMemberPhoneInfo(editingController.text ?? "",isShow: false); + else{ + refreshController.loadComplete(); + refreshController.refreshCompleted(); + } + }, + physics: BouncingScrollPhysics(), + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 19.h, bottom: 13.h), + decoration: BoxDecoration( + color: Colors.white, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(left: 16.w), + child: Text( + "快速收银", + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.bold, + color: Color(0xFF0D0D0D), + ), + ), + ), + Stack( + children: [ + Container( + width: double.infinity, + height: 2.h, + margin: EdgeInsets.only(top: 5.h), + color: Color(0xFFD8D8D8), + ), + Container( + width: 44.w, + height: 1.5.h, + margin: EdgeInsets.only(top: 5.h, left: 24.w), + color: Color(0xFF30415B), + ), + ], + ), + SizedBox( + height: 13.h, + ), + vipUserSearch(), + ], + ), + ), + phoneQueryMemberInfo != null? + vipPlate(): + SizedBox(height:103.h), + calculator() + ], + ), + ), + )), + ), + ); + } + + /// 搜索框 + Widget vipUserSearch() { + return Container( + color: Colors.white, + child: Container( + height: 40.h, + margin: EdgeInsets.only(left: 18.w, right: 18.w), + decoration: BoxDecoration( + color: Color(0xFFF7F8FA), + borderRadius: BorderRadius.circular(2), + ), + child: TextField( + focusNode: _focusNode, + textInputAction: TextInputAction.search, + onEditingComplete: () { + FocusScope.of(context).requestFocus(FocusNode()); + queryMemberPhoneInfo(editingController.text ?? ""); + }, + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF808080), + ), + controller: editingController, + decoration: InputDecoration( + hintText: "请输入会员手机号", + hintStyle: TextStyle( + color: Color(0xFF808080), + fontSize: 15.sp, + fontWeight: MyFontWeight.regular), + contentPadding: EdgeInsets.symmetric( + vertical: 12.h, + ), + prefixIcon: Image.asset( + "assets/image/bs_goods_search.webp", + width: 20, + height: 20, + ), + border: InputBorder.none, + ), + ), + ), + ); + } + + ///会员信息板块 + Widget vipPlate() { + return Container( + width: double.infinity, + margin: EdgeInsets.only(top: 12.h, left: 19.w, right: 13.w), + padding: EdgeInsets.only(bottom: 15.h), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x0F06152E), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ) + ], + borderRadius: BorderRadius.circular(8), ), - body: Column( - crossAxisAlignment: CrossAxisAlignment.center, + child: Column( children: [ Container( width: double.infinity, - margin: EdgeInsets.only(top:8.h, left: 16.w, right: 16.w), - padding: EdgeInsets.only(top:19.h,bottom: 36.h), + padding: EdgeInsets.only(top: 13.h, left: 16.w, bottom: 33.h), + margin: EdgeInsets.only(bottom: 10.h), decoration: BoxDecoration( color: Colors.white, - boxShadow: [ - BoxShadow( - color: Color(0x0F06152E), - offset: Offset(0, 2), - blurRadius: 4, - spreadRadius: 0, + gradient: LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [Color(0xFF30415B), Color(0xFF5171A4)]), + borderRadius: BorderRadius.circular(8), + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 52.h, + height: 52.h, + margin: EdgeInsets.only(right: 15.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + ), + child: Image.asset( + "assets/image/bs_mine_heading.webp", + width: double.infinity, + height: double.infinity, + fit: BoxFit.fill, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 8.h), + child: Text( + "会员名称:${phoneQueryMemberInfo?.nickName ?? ""}", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + )), + Text( + "手机号:${phoneQueryMemberInfo?.phoneNum ?? ""}", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ) + ], ) ], - borderRadius: BorderRadius.circular(8), ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 7.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + "assets/image/bus_vip_balance.webp", + width: 24.h, + height: 24.h, + fit: BoxFit.fill, + ), + Padding( + padding: EdgeInsets.only(left: 7.w), + child: Text( + "会员余额", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF252626), + ), + )) + ], + )), + Text( + "${double.tryParse(phoneQueryMemberInfo?.balance ?? 0)}", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF30415B), + ), + ) + ], + )), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 7.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + "assets/image/bus_coupon.webp", + width: 20.w, + height: 18.h, + fit: BoxFit.fill, + ), + Padding( + padding: EdgeInsets.only(left: 7.w), + child: Text( + "优惠券", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF252626), + ), + )) + ], + )), + Text( + (phoneQueryMemberInfo?.useableConponList?.length ?? 0).toString(), + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF30415B), + ), + ) + ], + )), + ], + ) + ], + ), + ); + } + + ///计算器ui + Widget calculator() { + return Container( + color: Colors.white, + margin: EdgeInsets.only(top: 15.h), + alignment: Alignment.bottomCenter, + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container( + padding: EdgeInsets.symmetric( + vertical: 6.h, + ), + margin: EdgeInsets.only(right: 32.w), + child: Text( + _display, + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.bold, + color: Color(0x4D000000), + ), + ), + ), + Container( + margin: EdgeInsets.only(right: 30.w), + child: Text( + _displayTotal.toStringAsFixed(2), + style: TextStyle( + fontSize: 36.sp, + fontWeight: MyFontWeight.bold, + color: Colors.black, + ), + ), + ), + Container( + color: Color(0xFFD8D8D8), + width: double.infinity, + height: 1.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + buildButton('7'), + buildButton('8'), + buildButton('9'), + Expanded( + flex: 2, + child: GestureDetector( + onTap: () { + setState(() { + _display = ""; + _displayTotal = 0; + }); + }, + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.only(top: 23.h, bottom: 18.h), + decoration: BoxDecoration( + border: Border( + right: BorderSide( + color: Color(0xFFD8D8D8), + width: 1.w, + ), + ), + ), + child: Text( + "C", + style: TextStyle( + fontSize: 32.sp, + fontWeight: MyFontWeight.bold, + color: Color(0xFF30415B), + ), + ), + ), + )) + ], + ), + Container( + color: Color(0xFFD8D8D8), + width: double.infinity, + height: 1.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + buildButton('4'), + buildButton('5'), + buildButton('6'), + Expanded( + flex: 2, + child: GestureDetector( + onTap: () => _onPressed("back"), + child: Container( + alignment: Alignment.center, + decoration: BoxDecoration( + border: Border( + right: BorderSide( + color: Color(0xFFD8D8D8), + width: 1.w, + ), + ), + ), + child: Image.asset( + "assets/image/bus_calculator_enter.webp", + width: 24.w, + height: 16.h, + fit: BoxFit.fill, + ), + ), + )) + ], + ), + Container( + color: Color(0xFFD8D8D8), + width: double.infinity, + height: 1.h, + ), + Row( + children: [ + Expanded( + child: Column( + children: [ + Row( + children: [ + buildButton('1'), + buildButton('2'), + buildButton('3'), + ], + ), + Container( + color: Color(0xFFD8D8D8), + width: double.infinity, + height: 1.h, + ), + Row( + children: [ + buildButton('0', flex: 2), + buildButton('.'), + ], + ), + ], + ), + flex: 3, + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () => _onPressed("+"), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.only(top: 23.h, bottom: 18.h), + decoration: BoxDecoration(), + child: Text( + "+", + style: TextStyle( + fontSize: 32.sp, + fontWeight: MyFontWeight.bold, + color: Color(0xFF30415B), + ), + ), + ), + ), + flex: 2, + ), + ], + ), + Row( + children: [ + Expanded( + flex: 2, + child: Container( + alignment: Alignment.center, + color: Color(0xFF5A7092), + padding: EdgeInsets.only(top: 32.h, bottom: 33.h), + child: Text( + "¥${_displayTotal.toStringAsFixed(2)}", + style: TextStyle( + fontSize: 24.sp, + fontWeight: MyFontWeight.bold, + color: Colors.white, + ), + ), + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + if(_displayTotal.toStringAsFixed(2) == "0.00"){ + SmartDialog.show( + widget: SettlementTips( + () {}, + text:"订单支付金额小于或等于0,无法进行支付操作", + color: Color(0xFF30415B), + )); + }else{ + if(phoneQueryMemberInfo != null){ + showPaySelectDialog(); + }else { + SmartDialog.show( + widget: SettlementTips( + () {}, + text:"请输入会员手机号进行结账", + color: Color(0xFF30415B), + )); + } + } + + }, + child: Container( + alignment: Alignment.center, + color: Color(0xFF30415B), + padding: EdgeInsets.only( + top: 22.h, bottom: 25.h, left: 45.w, right: 33.w), + child: Text( + "结账", + style: TextStyle( + fontSize: 36.sp, + fontWeight: MyFontWeight.bold, + color: Colors.white, + ), + ), + )), + ], ) ], ), ); } + + ///计算器文本 + Widget buildButton(String text, {int flex = 1}) { + return Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.only(top: 23.h, bottom: 18.h), + decoration: BoxDecoration( + border: Border( + right: BorderSide( + color: Color(0xFFD8D8D8), + width: 1.w, + ), + ), + ), + child: Text( + text, + style: TextStyle( + fontSize: 32.sp, + fontWeight: MyFontWeight.bold, + color: Color(0xD9000000), + ), + ), + ), + onTap: () => _onPressed(text), + ), + flex: flex, + ); + } + + ///计算器点击事件的处理 + void _onPressed(String button) { + setState(() { + FocusScope.of(context).requestFocus(FocusNode()); + int addIndex = _display.lastIndexOf("+") + 1; + String rStr = _display.substring(addIndex); + if (button == "+" || button == ".") { + if (_display.isEmpty || + _display.endsWith(".") || + _display.endsWith("+")) { + return; + } + if (button == ".") { + if (rStr.contains(".")) return; + } + } else if (button == "0") { + if (rStr == "0") return; + } else { + if (rStr == "0") { + _display = _display.substring(0, _display.length - 1); + } + } + if (button == "back") { + // 回删一个数值 + if (_display.length > 0) + _display = _display.substring(0, _display.length - 1); + } else { + _display += button; + } + _displayTotal = 0; + var tempNumArr = _display.split("+"); + tempNumArr.forEach((element) { + _displayTotal += double.parse(element); + }); + }); + } + + ///支付选项 + showPaySelectDialog() { + showModalBottomSheet( + context: context, + backgroundColor: Colors.transparent, + builder: (context) { + return Container( + width: double.infinity, + height: 280.h, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), + ), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Container( + alignment: Alignment.center, + margin: EdgeInsets.only(top: 12.h,bottom: 12.h,left: 41.w), + child: Text( + S.of(context).zhifufangshi, + style: TextStyle( + fontWeight: MyFontWeight.bold, + fontSize: 17.sp, + color: Color(0xFF1A1A1A), + ), + ), + )), + GestureDetector( + onTap: () { + setState(() { + Navigator.of(context).pop(); + }); + }, + child: Padding( + padding: EdgeInsets.only(right: 16.w), + child: Image.asset( + "assets/image/cancel.webp", + width: 25.h, + height: 25.h, + ), + ), + ), + ], + ), + Padding( + padding: EdgeInsets.only(left: 23.w,right: 9.w), + child:Column( + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap:(){ + Navigator.of(context).pop(); + showPayAmountDialog(0,"现金"); + }, + child: Padding(padding:EdgeInsets.only(left: 5.w), + child: Row( + children: [ + Image.asset( + "assets/image/bus_cashier_xj.webp", + width: 31.w, + height: 22.h, + ), + Padding( + padding: EdgeInsets.only(left: 14.w), + child: Text( + "现金支付", + textAlign: TextAlign.center, + style: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + )) + ], + ),), + ), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFEBEBEB), + margin: EdgeInsets.symmetric(vertical:13.h), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap:(){ + Navigator.of(context).pop(); + showPayAmountDialog(1,"微信");}, + child: Padding(padding:EdgeInsets.only(left: 5.w), + child: Row( + children: [ + Image.asset( + "assets/image/bus_vip_wx.webp", + width: 29.w, + height: 26.h, + ), + Padding( + padding: EdgeInsets.only(left: 14.w), + child: Text( + "微信", + textAlign: TextAlign.center, + style: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + )) + ], + ),)), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFEBEBEB), + margin: EdgeInsets.symmetric(vertical:13.h), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap:(){ + Navigator.of(context).pop(); + showPayAmountDialog(2,"支付宝");}, + child: Padding(padding:EdgeInsets.only(left: 5.w), + child: Row( + children: [ + Image.asset( + "assets/image/bus_vip_alipay.webp", + width: 29.h, + height: 29.h, + ), + Padding( + padding: EdgeInsets.only(left: 14.w), + child: Text( + "支付宝", + textAlign: TextAlign.center, + style: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + )) + ], + ),)), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFEBEBEB), + margin: EdgeInsets.symmetric(vertical:13.h), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap:(){ + Navigator.of(context).pop(); + showPayAmountDialog(3,"商户余额");}, + child: Padding(padding:EdgeInsets.only(left: 5.w), + child: Row( + children: [ + Image.asset( + "assets/image/bus_cashier_balance.webp", + width: 27.h, + height: 27.h, + ), + Padding( + padding: EdgeInsets.only(left: 14.w), + child: Text( + "商户余额", + textAlign: TextAlign.center, + style: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + )) + ], + ),)), + // Container( + // width: double.infinity, + // height: 1.h, + // color: Color(0xFFEBEBEB), + // margin: EdgeInsets.symmetric(vertical:13.h), + // ), + // GestureDetector( + // behavior: HitTestBehavior.opaque, + // onTap:(){ + // Navigator.of(context).pop(); + // showPayAmountDialog(4,"平台余额");}, + // child: Padding(padding:EdgeInsets.only(left: 5.w), + // child: Row( + // children: [ + // Image.asset( + // "assets/image/bus_cashier_pt.webp", + // width: 27.h, + // height: 27.h, + // ), + // Padding( + // padding: EdgeInsets.only(left: 14.w), + // child: Text( + // "平台余额", + // textAlign: TextAlign.center, + // style: TextStyle( + // color: Color(0xFF1A1A1A), + // fontSize: 14.sp, + // fontWeight: MyFontWeight.regular, + // ), + // )) + // ], + // ),)), + ], + ), + ) + ], + ), + ); + }); + } + + ///确认支付金额提示 + showPayAmountDialog(index,payText) { + showDialog( + context: context, + builder: (context) { + return AlertDialog( + content: Container( + width: MediaQuery.of(context).size.width - 84.w, + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "此操作将进行金额支付,请确认支付金额及支付方式是否正确?", + style: TextStyle( + color: Color(0xFFF4524D), + fontSize: 16.sp, + fontWeight: MyFontWeight.regular, + ), + ), + SizedBox( + height: 15.h, + ), + Text( + "支付方式: ${payText}", + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 16.sp, + fontWeight: MyFontWeight.regular, + ), + ), + SizedBox( + height:10.h, + ), + Text( + "支付金额: ${_displayTotal.toStringAsFixed(2)}元", + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 16.sp, + fontWeight: MyFontWeight.regular, + ), + ), + SizedBox( + height: 35.h, + ), + Row( + children: [ + Expanded( + child: InkWell( + child: BorderText( + text: S.of(context).quxiao, + textColor: Color(0xFF30415B), + fontSize: 16.sp, + fontWeight: FontWeight.bold, + borderColor: Color(0xFF30415B), + radius: 4, + padding: EdgeInsets.all(12), + borderWidth: 1, + ), + onTap: () { + Navigator.of(context).pop(); + }, + ), + flex: 1, + ), + SizedBox( + width: 16.w, + ), + Expanded( + child: InkWell( + child: RoundButton( + text: S.of(context).queren, + textColor: Colors.white, + radius: 4, + padding: EdgeInsets.all(12), + backgroup: Color(0xFF30415B), + fontSize: 16.sp, + fontWeight: FontWeight.bold, + ), + onTap: () { + setState(() { + Navigator.of(context).pop(); + cashierCreateOrder(index); + }); + }, + ), + flex: 1, + ), + ], + ) + ], + ), + ), + ); + }, + ); + } + + ///手动查询弹窗 + showPayQueryDialog(String queryDialog, String orderId) { + showDialog( + context: context, + barrierDismissible: false, + builder: (context) { + return AlertDialog( + contentPadding: EdgeInsets.all(0), + content: Container( + width: MediaQuery.of(context).size.width - 80, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + alignment: Alignment.topRight, + padding: + EdgeInsets.symmetric(horizontal: 5.w, vertical: 10.h), + child: Image.asset( + "assets/image/cancel.webp", + width: 24.h, + height: 24.h, + )), + ), + Padding( + padding: + EdgeInsets.only(bottom: 20.h, left: 14.w, right: 14.w), + child: Text( + queryDialog, + style: TextStyle( + color: Colors.black, + fontSize: 16.sp, + fontWeight: MyFontWeight.bold, + ), + ), + ), + Padding( + padding: + EdgeInsets.only(bottom: 20.h, left: 14.w, right: 14.w), + child: Text.rich( + TextSpan( + children: [ + TextSpan( + text: "*", + style: TextStyle( + color: Color(0xFFFA5151), + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + ), + TextSpan( + text: "请确认用户支付成功后再点击手动查询", + style: TextStyle( + color: Color(0xFFFA5151), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + ), + TextSpan( + text: "*", + style: TextStyle( + color: Color(0xFFFA5151), + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + ), + TextSpan( + text: "\n*", + style: TextStyle( + color: Colors.blue, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + ), + TextSpan( + text: "订单查询成功后可关闭当前弹窗", + style: TextStyle( + color: Colors.blue, + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + ), + TextSpan( + text: "*", + style: TextStyle( + color: Colors.blue, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + ), + ], + ), + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + manualQueryCashierOrder(orderId); + }, + child: Container( + decoration: BoxDecoration( + color: Color(0xFF30415B), + borderRadius: BorderRadius.circular(4), + ), + padding: EdgeInsets.symmetric( + horizontal: 26.w, vertical: 10.h), + margin: EdgeInsets.only(right: 8.w, bottom: 20.h), + child: Text( + "手动查询", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + )), + ], + ), + ), + ); + }, + ); + } } diff --git a/lib/business_system/home/consumer_ranking_page.dart b/lib/business_system/home/consumer_ranking_page.dart index 87cca153..761ef4c6 100644 --- a/lib/business_system/home/consumer_ranking_page.dart +++ b/lib/business_system/home/consumer_ranking_page.dart @@ -13,6 +13,7 @@ import '../../generated/l10n.dart'; import '../../retrofit/business_api.dart'; import '../../retrofit/data/balance_consumption_ranking_list.dart'; import '../../retrofit/data/base_data.dart'; +import '../../retrofit/data/store_total_money_info.dart'; import '../../utils/business_instance.dart'; import '../../utils/flutter_utils.dart'; import '../../view_widget/classic_header.dart'; @@ -44,12 +45,28 @@ class _ConsumerRankingPage extends State { String networkError = ""; int networkStatus = 0; List records = []; + StoreTotalMoneyInfo storeTotalMoneyInfo; int _pageNum = 1; String total = "0"; + int _loadCount = 0; @override void initState() { super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) { + setState(() { + print("object: ${MediaQuery.of(context).viewInsets.bottom}"); + if (MediaQuery.of(context).viewInsets.bottom == 0) { + if (isKeyBoardShow) { + isKeyBoardShow = false; + //关闭键盘 软键盘关闭了, 清除输入控件的焦点, 否则重新进入页面会导致软键盘再弹出问题 + FocusScope.of(context).requestFocus(FocusNode()); + } + } else { + isKeyBoardShow = true; + } + }); + }); titleName = widget?.arguments["titleName"] ?? ""; _onRefresh(); } @@ -67,15 +84,28 @@ class _ConsumerRankingPage extends State { EasyLoading.show( status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); - await queryStoreMoney(); - EasyLoading.dismiss(); - if (refreshController.isRefresh) refreshController.refreshCompleted(); - if (mounted) setState(() {}); + queryStoreMoney(isRefresh:false); + queryStoreTotalMoney(); + } + + + addLoadCount() { + _loadCount += 1; + if (_loadCount == 2) { + _loadCount = 0; + EasyLoading.dismiss(); + if (refreshController.isRefresh) refreshController.refreshCompleted(); + if (mounted) setState(() {}); + } } ///查询会员余额统计/消费排名 - queryStoreMoney({nickName,isShow = true}) async { + queryStoreMoney({keyword,isRefresh = true}) async { try { + if (isRefresh) + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); if (businessService == null) { businessService = BusinessApiService(Dio(), context: context, @@ -84,9 +114,9 @@ class _ConsumerRankingPage extends State { storeId: widget.arguments["storeId"]); } BaseData baseData = await businessService.storeMoney({ - "startTime": titleName == "消费排名" ? selectTimeDateNum.substring(0,19):"", - "endTime": titleName == "消费排名" ? selectTimeDateNum.substring(24,43):"", - "nickName": titleName == "消费排名" ? "" : nickName, + "startTime": titleName == "消费排名" ? (selectTimeDate != ""?selectTimeDate.replaceAll("年", "-").replaceAll("月", "-").replaceAll("日", "").substring(0,19):selectTimeDateNum.substring(0,19)):"", + "endTime": titleName == "消费排名" ? (selectTimeDate!=""?selectTimeDate.replaceAll("年", "-").replaceAll("月", "-").replaceAll("日", "").substring(22,41):selectTimeDateNum.substring(24,43)):"", + "keyword": titleName == "消费排名" ? "" : (keyword ?? ""), "type":titleName == "消费排名" ? 1:0, "pageNum": _pageNum, "pageSize": 10, @@ -100,24 +130,56 @@ class _ConsumerRankingPage extends State { if (!mounted) return; if (baseData != null && baseData.isSuccess) { records.addAll(baseData?.data?.records ?? []); - total = baseData?.data?.total ?? "0"; if ((baseData?.data?.records ?? []).isEmpty || records.length.toString() == baseData.data.pages) refreshController.loadNoData(); else refreshController.loadComplete(); networkStatus = 1; - } else { - SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } } finally { - if (isShow) setState(() {}); + if(isRefresh){ + setState(() {}); + EasyLoading.dismiss(); + }else + addLoadCount(); + } + } + + ///会员余额统计(总会员数,总余额数)查询/消费排名(消费会员数量,销售金额)查询 + queryStoreTotalMoney({keyword}) async { + try { + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.arguments["storeId"]); + } + BaseData baseData = await businessService.storeTotalMoney({ + "startTime": titleName == "消费排名" ? selectTimeDateNum.substring(0,19):"", + "endTime": titleName == "消费排名" ? selectTimeDateNum.substring(24,43):"", + }).catchError((error) { + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; + setState(() {}); + refreshController.refreshFailed(); + refreshController.loadFailed(); + }); + if (!mounted) return; + if (baseData != null && baseData.isSuccess) { + storeTotalMoneyInfo = baseData.data; + networkStatus = 1; + } + } finally { + addLoadCount(); } } @override Widget build(BuildContext context) { return Scaffold( + resizeToAvoidBottomInset: false, appBar: MyAppBar( title: titleName, titleColor: Colors.black, @@ -147,7 +209,7 @@ class _ConsumerRankingPage extends State { }, onLoading: () { _pageNum++; - _onRefresh(isShowLoad: false); + queryStoreMoney(); }, physics: BouncingScrollPhysics(), scrollController: ScrollController(), @@ -183,7 +245,7 @@ class _ConsumerRankingPage extends State { ), ), Text( - total, + (storeTotalMoneyInfo?.paySumCount ?? 0).toString(), style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.bold, @@ -207,7 +269,7 @@ class _ConsumerRankingPage extends State { ), ), Text( - "12334.00", + storeTotalMoneyInfo?.storeTotalMoney ?? "0", style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.bold, @@ -236,7 +298,7 @@ class _ConsumerRankingPage extends State { ), ), Text( - total, + (storeTotalMoneyInfo?.memberCount ?? 0).toString(), style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.bold, @@ -260,7 +322,7 @@ class _ConsumerRankingPage extends State { ), ), Text( - "12334.00", + storeTotalMoneyInfo?.memberTotalBalance ?? "0", style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.bold, @@ -293,7 +355,7 @@ class _ConsumerRankingPage extends State { ? NoDataView( src: "assets/image/bs_no data_logo.webp", isShowBtn: false, - text: "暂无商品分类", + text: "暂无相关数据", fontSize: 16.sp, margin: EdgeInsets.all(20.h), ) @@ -329,7 +391,7 @@ class _ConsumerRankingPage extends State { Navigator.of(context).pushNamed('/router/custom_page', arguments: {"beyondDateRange": "0"}).then((value) { selectTimeDate = value; - setState((){}); + queryStoreMoney(); }); }, child: Container( @@ -377,7 +439,8 @@ class _ConsumerRankingPage extends State { textInputAction: TextInputAction.search, onEditingComplete: () { FocusScope.of(context).requestFocus(FocusNode()); - queryStoreMoney(nickName: editingController?.text ?? ""); + records.clear(); + queryStoreMoney(keyword: editingController?.text ?? ""); }, style: TextStyle( fontSize: 15.sp, @@ -429,7 +492,7 @@ class _ConsumerRankingPage extends State { Padding( padding: EdgeInsets.only(bottom: 16.h), child: Text( - "${records?.name ?? ""}(${records?.phone})", + "${records?.name ?? ""}(${records?.phone})", style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.bold, diff --git a/lib/business_system/home/overview/trade_overview_page.dart b/lib/business_system/home/overview/trade_overview_page.dart index c5035d9e..65cce994 100644 --- a/lib/business_system/home/overview/trade_overview_page.dart +++ b/lib/business_system/home/overview/trade_overview_page.dart @@ -23,11 +23,14 @@ class TradeOverviewPage extends StatefulWidget { class _TradeOverviewPage extends State with SingleTickerProviderStateMixin{ final RefreshController refreshController = RefreshController(); String storeId; + TabController tabController; @override void initState() { super.initState(); storeId = widget?.arguments["storeId"] ??""; + tabController = TabController( + length: 3, vsync: this, initialIndex: widget?.arguments["index"]??0); } @override @@ -55,7 +58,7 @@ class _TradeOverviewPage extends State with SingleTickerProvi fontWeight: FontWeight.normal, color: Color(0xFF666666) ), - // controller: tabController, + controller: tabController, //未选中文字颜色 unselectedLabelColor: Color(0xffA29E9E), indicatorSize: TabBarIndicatorSize.label, diff --git a/lib/business_system/home/vip/business_vip_page.dart b/lib/business_system/home/vip/business_vip_page.dart index cb37896a..97a6189a 100644 --- a/lib/business_system/home/vip/business_vip_page.dart +++ b/lib/business_system/home/vip/business_vip_page.dart @@ -28,7 +28,7 @@ class _BusinessVipPage extends State @override void initState() { super.initState(); - tabController = TabController(length: 3, vsync: this); + tabController = TabController(length: 3, vsync: this, initialIndex: widget?.arguments["index"] ?? 0); tabController.addListener(() { if (!tabController.indexIsChanging) { setState(() {}); diff --git a/lib/business_system/home/vip/vip_recharge_page.dart b/lib/business_system/home/vip/vip_recharge_page.dart index 9ecdb0f0..43f9bdd3 100644 --- a/lib/business_system/home/vip/vip_recharge_page.dart +++ b/lib/business_system/home/vip/vip_recharge_page.dart @@ -410,7 +410,7 @@ class _VipRechargePage extends State { rechargeList(), ///选择充值的套餐 - if (networkStatus == 1) + if (networkStatus == 1 && records.length > 0) Container( decoration: BoxDecoration( color: Colors.white, @@ -840,7 +840,7 @@ class _VipRechargePage extends State { '/router/scan_code_page', arguments: { "storeId": widget.arguments["storeId"], - "scanCodeType": "支付", + "scanCodeType": "充值支付", "rechargePreferentialId": records[selectIndex]?.id ?? "", "memberSourceId": @@ -1012,7 +1012,7 @@ class _VipRechargePage extends State { child: (records != null && (records?.length ?? 0) > 0) ? ListView.builder( padding: EdgeInsets.zero, - itemCount: records.length ?? 0, + itemCount: records?.length ?? 0, scrollDirection: Axis.vertical, shrinkWrap: true, physics: BouncingScrollPhysics(), diff --git a/lib/business_system/mine/business_mine_page.dart b/lib/business_system/mine/business_mine_page.dart index 785cc8fc..8581d97e 100644 --- a/lib/business_system/mine/business_mine_page.dart +++ b/lib/business_system/mine/business_mine_page.dart @@ -277,8 +277,9 @@ class _BusinessMinePage extends State GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { - Navigator.of(context).pushNamed('/router/shop_reservation_code', - arguments: {"storeId": widget.storeId,}); + // Navigator.of(context).pushNamed('/router/shop_reservation_code', + // arguments: {"storeId": widget.storeId,}); + SmartDialog.showToast("该功能暂未开放!", alignment: Alignment.center); }, child: commonFunctionsItem( "assets/image/bs_mine_code.webp", "门店预约二维码", "",18,18), diff --git a/lib/business_system/scan_code_page.dart b/lib/business_system/scan_code_page.dart index 2fba9600..8273bc7e 100644 --- a/lib/business_system/scan_code_page.dart +++ b/lib/business_system/scan_code_page.dart @@ -101,6 +101,39 @@ class _ScanCodePage extends State { } } + ///收银台支付 + cashierPay(authCode) async { + try{ + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.arguments["storeId"]); + } + BaseData baseData = await businessService.prePayOrder({ + "orderId": widget?.arguments["orderId"] ?? "", + "payChannel": widget?.arguments["payChannel"] ?? "", + "mid":widget?.arguments["mid"] ?? "", + "authCode": authCode ?? null + }).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + Navigator.of(context).pop(1); + SmartDialog.show( + widget: SettlementTips( + () {}, + text: baseData.data, + color: Color(0xFF30415B), + )); + } else { + Navigator.of(context).pop([baseData.msg,baseData.data]); + }}finally{ + EasyLoading.dismiss(); + } + } @override Widget build(BuildContext context) { @@ -121,7 +154,11 @@ class _ScanCodePage extends State { widget.arguments["scanCodeType"] == null) { queryTicketDetails(data); } else { - rechargePay(data); + if(widget.arguments["scanCodeType"] == "充值支付"){ + rechargePay(data); + }else{ + cashierPay(data); + } } }, ), diff --git a/lib/retrofit/business_api.dart b/lib/retrofit/business_api.dart index 55adaf4d..0b4aeadb 100644 --- a/lib/retrofit/business_api.dart +++ b/lib/retrofit/business_api.dart @@ -33,6 +33,7 @@ import 'data/recharge_flow_list.dart'; import 'data/refund_reason_list.dart'; import 'data/single_sales_list.dart'; import 'data/store_time_info_list.dart'; +import 'data/store_total_money_info.dart'; import 'data/ticket_details.dart'; import 'data/ticket_record.dart'; import 'data/ticket_show.dart'; @@ -325,7 +326,7 @@ abstract class BusinessApiService { @POST("member/posMemberRecharge") Future posMemberRecharge(@Body() Map param); - ///充值订单查询 + ///充值订单手动查询 @POST("member/manualQuery") Future manualQuery(@Body() Map param); @@ -353,4 +354,20 @@ abstract class BusinessApiService { @POST("dashBoard/storeMoney") Future> storeMoney(@Body() Map param); + ///会员余额统计(总会员数,总余额数)查询/消费排名(消费会员数量,销售金额)查询 + @POST("dashBoard/storeTotalMoney") + Future> storeTotalMoney(@Body() Map param); + + ///收银台创建直付订单 + @POST("order/createOrder") + Future createOrder(@Body() Map param); + + ///收银台支付 + @POST("order/prePayOrder") + Future prePayOrder(@Body() Map param); + + ///收银台直付订单手动查询 + @POST("order/queryOrder/{orderId}?login={login}") + Future queryCashierOrder(@Path("orderId") String orderId,@Path("login") bool login); + } diff --git a/lib/retrofit/business_api.g.dart b/lib/retrofit/business_api.g.dart index 124e27a4..3a621c82 100644 --- a/lib/retrofit/business_api.g.dart +++ b/lib/retrofit/business_api.g.dart @@ -1076,4 +1076,91 @@ class _BusinessApiService implements BusinessApiService { return value; } + @override + Future> storeTotalMoney(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'dashBoard/storeTotalMoney', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => (json ?? "") == "" ? null : StoreTotalMoneyInfo.fromJson(json), + ); + return value; + } + + @override + Future createOrder(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _result = await _dio.request>( + 'order/createOrder', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: param); + final value = BaseData.fromJson( + _result.data, + (json) => (json ?? "") == "" ? null : json, + ); + return value; + } + + @override + Future prePayOrder(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _result = await _dio.request>( + 'order/prePayOrder', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: param); + final value = BaseData.fromJson( + _result.data, + (json) => (json ?? "") == "" ? null : json, + ); + return value; + } + + @override + Future> queryCashierOrder(orderId,login) async { + ArgumentError.checkNotNull(orderId, 'orderId'); + ArgumentError.checkNotNull(login, 'login'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>('order/queryOrder/$orderId?login=$login', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, + ); + return value; + } + } diff --git a/lib/retrofit/data/phone_query_member_info.dart b/lib/retrofit/data/phone_query_member_info.dart index 33e57cec..30df614c 100644 --- a/lib/retrofit/data/phone_query_member_info.dart +++ b/lib/retrofit/data/phone_query_member_info.dart @@ -1,16 +1,19 @@ /// mid : "1379254113602109440" -/// sid : "1706504181134655488" +/// sid : "1659496253991419904" /// phoneNum : "13052919193" /// nickName : "" /// headimg : "" /// sex : "0" /// balance : "0.00" +/// realBalance : "0.00" +/// giftBalance : "0.00" /// memberSourceCredit : false /// money : "1.49" /// memberCredit : false /// greenMoney : "0.00" /// raiseMoney : "0.00" /// payPassword : "222222" +/// useableConponList : [{"id":"1730867009651998720","storeIds":["1333246101343436800","1432164681279078400","1665555596536971264"],"stores":[],"bizType":2,"fullType":"TOTAL_FULL","fullAmount":"0.00","discountAmount":"0.00","fullNumber":2,"dateOrDay":true,"startAfterDays":0,"daysValidate":3,"discountPercent":68,"limitAmount":"0.00","bizId":"","publishStartTime":"2023-05-05","publishEndTime":"2023-12-31","useStartTime":"2023-12-02 16:30:28","useEndTime":"2023-12-05 16:30:28","doStartTime":"00:00","doEndTime":"23:59","promotionId":"0","couponId":"1654409900576473088","receiveTime":"2023-12-02","useTime":null,"status":1,"tenantCode":"admin","type":2,"promotionName":"双杯优享6.8折(海峡姐妹)","usable":false,"usableReason":"不在可使用时间内,本券须在领取0天后,3天内使用","allProduct":false,"productSkuId":[],"productGroupIds":["1433971071249285120","1433971071266062336","1433971071287033856","1433971071303811072","1433971071316393984","1433972467273039872","1435141914704740352","1524320958125441024","1552172579970613248","1668105881067192320","1668134716433235968","1668134867440762880","1668134955919605760","1668135085221609472","1668135269255086080","1425708380399337472","1426064940447301632","1426067376096411648","1426095795836289024","1522572290481455104","1522572604823568384","1524327158112059392","1601821884305899520","1668135150308818944","1678291351080271872"],"productList":null,"isMaxCoupon":false,"productGroupList":[],"remark":"

1.本券自领取日起3天有效。
2.本券仅用于海峡姐妹饮品,一次性购买满2杯使用。
3.本券不可与其他活动同享。

","canUseBalance":true},{"id":"1738109465292439552","storeIds":["1432164681279078400"],"stores":[],"bizType":6,"fullType":"EACH_FULL","fullAmount":"0.00","discountAmount":"0.00","fullNumber":1,"dateOrDay":true,"startAfterDays":0,"daysValidate":90,"discountPercent":0,"limitAmount":"0.00","bizId":"","publishStartTime":"2023-08-28","publishEndTime":"2025-08-31","useStartTime":"2023-12-22 16:09:24","useEndTime":"2024-03-21 16:09:24","doStartTime":"00:00","doEndTime":"23:59","promotionId":"0","couponId":"1695995932824305664","receiveTime":"2023-12-22","useTime":null,"status":1,"tenantCode":"admin","type":6,"promotionName":"茶饮畅饮券","usable":false,"usableReason":null,"allProduct":false,"productSkuId":[],"productGroupIds":["1433971071249285120","1433971071266062336","1433971071287033856","1433971071303811072","1433972467273039872","1434859128668291072","1435141914704740352","1524320958125441024","1552172579970613248"],"productList":null,"isMaxCoupon":false,"productGroupList":[],"remark":"

1.本券仅作为有奖兑换凭证,不可转赠,不可兑换现金;
2.请在有效期内使用该券,逾期作废;
3.本券一次性核销。

","canUseBalance":true},{"id":"1739525906998755328","storeIds":["1432164681279078400"],"stores":[],"bizType":6,"fullType":"EACH_FULL","fullAmount":"0.00","discountAmount":"0.00","fullNumber":1,"dateOrDay":true,"startAfterDays":0,"daysValidate":90,"discountPercent":0,"limitAmount":"0.00","bizId":"","publishStartTime":"2023-08-28","publishEndTime":"2025-08-31","useStartTime":"2023-12-26 13:57:50","useEndTime":"2024-03-25 13:57:50","doStartTime":"00:00","doEndTime":"23:59","promotionId":"0","couponId":"1695995932824305664","receiveTime":"2023-12-26","useTime":null,"status":1,"tenantCode":"admin","type":6,"promotionName":"茶饮畅饮券","usable":false,"usableReason":null,"allProduct":false,"productSkuId":[],"productGroupIds":["1433971071249285120","1433971071266062336","1433971071287033856","1433971071303811072","1433972467273039872","1434859128668291072","1435141914704740352","1524320958125441024","1552172579970613248"],"productList":null,"isMaxCoupon":false,"productGroupList":[],"remark":"

1.本券仅作为有奖兑换凭证,不可转赠,不可兑换现金;
2.请在有效期内使用该券,逾期作废;
3.本券一次性核销。

","canUseBalance":true},{"id":"1739947698053709824","storeIds":["1627869775969386496"],"stores":[{"id":"1627869775969386496","createTime":"2023-02-21 11:16:14","createUser":"1","updateTime":"2023-02-21 11:16:14","updateUser":"1","tenantCode":"1193","useErp":false,"openStartTime":"08:00:00","openEndTime":"21:15:00","storeName":"海峡姐妹茶膳坊","nickName":"","logo":"https://pos.upload.lotus-wallet.com/1193/2023/05/335470b8-557e-4809-92b3-c8050f98bb7f.png","facade":"https://pos.upload.lotus-wallet.com/1193/2023/05/f4e502de-d3af-4524-962a-d588733f0b1b.jpg","shipAddress":null,"remark":"","mobile":"18696193737","longitude":"116.4273410000","latitude":"39.9028420000","refundAddress":"北京市东城区毛家湾胡同甲13号北京站第八候车室西侧第一跨2-8-1B","refundTel":null,"refundContact":null,"isAutoSendRefundAddress":1,"province":"北京","city":"北京","district":"东城区","address":"北京市东城区毛家湾胡同甲13号北京站第八候车室西侧第一跨2-8-1B","headName":"","headMobile":"","tel":"18696193737","businessService":"","businessType":"","deliveryInfo":null,"pickupType":{"dineInTakeStatus":true,"takeawayStatus":false,"expressDeliveryStatus":false},"miniParam":{"mini_program_app_id":"wx8f3ce8f059abff52","mini_program_secret":"40a7eb06bb1eb537a2faf094baa787e1","mini_mch_id":"","mini_sub_mch_id":"1639906514","is_sub_app":true,"sub_app_id":"wx8f3ce8f059abff52","mini_mch_key":"e10adc3949ba59abbe56e057f20f883e","mini_key_path":"","mini_key_sn_no":"","mini_key_cert_path":"","mini_key_key_path":""},"alipayParam":{"appid":"","privateKey":"","alipayPublicKey":"","alipayPid":"2088541867845156","appAuthToken":"202303BBbcba1639502a4d1c8e1c67e209b71D15"},"setting":{"speakerKey":"","speakerSn":"zsw03","printUsername":"","printUserPwd":"","tagWidth":null,"tagHeight":null},"refundApprover":null,"enableRefundApprover":null,"tableFee":{"merchant_table_price":"","per_capita_consumption":"30","pay_set":["0","1","2","3","4"]},"money":"1502.00","platformShow":true,"subMchId":"","serviceType":"EATSTORE","isEnable":true,"is_delete":0,"sort":0,"profitSharing":{"type":"manual","mchName":"","mchCode":"","ratio":0},"autoSetting":{"use_auto_open":false,"use_finish_order":true,"use_flow_auto_open":true,"use_flow_finish_order":false},"posType":{"desc":"快消餐饮","code":"FASTSTORE"}}],"bizType":2,"fullType":"TOTAL_FULL","fullAmount":"0.00","discountAmount":"0.00","fullNumber":1,"dateOrDay":false,"startAfterDays":0,"daysValidate":0,"discountPercent":80,"limitAmount":"0.00","bizId":"","publishStartTime":"2023-12-26","publishEndTime":"2023-12-28","useStartTime":"2023-12-26 00:00:00","useEndTime":"2023-12-30 00:00:00","doStartTime":"00:00","doEndTime":"23:59","promotionId":"0","couponId":"1739593476279894016","receiveTime":"2023-12-27","useTime":null,"status":1,"tenantCode":"1193","type":2,"promotionName":"素燥饭八折券","usable":false,"usableReason":null,"allProduct":false,"productSkuId":["1647843685146034176"],"productGroupIds":[],"productList":[{"id":"1647843685146034176","createTime":"2023-04-17 14:05:25","createUser":"1627869775885500416","updateTime":"2023-06-21 13:02:44","updateUser":"1627869775885500416","supplierName":"茶膳坊","storeId":"1627869775969386496","categoryId":"1300687829071822848","groupId":"1646761808653975552","shortName":"主食搭配贡丸汤,美味又营养","productName":"素燥饭套餐","sellDesc":"","attribute":null,"productCode":"PRO202304171405240000000000003","weight":"0","applyPrice":"42.00","price":"42.00","vipPrice":"42.00","stock":991,"sellCount":1032,"needLogistics":1,"oversold":0,"organic":0,"status":1,"posShow":true,"subscribeParam":null,"isRaise":false,"productType":0,"productNumber":1,"setMeal":1,"attrStyle":0,"detail":"","isDelete":0,"printerFlag":"DEFAULT","materials":null,"materialId":null,"details":"","thumbnailImg":"","info":"","buyCount":-53,"sellCountLimit":0,"stockRecoveryTime":"00:00:00","isAddPurchase":null,"limitNum":0,"rankId":"0","happyBean":0,"sort":0,"salesRules":null}],"isMaxCoupon":false,"productGroupList":null,"remark":"

111

","canUseBalance":true},{"id":"1739947724452659200","storeIds":["1627869775969386496"],"stores":[{"id":"1627869775969386496","createTime":"2023-02-21 11:16:14","createUser":"1","updateTime":"2023-02-21 11:16:14","updateUser":"1","tenantCode":"1193","useErp":false,"openStartTime":"08:00:00","openEndTime":"21:15:00","storeName":"海峡姐妹茶膳坊","nickName":"","logo":"https://pos.upload.lotus-wallet.com/1193/2023/05/335470b8-557e-4809-92b3-c8050f98bb7f.png","facade":"https://pos.upload.lotus-wallet.com/1193/2023/05/f4e502de-d3af-4524-962a-d588733f0b1b.jpg","shipAddress":null,"remark":"","mobile":"18696193737","longitude":"116.4273410000","latitude":"39.9028420000","refundAddress":"北京市东城区毛家湾胡同甲13号北京站第八候车室西侧第一跨2-8-1B","refundTel":null,"refundContact":null,"isAutoSendRefundAddress":1,"province":"北京","city":"北京","district":"东城区","address":"北京市东城区毛家湾胡同甲13号北京站第八候车室西侧第一跨2-8-1B","headName":"","headMobile":"","tel":"18696193737","businessService":"","businessType":"","deliveryInfo":null,"pickupType":{"dineInTakeStatus":true,"takeawayStatus":false,"expressDeliveryStatus":false},"miniParam":{"mini_program_app_id":"wx8f3ce8f059abff52","mini_program_secret":"40a7eb06bb1eb537a2faf094baa787e1","mini_mch_id":"","mini_sub_mch_id":"1639906514","is_sub_app":true,"sub_app_id":"wx8f3ce8f059abff52","mini_mch_key":"e10adc3949ba59abbe56e057f20f883e","mini_key_path":"","mini_key_sn_no":"","mini_key_cert_path":"","mini_key_key_path":""},"alipayParam":{"appid":"","privateKey":"","alipayPublicKey":"","alipayPid":"2088541867845156","appAuthToken":"202303BBbcba1639502a4d1c8e1c67e209b71D15"},"setting":{"speakerKey":"","speakerSn":"zsw03","printUsername":"","printUserPwd":"","tagWidth":null,"tagHeight":null},"refundApprover":null,"enableRefundApprover":null,"tableFee":{"merchant_table_price":"","per_capita_consumption":"30","pay_set":["0","1","2","3","4"]},"money":"1502.00","platformShow":true,"subMchId":"","serviceType":"EATSTORE","isEnable":true,"is_delete":0,"sort":0,"profitSharing":{"type":"manual","mchName":"","mchCode":"","ratio":0},"autoSetting":{"use_auto_open":false,"use_finish_order":true,"use_flow_auto_open":true,"use_flow_finish_order":false},"posType":{"desc":"快消餐饮","code":"FASTSTORE"}}],"bizType":1,"fullType":"EACH_FULL","fullAmount":"49.00","discountAmount":"10.00","fullNumber":1,"dateOrDay":true,"startAfterDays":1,"daysValidate":90,"discountPercent":100,"limitAmount":"0.00","bizId":"","publishStartTime":"2023-06-19","publishEndTime":"2023-06-26","useStartTime":"2023-12-28 17:53:59","useEndTime":"2024-03-27 17:53:59","doStartTime":"00:00","doEndTime":"23:59","promotionId":"0","couponId":"1669883455174868992","receiveTime":"2023-12-27","useTime":null,"status":1,"tenantCode":"1193","type":1,"promotionName":"满49减10元端午礼券","usable":false,"usableReason":"不在可使用时间内,本券须在领取1天后,90天内使用","allProduct":true,"productSkuId":[],"productGroupIds":[],"productList":null,"isMaxCoupon":false,"productGroupList":null,"remark":"

1.本券自领取日,次日生效可用,90天内有效;
2.本券可用于购买海峡姐妹茶膳坊内商品,满49元可使用;
3.本券不可与其他活动同享;
4.本券不可转赠,不可找零。

\n

 

","canUseBalance":true}] class PhoneQueryMemberInfo { PhoneQueryMemberInfo({ @@ -21,12 +24,15 @@ class PhoneQueryMemberInfo { String headimg, String sex, String balance, + String realBalance, + String giftBalance, bool memberSourceCredit, String money, bool memberCredit, String greenMoney, String raiseMoney, - String payPassword,}){ + String payPassword, + List useableConponList,}){ _mid = mid; _sid = sid; _phoneNum = phoneNum; @@ -34,12 +40,15 @@ class PhoneQueryMemberInfo { _headimg = headimg; _sex = sex; _balance = balance; + _realBalance = realBalance; + _giftBalance = giftBalance; _memberSourceCredit = memberSourceCredit; _money = money; _memberCredit = memberCredit; _greenMoney = greenMoney; _raiseMoney = raiseMoney; _payPassword = payPassword; + _useableConponList = useableConponList; } PhoneQueryMemberInfo.fromJson(dynamic json) { @@ -50,12 +59,20 @@ class PhoneQueryMemberInfo { _headimg = json['headimg']; _sex = json['sex']; _balance = json['balance']; + _realBalance = json['realBalance']; + _giftBalance = json['giftBalance']; _memberSourceCredit = json['memberSourceCredit']; _money = json['money']; _memberCredit = json['memberCredit']; _greenMoney = json['greenMoney']; _raiseMoney = json['raiseMoney']; _payPassword = json['payPassword']; + if (json['useableConponList'] != null) { + _useableConponList = []; + json['useableConponList'].forEach((v) { + _useableConponList.add(UseableConponList.fromJson(v)); + }); + } } String _mid; String _sid; @@ -64,12 +81,15 @@ class PhoneQueryMemberInfo { String _headimg; String _sex; String _balance; + String _realBalance; + String _giftBalance; bool _memberSourceCredit; String _money; bool _memberCredit; String _greenMoney; String _raiseMoney; String _payPassword; + List _useableConponList; PhoneQueryMemberInfo copyWith({ String mid, String sid, String phoneNum, @@ -77,12 +97,15 @@ PhoneQueryMemberInfo copyWith({ String mid, String headimg, String sex, String balance, + String realBalance, + String giftBalance, bool memberSourceCredit, String money, bool memberCredit, String greenMoney, String raiseMoney, String payPassword, + List useableConponList, }) => PhoneQueryMemberInfo( mid: mid ?? _mid, sid: sid ?? _sid, phoneNum: phoneNum ?? _phoneNum, @@ -90,12 +113,15 @@ PhoneQueryMemberInfo copyWith({ String mid, headimg: headimg ?? _headimg, sex: sex ?? _sex, balance: balance ?? _balance, + realBalance: realBalance ?? _realBalance, + giftBalance: giftBalance ?? _giftBalance, memberSourceCredit: memberSourceCredit ?? _memberSourceCredit, money: money ?? _money, memberCredit: memberCredit ?? _memberCredit, greenMoney: greenMoney ?? _greenMoney, raiseMoney: raiseMoney ?? _raiseMoney, payPassword: payPassword ?? _payPassword, + useableConponList: useableConponList ?? _useableConponList, ); String get mid => _mid; String get sid => _sid; @@ -104,12 +130,15 @@ PhoneQueryMemberInfo copyWith({ String mid, String get headimg => _headimg; String get sex => _sex; String get balance => _balance; + String get realBalance => _realBalance; + String get giftBalance => _giftBalance; bool get memberSourceCredit => _memberSourceCredit; String get money => _money; bool get memberCredit => _memberCredit; String get greenMoney => _greenMoney; String get raiseMoney => _raiseMoney; String get payPassword => _payPassword; + List get useableConponList => _useableConponList; Map toJson() { final map = {}; @@ -120,12 +149,396 @@ PhoneQueryMemberInfo copyWith({ String mid, map['headimg'] = _headimg; map['sex'] = _sex; map['balance'] = _balance; + map['realBalance'] = _realBalance; + map['giftBalance'] = _giftBalance; map['memberSourceCredit'] = _memberSourceCredit; map['money'] = _money; map['memberCredit'] = _memberCredit; map['greenMoney'] = _greenMoney; map['raiseMoney'] = _raiseMoney; map['payPassword'] = _payPassword; + if (_useableConponList != null) { + map['useableConponList'] = _useableConponList.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// id : "1730867009651998720" +/// storeIds : ["1333246101343436800","1432164681279078400","1665555596536971264"] +/// stores : [] +/// bizType : 2 +/// fullType : "TOTAL_FULL" +/// fullAmount : "0.00" +/// discountAmount : "0.00" +/// fullNumber : 2 +/// dateOrDay : true +/// startAfterDays : 0 +/// daysValidate : 3 +/// discountPercent : 68 +/// limitAmount : "0.00" +/// bizId : "" +/// publishStartTime : "2023-05-05" +/// publishEndTime : "2023-12-31" +/// useStartTime : "2023-12-02 16:30:28" +/// useEndTime : "2023-12-05 16:30:28" +/// doStartTime : "00:00" +/// doEndTime : "23:59" +/// promotionId : "0" +/// couponId : "1654409900576473088" +/// receiveTime : "2023-12-02" +/// useTime : null +/// status : 1 +/// tenantCode : "admin" +/// type : 2 +/// promotionName : "双杯优享6.8折(海峡姐妹)" +/// usable : false +/// usableReason : "不在可使用时间内,本券须在领取0天后,3天内使用" +/// allProduct : false +/// productSkuId : [] +/// productGroupIds : ["1433971071249285120","1433971071266062336","1433971071287033856","1433971071303811072","1433971071316393984","1433972467273039872","1435141914704740352","1524320958125441024","1552172579970613248","1668105881067192320","1668134716433235968","1668134867440762880","1668134955919605760","1668135085221609472","1668135269255086080","1425708380399337472","1426064940447301632","1426067376096411648","1426095795836289024","1522572290481455104","1522572604823568384","1524327158112059392","1601821884305899520","1668135150308818944","1678291351080271872"] +/// productList : null +/// isMaxCoupon : false +/// productGroupList : [] +/// remark : "

1.本券自领取日起3天有效。
2.本券仅用于海峡姐妹饮品,一次性购买满2杯使用。
3.本券不可与其他活动同享。

" +/// canUseBalance : true + +class UseableConponList { + UseableConponList({ + String id, + List storeIds, + List stores, + num bizType, + String fullType, + String fullAmount, + String discountAmount, + num fullNumber, + bool dateOrDay, + num startAfterDays, + num daysValidate, + num discountPercent, + String limitAmount, + String bizId, + String publishStartTime, + String publishEndTime, + String useStartTime, + String useEndTime, + String doStartTime, + String doEndTime, + String promotionId, + String couponId, + String receiveTime, + dynamic useTime, + num status, + String tenantCode, + num type, + String promotionName, + bool usable, + String usableReason, + bool allProduct, + List productSkuId, + List productGroupIds, + dynamic productList, + bool isMaxCoupon, + List productGroupList, + String remark, + bool canUseBalance,}){ + _id = id; + _storeIds = storeIds; + _stores = stores; + _bizType = bizType; + _fullType = fullType; + _fullAmount = fullAmount; + _discountAmount = discountAmount; + _fullNumber = fullNumber; + _dateOrDay = dateOrDay; + _startAfterDays = startAfterDays; + _daysValidate = daysValidate; + _discountPercent = discountPercent; + _limitAmount = limitAmount; + _bizId = bizId; + _publishStartTime = publishStartTime; + _publishEndTime = publishEndTime; + _useStartTime = useStartTime; + _useEndTime = useEndTime; + _doStartTime = doStartTime; + _doEndTime = doEndTime; + _promotionId = promotionId; + _couponId = couponId; + _receiveTime = receiveTime; + _useTime = useTime; + _status = status; + _tenantCode = tenantCode; + _type = type; + _promotionName = promotionName; + _usable = usable; + _usableReason = usableReason; + _allProduct = allProduct; + _productSkuId = productSkuId; + _productGroupIds = productGroupIds; + _productList = productList; + _isMaxCoupon = isMaxCoupon; + _productGroupList = productGroupList; + _remark = remark; + _canUseBalance = canUseBalance; +} + + UseableConponList.fromJson(dynamic json) { + _id = json['id']; + _storeIds = json['storeIds'] != null ? json['storeIds'].cast() : []; + // if (json['stores'] != null) { + // _stores = []; + // json['stores'].forEach((v) { + // _stores.add(Dynamic.fromJson(v)); + // }); + // } + _bizType = json['bizType']; + _fullType = json['fullType']; + _fullAmount = json['fullAmount']; + _discountAmount = json['discountAmount']; + _fullNumber = json['fullNumber']; + _dateOrDay = json['dateOrDay']; + _startAfterDays = json['startAfterDays']; + _daysValidate = json['daysValidate']; + _discountPercent = json['discountPercent']; + _limitAmount = json['limitAmount']; + _bizId = json['bizId']; + _publishStartTime = json['publishStartTime']; + _publishEndTime = json['publishEndTime']; + _useStartTime = json['useStartTime']; + _useEndTime = json['useEndTime']; + _doStartTime = json['doStartTime']; + _doEndTime = json['doEndTime']; + _promotionId = json['promotionId']; + _couponId = json['couponId']; + _receiveTime = json['receiveTime']; + _useTime = json['useTime']; + _status = json['status']; + _tenantCode = json['tenantCode']; + _type = json['type']; + _promotionName = json['promotionName']; + _usable = json['usable']; + _usableReason = json['usableReason']; + _allProduct = json['allProduct']; + if (json['productSkuId'] != null) { + _productSkuId = []; + // json['productSkuId'].forEach((v) { + // _productSkuId.add(Dynamic.fromJson(v)); + // }); + } + _productGroupIds = json['productGroupIds'] != null ? json['productGroupIds'].cast() : []; + _productList = json['productList']; + _isMaxCoupon = json['isMaxCoupon']; + if (json['productGroupList'] != null) { + _productGroupList = []; + // json['productGroupList'].forEach((v) { + // _productGroupList.add(Dynamic.fromJson(v)); + // }); + } + _remark = json['remark']; + _canUseBalance = json['canUseBalance']; + } + String _id; + List _storeIds; + List _stores; + num _bizType; + String _fullType; + String _fullAmount; + String _discountAmount; + num _fullNumber; + bool _dateOrDay; + num _startAfterDays; + num _daysValidate; + num _discountPercent; + String _limitAmount; + String _bizId; + String _publishStartTime; + String _publishEndTime; + String _useStartTime; + String _useEndTime; + String _doStartTime; + String _doEndTime; + String _promotionId; + String _couponId; + String _receiveTime; + dynamic _useTime; + num _status; + String _tenantCode; + num _type; + String _promotionName; + bool _usable; + String _usableReason; + bool _allProduct; + List _productSkuId; + List _productGroupIds; + dynamic _productList; + bool _isMaxCoupon; + List _productGroupList; + String _remark; + bool _canUseBalance; +UseableConponList copyWith({ String id, + List storeIds, + List stores, + num bizType, + String fullType, + String fullAmount, + String discountAmount, + num fullNumber, + bool dateOrDay, + num startAfterDays, + num daysValidate, + num discountPercent, + String limitAmount, + String bizId, + String publishStartTime, + String publishEndTime, + String useStartTime, + String useEndTime, + String doStartTime, + String doEndTime, + String promotionId, + String couponId, + String receiveTime, + dynamic useTime, + num status, + String tenantCode, + num type, + String promotionName, + bool usable, + String usableReason, + bool allProduct, + List productSkuId, + List productGroupIds, + dynamic productList, + bool isMaxCoupon, + List productGroupList, + String remark, + bool canUseBalance, +}) => UseableConponList( id: id ?? _id, + storeIds: storeIds ?? _storeIds, + stores: stores ?? _stores, + bizType: bizType ?? _bizType, + fullType: fullType ?? _fullType, + fullAmount: fullAmount ?? _fullAmount, + discountAmount: discountAmount ?? _discountAmount, + fullNumber: fullNumber ?? _fullNumber, + dateOrDay: dateOrDay ?? _dateOrDay, + startAfterDays: startAfterDays ?? _startAfterDays, + daysValidate: daysValidate ?? _daysValidate, + discountPercent: discountPercent ?? _discountPercent, + limitAmount: limitAmount ?? _limitAmount, + bizId: bizId ?? _bizId, + publishStartTime: publishStartTime ?? _publishStartTime, + publishEndTime: publishEndTime ?? _publishEndTime, + useStartTime: useStartTime ?? _useStartTime, + useEndTime: useEndTime ?? _useEndTime, + doStartTime: doStartTime ?? _doStartTime, + doEndTime: doEndTime ?? _doEndTime, + promotionId: promotionId ?? _promotionId, + couponId: couponId ?? _couponId, + receiveTime: receiveTime ?? _receiveTime, + useTime: useTime ?? _useTime, + status: status ?? _status, + tenantCode: tenantCode ?? _tenantCode, + type: type ?? _type, + promotionName: promotionName ?? _promotionName, + usable: usable ?? _usable, + usableReason: usableReason ?? _usableReason, + allProduct: allProduct ?? _allProduct, + productSkuId: productSkuId ?? _productSkuId, + productGroupIds: productGroupIds ?? _productGroupIds, + productList: productList ?? _productList, + isMaxCoupon: isMaxCoupon ?? _isMaxCoupon, + productGroupList: productGroupList ?? _productGroupList, + remark: remark ?? _remark, + canUseBalance: canUseBalance ?? _canUseBalance, +); + String get id => _id; + List get storeIds => _storeIds; + List get stores => _stores; + num get bizType => _bizType; + String get fullType => _fullType; + String get fullAmount => _fullAmount; + String get discountAmount => _discountAmount; + num get fullNumber => _fullNumber; + bool get dateOrDay => _dateOrDay; + num get startAfterDays => _startAfterDays; + num get daysValidate => _daysValidate; + num get discountPercent => _discountPercent; + String get limitAmount => _limitAmount; + String get bizId => _bizId; + String get publishStartTime => _publishStartTime; + String get publishEndTime => _publishEndTime; + String get useStartTime => _useStartTime; + String get useEndTime => _useEndTime; + String get doStartTime => _doStartTime; + String get doEndTime => _doEndTime; + String get promotionId => _promotionId; + String get couponId => _couponId; + String get receiveTime => _receiveTime; + dynamic get useTime => _useTime; + num get status => _status; + String get tenantCode => _tenantCode; + num get type => _type; + String get promotionName => _promotionName; + bool get usable => _usable; + String get usableReason => _usableReason; + bool get allProduct => _allProduct; + List get productSkuId => _productSkuId; + List get productGroupIds => _productGroupIds; + dynamic get productList => _productList; + bool get isMaxCoupon => _isMaxCoupon; + List get productGroupList => _productGroupList; + String get remark => _remark; + bool get canUseBalance => _canUseBalance; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['storeIds'] = _storeIds; + if (_stores != null) { + map['stores'] = _stores.map((v) => v.toJson()).toList(); + } + map['bizType'] = _bizType; + map['fullType'] = _fullType; + map['fullAmount'] = _fullAmount; + map['discountAmount'] = _discountAmount; + map['fullNumber'] = _fullNumber; + map['dateOrDay'] = _dateOrDay; + map['startAfterDays'] = _startAfterDays; + map['daysValidate'] = _daysValidate; + map['discountPercent'] = _discountPercent; + map['limitAmount'] = _limitAmount; + map['bizId'] = _bizId; + map['publishStartTime'] = _publishStartTime; + map['publishEndTime'] = _publishEndTime; + map['useStartTime'] = _useStartTime; + map['useEndTime'] = _useEndTime; + map['doStartTime'] = _doStartTime; + map['doEndTime'] = _doEndTime; + map['promotionId'] = _promotionId; + map['couponId'] = _couponId; + map['receiveTime'] = _receiveTime; + map['useTime'] = _useTime; + map['status'] = _status; + map['tenantCode'] = _tenantCode; + map['type'] = _type; + map['promotionName'] = _promotionName; + map['usable'] = _usable; + map['usableReason'] = _usableReason; + map['allProduct'] = _allProduct; + if (_productSkuId != null) { + map['productSkuId'] = _productSkuId.map((v) => v.toJson()).toList(); + } + map['productGroupIds'] = _productGroupIds; + map['productList'] = _productList; + map['isMaxCoupon'] = _isMaxCoupon; + if (_productGroupList != null) { + map['productGroupList'] = _productGroupList.map((v) => v.toJson()).toList(); + } + map['remark'] = _remark; + map['canUseBalance'] = _canUseBalance; return map; } diff --git a/lib/retrofit/data/store_total_money_info.dart b/lib/retrofit/data/store_total_money_info.dart new file mode 100644 index 00000000..5f332dc0 --- /dev/null +++ b/lib/retrofit/data/store_total_money_info.dart @@ -0,0 +1,51 @@ +/// storeTotalMoney : "117.00" +/// paySumCount : 2 +/// memberCount : 9385 +/// memberTotalBalance : "42236.77" + +class StoreTotalMoneyInfo { + StoreTotalMoneyInfo({ + String storeTotalMoney, + num paySumCount, + num memberCount, + String memberTotalBalance,}){ + _storeTotalMoney = storeTotalMoney; + _paySumCount = paySumCount; + _memberCount = memberCount; + _memberTotalBalance = memberTotalBalance; +} + + StoreTotalMoneyInfo.fromJson(dynamic json) { + _storeTotalMoney = json['storeTotalMoney']; + _paySumCount = json['paySumCount']; + _memberCount = json['memberCount']; + _memberTotalBalance = json['memberTotalBalance']; + } + String _storeTotalMoney; + num _paySumCount; + num _memberCount; + String _memberTotalBalance; +StoreTotalMoneyInfo copyWith({ String storeTotalMoney, + num paySumCount, + num memberCount, + String memberTotalBalance, +}) => StoreTotalMoneyInfo( storeTotalMoney: storeTotalMoney ?? _storeTotalMoney, + paySumCount: paySumCount ?? _paySumCount, + memberCount: memberCount ?? _memberCount, + memberTotalBalance: memberTotalBalance ?? _memberTotalBalance, +); + String get storeTotalMoney => _storeTotalMoney; + num get paySumCount => _paySumCount; + num get memberCount => _memberCount; + String get memberTotalBalance => _memberTotalBalance; + + Map toJson() { + final map = {}; + map['storeTotalMoney'] = _storeTotalMoney; + map['paySumCount'] = _paySumCount; + map['memberCount'] = _memberCount; + map['memberTotalBalance'] = _memberTotalBalance; + return map; + } + +} \ No newline at end of file diff --git a/lib/setting/permission_setting_page.dart b/lib/setting/permission_setting_page.dart index 5b720738..b0cbf557 100644 --- a/lib/setting/permission_setting_page.dart +++ b/lib/setting/permission_setting_page.dart @@ -46,7 +46,7 @@ class _PermissionSettingPage extends State { List tipIcons = [ "assets/image/icon_location_permission_tips.webp", - "assets/image/icon_notification_permission_tips.webp", + "assets/image/icon_natification_permission_tips.webp", "assets/image/icon_camera_permission_tips.webp", "assets/image/icon_storage_permission_tips.webp", ];