From da552bddbd9a32e0e6372c66557eb238055a9914 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Mon, 4 Dec 2023 17:45:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=A5=A8=E5=88=B8=E5=88=97?= =?UTF-8?q?=E8=A1=A8=EF=BC=8C=E7=A5=A8=E5=88=B8=E6=A0=B8=E9=94=80=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=EF=BC=8C=E7=A5=A8=E5=88=B8=E6=A0=B8=E9=94=80=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=EF=BC=8C=E4=BC=9A=E5=91=98=E5=88=97=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E4=BC=9A=E5=91=98=E5=85=85=E5=80=BC=E6=B5=81=E6=B0=B4=EF=BC=8C?= =?UTF-8?q?=E4=BC=9A=E5=91=98=E4=BD=99=E9=A2=9D=E5=8F=98=E5=8A=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=9B=20=E9=A6=96=E9=A1=B5=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=A6=82=E8=A7=88=E6=9D=BF=E5=9D=97=E6=9B=B4=E6=94=B9=E6=88=90?= =?UTF-8?q?=E4=BC=9A=E5=91=98=E7=AE=A1=E7=90=86=EF=BC=8C=E5=B9=B6=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=BC=9A=E5=91=98=E6=A6=82=E8=A7=88=EF=BC=8C=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E5=88=97=E8=A1=A8=EF=BC=8C=E4=BC=9A=E5=91=98=E5=85=85?= =?UTF-8?q?=E5=80=BC=E6=B5=81=E6=B0=B4=E4=B8=89=E4=B8=AA=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E6=9D=BF=E5=9D=97=EF=BC=8C=E5=B9=B6=E5=A2=9E=E5=8A=A0=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E6=9B=B4=E5=A4=9A=E6=95=B0=E6=8D=AE=E6=9D=BF=E5=9D=97?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=EF=BC=9B=20=E9=A6=96=E9=A1=B5=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BC=98=E5=8C=96=E6=9B=B4=E6=94=B9=EF=BC=9B=20?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=A1=B5=E9=9D=A2=E6=9B=B4=E6=94=B9=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=A5=A8=E5=88=B8=E6=9D=BF=E5=9D=97=E9=80=89?= =?UTF-8?q?=E9=A1=B9=EF=BC=9B=20=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2ui=E9=AB=98=E5=BA=A6=E8=BE=B9=E8=B7=9D?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9B=20=E7=A5=A8=E5=88=B8=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E9=9D=A2=E7=A5=A8=E5=88=B8=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=BC=98=E5=8C=96=EF=BC=9B=20=E6=89=AB?= =?UTF-8?q?=E4=B8=80=E6=89=AB=E9=A1=B5=E9=9D=A2ui=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=9B=20=E6=96=B0=E5=A2=9E=E4=BD=99=E9=A2=9D=E5=8F=98?= =?UTF-8?q?=E5=8A=A8=EF=BC=8C=E4=BC=9A=E5=91=98=E5=88=97=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E4=BC=9A=E5=91=98=E5=85=85=E5=80=BC=E6=B5=81=E6=B0=B4=EF=BC=8C?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E7=B1=BB=EF=BC=9B=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E4=BC=9A=E5=91=98=E9=A1=B5=E9=9D=A2=EF=BC=8C=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E5=88=97=E8=A1=A8=EF=BC=8C=E4=BC=9A=E5=91=98=E5=85=85=E5=80=BC?= =?UTF-8?q?=E6=B5=81=E6=B0=B4=EF=BC=8C=E4=BC=9A=E5=91=98=E4=BD=99=E9=A2=9D?= =?UTF-8?q?=E5=8F=98=E5=8A=A8=E9=A1=B5=E9=9D=A2=EF=BC=9B=20=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E9=A1=B5=E9=9D=A2=E6=9B=B4=E6=94=B9=EF=BC=8C=E5=8D=95?= =?UTF-8?q?=E7=8B=AC=E6=96=B0=E5=A2=9E=E8=AE=A2=E5=8D=95=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=9B=20=E6=96=B0=E5=A2=9Etab=E4=B8=8B=E5=88=92=E7=BA=BF?= =?UTF-8?q?=E9=95=BF=E5=BA=A6=E6=96=87=E4=BB=B6=EF=BC=9B=EF=BC=88=E5=8F=AF?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E8=87=AA=E5=AE=9A=E4=B9=89tab=E4=B8=8B?= =?UTF-8?q?=E5=88=92=E7=BA=BF=E9=95=BF=E7=9F=AD=EF=BC=8C=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=E7=AD=89=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/business_home_page.dart | 421 ++++++- .../home/vip/balance_change_record.dart | 1013 +++++++++++++++++ .../home/vip/bus_vip_list.dart | 867 ++++++++++++++ .../home/vip/business_vip_page.dart | 117 ++ .../home/vip/vip_recharge_flow.dart | 988 ++++++++++++++++ .../order/business_order_page.dart | 252 +--- lib/business_system/order/order_list.dart | 11 +- .../order/order_list_page.dart | 232 ++++ .../order/order_write_off.dart | 6 +- lib/business_system/order/request_refund.dart | 1 - .../order/ticket/ticket_list.dart | 612 ++++++++++ .../order/ticket/ticket_page.dart | 634 +++++++++++ .../order/ticket/ticket_records_page.dart | 622 ++++++++++ .../order/ticket/ticket_statistics_page.dart | 588 ++++++++++ .../order/ticket/ticket_tab.dart | 106 ++ lib/business_system/scan_code_page.dart | 25 - lib/home/main_home_page.dart | 1 - lib/main.dart | 3 + lib/retrofit/business_api.dart | 67 +- lib/retrofit/business_api.g.dart | 141 +++ lib/retrofit/data/balance_change_list.dart | 367 ++++++ lib/retrofit/data/business_vip_list.dart | 374 ++++++ lib/retrofit/data/recharge_flow_list.dart | 329 ++++++ lib/retrofit/data/ticket_record.dart | 709 ++++++++++++ lib/retrofit/data/ticket_show.dart | 380 +++++++ lib/retrofit/data/ticket_stats_list.dart | 90 ++ 26 files changed, 8665 insertions(+), 291 deletions(-) create mode 100644 lib/business_system/home/vip/balance_change_record.dart create mode 100644 lib/business_system/home/vip/bus_vip_list.dart create mode 100644 lib/business_system/home/vip/business_vip_page.dart create mode 100644 lib/business_system/home/vip/vip_recharge_flow.dart create mode 100644 lib/business_system/order/order_list_page.dart create mode 100644 lib/business_system/order/ticket/ticket_list.dart create mode 100644 lib/business_system/order/ticket/ticket_page.dart create mode 100644 lib/business_system/order/ticket/ticket_records_page.dart create mode 100644 lib/business_system/order/ticket/ticket_statistics_page.dart create mode 100644 lib/business_system/order/ticket/ticket_tab.dart create mode 100644 lib/retrofit/data/balance_change_list.dart create mode 100644 lib/retrofit/data/business_vip_list.dart create mode 100644 lib/retrofit/data/recharge_flow_list.dart create mode 100644 lib/retrofit/data/ticket_record.dart create mode 100644 lib/retrofit/data/ticket_show.dart create mode 100644 lib/retrofit/data/ticket_stats_list.dart diff --git a/lib/business_system/home/business_home_page.dart b/lib/business_system/home/business_home_page.dart index 1604a031..5fd086a2 100644 --- a/lib/business_system/home/business_home_page.dart +++ b/lib/business_system/home/business_home_page.dart @@ -17,9 +17,11 @@ 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'; @@ -48,9 +50,12 @@ class _BusinessHomePage extends State 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"), @@ -89,11 +94,17 @@ class _BusinessHomePage extends State ? "0" : widget.businessLoginInfo .storeList[index ?? widget.selectStoreIndex].id); - queryDayAmount(); - queryPopularList(isSing: false); - queryOrderTrend(); - queryVipCounts(); - queryDayFlow(); + if(vipIndex != 1 && vipIndex != 2){ + queryDayAmount(); + queryPopularList(isSing: false); + queryOrderTrend(); + queryVipCounts(); + queryDayFlow(); + } + if(vipIndex == 1) + queryVipList(); + if(vipIndex == 2) + queryRechargeFlow(); }); } @@ -199,6 +210,50 @@ class _BusinessHomePage extends State } } + ///会员列表 + 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); @@ -229,7 +284,7 @@ class _BusinessHomePage extends State children: [ homeTop(), tradeOverview(), - userOverview(), + vipManage(), hotSellHotCharts(), todayFlow(), ], @@ -657,39 +712,13 @@ class _BusinessHomePage extends State ); } - ///用户概览 + ///会员概览 Widget userOverview() { return Container( color: Colors.white, - margin: EdgeInsets.only(top: 16.h), - padding: EdgeInsets.only(left: 9.w, right: 9.w, top: 12.h, bottom: 12.h), + margin: EdgeInsets.only(bottom: 16.h), child: Column( children: [ - Padding( - padding: EdgeInsets.only( - left: 7.w, - ), - child: Row( - children: [ - Container(width: 4.w, height: 16.h, color: Color(0xFF30415B)), - Padding( - padding: EdgeInsets.only( - left: 12.w, - ), - child: Text( - "用户概览", - style: TextStyle( - fontSize: 15.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xFF0D0D0D), - ), - ), - ), - ], - )), - SizedBox( - height: 12.h, - ), Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -866,6 +895,330 @@ class _BusinessHomePage extends State ); } + ///会员管理 + 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), + ), + ), + ), + ], + ), + ); + } + + ///会员充值流水 + 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( + child: Text( + rechargeFlowList?.balance ?? "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xD9000000), + ), + ), + ), + ], + ), + ); + } + ///用户概览弹窗提示 showVipTipDialog(index) { showDialog( diff --git a/lib/business_system/home/vip/balance_change_record.dart b/lib/business_system/home/vip/balance_change_record.dart new file mode 100644 index 00000000..724d555e --- /dev/null +++ b/lib/business_system/home/vip/balance_change_record.dart @@ -0,0 +1,1013 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shimmer/shimmer.dart'; + +import '../../../generated/l10n.dart'; +import '../../../retrofit/business_api.dart'; +import '../../../retrofit/data/balance_change_list.dart'; +import '../../../retrofit/data/base_data.dart'; +import '../../../utils/business_instance.dart'; +import '../../../utils/flutter_utils.dart'; +import '../../../utils/font_weight.dart'; +import '../../../view_widget/no_data_view.dart'; + +class BalanceChangeRecord extends StatefulWidget { + final String storeId; + + BalanceChangeRecord( + Key key, + this.storeId, + ) : super(key: key); + + @override + State createState() { + return _BalanceChangeRecord(); + } +} + +class _BalanceChangeRecord extends State { + final RefreshController _refreshController = RefreshController(); + BusinessApiService businessService; + List records = []; + int _current = 1; + String networkError = ""; + int networkStatus = 0; + final TextEditingController editingController = TextEditingController(); + FocusNode _focusNode = FocusNode(); + bool isKeyBoardShow = false; + String selectTimeDate = ""; + bool _isShow = false; + int recordType = -1; + + ///离开页面记着销毁和清除 + @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; + } + }); + }); + _onRefresh(); + } + + _onRefresh({bool isShowLoad = true}) async { + if (isShowLoad) + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + await queryBalanceChange(isRefreshData: false); + EasyLoading.dismiss(); + if (!mounted) return; + if (_refreshController.isRefresh) _refreshController.refreshCompleted(); + setState(() {}); + } + + queryBalanceChange({isRefreshData = true}) async { + try { + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.storeId); + } + BaseData baseData = + await businessService.getTenantMemberBill({ + "size": 10, + "pageSize": 10, + "current": _current, + "currentPage": 1, + "sort": "id", + "order": "descending", + "model": { + "startTime": (selectTimeDate == "" || selectTimeDate == null) + ? "" + : selectTimeDate + .replaceAll("年", "-") + .replaceAll("月", "-") + .replaceAll("日", "") + .substring(0, 19), + "endTime": (selectTimeDate == "" || selectTimeDate == null) + ? "" + : selectTimeDate + .replaceAll("年", "-") + .replaceAll("月", "-") + .replaceAll("日", "") + .substring(selectTimeDate.length >= 21 ? 22 : 0, + selectTimeDate.length >= 21 ? 41 : 0), + "pm": recordType == -1 ? "" : recordType, + "phone": editingController?.text ?? "" + }, + "map": {}, + "timeRange": null + }).catchError((error) { + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; + setState(() {}); + _refreshController.refreshFailed(); + _refreshController.loadFailed(); + }); + if (!mounted) return; + if (baseData != null && baseData.isSuccess) { + records.addAll(baseData?.data?.records ?? []); + if ((baseData?.data?.records ?? []).isEmpty || + records.length.toString() == baseData.data.total) + _refreshController.loadNoData(); + else + _refreshController.loadComplete(); + networkStatus = 1; + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } finally { + if (isRefreshData) setState(() {}); + } + } + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + Column( + children: [ + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFD8D8D8), + ), + timeSelect(), + balanceChangeSearch(), + Container( + color: Colors.white, + padding: EdgeInsets.only(left: 19.w, bottom: 12.h), + child: Row( + children: [ + Text( + "记录类型", + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF808080), + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + _isShow = !_isShow; + }); + }, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 12.w), + child: Icon( + _isShow + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, + color: Color(0xFF808080), + size: 24, + )), + ), + ], + )), + Expanded( + child: SmartRefresher( + controller: _refreshController, + enablePullDown: true, + enablePullUp: records.length == 0 ? false : true, + header: MyHeader(color: Color(0xFF30415B)), + physics: BouncingScrollPhysics(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: () { + _isShow = false; + _current = 1; + records.clear(); + _onRefresh(isShowLoad: false); + }, + onLoading: () { + _isShow = false; + _current++; + _onRefresh(isShowLoad: false); + }, + child: networkStatus == -1 + ? noNetwork() + : ((networkStatus == 0) + ? ListView.builder( + padding: EdgeInsets.zero, + itemCount: 10, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return balanceChangeItemSm(); + }, + ) + : ((records == null || records.length == 0) + ? NoDataView( + src: "assets/image/bs_no data_logo.webp", + isShowBtn: false, + text: "暂无数据", + fontSize: 16.sp, + iconHeight: 120.h, + margin: EdgeInsets.all(50.h), + ) + : Padding( + padding: EdgeInsets.only(top: 16.h), + child: Expanded( + child: ListView.builder( + itemCount: records?.length ?? 0, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + if (isKeyBoardShow) + FocusScope.of(context) + .requestFocus(FocusNode()); + return; + }, + child: balanceChangeItem( + records[position], position), + ); + }, + ), + ), + ))), + )), + ], + ), + if (_isShow) + Container( + height: 100.h, + width: 100.w, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all( + color: Color(0x29000000), + width: 0.5.w, + ), + borderRadius: BorderRadius.circular(2), + ), + margin: EdgeInsets.only(top: 149.h, left: 19.w), + padding: EdgeInsets.symmetric(vertical: 8.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + recordType = 0; + _isShow = false; + records.clear(); + _onRefresh(); + }); + }, + child: Container( + width: double.infinity, + padding: EdgeInsets.symmetric( + vertical: 8.h, horizontal: 16.w), + child: Text( + "支出", + style: TextStyle( + color: Color(0xFF808080), + fontSize: 15.sp, + fontWeight: MyFontWeight.regular), + )), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + recordType = 1; + _isShow = false; + records.clear(); + _onRefresh(); + }); + }, + child: Container( + width: double.infinity, + padding: EdgeInsets.symmetric( + vertical: 8.h, horizontal: 16.w), + child: Text( + "收入", + style: TextStyle( + color: Color(0xFF808080), + fontSize: 15.sp, + fontWeight: MyFontWeight.regular), + ), + )), + ], + )) + ], + ); + } + + /// 搜索框 + Widget balanceChangeSearch() { + return Container( + color: Colors.white, + child: Container( + height: 40.h, + margin: + EdgeInsets.only(left: 20.w, right: 17.w, top: 10.h, bottom: 15.h), + decoration: BoxDecoration( + color: Color(0xFFF7F8FA), + borderRadius: BorderRadius.circular(2), + ), + child: TextField( + focusNode: _focusNode, + textInputAction: TextInputAction.search, + onTap: () { + setState(() { + _isShow = false; + }); + }, + onEditingComplete: () { + _isShow = false; + FocusScope.of(context).requestFocus(FocusNode()); + records.clear(); + _onRefresh(); + }, + 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 timeSelect() { + return Container( + color: Colors.white, + child: GestureDetector( + onTap: () { + _isShow = false; + Navigator.of(context).pushNamed('/router/custom_page').then((value) { + selectTimeDate = value; + records.clear(); + _onRefresh(); + }); + }, + child: Container( + decoration: BoxDecoration( + color: Color(0xFFF7F8FA), + borderRadius: BorderRadius.circular(2), + ), + margin: EdgeInsets.only(left: 18.w, right: 18.w, top: 11.h), + padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 12.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + (selectTimeDate == "" || selectTimeDate == null) + ? "开始时间 至 结束时间" + : "${selectTimeDate.substring(0, 11)} ${selectTimeDate.substring(21, 34)}", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF30415B), + fontWeight: MyFontWeight.regular), + ), + ], + ), + ), + ), + ); + } + + Widget balanceChangeItem(Records records, index) { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 12.h), + padding: EdgeInsets.only( + top: 13.h, + bottom: 16.h, + ), + child: Column( + children: [ + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Text( + "会员名称: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 1, + ), + Expanded( + child: Text( + records?.nickname ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 3, + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Row( + children: [ + Expanded( + child: Text( + "手机号: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 1, + ), + Expanded( + child: Text( + records?.phone ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 3, + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Row( + children: [ + Expanded( + child: Text( + "记录类型: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 1, + ), + Expanded( + child: Text( + records.pm == 0 ? "支出" : "收入", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 3, + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Row( + children: [ + Expanded( + flex: 1, + child: Text( + "变动金额: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + Expanded( + flex: 3, + child: Text( + "¥${records?.number ?? ""}", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + ], + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Row( + children: [ + Expanded( + flex: 1, + child: Text( + "变动实储: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + Expanded( + flex: 3, + child: Text( + "¥${records?.realNumber ?? ""}", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + ], + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Row( + children: [ + Expanded( + flex: 1, + child: Text( + "变动后余额: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + Expanded( + flex: 3, + child: Text( + "¥${records?.balance ?? ""}", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + ], + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Row( + children: [ + Expanded( + flex: 1, + child: Text( + "创建时间: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + Expanded( + flex: 3, + child: Text( + records?.createTime ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + ], + )), + ], + ), + ); + } + + Widget balanceChangeItemSm() { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 12.h), + padding: EdgeInsets.only( + top: 13.h, + bottom: 16.h, + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 60.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 77.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + ], + )), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 48.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 77.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 120.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 44.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 44.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 44.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 44.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 44.w, + height: 18.h, + ), + ), + ), + ], + )), + ], + )); + } + + Widget noNetwork() { + return Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + networkError.substring(0, networkError.indexOf(",")), + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF0D0D0D), + fontWeight: MyFontWeight.bold), + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 10.h), + child: Text( + "请检查网络设置或稍后重试", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + _onRefresh(); + }, + child: Container( + decoration: BoxDecoration( + color: Color(0xFF30415B), + borderRadius: BorderRadius.circular(15), + ), + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h), + child: Text( + "重试", + style: TextStyle( + fontSize: 14.sp, + color: Colors.white, + fontWeight: MyFontWeight.regular), + )), + ) + ], + ), + ); + } +} diff --git a/lib/business_system/home/vip/bus_vip_list.dart b/lib/business_system/home/vip/bus_vip_list.dart new file mode 100644 index 00000000..a5cdc65f --- /dev/null +++ b/lib/business_system/home/vip/bus_vip_list.dart @@ -0,0 +1,867 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shimmer/shimmer.dart'; + +import '../../../generated/l10n.dart'; +import '../../../retrofit/business_api.dart'; +import '../../../retrofit/data/base_data.dart'; +import '../../../retrofit/data/business_vip_list.dart'; +import '../../../utils/business_instance.dart'; +import '../../../utils/flutter_utils.dart'; +import '../../../utils/font_weight.dart'; +import '../../../view_widget/no_data_view.dart'; + +class BusVipList extends StatefulWidget { + final String storeId; + + BusVipList( + Key key, + this.storeId, + ) : super(key: key); + + @override + State createState() { + return _BusVipList(); + } +} + +class _BusVipList extends State { + final RefreshController _refreshController = RefreshController(); + BusinessApiService businessService; + List records = []; + int _current = 1; + String networkError = ""; + int networkStatus = 0; + final TextEditingController editingController = TextEditingController(); + FocusNode _focusNode = FocusNode(); + bool isKeyBoardShow = 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; + } + }); + }); + _onRefresh(); + } + + _onRefresh({bool isShowLoad = true}) async { + if (isShowLoad) + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + await queryVipList(isRefreshData: false); + EasyLoading.dismiss(); + if (!mounted) return; + if (_refreshController.isRefresh) _refreshController.refreshCompleted(); + setState(() {}); + } + + queryVipList({isRefreshData = true}) async { + try { + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.storeId); + } + BaseData baseData = await businessService.vipDataList({ + "map": {"nickname": "", "phone":editingController?.text ?? "", "source": "", "hasMoney": "2"}, + "model": {"tenantCode": null}, + "date": "", + "sort": "id", + "size": 10, + "current": _current + }).catchError((error) { + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; + setState(() {}); + _refreshController.refreshFailed(); + _refreshController.loadFailed(); + }); + if (!mounted) return; + if (baseData != null && baseData.isSuccess) { + records.addAll(baseData?.data?.records ?? []); + if ((baseData?.data?.records ?? []).isEmpty || + records.length.toString() == baseData.data.total) + _refreshController.loadNoData(); + else + _refreshController.loadComplete(); + networkStatus = 1; + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } finally { + if (isRefreshData) + setState(() {}); + } + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFD8D8D8), + ), + vipSearch(), + Expanded( + child: SmartRefresher( + controller: _refreshController, + enablePullDown: true, + enablePullUp: records.length == 0 ? false : true, + header: MyHeader(color: Color(0xFF30415B)), + physics: BouncingScrollPhysics(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: () { + _current = 1; + records.clear(); + _onRefresh(isShowLoad: false); + }, + onLoading: () { + _current++; + _onRefresh(isShowLoad: false); + }, + child: SingleChildScrollView( + physics: NeverScrollableScrollPhysics(), + child: Column( + children: [ + Padding( + padding: EdgeInsets.only( + left: 20.w,top: 16.h + ), + child: 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), + ), + ), + ), + ], + ), + ), + networkStatus == -1 + ? noNetwork() + : ((networkStatus == 0) + ? ListView.builder( + padding: EdgeInsets.zero, + itemCount: 10, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return vipListItemSm(); + }, + ) + : ((records == null || records.length == 0) + ? NoDataView( + src: + "assets/image/bs_no data_logo.webp", + isShowBtn: false, + text: "暂无数据", + fontSize: 16.sp, + iconHeight: 120.h, + margin: EdgeInsets.all(50.h), + ) + : Padding( + padding: EdgeInsets.only(top: 16.h), + child: Expanded( + child: ListView.builder( + itemCount: records?.length ?? 0, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return GestureDetector( + behavior: + HitTestBehavior.opaque, + onTap: () { + if (isKeyBoardShow) + FocusScope.of(context) + .requestFocus( + FocusNode()); + return; + }, + child: vipListItem( + records[position], + position), + ); + }, + ), + ), + ))), + ], + )))), + ], + ); + } + + /// 搜索框 + Widget vipSearch() { + return Container( + color: Colors.white, + child: Container( + height: 40.h, + margin: + EdgeInsets.only(left: 20.w, right: 17.w, top: 10.h, bottom: 15.h), + decoration: BoxDecoration( + color: Color(0xFFF7F8FA), + borderRadius: BorderRadius.circular(2), + ), + child: TextField( + focusNode: _focusNode, + textInputAction: TextInputAction.search, + onEditingComplete: () { + FocusScope.of(context).requestFocus(FocusNode()); + records.clear(); + _onRefresh(); + }, + 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 vipListItem(Records records, index) { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 12.h), + padding: EdgeInsets.only( + left: 12.h, + top: 16.h, + bottom: 16.h, + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded(child: Column( + children: [ + Padding( + padding: EdgeInsets.only( + bottom: 12.h, + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Text( + "会员名称: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 1, + ), + Expanded( + child: Text( + records?.nickname ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 3, + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12.h, + ), + child: Row( + children: [ + Expanded( + child: Text( + "手机号: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 1, + ), + Expanded( + child: Text( + records?.phone ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 3, + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12.h, + ), + child: Row( + children: [ + Expanded( + child: Text( + "加入时间: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 1, + ), + Expanded( + child: Text( + records?.createTime ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 3, + ), + ], + ), + ), + if(records.isShow) + Padding( + padding: EdgeInsets.only( + bottom: 12.h, + ), + child: Row( + children: [ + Expanded( + flex: 1, + child: Text( + "充值金额: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + Expanded( + flex: 3, + child: Text( + "¥${records?.realRecharge ?? ""}", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + ], + ), + ), + if(records.isShow) + Padding( + padding: EdgeInsets.only( + bottom: 12.h, + ), + child: Row( + children: [ + Expanded( + flex: 1, + child: Text( + "赠送金额: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + Expanded( + flex: 3, + child: Text( + "¥${records?.giftRecharge ?? ""}", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + ], + ), + ), + if (records.isShow) + Padding( + padding: EdgeInsets.only( + bottom: 12.h, + ), + child: Row( + children: [ + Expanded( + flex: 1, + child: Text( + "商户余额: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + Expanded( + flex: 3, + child: Text( + "¥${records?.realRecharge ?? ""}", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + ], + ), + ), + if(records.isShow) + Padding( + padding: EdgeInsets.only( + bottom: 12.h, + ), + child: Row( + children: [ + Expanded( + flex: 1, + child: Text( + "平台余额: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + Expanded( + flex: 3, + child: Text( + "¥${records?.money ?? ""}", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + ], + )), + ], + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + records.isShow = !records.isShow; + }); + }, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 6.h), + child: Icon( + records.isShow + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, + color: Color(0xFF0D0D0D), + size: 24, + )), + ), + ], + ), + ); + } + + Widget vipListItemSm() { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 12.h), + padding: EdgeInsets.only( + left: 12.h, + top: 16.h, + bottom: 16.h, + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 12), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 60.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 12), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 40.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 12), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 12), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 12), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 12), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 12), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 12), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + ], + )), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 12), + child: + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 48.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 12), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 77.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 12), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 120.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 12), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 44.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 12), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 44.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 12), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 44.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 12), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 44.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 12), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 44.w, + height: 18.h, + ), + ), + ), + ], + )), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + margin: EdgeInsets.only(right: 24.w), + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 16.w, + height: 16.h, + ), + ), + ], + ), + ); + } + + Widget noNetwork() { + return Container( + margin: EdgeInsets.only(top: 120.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + // "无法连接到网络", + networkError.substring(0, networkError.indexOf(",")), + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF0D0D0D), + fontWeight: MyFontWeight.bold), + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 10.h), + child: Text( + "请检查网络设置或稍后重试", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + _onRefresh(); + }, + child: Container( + decoration: BoxDecoration( + color: Color(0xFF30415B), + borderRadius: BorderRadius.circular(15), + ), + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h), + child: Text( + "重试", + style: TextStyle( + fontSize: 14.sp, + color: Colors.white, + fontWeight: MyFontWeight.regular), + )), + ) + ], + ), + ); + } +} diff --git a/lib/business_system/home/vip/business_vip_page.dart b/lib/business_system/home/vip/business_vip_page.dart new file mode 100644 index 00000000..cb37896a --- /dev/null +++ b/lib/business_system/home/vip/business_vip_page.dart @@ -0,0 +1,117 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:huixiang/business_system/home/vip/vip_recharge_flow.dart'; +import 'package:huixiang/business_system/order/ticket/ticket_tab.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import '../../../view_widget/my_appbar.dart'; +import '../../../view_widget/my_tab.dart'; +import 'balance_change_record.dart'; +import 'bus_vip_list.dart'; + +class BusinessVipPage extends StatefulWidget { + final Map arguments; + + BusinessVipPage({this.arguments}); + + @override + State createState() { + return _BusinessVipPage(); + } +} + +class _BusinessVipPage extends State + with SingleTickerProviderStateMixin { + List _allKey = []; + String storeId; + TabController tabController; + + @override + void initState() { + super.initState(); + tabController = TabController(length: 3, vsync: this); + tabController.addListener(() { + if (!tabController.indexIsChanging) { + setState(() {}); + FocusScope.of(context).requestFocus(FocusNode()); + } + }); + loadFinish(); + storeId = widget.arguments["storeId"]; + } + + loadFinish() { + _allKey = [GlobalKey(), GlobalKey(), GlobalKey()]; + setState(() {}); + } + + + @override + Widget build(BuildContext context) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: Column( + children: [ + Expanded(child: DefaultTabController( + length: 3, + child: Scaffold( + resizeToAvoidBottomInset: false, + appBar: MyAppBar( + title: "", + leadingColor: Colors.black, + background: Colors.white, + toolbarHeight: kToolbarHeight + MediaQuery.of(context).padding.top, + bottom: TabBar ( + // isScrollable: true, //可滚动 + //去掉按钮阴影 + overlayColor: MaterialStateProperty.all(Colors.white), + indicator: const TicketTab( + width: 44, + borderSide: + BorderSide(width: 2.0, color: Color(0xFF30415B))), + labelColor: Colors.black, + labelStyle: TextStyle( + fontSize: 15.sp, + fontWeight: FontWeight.bold, + ), + unselectedLabelStyle: TextStyle( + fontSize: 15.sp, + fontWeight: FontWeight.normal, + color: Color(0xFF666666)), + controller: tabController, + //未选中文字颜色 + unselectedLabelColor: Color(0xFF666666), + //指示器与文字等宽 + tabs: [ + MyTab(text: "会员列表"), + MyTab(text: "会员充值流水"), + MyTab(text: "会员余额变动"), + ], + ), + ), + body: TabBarView( + controller: tabController, + children: [ + BusVipList( + _allKey[0], + storeId), + VipRechargeFlow( + _allKey[1], + storeId), + BalanceChangeRecord( + _allKey[2], + storeId,), + ], + ), + ), + )), + // SizedBox( + // height: 76.h, + // ), + ], + ), + ); + } +} diff --git a/lib/business_system/home/vip/vip_recharge_flow.dart b/lib/business_system/home/vip/vip_recharge_flow.dart new file mode 100644 index 00000000..b4d0c28b --- /dev/null +++ b/lib/business_system/home/vip/vip_recharge_flow.dart @@ -0,0 +1,988 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shimmer/shimmer.dart'; + +import '../../../generated/l10n.dart'; +import '../../../retrofit/business_api.dart'; +import '../../../retrofit/data/base_data.dart'; +import '../../../retrofit/data/recharge_flow_list.dart'; +import '../../../utils/business_instance.dart'; +import '../../../utils/flutter_utils.dart'; +import '../../../utils/font_weight.dart'; +import '../../../view_widget/no_data_view.dart'; + +class VipRechargeFlow extends StatefulWidget { + final String storeId; + + VipRechargeFlow( + Key key, + this.storeId, + ) : super(key: key); + + @override + State createState() { + return _VipRechargeFlow(); + } +} + +class _VipRechargeFlow extends State { + final RefreshController _refreshController = RefreshController(); + BusinessApiService businessService; + List records = []; + int _current = 1; + String networkError = ""; + int networkStatus = 0; + final TextEditingController editingController = TextEditingController(); + FocusNode _focusNode = FocusNode(); + bool isKeyBoardShow = 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; + } + }); + }); + _onRefresh(); + } + + _onRefresh({bool isShowLoad = true}) async { + if (isShowLoad) + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + await queryRechargeFlow(isRefreshData: false); + EasyLoading.dismiss(); + if (!mounted) return; + if (_refreshController.isRefresh) _refreshController.refreshCompleted(); + setState(() {}); + } + + queryRechargeFlow({isRefreshData = true}) async { + try { + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.storeId); + } + BaseData baseData = await businessService.rechargeFlow({ + "size": 10, + "pageSize": 10, + "current": _current, + "currentPage": 1, + "sort": "id", + "order": "descending", + "model": {"id": editingController?.text ?? ""}, + // "map": {"startDate": "", "endDate": ""}, + "timeRange": null + }).catchError((error) { + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; + setState(() {}); + _refreshController.refreshFailed(); + _refreshController.loadFailed(); + }); + if (!mounted) return; + if (baseData != null && baseData.isSuccess) { + records.addAll(baseData?.data?.records ?? []); + if ((baseData?.data?.records ?? []).isEmpty || + records.length.toString() == baseData.data.total) + _refreshController.loadNoData(); + else + _refreshController.loadComplete(); + networkStatus = 1; + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } finally { + if (isRefreshData) setState(() {}); + } + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFD8D8D8), + ), + rechargeFlowSearch(), + Expanded( + child: SmartRefresher( + controller: _refreshController, + enablePullDown: true, + enablePullUp: records.length == 0 ? false : true, + header: MyHeader(color: Color(0xFF30415B)), + physics: BouncingScrollPhysics(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: () { + _current = 1; + records.clear(); + _onRefresh(isShowLoad: false); + }, + onLoading: () { + _current++; + _onRefresh(isShowLoad: false); + }, + child: SingleChildScrollView( + physics: NeverScrollableScrollPhysics(), + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(left: 20.w, top: 16.h), + child: 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), + ), + ), + ), + ], + ), + ), + networkStatus == -1 + ? noNetwork() + : ((networkStatus == 0) + ? ListView.builder( + padding: EdgeInsets.zero, + itemCount: 10, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return rechargeFlowItemSm(); + }, + ) + : ((records == null || records.length == 0) + ? NoDataView( + src: + "assets/image/bs_no data_logo.webp", + isShowBtn: false, + text: "暂无数据", + fontSize: 16.sp, + iconHeight: 120.h, + margin: EdgeInsets.all(50.h), + ) + : Padding( + padding: EdgeInsets.only(top: 16.h), + child: Expanded( + child: ListView.builder( + itemCount: records?.length ?? 0, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return GestureDetector( + behavior: + HitTestBehavior.opaque, + onTap: () { + if (isKeyBoardShow) + FocusScope.of(context) + .requestFocus( + FocusNode()); + return; + }, + child: rechargeFlowItem( + records[position], + position), + ); + }, + ), + ), + ))), + ], + )))), + ], + ); + } + + /// 搜索框 + Widget rechargeFlowSearch() { + return Container( + color: Colors.white, + child: Container( + height: 40.h, + margin: + EdgeInsets.only(left: 20.w, right: 17.w, top: 10.h, bottom: 15.h), + decoration: BoxDecoration( + color: Color(0xFFF7F8FA), + borderRadius: BorderRadius.circular(2), + ), + child: TextField( + focusNode: _focusNode, + textInputAction: TextInputAction.search, + onEditingComplete: () { + FocusScope.of(context).requestFocus(FocusNode()); + records.clear(); + _onRefresh(); + }, + 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 rechargeFlowItem(Records records, index) { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 12.h), + padding: EdgeInsets.only( + top: 13.h, + bottom: 16.h, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + left: 12.h, + ), + child: Text( + "订单编号: ${records?.id ?? ""}", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.bold), + ), + ), + Container( + height: 1.h, + width: double.infinity, + color: Color(0xFFF4F6F7), + margin: EdgeInsets.symmetric(vertical: 13.h), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Column( + children: [ + Padding( + padding: EdgeInsets.only( + bottom: 12.h, + left: 12.w, + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Text( + "充值用户: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 1, + ), + Expanded( + child: Text( + records?.createPerson ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 2, + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12.h, + left: 12.w, + ), + child: Row( + children: [ + Expanded( + child: Text( + "手机号: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 1, + ), + Expanded( + child: Text( + records?.phone ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 2, + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12.h, + left: 12.w, + ), + child: Row( + children: [ + Expanded( + child: Text( + "充值实付金额: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 1, + ), + Expanded( + child: Text( + "¥${records?.rechargeMoney ?? ""}", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + flex: 2, + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12.h, + left: 12.w, + ), + child: Row( + children: [ + Expanded( + flex: 1, + child: Text( + "充值实赠金额: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + Expanded( + flex: 2, + child: Text( + "¥${records?.giftdMoney ?? ""}", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + ], + ), + ), + if (records.isShow) + Padding( + padding: EdgeInsets.only( + bottom: 12.h, + left: 12.w, + ), + child: Row( + children: [ + Expanded( + flex: 1, + child: Text( + "充值门店: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + Expanded( + flex: 2, + child: Text( + records?.storeName ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + ], + ), + ), + if (records.isShow) + Padding( + padding: EdgeInsets.only( + bottom: 12.h, + left: 12.w, + ), + child: Row( + children: [ + Expanded( + flex: 1, + child: Text( + "充值方式: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + Expanded( + flex: 2, + child: Text( + records?.rechargeName ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + ], + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12.h, + left: 12.w, + ), + child: Row( + children: [ + Expanded( + flex: 1, + child: Text( + "入账时间: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + Expanded( + flex: 2, + child: Text( + records?.createTime ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + )), + ], + )), + ], + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + records.isShow = !records.isShow; + }); + }, + child: Container( + padding: + EdgeInsets.symmetric(horizontal: 24.w, vertical: 6.h), + child: Icon( + records.isShow + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, + color: Color(0xFF0D0D0D), + size: 24, + )), + ), + ], + ) + ], + ), + ); + } + + Widget rechargeFlowItemSm() { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 12.h), + padding: EdgeInsets.only( + top: 13.h, + bottom: 16.h, + ), + child: Column( + children: [ + Container( + padding: EdgeInsets.only( + left: 12.h, + ), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 60.w, + height: 18.h, + ), + ), + SizedBox( + width: 15.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 198.w, + height: 18.h, + ), + ), + ], + ), + ), + Container( + height: 1.h, + width: double.infinity, + color: Color(0xFFF4F6F7), + margin: EdgeInsets.symmetric(vertical: 13.h), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 60.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 77.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + ), + ], + )), + Expanded( + flex: 2, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 48.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 77.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 120.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 44.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 44.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 44.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 44.w, + height: 18.h, + ), + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 12, + left: 12.h, + ), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 44.w, + height: 18.h, + ), + ), + ), + ], + )), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + margin: EdgeInsets.only(right: 24.w), + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 16.w, + height: 16.h, + ), + ), + ], + ) + ], + ), + ); + } + + Widget noNetwork() { + return Container( + margin: EdgeInsets.only(top: 120.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + networkError.substring(0, networkError.indexOf(",")), + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF0D0D0D), + fontWeight: MyFontWeight.bold), + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 10.h), + child: Text( + "请检查网络设置或稍后重试", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + _onRefresh(); + }, + child: Container( + decoration: BoxDecoration( + color: Color(0xFF30415B), + borderRadius: BorderRadius.circular(15), + ), + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h), + child: Text( + "重试", + style: TextStyle( + fontSize: 14.sp, + color: Colors.white, + fontWeight: MyFontWeight.regular), + )), + ) + ], + ), + ); + } +} diff --git a/lib/business_system/order/business_order_page.dart b/lib/business_system/order/business_order_page.dart index 5678208a..2b187cd2 100644 --- a/lib/business_system/order/business_order_page.dart +++ b/lib/business_system/order/business_order_page.dart @@ -1,12 +1,11 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; +import 'package:huixiang/business_system/order/ticket/ticket_page.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import '../../utils/font_weight.dart'; import '../../view_widget/my_appbar.dart'; import '../../view_widget/my_tab.dart'; -import 'order_list.dart'; +import 'order_list_page.dart'; class BusinessOrderPage extends StatefulWidget { final String storeId; @@ -20,223 +19,74 @@ class BusinessOrderPage extends StatefulWidget { } class _BusinessOrderPage extends State - with AutomaticKeepAliveClientMixin { + with AutomaticKeepAliveClientMixin,SingleTickerProviderStateMixin{ final RefreshController refreshController = RefreshController(); final ScrollController scrollController = ScrollController(); - final TextEditingController editingController = TextEditingController(); - FocusNode _focusNode = FocusNode(); - bool isKeyBoardShow = false; - List _allKey = []; - String selectTimeDate = ""; - String selectTimeDateNum = - "${DateFormat("yyyy年MM月dd日 00:00:00").format(DateTime.now().subtract(Duration(days: 2)))} 至 " - "${DateFormat("yyyy年MM月dd日 23:59:59").format(DateTime.now())}"; + TabController tabController; @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; - } - }); + tabController = TabController(length: 2, vsync: this); + tabController.addListener(() { + if (!tabController.indexIsChanging) { + FocusScope.of(context).requestFocus(FocusNode()); + } }); - loadFinish(); - } - - loadFinish() { - _allKey = [GlobalKey(), GlobalKey(), GlobalKey(), GlobalKey()]; - setState(() {}); - } - - ///离开页面记着销毁和清除 - @override - void dispose() { - _focusNode.unfocus(); - super.dispose(); } @override Widget build(BuildContext context) { super.build(context); - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - FocusScope.of(context).requestFocus(FocusNode()); - }, - child: Column( - children: [ - orderSearch(), - Expanded( - child: Stack( - children: [ - DefaultTabController( - length: 4, - child: Scaffold( - resizeToAvoidBottomInset: false, - appBar: MyAppBar( - title: "", - leading: false, - background: Colors.white, - toolbarHeight: MediaQuery.of(context).size.height >= 750 ? (kToolbarHeight + 15.h) : kToolbarHeight, - bottom: TabBar( - // isScrollable: true, //可滚动 - //去掉按钮阴影 - overlayColor: MaterialStateProperty.all(Colors.white), - indicatorColor: Color(0xFF30415B), - labelColor: Colors.black, - labelStyle: TextStyle( - fontSize: 15.sp, - fontWeight: FontWeight.bold, - ), - unselectedLabelStyle: TextStyle( - fontSize: 15.sp, - fontWeight: FontWeight.normal, - color: Color(0xFF666666)), - // controller: tabController, - //未选中文字颜色 - unselectedLabelColor: Color(0xffA29E9E), - indicatorSize: TabBarIndicatorSize.label, - //指示器与文字等宽 - tabs: [ - MyTab(text: "全部"), - MyTab(text: "未付款"), - MyTab(text: "已付款"), - MyTab(text: "已退款"), - ], - ), - ), - body: TabBarView( - children: [ - OrderList(_allKey[0], 0, widget.storeId, - editingController.text, selectTime(),MediaQuery.of(context).viewInsets.bottom != 0 ? isKeyBoardShow = true: isKeyBoardShow = false), - OrderList(_allKey[1], 1, widget.storeId, - editingController.text, selectTime(),MediaQuery.of(context).viewInsets.bottom != 0 ? isKeyBoardShow = true: isKeyBoardShow = false), - OrderList(_allKey[2], 2, widget.storeId, - editingController.text, selectTime(),MediaQuery.of(context).viewInsets.bottom != 0 ? isKeyBoardShow = true: isKeyBoardShow = false), - OrderList(_allKey[3], 3, widget.storeId, - editingController.text, selectTime(),MediaQuery.of(context).viewInsets.bottom != 0 ? isKeyBoardShow = true: isKeyBoardShow = false), - ], - ), - ), - ), - timeSelect(), - ], - ), - ), - SizedBox( - height: 76.h, - ), - ], - ), - ); - } - - /// 搜索框 - Widget orderSearch() { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Navigator.of(context).pushNamed('/router/goods_search_page'); - }, - child: Container( - color: Colors.white, - child: Container( - height: 40.h, - margin: EdgeInsets.only( - left: 18.w, - right: 18.w, - top: 55.h, - ), - decoration: BoxDecoration( - color: Color(0xFFF7F8FA), - borderRadius: BorderRadius.circular(2), - ), - child: TextField( - focusNode: _focusNode, - textInputAction: TextInputAction.search, - onEditingComplete: () { - FocusScope.of(context).requestFocus(FocusNode()); - loadFinish(); - }, - style: TextStyle( - fontSize: 15.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF808080), - ), - controller: editingController, - decoration: InputDecoration( - hintText: "请输入订单ID", - hintStyle: TextStyle( - color: Color(0xFF808080), + return Column( + children: [ + Expanded(child: + DefaultTabController( + length: 2, + child: Scaffold( + resizeToAvoidBottomInset: false, + appBar: MyAppBar( + title:"", + leading: false, + background: Colors.white, + bottom: TabBar( + // isScrollable: true, //可滚动 + //去掉按钮阴影 + overlayColor: MaterialStateProperty.all(Colors.white), + indicatorColor: Color(0xFF30415B), + labelColor: Colors.black, + labelStyle: TextStyle( 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, + fontWeight: FontWeight.bold, + ), + unselectedLabelStyle: TextStyle( + fontSize: 15.sp, + fontWeight: FontWeight.normal, + color: Color(0xFF666666) + ), + controller: tabController, + //未选中文字颜色 + unselectedLabelColor: Color(0xffA29E9E), + indicatorSize: TabBarIndicatorSize.label, + //指示器与文字等宽 + tabs: [ + MyTab(text:"订单列表"), + MyTab(text: "票券"), + ], ), - border: InputBorder.none, + ), + body: TabBarView( + controller: tabController, + children: [ + OrderListPage(widget.storeId), + TicketPage(widget.storeId)], ), ), - ), - ), - ); - } - - Widget timeSelect() { - return Container( - color: Colors.white, - child: GestureDetector( - onTap: () { - Navigator.of(context).pushNamed('/router/custom_page').then((value) { - selectTimeDate = value; - loadFinish(); - }); - }, - child: Container( - decoration: BoxDecoration( - color: Color(0xFFF7F8FA), - borderRadius: BorderRadius.circular(2), - ), - margin: - EdgeInsets.only(left: 18.w, right: 18.w, top: 12.h, bottom: 16.h), - padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 12.h), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - ("${selectTime().substring(0, 11)} ${selectTime().substring(21, 34)}"), - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF30415B), - fontWeight: MyFontWeight.regular), - ), - ], - ), - ), - ), + ),), + ], ); } - String selectTime() { - if (selectTimeDate == "" || selectTimeDate == null) { - return selectTimeDateNum; - } else - return selectTimeDate; - } - @override bool get wantKeepAlive => true; } diff --git a/lib/business_system/order/order_list.dart b/lib/business_system/order/order_list.dart index 2bb269d7..c2858088 100644 --- a/lib/business_system/order/order_list.dart +++ b/lib/business_system/order/order_list.dart @@ -334,9 +334,6 @@ class _OrderList extends State { ), ], ), - SizedBox( - height: 20.h, - ), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -367,7 +364,7 @@ class _OrderList extends State { right: (adminOrderDtoList.payStatus == 1 && adminOrderDtoList.refundStatus == 0 && adminOrderDtoList.enableRefundApprover == false) ? 20.w - : 0), + : 0,top: 20.h), child: Text( "核销", style: TextStyle( @@ -406,6 +403,7 @@ class _OrderList extends State { ), padding: EdgeInsets.symmetric( vertical: 5.h, horizontal: 14.w), + margin: EdgeInsets.only(top:20.h), child: Text( "申请退款", style: TextStyle( @@ -419,13 +417,14 @@ class _OrderList extends State { ), if(adminOrderDtoList.payStatus == 1 && adminOrderDtoList.refundStatus == 0 && adminOrderDtoList.enableRefundApprover == true) - Text( + Padding(padding: EdgeInsets.only(top:15.h), + child: Text( "备注:暂无退款权限,请前往企业微信联系退款审核人员进行审批", style: TextStyle( fontSize: 12.sp, color: Colors.red, fontWeight: MyFontWeight.regular), - ), + ),), ], ), ), diff --git a/lib/business_system/order/order_list_page.dart b/lib/business_system/order/order_list_page.dart new file mode 100644 index 00000000..f86fb352 --- /dev/null +++ b/lib/business_system/order/order_list_page.dart @@ -0,0 +1,232 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import '../../../utils/font_weight.dart'; +import '../../view_widget/my_appbar.dart'; +import '../../view_widget/my_tab.dart'; +import 'order_list.dart'; + +class OrderListPage extends StatefulWidget { + final String storeId; + + OrderListPage(this.storeId); + + @override + State createState() { + return _OrderListPage(); + } +} + +class _OrderListPage extends State { + final RefreshController refreshController = RefreshController(); + final ScrollController scrollController = ScrollController(); + final TextEditingController editingController = TextEditingController(); + FocusNode _focusNode = FocusNode(); + bool isKeyBoardShow = false; + List _allKey = []; + String selectTimeDate = ""; + String selectTimeDateNum = + "${DateFormat("yyyy年MM月dd日 00:00:00").format(DateTime.now().subtract(Duration(days: 2)))} 至 " + "${DateFormat("yyyy年MM月dd日 23:59:59").format(DateTime.now())}"; + + @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; + } + }); + }); + loadFinish(); + } + + loadFinish() { + _allKey = [GlobalKey(), GlobalKey(), GlobalKey(), GlobalKey()]; + setState(() {}); + } + + ///离开页面记着销毁和清除 + @override + void dispose() { + _focusNode.unfocus(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: Column( + children: [ + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFD8D8D8), + ), + orderSearch(), + timeSelect(), + Expanded( + child: DefaultTabController( + length: 4, + child: Scaffold( + resizeToAvoidBottomInset: false, + appBar: MyAppBar( + title: "", + leading: false, + background: Colors.white, + // toolbarHeight: MediaQuery.of(context).size.height >= 750 ? (kToolbarHeight + 15.h) : kToolbarHeight, + bottom: TabBar( + // isScrollable: true, //可滚动 + //去掉按钮阴影 + overlayColor: MaterialStateProperty.all(Colors.white), + indicatorColor: Color(0xFF30415B), + labelColor: Colors.black, + labelStyle: TextStyle( + fontSize: 15.sp, + fontWeight: FontWeight.bold, + ), + unselectedLabelStyle: TextStyle( + fontSize: 15.sp, + fontWeight: FontWeight.normal, + color: Color(0xFF666666)), + // controller: tabController, + //未选中文字颜色 + unselectedLabelColor: Color(0xffA29E9E), + indicatorSize: TabBarIndicatorSize.label, + //指示器与文字等宽 + tabs: [ + MyTab(text: "全部"), + MyTab(text: "未付款"), + MyTab(text: "已付款"), + MyTab(text: "已退款"), + ], + ), + ), + body: TabBarView( + children: [ + OrderList(_allKey[0], 0, widget.storeId, + editingController.text, selectTime(),MediaQuery.of(context).viewInsets.bottom != 0 ? isKeyBoardShow = true: isKeyBoardShow = false), + OrderList(_allKey[1], 1, widget.storeId, + editingController.text, selectTime(),MediaQuery.of(context).viewInsets.bottom != 0 ? isKeyBoardShow = true: isKeyBoardShow = false), + OrderList(_allKey[2], 2, widget.storeId, + editingController.text, selectTime(),MediaQuery.of(context).viewInsets.bottom != 0 ? isKeyBoardShow = true: isKeyBoardShow = false), + OrderList(_allKey[3], 3, widget.storeId, + editingController.text, selectTime(),MediaQuery.of(context).viewInsets.bottom != 0 ? isKeyBoardShow = true: isKeyBoardShow = false), + ], + ), + ), + ), + ), + SizedBox( + height: 76.h, + ), + ], + ), + ); + } + + /// 搜索框 + Widget orderSearch() { + return Container( + color: Colors.white, + child: Container( + height: 40.h, + margin: EdgeInsets.only( + left: 18.w, + right: 18.w, + top: 6.h, + ), + decoration: BoxDecoration( + color: Color(0xFFF7F8FA), + borderRadius: BorderRadius.circular(2), + ), + child: TextField( + focusNode: _focusNode, + textInputAction: TextInputAction.search, + onEditingComplete: () { + FocusScope.of(context).requestFocus(FocusNode()); + loadFinish(); + }, + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF808080), + ), + controller: editingController, + decoration: InputDecoration( + hintText: "请输入订单ID", + 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 timeSelect() { + return Container( + color: Colors.white, + child: GestureDetector( + onTap: () { + Navigator.of(context).pushNamed('/router/custom_page').then((value) { + selectTimeDate = value; + loadFinish(); + }); + }, + child: Container( + decoration: BoxDecoration( + color: Color(0xFFF7F8FA), + borderRadius: BorderRadius.circular(2), + ), + margin: + EdgeInsets.only(left: 18.w, right: 18.w, top: 13.h,), + padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 12.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + ("${selectTime().substring(0, 11)} ${selectTime().substring(21, 34)}"), + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF30415B), + fontWeight: MyFontWeight.regular), + ), + ], + ), + ), + ), + ); + } + + String selectTime() { + if (selectTimeDate == "" || selectTimeDate == null) { + return selectTimeDateNum; + } else + return selectTimeDate; + } +} diff --git a/lib/business_system/order/order_write_off.dart b/lib/business_system/order/order_write_off.dart index 91a73aee..cd1b79ad 100644 --- a/lib/business_system/order/order_write_off.dart +++ b/lib/business_system/order/order_write_off.dart @@ -446,7 +446,7 @@ class _OrderWriteOff extends State { ); } - ///扫码进入的核销数据 + ///扫码进入/票券列表进入的核销数据 Widget scanCodeInfoItem(TicketItemList ticketItemList) { return Container( width: double.infinity, @@ -478,7 +478,7 @@ class _OrderWriteOff extends State { style: TextStyle( fontWeight: MyFontWeight.semi_bold, fontSize: 12.sp, - color: (ticketItemList.state == 1) + color: (ticketItemList.state == 1 && ticketDetails.state != 9) ? Color(0xFF30415B) : Color(0xFFACACAC), ), @@ -487,7 +487,7 @@ class _OrderWriteOff extends State { SizedBox( height: 25.h, ), - if (ticketItemList.state == 1) + if (ticketItemList.state == 1 && ticketDetails.state != 9) Checkbox( value: ticketItemList.isSelect, onChanged: (a) { diff --git a/lib/business_system/order/request_refund.dart b/lib/business_system/order/request_refund.dart index e78860de..516ec3bf 100644 --- a/lib/business_system/order/request_refund.dart +++ b/lib/business_system/order/request_refund.dart @@ -6,7 +6,6 @@ import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:shared_preferences/shared_preferences.dart'; import '../../generated/l10n.dart'; import '../../retrofit/business_api.dart'; diff --git a/lib/business_system/order/ticket/ticket_list.dart b/lib/business_system/order/ticket/ticket_list.dart new file mode 100644 index 00000000..852328e0 --- /dev/null +++ b/lib/business_system/order/ticket/ticket_list.dart @@ -0,0 +1,612 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shimmer/shimmer.dart'; + +import '../../../generated/l10n.dart'; +import '../../../retrofit/business_api.dart'; +import '../../../retrofit/data/base_data.dart'; +import '../../../retrofit/data/ticket_details.dart'; +import '../../../retrofit/data/ticket_show.dart'; +import '../../../utils/business_instance.dart'; +import '../../../utils/flutter_utils.dart'; +import '../../../utils/font_weight.dart'; +import '../../../view_widget/no_data_view.dart'; + +class TicketList extends StatefulWidget { + final String ticketState; + final String ticketType; + final String storeId; + final String keyword; + final bool typeScreen; + final bool stateScreen; + final bool isKeyBoardShow; + + TicketList(Key key, this.ticketState, this.ticketType, this.storeId, this.keyword,this.typeScreen,this.stateScreen, + this.isKeyBoardShow) + : super(key: key); + + @override + State createState() { + return _TicketList(); + } +} + +class _TicketList extends State { + final RefreshController _refreshController = RefreshController(); + ScrollPhysics scrollPhysics = NeverScrollableScrollPhysics(); + final ScrollController controller = ScrollController(); + BusinessApiService businessService; + List ticketShowList = []; + int _pageNum = 1; + String networkError = ""; + int networkStatus = 0; + TicketDetails ticketDetails; + + @override + void dispose() { + super.dispose(); + _refreshController.dispose(); + } + + @override + void initState() { + super.initState(); + _onRefresh(); + } + + _onRefresh({bool isShowLoad = true}) async { + if (isShowLoad) + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + await queryTicketList(isRefreshData: false); + EasyLoading.dismiss(); + if (!mounted) return; + if (_refreshController.isRefresh) _refreshController.refreshCompleted(); + setState(() {}); + } + + queryTicketList({String queryName,isRefreshData = true}) async { + try { + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.storeId); + } + BaseData baseData = await businessService.showList({ + "pageNum": _pageNum, + "pageSize": 10, + "productId": 0, + "productSkuId": 0, + "searchKey": widget.keyword == "" ? (queryName ?? "") : widget.keyword, + "state": widget?.ticketState ?? "", + "storeId": widget?.storeId ?? "", + "ticketCode": "", + "ticketId": 0, + "ticketItemIds": [], + "type": widget?.ticketType ?? "" + }).catchError((error) { + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; + setState(() {}); + _refreshController.refreshFailed(); + _refreshController.loadFailed(); + }); + if (!mounted) return; + if (baseData != null && baseData.isSuccess) { + ticketShowList.addAll(baseData?.data?.list ?? []); + if ((baseData?.data?.list ?? []).isEmpty || + ticketShowList.length.toString() == baseData.data.total) + _refreshController.loadNoData(); + else + _refreshController.loadComplete(); + networkStatus = 1; + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } finally { + if (isRefreshData) setState(() {}); + } + } + + ///票券详情 + queryTicketDetails(code) async { + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.storeId); + } + BaseData baseData = + await businessService.ticketCode(code).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + ticketDetails = baseData.data; + if(ticketDetails.state != 9){ + Navigator.of(context) + .pushNamed('/router/order_write_off', arguments: { + "ticketDetails": ticketDetails, + }).then((value) async { + queryTicketList(queryName: ticketDetails.name); + }); + } + else{ + Navigator.of(context) + .pushNamed('/router/order_write_off', arguments: { + "ticketDetails": ticketDetails, + }); + } + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + + @override + Widget build(BuildContext context) { + return SmartRefresher( + controller: _refreshController, + enablePullDown: true, + enablePullUp: ticketShowList.length == 0 ? false : true, + header: MyHeader(color: Color(0xFF30415B)), + physics: BouncingScrollPhysics(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: () { + _pageNum = 1; + ticketShowList.clear(); + _onRefresh(isShowLoad: false); + }, + onLoading: () { + _pageNum++; + _onRefresh(isShowLoad: false); + }, + child: networkStatus == -1 + ? noNetwork() + : ((networkStatus == 0) + ? ListView.builder( + padding: EdgeInsets.zero, + itemCount: 10, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return ticketListSm(); + }, + ) + : ((ticketShowList == null || ticketShowList.length == 0) + ? NoDataView( + src: "assets/image/bs_no data_logo.webp", + isShowBtn: false, + text: "暂无数据", + fontSize: 16.sp, + iconHeight: 120.h, + margin: EdgeInsets.all(50.h), + ) + : Padding( + padding: EdgeInsets.only(top: 16.h), + child: ListView.builder( + itemCount: ticketShowList?.length ?? 0, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + if (widget.isKeyBoardShow || widget.stateScreen == true || widget.typeScreen == true) { + FocusScope.of(context) + .requestFocus(FocusNode()); + return; + } else { + queryTicketDetails(ticketShowList[position].code ?? ""); + } + }, + child: ticketListItem(ticketShowList[position],position), + ); + }, + ), + ))), + ); + } + + Widget ticketListItem(TicketShowList ticketShowList,index) { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 16.h), + padding: EdgeInsets.symmetric(vertical: 12.h), + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(left: 12.w, right: 12.w, bottom: 13.h), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Text( + ticketShowList.name ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + fontSize: 14.sp, + color: Colors.black, + fontWeight: MyFontWeight.bold), + ), + ), + Text( + ticketState(index), + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFFFA5151), + fontWeight: MyFontWeight.bold), + ) + ], + ), + ), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFF4F6F7), + ), + Padding( + padding: EdgeInsets.only(top: 13.h, left: 12.w), + child: Row( + children: [ + Text( + "联系人:", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ), + SizedBox( + width: 26.w, + ), + Text( + ticketShowList?.nickName ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ) + ], + )), + Padding( + padding: EdgeInsets.only(top: 12.h, left: 12.w), + child: Row( + children: [ + Text( + "手机号:", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ), + SizedBox( + width: 26.w, + ), + Text( + ticketShowList?.userPhone ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ) + ], + ), + ), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFF4F6F7), + margin: EdgeInsets.symmetric(vertical: 12.h), + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 12.w), + child: Row( + children: [ + Text( + "票券编号: ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ), + Expanded( + child: Text( + ticketShowList?.code ??"", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF808080), + fontWeight: MyFontWeight.regular), + )), + Text( + ticketShowList?.amount ??"", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF181818), + fontWeight: MyFontWeight.bold), + ) + ], + )), + if(ticketShowList.state == 1 || ticketShowList?.state == 2) + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + queryTicketDetails(ticketShowList.code ?? ""); + }, + child: Container( + decoration: BoxDecoration( + color: Color(0xFF30415B), + borderRadius: BorderRadius.circular(4), + ), + padding: + EdgeInsets.symmetric(vertical: 5.h, horizontal: 26.w), + margin: EdgeInsets.only(top: 16.h, right:12.w), + child: Text( + "核销", + style: TextStyle( + fontSize: 12.sp, + color: Colors.white, + fontWeight: MyFontWeight.regular), + ), + ), + ) + ], + ), + ], + ), + ); + } + + String ticketState(index){ + if (ticketShowList[index].state == 1 || ticketShowList[index].state == 2) { + return "可使用"; + } else if (ticketShowList[index].state == 7) { + return "已取消"; + } else if (ticketShowList[index].state == 8) { + return "已失效"; + }else if (ticketShowList[index].state == 9) { + return "已使用"; + } + } + + Widget ticketListSm() { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + margin: EdgeInsets.all(16), + padding: EdgeInsets.symmetric(vertical: 12.h), + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(left: 12.w, right: 12.w, bottom: 13.h), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 154.w, + height: 18.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 42.w, + height: 18.h, + ), + ), + ], + ), + ), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFF4F6F7), + ), + Padding( + padding: EdgeInsets.only(top: 13.h, left: 12.w), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 40.w, + height: 17.h, + ), + ), + SizedBox( + width: 26.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 24.w, + height: 17.h, + ), + ), + ], + )), + Padding( + padding: EdgeInsets.only(top: 12.h, left: 12.w), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 40.w, + height: 17.h, + ), + ), + SizedBox( + width: 26.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 77.w, + height: 17.h, + ), + ), + ], + ), + ), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFF4F6F7), + margin: EdgeInsets.symmetric(vertical: 12.h), + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 12.w), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 17.h, + ), + ), + SizedBox(width:14.w,), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 115.w, + height: 17.h, + ), + ), + ], + )), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + margin: EdgeInsets.only(right: 20.w,top:16.h), + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 76.w, + height: 27.h, + ), + ), + ], + ), + ], + ) + ); + } + + Widget noNetwork() { + return Container( + color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + // "无法连接到网络", + networkError.substring(0, networkError.indexOf(",")), + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF0D0D0D), + fontWeight: MyFontWeight.bold), + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 10.h), + child: Text( + "请检查网络设置或稍后重试", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + _onRefresh(); + }, + child: Container( + decoration: BoxDecoration( + color: Color(0xFF30415B), + borderRadius: BorderRadius.circular(15), + ), + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h), + child: Text( + "重试", + style: TextStyle( + fontSize: 14.sp, + color: Colors.white, + fontWeight: MyFontWeight.regular), + )), + ) + ], + ), + ); + } +} diff --git a/lib/business_system/order/ticket/ticket_page.dart b/lib/business_system/order/ticket/ticket_page.dart new file mode 100644 index 00000000..d07ff910 --- /dev/null +++ b/lib/business_system/order/ticket/ticket_page.dart @@ -0,0 +1,634 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:huixiang/business_system/order/ticket/ticket_list.dart'; +import 'package:huixiang/business_system/order/ticket/ticket_records_page.dart'; +import 'package:huixiang/business_system/order/ticket/ticket_statistics_page.dart'; +import 'package:huixiang/business_system/order/ticket/ticket_tab.dart'; +import 'package:intl/intl.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import '../../../utils/font_weight.dart'; +import '../../../view_widget/my_appbar.dart'; +import '../../../view_widget/my_tab.dart'; + +class TicketPage extends StatefulWidget { + final String storeId; + + TicketPage(this.storeId); + + @override + State createState() { + return _TicketPage(); + } +} + +class _TicketPage extends State + with SingleTickerProviderStateMixin { + final RefreshController refreshController = RefreshController(); + final ScrollController scrollController = ScrollController(); + final TextEditingController editingController = TextEditingController(); + FocusNode _focusNode = FocusNode(); + bool isKeyBoardShow = false; + List _allKey = []; + String selectTimeDate = ""; + String selectTimeDateNum = + "${DateFormat("yyyy年MM月dd日 00:00:00").format(DateTime.now().subtract(Duration(days:5)))} 至 " + "${DateFormat("yyyy年MM月dd日 23:59:59").format(DateTime.now())}"; + bool typeScreen = false; + bool stateScreen = false; + String ticketType; + String ticketState = "-1"; + TabController tabController; + + @override + void initState() { + super.initState(); + tabController = TabController(length: 3, vsync: this); + tabController.addListener(() { + if (!tabController.indexIsChanging) { + setState(() {}); + FocusScope.of(context).requestFocus(FocusNode()); + } + }); + 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; + } + }); + }); + loadFinish(); + } + + loadFinish() { + _allKey = [GlobalKey(), GlobalKey(), GlobalKey()]; + setState(() {}); + } + + ///离开页面记着销毁和清除 + @override + void dispose() { + _focusNode.unfocus(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: Stack( + children: [ + Column( + children: [ + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFD8D8D8), + ), + ticketSearch(), + tabController.index == 0 ? screen() : timeSelect(), + Expanded( + child: DefaultTabController( + length: 3, + child: Scaffold( + resizeToAvoidBottomInset: false, + appBar: MyAppBar( + title: "", + leading: false, + background: Colors.white, + bottom: TabBar( + // isScrollable: true, //可滚动 + //去掉按钮阴影 + overlayColor: MaterialStateProperty.all(Colors.white), + indicator: const TicketTab( + width: 33, + borderSide: BorderSide( + width: 2.0, color: Color(0xFF30415B))), + labelColor: Colors.black, + labelStyle: TextStyle( + fontSize: 15.sp, + fontWeight: FontWeight.bold, + ), + unselectedLabelStyle: TextStyle( + fontSize: 15.sp, + fontWeight: FontWeight.normal, + color: Color(0xFF666666)), + controller: tabController, + //未选中文字颜色 + unselectedLabelColor: Color(0xFF0D0D0D), + //指示器与文字等宽 + tabs: [ + MyTab(text: "票券列表"), + MyTab(text: "核销记录"), + MyTab(text: "核销统计"), + ], + ), + ), + body: TabBarView( + controller: tabController, + children: [ + TicketList( + _allKey[0], + ticketState == "-1" ? "0" : ticketState, + ticketType, + widget.storeId, + editingController.text, + typeScreen, + stateScreen, + MediaQuery.of(context).viewInsets.bottom != 0 + ? isKeyBoardShow = true + : isKeyBoardShow = false), + TicketRecordPage( + _allKey[1], + 1, + widget.storeId, + editingController.text, + (selectTimeDate == "" || selectTimeDate == null) ? "" :selectTimeDate, + MediaQuery.of(context).viewInsets.bottom != 0 + ? isKeyBoardShow = true + : isKeyBoardShow = false), + TicketStatisticsPage( + _allKey[2], + 2, + widget.storeId, + editingController.text, + selectTime(), + MediaQuery.of(context).viewInsets.bottom != 0 + ? isKeyBoardShow = true + : isKeyBoardShow = false), + ], + ), + ), + ), + ), + SizedBox( + height: 76.h, + ), + ], + ), + Container( + padding: EdgeInsets.symmetric(horizontal: 18.w), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (typeScreen && tabController.index == 0) + Expanded( + child: Container( + height: 176.h, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all( + color: Color(0x29000000), + width: 0.5.w, + ), + borderRadius: BorderRadius.circular(2), + ), + margin: EdgeInsets.only(top: 108.h), + padding: EdgeInsets.symmetric( + horizontal: 16.w, vertical: 8.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + ticketType = ""; + typeScreen = false; + loadFinish(); + }); + }, + child: Container( + width: double.infinity, + padding: + EdgeInsets.symmetric(vertical: 8.h), + child: Text( + "所有", + style: TextStyle( + color: Color(0xFF808080), + fontSize: 15.sp, + fontWeight: MyFontWeight.regular), + )), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + ticketType = "ADOPT_WARRANT"; + typeScreen = false; + loadFinish(); + }); + }, + child: Container( + width: double.infinity, + padding: + EdgeInsets.symmetric(vertical: 8.h), + child: Text( + "认领凭证", + style: TextStyle( + color: Color(0xFF808080), + fontSize: 15.sp, + fontWeight: MyFontWeight.regular), + ), + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + ticketType = "IDENTITY_CARD"; + typeScreen = false; + loadFinish(); + }); + }, + child: Container( + width: double.infinity, + padding: + EdgeInsets.symmetric(vertical: 8.h), + child: Text( + "身份卡片", + style: TextStyle( + color: Color(0xFF808080), + fontSize: 15.sp, + fontWeight: MyFontWeight.regular), + ), + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + ticketType = "NORMAL"; + typeScreen = false; + loadFinish(); + }); + }, + child: Container( + width: double.infinity, + padding: + EdgeInsets.symmetric(vertical: 8.h), + child: Text( + "常规票券", + style: TextStyle( + color: Color(0xFF808080), + fontSize: 15.sp, + fontWeight: MyFontWeight.regular), + ))), + ], + ))), + if (!typeScreen || !stateScreen) Expanded(child: Container()), + SizedBox( + width: 14.w, + ), + if (stateScreen && tabController.index == 0) + Expanded( + child: Container( + height: 210.h, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all( + color: Color(0x29000000), + width: 0.5.w, + ), + borderRadius: BorderRadius.circular(2), + ), + margin: EdgeInsets.only(top: 108.h), + padding: EdgeInsets.symmetric( + horizontal: 16.w, vertical: 8.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + ticketState = "0"; + stateScreen = false; + loadFinish(); + }); + }, + child: Container( + width: double.infinity, + padding: + EdgeInsets.symmetric(vertical: 8.h), + child: Text( + "全部", + style: TextStyle( + color: Color(0xFF808080), + fontSize: 15.sp, + fontWeight: MyFontWeight.regular), + ))), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + ticketState = "1"; + stateScreen = false; + loadFinish(); + }); + }, + child: Container( + width: double.infinity, + padding: + EdgeInsets.symmetric(vertical: 8.h), + child: Text( + "可使用", + style: TextStyle( + color: Color(0xFF808080), + fontSize: 15.sp, + fontWeight: MyFontWeight.regular), + ), + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + ticketState = "7"; + stateScreen = false; + loadFinish(); + }); + }, + child: Container( + width: double.infinity, + padding: + EdgeInsets.symmetric(vertical: 8.h), + child: Text( + "已取消", + style: TextStyle( + color: Color(0xFF808080), + fontSize: 15.sp, + fontWeight: MyFontWeight.regular), + ), + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + ticketState = "8"; + stateScreen = false; + loadFinish(); + }); + }, + child: Container( + width: double.infinity, + padding: + EdgeInsets.symmetric(vertical: 8.h), + child: Text( + "已失效", + style: TextStyle( + color: Color(0xFF808080), + fontSize: 15.sp, + fontWeight: MyFontWeight.regular), + ), + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + ticketState = "9"; + stateScreen = false; + loadFinish(); + }); + }, + child: Container( + width: double.infinity, + padding: + EdgeInsets.symmetric(vertical: 8.h), + child: Text( + "已使用", + style: TextStyle( + color: Color(0xFF808080), + fontSize: 15.sp, + fontWeight: MyFontWeight.regular), + ), + )), + ], + ))), + ], + ), + ), + ], + ), + ); + } + + /// 搜索框 + Widget ticketSearch() { + return Container( + color: Colors.white, + child: Container( + height: 40.h, + margin: + EdgeInsets.only(left: 18.w, right: 18.w, top: 6.h, bottom: 13.h), + decoration: BoxDecoration( + color: Color(0xFFF7F8FA), + borderRadius: BorderRadius.circular(2), + ), + child: TextField( + focusNode: _focusNode, + textInputAction: TextInputAction.search, + onTap: () { + typeScreen = false; + stateScreen = false; + }, + onEditingComplete: () { + FocusScope.of(context).requestFocus(FocusNode()); + loadFinish(); + }, + 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 screen() { + return Container( + color: Colors.white, + width: double.infinity, + padding: EdgeInsets.only(left: 18.w, right: 18.w), + child: Row( + children: [ + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + typeScreen = !typeScreen; + FocusScope.of(context).requestFocus(FocusNode()); + stateScreen = false; + }); + }, + child: Container( + decoration: BoxDecoration( + color: Color(0XFFF7F8FA), + borderRadius: BorderRadius.circular(2), + ), + padding: EdgeInsets.symmetric(horizontal: 9.w, vertical: 11.h), + child: Row( + children: [ + Expanded( + child: Text( + ticketType == null ? "类型筛选" : shopTypeSelect(), + style: TextStyle( + color: Color(0xFF808080), + fontSize: 18.sp, + fontWeight: MyFontWeight.regular), + )), + Icon( + (typeScreen != null && !typeScreen) + ? Icons.keyboard_arrow_down + : Icons.keyboard_arrow_up, + color: Color(0xFF808080), + size: 24, + ), + ], + ), + ), + ), + ), + SizedBox( + width: 14.w, + ), + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + stateScreen = !stateScreen; + FocusScope.of(context).requestFocus(FocusNode()); + typeScreen = false; + }); + }, + child: Container( + decoration: BoxDecoration( + color: Color(0XFFF7F8FA), + borderRadius: BorderRadius.circular(2), + ), + padding: + EdgeInsets.symmetric(horizontal: 9.w, vertical: 11.h), + child: Row( + children: [ + Expanded( + child: Text( + ticketState == "-1" ? "状态筛选" : shopStateSelect(), + style: TextStyle( + color: Color(0xFF808080), + fontSize: 18.sp, + fontWeight: MyFontWeight.regular), + )), + Icon( + (stateScreen != null && !stateScreen) + ? Icons.keyboard_arrow_down + : Icons.keyboard_arrow_up, + color: Color(0xFF808080), + size: 24, + ), + ], + ), + ))), + ], + ), + ); + } + + ///类型筛选 + String shopTypeSelect() { + if (ticketType == "") { + return "所有"; + } else if (ticketType == "ADOPT_WARRANT") { + return "认领凭证"; + } else if (ticketType == "IDENTITY_CARD") { + return "身份卡片"; + } else if (ticketType == "NORMAL") { + return "常规票券"; + } + } + + ///类型筛选 + String shopStateSelect() { + if (ticketState == "0") { + return "全部"; + } else if (ticketState == "1") { + return "可使用"; + } else if (ticketState == "7") { + return "已取消"; + } else if (ticketState == "8") { + return "已失效"; + } else if (ticketState == "9") { + return "已使用"; + } + } + + ///时间选择 + Widget timeSelect() { + return Container( + color: Colors.white, + child: GestureDetector( + onTap: () { + Navigator.of(context).pushNamed('/router/custom_page').then((value) { + selectTimeDate = value; + loadFinish(); + }); + }, + child: Container( + decoration: BoxDecoration( + color: Color(0xFFF7F8FA), + borderRadius: BorderRadius.circular(2), + ), + margin: EdgeInsets.only( + left: 18.w, + right: 18.w, + ), + padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 12.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + (tabController.index == 1 && (selectTimeDate == "" || selectTimeDate == null)) ? "开始时间 至 结束时间" :"${selectTime().substring(0, 11)} ${selectTime().substring(21, 34)}", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF30415B), + fontWeight: MyFontWeight.regular), + ), + ], + ), + ), + ), + ); + } + + String selectTime() { + if (selectTimeDate == "" || selectTimeDate == null) { + return selectTimeDateNum; + } else + return selectTimeDate; + } +} diff --git a/lib/business_system/order/ticket/ticket_records_page.dart b/lib/business_system/order/ticket/ticket_records_page.dart new file mode 100644 index 00000000..51c290f9 --- /dev/null +++ b/lib/business_system/order/ticket/ticket_records_page.dart @@ -0,0 +1,622 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shimmer/shimmer.dart'; + +import '../../../generated/l10n.dart'; +import '../../../retrofit/business_api.dart'; +import '../../../retrofit/data/base_data.dart'; +import '../../../retrofit/data/ticket_record.dart'; +import '../../../utils/business_instance.dart'; +import '../../../utils/flutter_utils.dart'; +import '../../../utils/font_weight.dart'; +import '../../../view_widget/no_data_view.dart'; + +class TicketRecordPage extends StatefulWidget { + final int status; + final String storeId; + final String keyword; + final String time; + final bool isKeyBoardShow; + + TicketRecordPage(Key key, this.status, this.storeId, this.keyword, this.time, + this.isKeyBoardShow) + : super(key: key); + + @override + State createState() { + return _TicketRecordPage(); + } +} + +class _TicketRecordPage extends State { + final RefreshController _refreshController = RefreshController(); + ScrollPhysics scrollPhysics = NeverScrollableScrollPhysics(); + final ScrollController controller = ScrollController(); + BusinessApiService businessService; + List ticketRecordList = []; + int _pageNum = 1; + String networkError = ""; + int networkStatus = 0; + + @override + void dispose() { + super.dispose(); + _refreshController.dispose(); + } + + @override + void initState() { + super.initState(); + _onRefresh(); + } + + _onRefresh({bool isShowLoad = true}) async { + if (isShowLoad) + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + await queryRecordsList(isRefreshData: false); + EasyLoading.dismiss(); + if (!mounted) return; + if (_refreshController.isRefresh) _refreshController.refreshCompleted(); + setState(() {}); + } + + queryRecordsList({isRefreshData = true}) async { + try { + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.storeId); + } + BaseData baseData = await businessService.wipedRecord({ + "pageNum":_pageNum, + "pageSize": 10, + "searchKey": widget?.keyword ?? "", + "startTime": widget.time == "" ? "" :widget.time + .replaceAll("年", "-") + .replaceAll("月", "-") + .replaceAll("日", "") + .substring(0, 19), + "endTime": widget.time == "" ? "" :widget.time + .replaceAll("年", "-") + .replaceAll("月", "-") + .replaceAll("日", "") + .substring(widget.time.length >= 21 ? 22 : 0, + widget.time.length >= 21 ? 41 : 0), + }).catchError((error) { + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; + setState(() {}); + _refreshController.refreshFailed(); + _refreshController.loadFailed(); + }); + if (!mounted) return; + if (baseData != null && baseData.isSuccess) { + ticketRecordList.addAll(baseData?.data?.list ?? []); + if ((baseData?.data?.list ?? []).isEmpty || + ticketRecordList.length.toString() == baseData.data.total) + _refreshController.loadNoData(); + else + _refreshController.loadComplete(); + networkStatus = 1; + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } finally { + if (isRefreshData) setState(() {}); + } + } + + @override + Widget build(BuildContext context) { + return SmartRefresher( + controller: _refreshController, + enablePullDown: true, + enablePullUp: ticketRecordList.length == 0 ? false : true, + header: MyHeader(color: Color(0xFF30415B)), + physics: BouncingScrollPhysics(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: () { + _pageNum = 1; + ticketRecordList.clear(); + _onRefresh(isShowLoad: false); + }, + onLoading: () { + _pageNum++; + _onRefresh(isShowLoad: false); + }, + child: networkStatus == -1 + ? noNetwork() + : ((networkStatus==0) + ? ListView.builder( + padding: EdgeInsets.zero, + itemCount: 10, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return recordsSm(); + }, + ) + : ((ticketRecordList == null || ticketRecordList.length == 0) + ? NoDataView( + src: "assets/image/bs_no data_logo.webp", + isShowBtn: false, + text: "暂无数据", + fontSize: 16.sp, + iconHeight: 120.h, + margin: EdgeInsets.all(50.h), + ) + : Padding( + padding: EdgeInsets.only(top: 16.h), + child: ListView.builder( + itemCount: ticketRecordList?.length ?? 0, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + if (widget.isKeyBoardShow) + FocusScope.of(context) + .requestFocus(FocusNode()); + return; + }, + child: recordsItem(ticketRecordList[position],position), + ); + }, + ), + ))), + ); + } + + Widget recordsItem(TicketRecordList ticketRecordList,index) { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 16.h), + padding: EdgeInsets.symmetric(vertical: 12.h), + child: Column( + children: [ + Padding(padding:EdgeInsets.only(left: 12.w,right: 18.w,bottom:13.h), + child: Row( + children: [ + Expanded(child:Text( + ticketRecordList?.ticketName ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + fontSize: 14.sp, + color: Colors.black, + fontWeight: MyFontWeight.bold), + )), + Text( + "核销次数: ${ticketRecordList?.ticketItems[0]?.canWipedNumber ?? "0"}", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ) + ], + ),), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFF4F6F7), + ), + Padding(padding:EdgeInsets.only(top:13.h,left:12.w), + child:Row( + children: [ + Text( + "联系人:", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + SizedBox(width: 26.w,), + Text( + ticketRecordList?.userName ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ) + ], + )), + Padding(padding:EdgeInsets.only(top:12.h,left:12.w), + child:Row( + children: [ + Text( + "手机号:", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + Text( + ticketRecordList?.userPhone ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ) + ], + ),), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFF4F6F7), + margin: EdgeInsets.symmetric(vertical:12.h), + ), + Padding(padding:EdgeInsets.only(left:12.w), + child:Row( + children: [ + Text( + "核销店铺:", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ), + SizedBox(width: 14.w,), + Text( + ticketRecordList?.wipedUserName ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF808080), + fontWeight: MyFontWeight.regular), + ) + ], + )), + Padding(padding:EdgeInsets.only(left:12.w), + child:Row( + children: [ + Text( + "票券编号:", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ), + SizedBox(width: 14.w,), + Text( + ticketRecordList?.ticketCode ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF808080), + fontWeight: MyFontWeight.regular), + ) + ], + )), + Padding(padding:EdgeInsets.symmetric(horizontal:12.w), + child:Row( + children: [ + Text( + "核销时间:", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ), + SizedBox(width: 14.w,), + Expanded(child:Text( + ticketRecordList?.ticketItems[0]?.finishTime ??"", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF808080), + fontWeight: MyFontWeight.regular), + )), + Text( + ticketRecordList?.ticket?.amount ??"", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF181818), + fontWeight: MyFontWeight.bold), + ) + ], + )), + ], + ), + ); + } + + Widget recordsSm() { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + margin: EdgeInsets.all(16), + padding: EdgeInsets.symmetric(vertical: 12.h), + child: Column( + children: [ + Padding(padding:EdgeInsets.only(left: 12.w,right: 18.w,bottom:13.h), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 154.w, + height: 18.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 10.w, + height: 18.h, + margin: EdgeInsets.only(left: 14.w), + ), + ), + ], + ),), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFF4F6F7), + ), + Padding(padding:EdgeInsets.only(top:13.h,left:12.w), + child:Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 40.w, + height: 18.h, + ), + ), + SizedBox(width: 26.w,), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 24.w, + height: 18.h, + ), + ), + ], + )), + Padding(padding:EdgeInsets.only(top:12.h,left:12.w), + child:Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 40.w, + height: 18.h, + ), + ), + SizedBox(width: 26.w,), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 77.w, + height: 18.h, + ), + ), + ], + ),), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFF4F6F7), + margin: EdgeInsets.symmetric(vertical:12.h), + ), + Container( + padding:EdgeInsets.only(left:12.w), + margin: EdgeInsets.only(bottom: 6.h), + child:Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + SizedBox(width: 14.w,), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 84.w, + height: 18.h, + ), + ), + ], + )), + Container(padding:EdgeInsets.only(left:12.w), + margin: EdgeInsets.only(bottom: 6.h), + child:Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + SizedBox(width: 14.w,), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 107.w, + height: 18.h, + ), + ), + ], + )), + Padding(padding:EdgeInsets.symmetric(horizontal:12.w), + child:Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + SizedBox(width: 14.w,), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 107.w, + height: 18.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 36.w, + height: 18.h, + ), + ), + ], + )), + ], + ) + ); + } + + Widget noNetwork() { + return Container( + color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + // "无法连接到网络", + networkError.substring(0, networkError.indexOf(",")), + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF0D0D0D), + fontWeight: MyFontWeight.bold), + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 10.h), + child: Text( + "请检查网络设置或稍后重试", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + _onRefresh(); + }, + child: Container( + decoration: BoxDecoration( + color: Color(0xFF30415B), + borderRadius: BorderRadius.circular(15), + ), + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h), + child: Text( + "重试", + style: TextStyle( + fontSize: 14.sp, + color: Colors.white, + fontWeight: MyFontWeight.regular), + )), + ) + ], + ), + ); + } +} diff --git a/lib/business_system/order/ticket/ticket_statistics_page.dart b/lib/business_system/order/ticket/ticket_statistics_page.dart new file mode 100644 index 00000000..7f74c702 --- /dev/null +++ b/lib/business_system/order/ticket/ticket_statistics_page.dart @@ -0,0 +1,588 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shimmer/shimmer.dart'; + +import '../../../generated/l10n.dart'; +import '../../../retrofit/business_api.dart'; +import '../../../retrofit/data/base_data.dart'; +import '../../../retrofit/data/ticket_stats_list.dart'; +import '../../../utils/business_instance.dart'; +import '../../../utils/flutter_utils.dart'; +import '../../../utils/font_weight.dart'; +import '../../../view_widget/no_data_view.dart'; + +class TicketStatisticsPage extends StatefulWidget { + final int status; + final String storeId; + final String keyword; + final String time; + final bool isKeyBoardShow; + + TicketStatisticsPage(Key key, this.status, this.storeId, this.keyword, + this.time, this.isKeyBoardShow) + : super(key: key); + + @override + State createState() { + return _TicketStatisticsPage(); + } +} + +class _TicketStatisticsPage extends State { + final RefreshController _refreshController = RefreshController(); + ScrollPhysics scrollPhysics = NeverScrollableScrollPhysics(); + final ScrollController controller = ScrollController(); + BusinessApiService businessService; + List _infoList = []; + String networkError = ""; + int networkStatus = 0; + + @override + void dispose() { + super.dispose(); + _refreshController.dispose(); + } + + @override + void initState() { + super.initState(); + queryStatsList(); + } + + queryStatsList({isLoading = true}) async { + try { + if (isLoading) + 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.storeId); + } + BaseData> baseData = + await businessService.wipedStats({ + "searchKey": widget?.keyword ?? "", + "startDate": widget.time + .replaceAll("年", "-") + .replaceAll("月", "-") + .replaceAll("日", "") + .substring(0, 10), + "endDate": widget.time + .replaceAll("年", "-") + .replaceAll("月", "-") + .replaceAll("日", "") + .substring(widget.time.length >= 21 ? 22 : 0, + widget.time.length >= 21 ? 32 : 0), + }).catchError((error) { + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; + _refreshController.refreshFailed(); + _refreshController.loadFailed(); + }); + _infoList.clear(); + if (baseData != null && baseData.isSuccess) { + baseData.data.forEach((e1) { + e1.infoList.forEach((e2) { + e2.wipedDate = e1.wipedDate; + _infoList.add(e2); + }); + }); + networkStatus = 1; + _refreshController.refreshCompleted(); + _refreshController.loadComplete(); + } + } finally { + if (isLoading) setState(() {}); + EasyLoading.dismiss(); + } + } + + @override + Widget build(BuildContext context) { + return SmartRefresher( + controller: _refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(color: Color(0xFF30415B)), + physics: BouncingScrollPhysics(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: () { + queryStatsList(isLoading: false); + }, + child: networkStatus == -1 + ? noNetwork() + : ((networkStatus == 0) + ? ListView.builder( + padding: EdgeInsets.zero, + itemCount: 10, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return statisticsSm(); + }, + ) + : ((_infoList.isEmpty) + ? NoDataView( + src: "assets/image/bs_no data_logo.webp", + isShowBtn: false, + text: "暂无数据", + fontSize: 16.sp, + iconHeight: 120.h, + margin: EdgeInsets.all(50.h), + ) + : Padding( + padding: EdgeInsets.only(top: 16.h), + child: ListView.builder( + itemCount: _infoList.length, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + if (widget.isKeyBoardShow) + FocusScope.of(context) + .requestFocus(FocusNode()); + return; + }, + child: statisticsItem(_infoList[position]), + ); + }, + ), + ))), + ); + } + + Widget statisticsItem(InfoList infoList) { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 16.h), + padding: EdgeInsets.symmetric(vertical: 12.h), + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(left: 12.w, right: 18.w, bottom: 13.h), + child: Row( + children: [ + Expanded( + child: Text( + infoList?.ticketName ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + fontSize: 14.sp, + color: Colors.black, + fontWeight: MyFontWeight.bold), + )), + Text( + "核销次数: ${infoList?.wipedNumber ?? 0}", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ) + ], + ), + ), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFF4F6F7), + ), + Padding( + padding: EdgeInsets.only(top: 13.h, left: 12.w), + child: Row( + children: [ + Text( + "核销项:", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + SizedBox( + width: 13.w, + ), + Text( + infoList?.ticketItemName ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ) + ], + )), + Padding( + padding: EdgeInsets.only(top: 12.h, left: 12.w), + child: Row( + children: [ + Text( + "手机号:", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ), + SizedBox( + width: 13.w, + ), + Text( + "12323227890", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular), + ) + ], + ), + ), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFF4F6F7), + margin: EdgeInsets.symmetric(vertical: 12.h), + ), + Padding( + padding: EdgeInsets.only(left: 12.w), + child: Row( + children: [ + Text( + "核销时间 :", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ), + SizedBox( + width: 14.w, + ), + Text( + infoList?.wipedDate ?? "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF808080), + fontWeight: MyFontWeight.regular), + ) + ], + )), + ], + ), + ); + } + + Widget statisticsSm() { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + margin: EdgeInsets.all(16), + padding: EdgeInsets.symmetric(vertical: 12.h), + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(left: 12.w, right: 18.w, bottom: 13.h), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 154.w, + height: 18.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 10.w, + height: 18.h, + margin: EdgeInsets.only(left: 14.w), + ), + ), + ], + ), + ), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFF4F6F7), + ), + Padding( + padding: EdgeInsets.only(top: 13.h, left: 12.w), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 40.w, + height: 18.h, + ), + ), + SizedBox( + width: 26.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 24.w, + height: 18.h, + ), + ), + ], + )), + Padding( + padding: EdgeInsets.only(top: 12.h, left: 12.w), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 40.w, + height: 18.h, + ), + ), + SizedBox( + width: 26.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 77.w, + height: 18.h, + ), + ), + ], + ), + ), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFF4F6F7), + margin: EdgeInsets.symmetric(vertical: 12.h), + ), + Container( + padding: EdgeInsets.only(left: 12.w), + margin: EdgeInsets.only(bottom: 6.h), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + SizedBox( + width: 14.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 84.w, + height: 18.h, + ), + ), + ], + )), + Container( + padding: EdgeInsets.only(left: 12.w), + margin: EdgeInsets.only(bottom: 6.h), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + SizedBox( + width: 14.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 107.w, + height: 18.h, + ), + ), + ], + )), + Padding( + padding: EdgeInsets.symmetric(horizontal: 12.w), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 52.w, + height: 18.h, + ), + ), + SizedBox( + width: 14.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 107.w, + height: 18.h, + ), + ), + Spacer(), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 36.w, + height: 18.h, + ), + ), + ], + )), + ], + )); + } + + Widget noNetwork() { + return Container( + color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + // "无法连接到网络", + networkError.substring(0, networkError.indexOf(",")), + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF0D0D0D), + fontWeight: MyFontWeight.bold), + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 10.h), + child: Text( + "请检查网络设置或稍后重试", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + queryStatsList(); + }, + child: Container( + decoration: BoxDecoration( + color: Color(0xFF30415B), + borderRadius: BorderRadius.circular(15), + ), + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h), + child: Text( + "重试", + style: TextStyle( + fontSize: 14.sp, + color: Colors.white, + fontWeight: MyFontWeight.regular), + )), + ) + ], + ), + ); + } +} diff --git a/lib/business_system/order/ticket/ticket_tab.dart b/lib/business_system/order/ticket/ticket_tab.dart new file mode 100644 index 00000000..10544a51 --- /dev/null +++ b/lib/business_system/order/ticket/ticket_tab.dart @@ -0,0 +1,106 @@ +import 'package:flutter/material.dart'; + +class TicketTab extends Decoration { + /// Create an underline style selected tab indicator. + /// + /// The [borderSide] and [insets] arguments must not be null. + const TicketTab({ + this.width = 20, + this.strokeCap = StrokeCap.round, + this.borderSide = const BorderSide(width: 2.0, color: Colors.white), + this.insets = EdgeInsets.zero, + }) : assert(borderSide != null), + assert(insets != null); + + /// The color and weight of the horizontal line drawn below the selected tab. + final BorderSide borderSide; + + /// Locates the selected tab's underline relative to the tab's boundary. + /// + /// The [TabBar.indicatorSize] property can be used to define the tab + /// indicator's bounds in terms of its (centered) tab widget with + /// [TabBarIndicatorSize.label], or the entire tab with + /// [TabBarIndicatorSize.tab]. + final EdgeInsetsGeometry insets; + + ///新增的属性 + final double width; // 控制器宽度 + final StrokeCap strokeCap; // 控制器边角形状 + + @override + Decoration lerpFrom(Decoration a, double t) { + if (a is TicketTab) { + return TicketTab( + borderSide: BorderSide.lerp(a.borderSide, borderSide, t), + insets: EdgeInsetsGeometry.lerp(a.insets, insets, t), + ); + } + return super.lerpFrom(a, t); + } + + @override + Decoration lerpTo(Decoration b, double t) { + if (b is TicketTab) { + return TicketTab( + borderSide: BorderSide.lerp(borderSide, b.borderSide, t), + insets: EdgeInsetsGeometry.lerp(insets, b.insets, t), + ); + } + return super.lerpTo(b, t); + } + + @override + BoxPainter createBoxPainter([VoidCallback onChanged]) { + return _UnderlinePainter(this, onChanged); + } + + ///决定控制器宽度的方法 + Rect _indicatorRectFor(Rect rect, TextDirection textDirection) { + assert(rect != null); + assert(textDirection != null); + final Rect indicator = insets.resolve(textDirection).deflateRect(rect); + + // 希望的宽度 + double wantWidth = this.width; + // 取中间坐标 + double cw = (indicator.left + indicator.right) / 2; + + print( + '$cw,indicator left${indicator.left}, right ${indicator.right}, indicator top ${indicator.top},indicator bottom${indicator.bottom}, border width${borderSide.width}'); + //这里是核心代码 //下划线靠左 + // return Rect.fromLTWH(indicator.left, + // indicator.bottom - borderSide.width, wantWidth, borderSide.width); + + //下划线居中 + return Rect.fromLTWH(cw - wantWidth / 2, + indicator.bottom - borderSide.width, wantWidth, borderSide.width); + } + + @override + Path getClipPath(Rect rect, TextDirection textDirection) { + return Path()..addRect(_indicatorRectFor(rect, textDirection)); + } +} + +class _UnderlinePainter extends BoxPainter { + _UnderlinePainter(this.decoration, VoidCallback onChanged) + : assert(decoration != null), + super(onChanged); + + final TicketTab decoration; + + ///决定控制器边角形状的方法 + @override + void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) { + assert(configuration != null); + assert(configuration.size != null); + final Rect rect = offset & configuration.size; + final TextDirection textDirection = configuration.textDirection; + final Rect indicator = decoration + ._indicatorRectFor(rect, textDirection) + .deflate(decoration.borderSide.width / 2.0); + final Paint paint = decoration.borderSide.toPaint() + ..strokeCap = decoration.strokeCap; //这块更改为想要的形状 + canvas.drawLine(indicator.bottomLeft, indicator.bottomRight, paint); + } +} \ No newline at end of file diff --git a/lib/business_system/scan_code_page.dart b/lib/business_system/scan_code_page.dart index 87368aff..38701dec 100644 --- a/lib/business_system/scan_code_page.dart +++ b/lib/business_system/scan_code_page.dart @@ -116,31 +116,6 @@ class _ScanCodePage extends State { ), ), Spacer(), - // Expanded(child:Text( - // S.of(context).saoma, - // style: TextStyle( - // color: Colors.white, - // fontSize: 18.sp, - // fontWeight: FontWeight.bold, - // ), - // )), - // GestureDetector( - // behavior: HitTestBehavior.opaque, - // onTap: () { - // pickImage(); - // }, - // child:Container( - // padding: EdgeInsets.symmetric(horizontal:10.w), - // child: Text( - // S.of(context).xiangce, - // style: TextStyle( - // color: Colors.white, - // fontSize: 18.sp, - // fontWeight: FontWeight.bold, - // ), - // ), - // ), - // ), ], ), ), diff --git a/lib/home/main_home_page.dart b/lib/home/main_home_page.dart index 5dee3da6..fab517d3 100644 --- a/lib/home/main_home_page.dart +++ b/lib/home/main_home_page.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/home/activity_list_page.dart'; -import 'package:huixiang/home/home_page.dart'; import 'package:huixiang/home/points_mall_page.dart'; import 'package:huixiang/main.dart'; import 'package:huixiang/utils/event_type.dart'; diff --git a/lib/main.dart b/lib/main.dart index 58f2e827..22ca2495 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -98,6 +98,7 @@ import 'business_system/goods/on_sale/goods_sort.dart'; import 'business_system/home/flow_page.dart'; import 'business_system/home/select_shop.dart'; import 'business_system/home/overview/trade_overview_page.dart'; +import 'business_system/home/vip/business_vip_page.dart'; import 'business_system/login/business_login_page.dart'; import 'business_system/mine/account_information.dart'; import 'business_system/mine/merchant_info.dart'; @@ -512,4 +513,6 @@ Map routers = { ShopImageInfo(arguments:arguments), '/router/scan_code_page': (context, {arguments}) => ScanCodePage(arguments:arguments), + '/router/business_vip_page': (context, {arguments}) => + BusinessVipPage(arguments:arguments), }; diff --git a/lib/retrofit/business_api.dart b/lib/retrofit/business_api.dart index 017ae766..f984bee0 100644 --- a/lib/retrofit/business_api.dart +++ b/lib/retrofit/business_api.dart @@ -12,18 +12,24 @@ import 'package:huixiang/retrofit/data/order_trend.dart'; import 'package:huixiang/retrofit/data/vip_counts_info.dart'; import 'package:retrofit/retrofit.dart'; +import 'data/balance_change_list.dart'; import 'data/base_data.dart'; import 'data/business_goods.dart'; import 'data/business_order_detail_info.dart'; import 'data/business_order_list.dart'; import 'data/business_store_list.dart'; +import 'data/business_vip_list.dart'; import 'data/day_flow_list.dart'; import 'data/goods_type_sales_list.dart'; import 'data/popular_sales_list.dart'; import 'data/product_group_list.dart'; +import 'data/recharge_flow_list.dart'; import 'data/refund_reason_list.dart'; import 'data/single_sales_list.dart'; import 'data/ticket_details.dart'; +import 'data/ticket_record.dart'; +import 'data/ticket_show.dart'; +import 'data/ticket_stats_list.dart'; import 'data/trade_summary_list.dart'; import 'data/upload_result.dart'; @@ -210,55 +216,76 @@ abstract class BusinessApiService { ///修改密码 @PUT("user") - Future modifyPassword( - @Body() Map param); + Future modifyPassword(@Body() Map param); ///商品上下架 @POST("product/putStatus") - Future goodsUpdate( - @Body() Map param); + Future goodsUpdate(@Body() Map param); ///商品删除 @POST("product/delProduct") - Future delProduct( - @Body() Map param); + Future delProduct(@Body() Map param); ///新增或修改商品分组/商品分类-新增分类/编辑分类 @POST("productGroup/saveProductGroup") - Future saveProductGroup( - @Body() Map param); + Future saveProductGroup(@Body() Map param); ///删除分组分类 @POST("productGroup/delProductCategory") - Future delProductCategory( - @Body() Map param); + Future delProductCategory(@Body() Map param); ///门店设置-列表 - @GET("store/getStoreList?tenantCode={tenantCode}&pageIndex={pageIndex}&pageSize={pageSize}") - Future> getStoreList(@Path("tenantCode") String tenantCode, @Path("pageIndex") String pageIndex, @Path("pageSize") String pageSize); + @GET( + "store/getStoreList?tenantCode={tenantCode}&pageIndex={pageIndex}&pageSize={pageSize}") + Future> getStoreList( + @Path("tenantCode") String tenantCode, + @Path("pageIndex") String pageIndex, + @Path("pageSize") String pageSize); ///删除分组分类 @PUT("store") - Future saveStoreInfo( - @Body() Map param); + Future saveStoreInfo(@Body() Map param); ///文件上传 @POST("file/upload") @MultiPart() - Future> upload(@Part(name: "file") File data, - @Part(name: "folderId") int folderId); + Future> upload( + @Part(name: "file") File data, @Part(name: "folderId") int folderId); ///批量核销 @POST("ticket/wipedBatchs") - Future wipedBatchs( - @Body() String param); + Future wipedBatchs(@Body() String param); ///商品排序/一键置顶 @POST("product/productSortTop") - Future productSortTop( - @Body() Map param); + Future productSortTop(@Body() Map param); ///票券详情 @GET("ticket/code/{code}") Future> ticketCode(@Path("code") String code); + + ///票券列表 + @POST("ticket/showList") + Future> showList(@Body() Map param); + + ///票券核销记录 + @POST("ticket/wipedRecord") + Future> wipedRecord(@Body() Map param); + + ///票券核销统计 + @POST("ticket/wipedStats") + Future>> wipedStats( + @Body() Map param); + + ///会员列表 + @POST("member/page") + Future> vipDataList(@Body() Map param); + + ///会员充值流水 + @POST("audit/memberSourceRechargeDetial") + Future> rechargeFlow(@Body() Map param); + + ///会员余额变动 + @POST("member/getTenantMemberBill") + Future> getTenantMemberBill(@Body() Map param); } diff --git a/lib/retrofit/business_api.g.dart b/lib/retrofit/business_api.g.dart index 7a26cdb9..de5a513f 100644 --- a/lib/retrofit/business_api.g.dart +++ b/lib/retrofit/business_api.g.dart @@ -624,4 +624,145 @@ class _BusinessApiService implements BusinessApiService { ); return value; } + + @override + Future> showList(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'ticket/showList', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => (json ?? "") == "" ? null : TicketShow.fromJson(json), + ); + return value; + } + + @override + Future> wipedRecord(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'ticket/wipedRecord', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => (json ?? "") == "" ? null : TicketRecord.fromJson(json), + ); + return value; + } + + @override + Future>> wipedStats(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'ticket/wipedStats', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => (json as List) + .map( + (i) => TicketStatsList.fromJson(i as Map)) + .toList()); + return value; + } + + @override + Future> vipDataList(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'member/page', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => (json ?? "") == "" ? null : BusinessVipList.fromJson(json), + ); + return value; + } + + @override + Future> rechargeFlow(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'audit/memberSourceRechargeDetial', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => (json ?? "") == "" ? null : RechargeFlowList.fromJson(json), + ); + return value; + } + + @override + Future> getTenantMemberBill(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'member/getTenantMemberBill', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => (json ?? "") == "" ? null : BalanceChangeList.fromJson(json), + ); + return value; + } + } diff --git a/lib/retrofit/data/balance_change_list.dart b/lib/retrofit/data/balance_change_list.dart new file mode 100644 index 00000000..38e81813 --- /dev/null +++ b/lib/retrofit/data/balance_change_list.dart @@ -0,0 +1,367 @@ +/// records : [{"id":"1726925231030796288","createTime":"2023-11-21 19:27:14","createUser":"1699083374745878528","updateTime":"2023-11-21 19:27:14","updateUser":"1699083374745878528","mid":"1699083374745878528","linkId":"202311211927130002","pm":0,"title":"商户余额操作","category":"用户消费","type":"商户会员余额支付","number":"58.00","realNumber":"0.00","balance":"32.00","mark":"","status":true,"isDeleted":false,"storeName":"海峡姐妹茶(洛神)","nickname":"","phone":"13938248263","startTime":null,"endTime":null,"tenantCode":null,"storeId":null},{"id":"1726916049208606720","createTime":"2023-11-21 18:50:45","createUser":"1699075203830644736","updateTime":"2023-11-21 18:50:45","updateUser":"1699075203830644736","mid":"1699075203830644736","linkId":"202311211850440002","pm":0,"title":"商户余额操作","category":"用户消费","type":"商户会员余额支付","number":"22.50","realNumber":"0.00","balance":"50.50","mark":"","status":true,"isDeleted":false,"storeName":"台南湾蚵仔煎","nickname":"","phone":"13803841444","startTime":null,"endTime":null,"tenantCode":null,"storeId":null},{"id":"1726913953642053632","createTime":"2023-11-21 18:42:26","createUser":"1699075203830644736","updateTime":"2023-11-21 18:42:26","updateUser":"1699075203830644736","mid":"1699075203830644736","linkId":"202311211842250002","pm":0,"title":"商户余额操作","category":"用户消费","type":"商户会员余额支付","number":"25.00","realNumber":"0.00","balance":"73.00","mark":"","status":true,"isDeleted":false,"storeName":"前进麦味","nickname":"","phone":"13803841444","startTime":null,"endTime":null,"tenantCode":null,"storeId":null},{"id":"1726908739681779712","createTime":"2023-11-21 18:21:43","createUser":"1693622184796225536","updateTime":"2023-11-21 18:21:43","updateUser":"1693622184796225536","mid":"1693622184796225536","linkId":"202311211821410002","pm":0,"title":"商户余额操作","category":"用户消费","type":"商户会员余额支付","number":"15.00","realNumber":"0.00","balance":"38.00","mark":"","status":true,"isDeleted":false,"storeName":"嘉义鸡肉饭","nickname":"张心旷","phone":"18162517594","startTime":null,"endTime":null,"tenantCode":null,"storeId":null},{"id":"1726812435815333888","createTime":"2023-11-21 11:59:02","createUser":"1699272927989465088","updateTime":"2023-11-21 11:59:02","updateUser":"1699272927989465088","mid":"1699272927989465088","linkId":"202311211159010002","pm":0,"title":"商户余额操作","category":"用户消费","type":"特殊活动赠送金额支付","number":"26.00","realNumber":"0.00","balance":"74.00","mark":"","status":true,"isDeleted":false,"storeName":"台南锅烧意面","nickname":"","phone":"15515981657","startTime":null,"endTime":null,"tenantCode":null,"storeId":null},{"id":"1726812193049018368","createTime":"2023-11-21 11:58:04","createUser":"1699272910234976256","updateTime":"2023-11-21 11:58:04","updateUser":"1699272910234976256","mid":"1699272910234976256","linkId":"202311211158030001","pm":0,"title":"商户余额操作","category":"用户消费","type":"商户会员余额支付","number":"23.40","realNumber":"0.00","balance":"26.60","mark":"","status":true,"isDeleted":false,"storeName":"台南锅烧意面","nickname":"","phone":"13592548807","startTime":null,"endTime":null,"tenantCode":null,"storeId":null},{"id":"1726564858045923328","createTime":"2023-11-20 19:35:15","createUser":"1700858271767724032","updateTime":"2023-11-20 19:35:15","updateUser":"1700858271767724032","mid":"1700858271767724032","linkId":"202311201935140002","pm":0,"title":"商户余额操作","category":"用户消费","type":"商户会员余额支付","number":"10.00","realNumber":"0.00","balance":"90.00","mark":"","status":true,"isDeleted":false,"storeName":"前进麦味","nickname":"","phone":"15890630566","startTime":null,"endTime":null,"tenantCode":null,"storeId":null},{"id":"1726564858037534720","createTime":"2023-11-20 19:35:15","createUser":"1700858271767724032","updateTime":"2023-11-20 19:35:15","updateUser":"1700858271767724032","mid":"1700858271767724032","linkId":"202311201935140002","pm":0,"title":"商户余额操作","category":"用户消费","type":"特殊活动赠送金额支付","number":"14.00","realNumber":"0.00","balance":"0.00","mark":"","status":true,"isDeleted":false,"storeName":"前进麦味","nickname":"","phone":"15890630566","startTime":null,"endTime":null,"tenantCode":null,"storeId":null},{"id":"1726561831784284160","createTime":"2023-11-20 19:23:13","createUser":"1700356595696795648","updateTime":"2023-11-20 19:23:13","updateUser":"1700356595696795648","mid":"1700356595696795648","linkId":"202311201923120001","pm":0,"title":"商户余额操作","category":"用户消费","type":"商户会员余额支付","number":"17.00","realNumber":"0.00","balance":"119.60","mark":"","status":true,"isDeleted":false,"storeName":"海峡姐妹茶(奶茶)","nickname":"","phone":"13938290600","startTime":null,"endTime":null,"tenantCode":null,"storeId":null},{"id":"1726561243927412736","createTime":"2023-11-20 19:20:53","createUser":"1700356595696795648","updateTime":"2023-11-20 19:20:53","updateUser":"1700356595696795648","mid":"1700356595696795648","linkId":"202311201920520001","pm":0,"title":"商户余额操作","category":"用户消费","type":"商户会员余额支付","number":"29.00","realNumber":"0.00","balance":"136.60","mark":"","status":true,"isDeleted":false,"storeName":"前进麦味","nickname":"","phone":"13938290600","startTime":null,"endTime":null,"tenantCode":null,"storeId":null}] +/// total : "5617" +/// size : "10" +/// current : "1" +/// orders : [{"column":"id","asc":false}] +/// hitCount : false +/// searchCount : true +/// pages : "562" + +class BalanceChangeList { + BalanceChangeList({ + List records, + String total, + String size, + String current, + List orders, + bool hitCount, + bool searchCount, + String pages,}){ + _records = records; + _total = total; + _size = size; + _current = current; + _orders = orders; + _hitCount = hitCount; + _searchCount = searchCount; + _pages = pages; +} + + BalanceChangeList.fromJson(dynamic json) { + if (json['records'] != null) { + _records = []; + json['records'].forEach((v) { + _records.add(Records.fromJson(v)); + }); + } + _total = json['total']; + _size = json['size']; + _current = json['current']; + if (json['orders'] != null) { + _orders = []; + json['orders'].forEach((v) { + _orders.add(Orders.fromJson(v)); + }); + } + _hitCount = json['hitCount']; + _searchCount = json['searchCount']; + _pages = json['pages']; + } + List _records; + String _total; + String _size; + String _current; + List _orders; + bool _hitCount; + bool _searchCount; + String _pages; +BalanceChangeList copyWith({ List records, + String total, + String size, + String current, + List orders, + bool hitCount, + bool searchCount, + String pages, +}) => BalanceChangeList( records: records ?? _records, + total: total ?? _total, + size: size ?? _size, + current: current ?? _current, + orders: orders ?? _orders, + hitCount: hitCount ?? _hitCount, + searchCount: searchCount ?? _searchCount, + pages: pages ?? _pages, +); + List get records => _records; + String get total => _total; + String get size => _size; + String get current => _current; + List get orders => _orders; + bool get hitCount => _hitCount; + bool get searchCount => _searchCount; + String get pages => _pages; + + Map toJson() { + final map = {}; + if (_records != null) { + map['records'] = _records.map((v) => v.toJson()).toList(); + } + map['total'] = _total; + map['size'] = _size; + map['current'] = _current; + if (_orders != null) { + map['orders'] = _orders.map((v) => v.toJson()).toList(); + } + map['hitCount'] = _hitCount; + map['searchCount'] = _searchCount; + map['pages'] = _pages; + return map; + } + +} + +/// column : "id" +/// asc : false + +class Orders { + Orders({ + String column, + bool asc,}){ + _column = column; + _asc = asc; +} + + Orders.fromJson(dynamic json) { + _column = json['column']; + _asc = json['asc']; + } + String _column; + bool _asc; +Orders copyWith({ String column, + bool asc, +}) => Orders( column: column ?? _column, + asc: asc ?? _asc, +); + String get column => _column; + bool get asc => _asc; + + Map toJson() { + final map = {}; + map['column'] = _column; + map['asc'] = _asc; + return map; + } + +} + +/// id : "1726925231030796288" +/// createTime : "2023-11-21 19:27:14" +/// createUser : "1699083374745878528" +/// updateTime : "2023-11-21 19:27:14" +/// updateUser : "1699083374745878528" +/// mid : "1699083374745878528" +/// linkId : "202311211927130002" +/// pm : 0 +/// title : "商户余额操作" +/// category : "用户消费" +/// type : "商户会员余额支付" +/// number : "58.00" +/// realNumber : "0.00" +/// balance : "32.00" +/// mark : "" +/// status : true +/// isDeleted : false +/// storeName : "海峡姐妹茶(洛神)" +/// nickname : "" +/// phone : "13938248263" +/// startTime : null +/// endTime : null +/// tenantCode : null +/// storeId : null + +class Records { + Records({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String mid, + String linkId, + num pm, + String title, + String category, + String type, + String number, + String realNumber, + String balance, + String mark, + bool status, + bool isDeleted, + String storeName, + String nickname, + String phone, + dynamic startTime, + dynamic endTime, + dynamic tenantCode, + dynamic storeId,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _mid = mid; + _linkId = linkId; + _pm = pm; + _title = title; + _category = category; + _type = type; + _number = number; + _realNumber = realNumber; + _balance = balance; + _mark = mark; + _status = status; + _isDeleted = isDeleted; + _storeName = storeName; + _nickname = nickname; + _phone = phone; + _startTime = startTime; + _endTime = endTime; + _tenantCode = tenantCode; + _storeId = storeId; +} + + Records.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _mid = json['mid']; + _linkId = json['linkId']; + _pm = json['pm']; + _title = json['title']; + _category = json['category']; + _type = json['type']; + _number = json['number']; + _realNumber = json['realNumber']; + _balance = json['balance']; + _mark = json['mark']; + _status = json['status']; + _isDeleted = json['isDeleted']; + _storeName = json['storeName']; + _nickname = json['nickname']; + _phone = json['phone']; + _startTime = json['startTime']; + _endTime = json['endTime']; + _tenantCode = json['tenantCode']; + _storeId = json['storeId']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _mid; + String _linkId; + num _pm; + String _title; + String _category; + String _type; + String _number; + String _realNumber; + String _balance; + String _mark; + bool _status; + bool _isDeleted; + String _storeName; + String _nickname; + String _phone; + dynamic _startTime; + dynamic _endTime; + dynamic _tenantCode; + dynamic _storeId; +Records copyWith({ String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String mid, + String linkId, + num pm, + String title, + String category, + String type, + String number, + String realNumber, + String balance, + String mark, + bool status, + bool isDeleted, + String storeName, + String nickname, + String phone, + dynamic startTime, + dynamic endTime, + dynamic tenantCode, + dynamic storeId, +}) => Records( id: id ?? _id, + createTime: createTime ?? _createTime, + createUser: createUser ?? _createUser, + updateTime: updateTime ?? _updateTime, + updateUser: updateUser ?? _updateUser, + mid: mid ?? _mid, + linkId: linkId ?? _linkId, + pm: pm ?? _pm, + title: title ?? _title, + category: category ?? _category, + type: type ?? _type, + number: number ?? _number, + realNumber: realNumber ?? _realNumber, + balance: balance ?? _balance, + mark: mark ?? _mark, + status: status ?? _status, + isDeleted: isDeleted ?? _isDeleted, + storeName: storeName ?? _storeName, + nickname: nickname ?? _nickname, + phone: phone ?? _phone, + startTime: startTime ?? _startTime, + endTime: endTime ?? _endTime, + tenantCode: tenantCode ?? _tenantCode, + storeId: storeId ?? _storeId, +); + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get mid => _mid; + String get linkId => _linkId; + num get pm => _pm; + String get title => _title; + String get category => _category; + String get type => _type; + String get number => _number; + String get realNumber => _realNumber; + String get balance => _balance; + String get mark => _mark; + bool get status => _status; + bool get isDeleted => _isDeleted; + String get storeName => _storeName; + String get nickname => _nickname; + String get phone => _phone; + dynamic get startTime => _startTime; + dynamic get endTime => _endTime; + dynamic get tenantCode => _tenantCode; + dynamic get storeId => _storeId; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['mid'] = _mid; + map['linkId'] = _linkId; + map['pm'] = _pm; + map['title'] = _title; + map['category'] = _category; + map['type'] = _type; + map['number'] = _number; + map['realNumber'] = _realNumber; + map['balance'] = _balance; + map['mark'] = _mark; + map['status'] = _status; + map['isDeleted'] = _isDeleted; + map['storeName'] = _storeName; + map['nickname'] = _nickname; + map['phone'] = _phone; + map['startTime'] = _startTime; + map['endTime'] = _endTime; + map['tenantCode'] = _tenantCode; + map['storeId'] = _storeId; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/business_vip_list.dart b/lib/retrofit/data/business_vip_list.dart new file mode 100644 index 00000000..9542ff65 --- /dev/null +++ b/lib/retrofit/data/business_vip_list.dart @@ -0,0 +1,374 @@ +/// records : [{"id":"1730229003043733504","createTime":"2023-11-30 22:15:15","createUser":"0","updateTime":"2023-11-30 22:15:15","updateUser":"0","mid":null,"openid":"otrgp5C7qpd-V2AHosRZOnN4NoEM","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-30 22:15:15","loginNum":1,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1729813919708479488","createTime":"2023-11-29 18:45:52","createUser":"0","updateTime":"2023-11-29 18:45:52","updateUser":"0","mid":null,"openid":"otrgp5Brxv8c7fdZbIjmbUEaLBVM","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-29 18:45:52","loginNum":2,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1729685559346987008","createTime":"2023-11-29 10:15:48","createUser":"0","updateTime":"2023-11-29 10:15:48","updateUser":"0","mid":null,"openid":"otrgp5M6pxBus4Ykh1XdeHHLiFBA","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-29 10:15:48","loginNum":1,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1729685558696869888","createTime":"2023-11-29 10:15:48","createUser":"0","updateTime":"2023-11-29 10:15:48","updateUser":"0","mid":null,"openid":"otrgp5M6pxBus4Ykh1XdeHHLiFBA","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-29 10:15:48","loginNum":1,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1729062974783488000","createTime":"2023-11-27 17:01:52","createUser":"0","updateTime":"2023-11-27 17:01:52","updateUser":"0","mid":null,"openid":null,"nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-27 17:01:52","loginNum":0,"tenantCode":"1195","phone":"","source":1,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1728984020596817920","createTime":"2023-11-27 11:48:08","createUser":"0","updateTime":"2023-11-27 11:48:08","updateUser":"0","mid":null,"openid":"otrgp5GG69LQo1_xaPpxNnpnds7A","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-27 11:48:08","loginNum":1,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1728980774142607360","createTime":"2023-11-27 11:35:14","createUser":"0","updateTime":"2023-11-27 11:35:14","updateUser":"0","mid":null,"openid":"otrgp5NcFDlLRPi7RPpFolajayLQ","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-27 11:35:14","loginNum":1,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1728297227396317184","createTime":"2023-11-25 14:19:04","createUser":"0","updateTime":"2023-11-25 14:19:04","updateUser":"0","mid":null,"openid":"otrgp5Obp61VrN7tyvXdT1MNsAL0","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-25 14:19:04","loginNum":1,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1728274418079105024","createTime":"2023-11-25 12:48:26","createUser":"0","updateTime":"2023-11-25 12:48:26","updateUser":"0","mid":null,"openid":"otrgp5L0bMvf8DXFf_kdRCzPqpEM","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-25 12:48:26","loginNum":1,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1727662634473357312","createTime":"2023-11-23 20:17:25","createUser":"0","updateTime":"2023-11-23 20:17:25","updateUser":"0","mid":null,"openid":"otrgp5Jxyl5zQOgIwZaYK3aHuF9g","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-23 20:17:25","loginNum":1,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false}] +/// total : "9378" +/// size : "10" +/// current : "1" +/// orders : [{"column":"id","asc":false}] +/// hitCount : false +/// searchCount : true +/// pages : "938" + +class BusinessVipList { + BusinessVipList({ + List records, + String total, + String size, + String current, + List orders, + bool hitCount, + bool searchCount, + String pages,}){ + _records = records; + _total = total; + _size = size; + _current = current; + _orders = orders; + _hitCount = hitCount; + _searchCount = searchCount; + _pages = pages; +} + + BusinessVipList.fromJson(dynamic json) { + if (json['records'] != null) { + _records = []; + json['records'].forEach((v) { + _records.add(Records.fromJson(v)); + }); + } + _total = json['total']; + _size = json['size']; + _current = json['current']; + if (json['orders'] != null) { + _orders = []; + json['orders'].forEach((v) { + _orders.add(Orders.fromJson(v)); + }); + } + _hitCount = json['hitCount']; + _searchCount = json['searchCount']; + _pages = json['pages']; + } + List _records; + String _total; + String _size; + String _current; + List _orders; + bool _hitCount; + bool _searchCount; + String _pages; +BusinessVipList copyWith({ List records, + String total, + String size, + String current, + List orders, + bool hitCount, + bool searchCount, + String pages, +}) => BusinessVipList( records: records ?? _records, + total: total ?? _total, + size: size ?? _size, + current: current ?? _current, + orders: orders ?? _orders, + hitCount: hitCount ?? _hitCount, + searchCount: searchCount ?? _searchCount, + pages: pages ?? _pages, +); + List get records => _records; + String get total => _total; + String get size => _size; + String get current => _current; + List get orders => _orders; + bool get hitCount => _hitCount; + bool get searchCount => _searchCount; + String get pages => _pages; + + Map toJson() { + final map = {}; + if (_records != null) { + map['records'] = _records.map((v) => v.toJson()).toList(); + } + map['total'] = _total; + map['size'] = _size; + map['current'] = _current; + if (_orders != null) { + map['orders'] = _orders.map((v) => v.toJson()).toList(); + } + map['hitCount'] = _hitCount; + map['searchCount'] = _searchCount; + map['pages'] = _pages; + return map; + } + +} + +/// column : "id" +/// asc : false + +class Orders { + Orders({ + String column, + bool asc,}){ + _column = column; + _asc = asc; +} + + Orders.fromJson(dynamic json) { + _column = json['column']; + _asc = json['asc']; + } + String _column; + bool _asc; +Orders copyWith({ String column, + bool asc, +}) => Orders( column: column ?? _column, + asc: asc ?? _asc, +); + String get column => _column; + bool get asc => _asc; + + Map toJson() { + final map = {}; + map['column'] = _column; + map['asc'] = _asc; + return map; + } + +} + +/// id : "1730229003043733504" +/// createTime : "2023-11-30 22:15:15" +/// createUser : "0" +/// updateTime : "2023-11-30 22:15:15" +/// updateUser : "0" +/// mid : null +/// openid : "otrgp5C7qpd-V2AHosRZOnN4NoEM" +/// nickname : "" +/// headimg : "" +/// balance : "0.00" +/// money : "0" +/// realRecharge : "0.00" +/// giftRecharge : "0.00" +/// sex : "0" +/// status : true +/// loginTime : "2023-11-30 22:15:15" +/// loginNum : 1 +/// tenantCode : "1195" +/// phone : "" +/// source : 0 +/// expendAmount : "0.00" +/// buyTimes : 0 +/// lastBuyTime : null +/// onCredit : false + +class Records { + Records({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + dynamic mid, + String openid, + String nickname, + String headimg, + String balance, + String money, + String realRecharge, + String giftRecharge, + String sex, + bool status, + String loginTime, + num loginNum, + String tenantCode, + String phone, + num source, + String expendAmount, + num buyTimes, + dynamic lastBuyTime, + bool onCredit,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _mid = mid; + _openid = openid; + _nickname = nickname; + _headimg = headimg; + _balance = balance; + _money = money; + _realRecharge = realRecharge; + _giftRecharge = giftRecharge; + _sex = sex; + _status = status; + _loginTime = loginTime; + _loginNum = loginNum; + _tenantCode = tenantCode; + _phone = phone; + _source = source; + _expendAmount = expendAmount; + _buyTimes = buyTimes; + _lastBuyTime = lastBuyTime; + _onCredit = onCredit; +} + + Records.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _mid = json['mid']; + _openid = json['openid']; + _nickname = json['nickname']; + _headimg = json['headimg']; + _balance = json['balance']; + _money = json['money']; + _realRecharge = json['realRecharge']; + _giftRecharge = json['giftRecharge']; + _sex = json['sex']; + _status = json['status']; + _loginTime = json['loginTime']; + _loginNum = json['loginNum']; + _tenantCode = json['tenantCode']; + _phone = json['phone']; + _source = json['source']; + _expendAmount = json['expendAmount']; + _buyTimes = json['buyTimes']; + _lastBuyTime = json['lastBuyTime']; + _onCredit = json['onCredit']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + dynamic _mid; + String _openid; + String _nickname; + String _headimg; + String _balance; + String _money; + String _realRecharge; + String _giftRecharge; + String _sex; + bool _status; + String _loginTime; + num _loginNum; + String _tenantCode; + String _phone; + num _source; + String _expendAmount; + num _buyTimes; + dynamic _lastBuyTime; + bool _onCredit; +Records copyWith({ String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + dynamic mid, + String openid, + String nickname, + String headimg, + String balance, + String money, + String realRecharge, + String giftRecharge, + String sex, + bool status, + String loginTime, + num loginNum, + String tenantCode, + String phone, + num source, + String expendAmount, + num buyTimes, + dynamic lastBuyTime, + bool onCredit, +}) => Records( id: id ?? _id, + createTime: createTime ?? _createTime, + createUser: createUser ?? _createUser, + updateTime: updateTime ?? _updateTime, + updateUser: updateUser ?? _updateUser, + mid: mid ?? _mid, + openid: openid ?? _openid, + nickname: nickname ?? _nickname, + headimg: headimg ?? _headimg, + balance: balance ?? _balance, + money: money ?? _money, + realRecharge: realRecharge ?? _realRecharge, + giftRecharge: giftRecharge ?? _giftRecharge, + sex: sex ?? _sex, + status: status ?? _status, + loginTime: loginTime ?? _loginTime, + loginNum: loginNum ?? _loginNum, + tenantCode: tenantCode ?? _tenantCode, + phone: phone ?? _phone, + source: source ?? _source, + expendAmount: expendAmount ?? _expendAmount, + buyTimes: buyTimes ?? _buyTimes, + lastBuyTime: lastBuyTime ?? _lastBuyTime, + onCredit: onCredit ?? _onCredit, +); + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + dynamic get mid => _mid; + String get openid => _openid; + String get nickname => _nickname; + String get headimg => _headimg; + String get balance => _balance; + String get money => _money; + String get realRecharge => _realRecharge; + String get giftRecharge => _giftRecharge; + String get sex => _sex; + bool get status => _status; + String get loginTime => _loginTime; + num get loginNum => _loginNum; + String get tenantCode => _tenantCode; + String get phone => _phone; + num get source => _source; + String get expendAmount => _expendAmount; + num get buyTimes => _buyTimes; + dynamic get lastBuyTime => _lastBuyTime; + bool get onCredit => _onCredit; + bool _isShow = false; + + bool get isShow => _isShow; + + set isShow(bool value) { + _isShow = value; + } + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['mid'] = _mid; + map['openid'] = _openid; + map['nickname'] = _nickname; + map['headimg'] = _headimg; + map['balance'] = _balance; + map['money'] = _money; + map['realRecharge'] = _realRecharge; + map['giftRecharge'] = _giftRecharge; + map['sex'] = _sex; + map['status'] = _status; + map['loginTime'] = _loginTime; + map['loginNum'] = _loginNum; + map['tenantCode'] = _tenantCode; + map['phone'] = _phone; + map['source'] = _source; + map['expendAmount'] = _expendAmount; + map['buyTimes'] = _buyTimes; + map['lastBuyTime'] = _lastBuyTime; + map['onCredit'] = _onCredit; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/recharge_flow_list.dart b/lib/retrofit/data/recharge_flow_list.dart new file mode 100644 index 00000000..e156149d --- /dev/null +++ b/lib/retrofit/data/recharge_flow_list.dart @@ -0,0 +1,329 @@ +/// records : [{"id":"1726114100938801152","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-19 13:44:06","createTimeFormat":null,"createPerson":"","phone":"18537827823","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"0.00","realRecharge":"0.00"},{"id":"1726114054612713472","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-19 13:43:55","createTimeFormat":null,"createPerson":"","phone":"18537827823","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"0.00","realRecharge":"0.00"},{"id":"1726113414083772416","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-19 13:41:22","createTimeFormat":null,"createPerson":"","phone":"18537827823","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"0.00","realRecharge":"0.00"},{"id":"1726113338053623808","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-19 13:41:04","createTimeFormat":null,"createPerson":"","phone":"18537827823","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"0.00","realRecharge":"0.00"},{"id":"1726113287562592256","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-19 13:40:52","createTimeFormat":null,"createPerson":"","phone":"18537827823","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"0.00","realRecharge":"0.00"},{"id":"1725756687412887552","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-18 14:03:52","createTimeFormat":null,"createPerson":"","phone":"17813120251","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"27.00","realRecharge":"27.00"},{"id":"1725730560917110784","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-18 12:20:03","createTimeFormat":null,"createPerson":"","phone":"15837166590","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"39.60","realRecharge":"39.60"},{"id":"1724976129296564224","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-16 10:22:12","createTimeFormat":null,"createPerson":"","phone":"15836615333","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"58.00","realRecharge":"50.00"},{"id":"1723958918691946496","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-13 15:00:10","createTimeFormat":null,"createPerson":"","phone":"17813120251","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"27.00","realRecharge":"27.00"},{"id":"1723682257861869568","rechargeType":1,"rechargeName":"现金","source":1,"createTime":"2023-11-12 20:40:49","createTimeFormat":null,"createPerson":"","phone":"13253333210","tenantCode":"1195","storeName":"台北牛肉面","rechargeMoney":"0.00","giftdMoney":"500.00","sumMoney":"500.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"1000.00","realRecharge":"0.00"}] +/// total : "21" +/// size : "10" +/// current : "1" +/// orders : [{"column":"id","asc":false}] +/// hitCount : false +/// searchCount : true +/// pages : "3" + +class RechargeFlowList { + RechargeFlowList({ + List records, + String total, + String size, + String current, + List orders, + bool hitCount, + bool searchCount, + String pages,}){ + _records = records; + _total = total; + _size = size; + _current = current; + _orders = orders; + _hitCount = hitCount; + _searchCount = searchCount; + _pages = pages; +} + + RechargeFlowList.fromJson(dynamic json) { + if (json['records'] != null) { + _records = []; + json['records'].forEach((v) { + _records.add(Records.fromJson(v)); + }); + } + _total = json['total']; + _size = json['size']; + _current = json['current']; + if (json['orders'] != null) { + _orders = []; + json['orders'].forEach((v) { + _orders.add(Orders.fromJson(v)); + }); + } + _hitCount = json['hitCount']; + _searchCount = json['searchCount']; + _pages = json['pages']; + } + List _records; + String _total; + String _size; + String _current; + List _orders; + bool _hitCount; + bool _searchCount; + String _pages; +RechargeFlowList copyWith({ List records, + String total, + String size, + String current, + List orders, + bool hitCount, + bool searchCount, + String pages, +}) => RechargeFlowList( records: records ?? _records, + total: total ?? _total, + size: size ?? _size, + current: current ?? _current, + orders: orders ?? _orders, + hitCount: hitCount ?? _hitCount, + searchCount: searchCount ?? _searchCount, + pages: pages ?? _pages, +); + List get records => _records; + String get total => _total; + String get size => _size; + String get current => _current; + List get orders => _orders; + bool get hitCount => _hitCount; + bool get searchCount => _searchCount; + String get pages => _pages; + + Map toJson() { + final map = {}; + if (_records != null) { + map['records'] = _records.map((v) => v.toJson()).toList(); + } + map['total'] = _total; + map['size'] = _size; + map['current'] = _current; + if (_orders != null) { + map['orders'] = _orders.map((v) => v.toJson()).toList(); + } + map['hitCount'] = _hitCount; + map['searchCount'] = _searchCount; + map['pages'] = _pages; + return map; + } + +} + +/// column : "id" +/// asc : false + +class Orders { + Orders({ + String column, + bool asc,}){ + _column = column; + _asc = asc; +} + + Orders.fromJson(dynamic json) { + _column = json['column']; + _asc = json['asc']; + } + String _column; + bool _asc; +Orders copyWith({ String column, + bool asc, +}) => Orders( column: column ?? _column, + asc: asc ?? _asc, +); + String get column => _column; + bool get asc => _asc; + + Map toJson() { + final map = {}; + map['column'] = _column; + map['asc'] = _asc; + return map; + } + +} + +/// id : "1726114100938801152" +/// rechargeType : 2 +/// rechargeName : "微信" +/// source : 0 +/// createTime : "2023-11-19 13:44:06" +/// createTimeFormat : null +/// createPerson : "" +/// phone : "18537827823" +/// tenantCode : "1195" +/// storeName : "" +/// rechargeMoney : "50.00" +/// giftdMoney : "20.00" +/// sumMoney : "70.00" +/// createMemberId : null +/// rechargePreferentialId : null +/// rechargeStatus : 0 +/// refuseReason : null +/// balance : "0.00" +/// realRecharge : "0.00" + +class Records { + Records({ + String id, + num rechargeType, + String rechargeName, + num source, + String createTime, + dynamic createTimeFormat, + String createPerson, + String phone, + String tenantCode, + String storeName, + String rechargeMoney, + String giftdMoney, + String sumMoney, + dynamic createMemberId, + dynamic rechargePreferentialId, + num rechargeStatus, + dynamic refuseReason, + String balance, + String realRecharge,}){ + _id = id; + _rechargeType = rechargeType; + _rechargeName = rechargeName; + _source = source; + _createTime = createTime; + _createTimeFormat = createTimeFormat; + _createPerson = createPerson; + _phone = phone; + _tenantCode = tenantCode; + _storeName = storeName; + _rechargeMoney = rechargeMoney; + _giftdMoney = giftdMoney; + _sumMoney = sumMoney; + _createMemberId = createMemberId; + _rechargePreferentialId = rechargePreferentialId; + _rechargeStatus = rechargeStatus; + _refuseReason = refuseReason; + _balance = balance; + _realRecharge = realRecharge; +} + + Records.fromJson(dynamic json) { + _id = json['id']; + _rechargeType = json['rechargeType']; + _rechargeName = json['rechargeName']; + _source = json['source']; + _createTime = json['createTime']; + _createTimeFormat = json['createTimeFormat']; + _createPerson = json['createPerson']; + _phone = json['phone']; + _tenantCode = json['tenantCode']; + _storeName = json['storeName']; + _rechargeMoney = json['rechargeMoney']; + _giftdMoney = json['giftdMoney']; + _sumMoney = json['sumMoney']; + _createMemberId = json['createMemberId']; + _rechargePreferentialId = json['rechargePreferentialId']; + _rechargeStatus = json['rechargeStatus']; + _refuseReason = json['refuseReason']; + _balance = json['balance']; + _realRecharge = json['realRecharge']; + } + String _id; + num _rechargeType; + String _rechargeName; + num _source; + String _createTime; + dynamic _createTimeFormat; + String _createPerson; + String _phone; + String _tenantCode; + String _storeName; + String _rechargeMoney; + String _giftdMoney; + String _sumMoney; + dynamic _createMemberId; + dynamic _rechargePreferentialId; + num _rechargeStatus; + dynamic _refuseReason; + String _balance; + String _realRecharge; +Records copyWith({ String id, + num rechargeType, + String rechargeName, + num source, + String createTime, + dynamic createTimeFormat, + String createPerson, + String phone, + String tenantCode, + String storeName, + String rechargeMoney, + String giftdMoney, + String sumMoney, + dynamic createMemberId, + dynamic rechargePreferentialId, + num rechargeStatus, + dynamic refuseReason, + String balance, + String realRecharge, +}) => Records( id: id ?? _id, + rechargeType: rechargeType ?? _rechargeType, + rechargeName: rechargeName ?? _rechargeName, + source: source ?? _source, + createTime: createTime ?? _createTime, + createTimeFormat: createTimeFormat ?? _createTimeFormat, + createPerson: createPerson ?? _createPerson, + phone: phone ?? _phone, + tenantCode: tenantCode ?? _tenantCode, + storeName: storeName ?? _storeName, + rechargeMoney: rechargeMoney ?? _rechargeMoney, + giftdMoney: giftdMoney ?? _giftdMoney, + sumMoney: sumMoney ?? _sumMoney, + createMemberId: createMemberId ?? _createMemberId, + rechargePreferentialId: rechargePreferentialId ?? _rechargePreferentialId, + rechargeStatus: rechargeStatus ?? _rechargeStatus, + refuseReason: refuseReason ?? _refuseReason, + balance: balance ?? _balance, + realRecharge: realRecharge ?? _realRecharge, +); + String get id => _id; + num get rechargeType => _rechargeType; + String get rechargeName => _rechargeName; + num get source => _source; + String get createTime => _createTime; + dynamic get createTimeFormat => _createTimeFormat; + String get createPerson => _createPerson; + String get phone => _phone; + String get tenantCode => _tenantCode; + String get storeName => _storeName; + String get rechargeMoney => _rechargeMoney; + String get giftdMoney => _giftdMoney; + String get sumMoney => _sumMoney; + dynamic get createMemberId => _createMemberId; + dynamic get rechargePreferentialId => _rechargePreferentialId; + num get rechargeStatus => _rechargeStatus; + dynamic get refuseReason => _refuseReason; + String get balance => _balance; + String get realRecharge => _realRecharge; + bool _isShow = false; + + bool get isShow => _isShow; + + set isShow(bool value) { + _isShow = value; + } + + Map toJson() { + final map = {}; + map['id'] = _id; + map['rechargeType'] = _rechargeType; + map['rechargeName'] = _rechargeName; + map['source'] = _source; + map['createTime'] = _createTime; + map['createTimeFormat'] = _createTimeFormat; + map['createPerson'] = _createPerson; + map['phone'] = _phone; + map['tenantCode'] = _tenantCode; + map['storeName'] = _storeName; + map['rechargeMoney'] = _rechargeMoney; + map['giftdMoney'] = _giftdMoney; + map['sumMoney'] = _sumMoney; + map['createMemberId'] = _createMemberId; + map['rechargePreferentialId'] = _rechargePreferentialId; + map['rechargeStatus'] = _rechargeStatus; + map['refuseReason'] = _refuseReason; + map['balance'] = _balance; + map['realRecharge'] = _realRecharge; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/ticket_record.dart b/lib/retrofit/data/ticket_record.dart new file mode 100644 index 00000000..ebb83c15 --- /dev/null +++ b/lib/retrofit/data/ticket_record.dart @@ -0,0 +1,709 @@ +/// pageNum : 1 +/// pageSize : 10 +/// size : 10 +/// pages : 9 +/// hasPreviousPage : false +/// hasNextPage : true +/// total : "89" +/// list : [{"id":"1724705264982032384","createTime":"2023-11-15 16:25:53","createUser":"1640233401329909760","updateTime":"2023-11-15 16:25:53","updateUser":"1640233401329909760","ticketId":"1724374425798705152","ticketCode":"T202311141831153237860001","ticketName":"四神汤 ","ticketItemIds":["1724374425903562752"],"finishTime":"2023-11-15 16:25:53","wipedUserId":"1640233401329909760","wipedUserName":"郑州小吃街","wipedStoreId":"0","isDelete":0,"tenantCode":"1195","ticket":{"id":"1724374425798705152","createTime":"2023-11-14 18:31:15","createUser":"0","updateTime":"2023-11-14 18:31:15","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724374364566061056","orderProductId":"1724374364817719296","productId":"1645714128276291584","productSkuId":"1645714128343400448","ticketWipedTimeTemplateId":"0","amount":"0.01","name":"四神汤 ","code":"T202311141831153237860001","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 18:31:15","finishTime":"2023-11-15 16:25:54","type":"NORMAL","source":null,"takeType":null,"style":"","state":9,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195"},"ticketItems":[{"id":"1724374425903562752","createTime":"2023-11-14 18:31:15","createUser":"0","updateTime":"2023-11-14 18:31:15","updateUser":"0","ticketId":"1724374425798705152","relationType":"PRODUCT","relationId":"1645714128343400448","name":"测试规格222","showImage":"","state":9,"finishTime":"2023-11-15 16:25:53","isDelete":0,"tenantCode":"1195","canWipedNumber":1}],"userName":null,"userAvatar":null,"userPhone":null},{"id":"1724704390121521152","createTime":"2023-11-15 16:22:25","createUser":"1640233401329909760","updateTime":"2023-11-15 16:22:25","updateUser":"1640233401329909760","ticketId":"1724348609991802880","ticketCode":"T202311141648406370470003","ticketName":"台湾粽 ","ticketItemIds":["1724348610033745920"],"finishTime":"2023-11-15 16:22:25","wipedUserId":"1640233401329909760","wipedUserName":"郑州小吃街","wipedStoreId":"0","isDelete":0,"tenantCode":"1195","ticket":{"id":"1724348609991802880","createTime":"2023-11-14 16:48:40","createUser":"0","updateTime":"2023-11-14 16:48:40","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724348544648740864","orderProductId":"1724348544715849728","productId":"1645981572022665216","productSkuId":"1645981572102356992","ticketWipedTimeTemplateId":null,"amount":"10.00","name":"台湾粽 ","code":"T202311141648406370470003","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 16:48:40","finishTime":null,"type":"NORMAL","source":null,"takeType":null,"style":"","state":2,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195"},"ticketItems":[{"id":"1724348610033745920","createTime":"2023-11-14 16:48:40","createUser":"0","updateTime":"2023-11-14 16:48:40","updateUser":"0","ticketId":"1724348609991802880","relationType":"PRODUCT","relationId":"1645981572102356992","name":"测试票券项目22","showImage":"","state":9,"finishTime":"2023-11-15 16:22:25","isDelete":0,"tenantCode":"1195","canWipedNumber":1}],"userName":null,"userAvatar":null,"userPhone":null},{"id":"1724704299910430720","createTime":"2023-11-15 16:22:03","createUser":"1640233401329909760","updateTime":"2023-11-15 16:22:03","updateUser":"1640233401329909760","ticketId":"1724348609991802880","ticketCode":"T202311141648406370470003","ticketName":"台湾粽 ","ticketItemIds":["1724348610037940224"],"finishTime":"2023-11-15 16:22:03","wipedUserId":"1640233401329909760","wipedUserName":"郑州小吃街","wipedStoreId":"0","isDelete":0,"tenantCode":"1195","ticket":{"id":"1724348609991802880","createTime":"2023-11-14 16:48:40","createUser":"0","updateTime":"2023-11-14 16:48:40","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724348544648740864","orderProductId":"1724348544715849728","productId":"1645981572022665216","productSkuId":"1645981572102356992","ticketWipedTimeTemplateId":null,"amount":"10.00","name":"台湾粽 ","code":"T202311141648406370470003","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 16:48:40","finishTime":null,"type":"NORMAL","source":null,"takeType":null,"style":"","state":2,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195"},"ticketItems":[{"id":"1724348610037940224","createTime":"2023-11-14 16:48:40","createUser":"0","updateTime":"2023-11-14 16:48:40","updateUser":"0","ticketId":"1724348609991802880","relationType":"PRODUCT","relationId":"1645981572102356992","name":"测试票券项目33","showImage":"","state":9,"finishTime":"2023-11-15 16:22:03","isDelete":0,"tenantCode":"1195","canWipedNumber":1}],"userName":null,"userAvatar":null,"userPhone":null},{"id":"1724610506108436480","createTime":"2023-11-15 10:09:21","createUser":"1640233401329909760","updateTime":"2023-11-15 10:09:21","updateUser":"1640233401329909760","ticketId":"1724348845887848448","ticketCode":"T202311141649367069660005","ticketName":"四神汤 ","ticketItemIds":["1724348845933985792"],"finishTime":"2023-11-15 10:09:21","wipedUserId":"1640233401329909760","wipedUserName":"郑州小吃街","wipedStoreId":"0","isDelete":0,"tenantCode":"1195","ticket":{"id":"1724348845887848448","createTime":"2023-11-14 16:49:36","createUser":"0","updateTime":"2023-11-14 16:49:36","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724348797322002432","orderProductId":"1724348797389111296","productId":"1645714128276291584","productSkuId":"1645714128343400448","ticketWipedTimeTemplateId":"0","amount":"0.01","name":"四神汤 ","code":"T202311141649367069660005","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 16:49:36","finishTime":"2023-11-15 10:09:22","type":"NORMAL","source":null,"takeType":null,"style":"","state":9,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195"},"ticketItems":[{"id":"1724348845933985792","createTime":"2023-11-14 16:49:36","createUser":"0","updateTime":"2023-11-14 16:49:36","updateUser":"0","ticketId":"1724348845887848448","relationType":"PRODUCT","relationId":"1645714128343400448","name":"测试规格222","showImage":"","state":9,"finishTime":"2023-11-15 10:09:21","isDelete":0,"tenantCode":"1195","canWipedNumber":1}],"userName":null,"userAvatar":null,"userPhone":null},{"id":"1724608421967167488","createTime":"2023-11-15 10:01:04","createUser":"1640233401329909760","updateTime":"2023-11-15 10:01:04","updateUser":"1640233401329909760","ticketId":"1724358600903622656","ticketCode":"T202311141728226409980002","ticketName":"四神汤 ","ticketItemIds":["1724358600987508736"],"finishTime":"2023-11-15 10:01:04","wipedUserId":"1640233401329909760","wipedUserName":"郑州小吃街","wipedStoreId":"0","isDelete":0,"tenantCode":"1195","ticket":{"id":"1724358600903622656","createTime":"2023-11-14 17:28:22","createUser":"0","updateTime":"2023-11-14 17:28:22","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724358540404981760","orderProductId":"1724358540778274816","productId":"1645714128276291584","productSkuId":"1645714128343400448","ticketWipedTimeTemplateId":"0","amount":"0.01","name":"四神汤 ","code":"T202311141728226409980002","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 17:28:22","finishTime":null,"type":"NORMAL","source":null,"takeType":null,"style":"","state":2,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195"},"ticketItems":[{"id":"1724358600987508736","createTime":"2023-11-14 17:28:22","createUser":"0","updateTime":"2023-11-14 17:28:22","updateUser":"0","ticketId":"1724358600903622656","relationType":"PRODUCT","relationId":"1645714128343400448","name":"测试规格222","showImage":"","state":9,"finishTime":"2023-11-15 10:01:04","isDelete":0,"tenantCode":"1195","canWipedNumber":1}],"userName":null,"userAvatar":null,"userPhone":null},{"id":"1724607895644930048","createTime":"2023-11-15 09:58:59","createUser":"1640233401329909760","updateTime":"2023-11-15 09:58:59","updateUser":"1640233401329909760","ticketId":"1724358600836513792","ticketCode":"T202311141728222105430001","ticketName":"台湾粽 ","ticketItemIds":["1724358600970731520"],"finishTime":"2023-11-15 09:58:59","wipedUserId":"1640233401329909760","wipedUserName":"郑州小吃街","wipedStoreId":"0","isDelete":0,"tenantCode":"1195","ticket":{"id":"1724358600836513792","createTime":"2023-11-14 17:28:22","createUser":"0","updateTime":"2023-11-14 17:28:22","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724358540404981760","orderProductId":"1724358540723748864","productId":"1645981572022665216","productSkuId":"1645981572102356992","ticketWipedTimeTemplateId":null,"amount":"10.00","name":"台湾粽 ","code":"T202311141728222105430001","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 17:28:22","finishTime":null,"type":"NORMAL","source":null,"takeType":null,"style":"","state":2,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195"},"ticketItems":[{"id":"1724358600970731520","createTime":"2023-11-14 17:28:22","createUser":"0","updateTime":"2023-11-14 17:28:22","updateUser":"0","ticketId":"1724358600836513792","relationType":"PRODUCT","relationId":"1645981572102356992","name":"测试票券项目22","showImage":"","state":9,"finishTime":"2023-11-15 09:58:59","isDelete":0,"tenantCode":"1195","canWipedNumber":1}],"userName":null,"userAvatar":null,"userPhone":null},{"id":"1724375348973404160","createTime":"2023-11-14 18:34:55","createUser":"1640233401329909760","updateTime":"2023-11-14 18:34:55","updateUser":"1640233401329909760","ticketId":"1724358600836513792","ticketCode":"T202311141728222105430001","ticketName":"台湾粽 ","ticketItemIds":["1724358600945565696"],"finishTime":"2023-11-14 18:34:55","wipedUserId":"1640233401329909760","wipedUserName":"郑州小吃街","wipedStoreId":"0","isDelete":0,"tenantCode":"1195","ticket":{"id":"1724358600836513792","createTime":"2023-11-14 17:28:22","createUser":"0","updateTime":"2023-11-14 17:28:22","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724358540404981760","orderProductId":"1724358540723748864","productId":"1645981572022665216","productSkuId":"1645981572102356992","ticketWipedTimeTemplateId":null,"amount":"10.00","name":"台湾粽 ","code":"T202311141728222105430001","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 17:28:22","finishTime":null,"type":"NORMAL","source":null,"takeType":null,"style":"","state":2,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195"},"ticketItems":[{"id":"1724358600945565696","createTime":"2023-11-14 17:28:22","createUser":"0","updateTime":"2023-11-14 17:28:22","updateUser":"0","ticketId":"1724358600836513792","relationType":"PRODUCT","relationId":"1645981572102356992","name":"测试票券项目11","showImage":"","state":9,"finishTime":"2023-11-14 18:34:55","isDelete":0,"tenantCode":"1195","canWipedNumber":1}],"userName":null,"userAvatar":null,"userPhone":null},{"id":"1724374711074291712","createTime":"2023-11-14 18:32:23","createUser":"1640233401329909760","updateTime":"2023-11-14 18:32:23","updateUser":"1640233401329909760","ticketId":"1724374425798705152","ticketCode":"T202311141831153237860001","ticketName":"四神汤 ","ticketItemIds":["1724374425882591232"],"finishTime":"2023-11-14 18:32:23","wipedUserId":"1640233401329909760","wipedUserName":"郑州小吃街","wipedStoreId":"0","isDelete":0,"tenantCode":"1195","ticket":{"id":"1724374425798705152","createTime":"2023-11-14 18:31:15","createUser":"0","updateTime":"2023-11-14 18:31:15","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724374364566061056","orderProductId":"1724374364817719296","productId":"1645714128276291584","productSkuId":"1645714128343400448","ticketWipedTimeTemplateId":"0","amount":"0.01","name":"四神汤 ","code":"T202311141831153237860001","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 18:31:15","finishTime":"2023-11-15 16:25:54","type":"NORMAL","source":null,"takeType":null,"style":"","state":9,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195"},"ticketItems":[{"id":"1724374425882591232","createTime":"2023-11-14 18:31:15","createUser":"0","updateTime":"2023-11-14 18:31:15","updateUser":"0","ticketId":"1724374425798705152","relationType":"PRODUCT","relationId":"1645714128343400448","name":"测试规格","showImage":"","state":9,"finishTime":"2023-11-14 18:32:23","isDelete":0,"tenantCode":"1195","canWipedNumber":1}],"userName":null,"userAvatar":null,"userPhone":null},{"id":"1724354767272017920","createTime":"2023-11-14 17:13:08","createUser":"1640233401329909760","updateTime":"2023-11-14 17:13:08","updateUser":"1640233401329909760","ticketId":"1724348845887848448","ticketCode":"T202311141649367069660005","ticketName":"四神汤 ","ticketItemIds":["1724348845913014272"],"finishTime":"2023-11-14 17:13:08","wipedUserId":"1640233401329909760","wipedUserName":"郑州小吃街","wipedStoreId":"0","isDelete":0,"tenantCode":"1195","ticket":{"id":"1724348845887848448","createTime":"2023-11-14 16:49:36","createUser":"0","updateTime":"2023-11-14 16:49:36","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724348797322002432","orderProductId":"1724348797389111296","productId":"1645714128276291584","productSkuId":"1645714128343400448","ticketWipedTimeTemplateId":"0","amount":"0.01","name":"四神汤 ","code":"T202311141649367069660005","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 16:49:36","finishTime":"2023-11-15 10:09:22","type":"NORMAL","source":null,"takeType":null,"style":"","state":9,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195"},"ticketItems":[{"id":"1724348845913014272","createTime":"2023-11-14 16:49:36","createUser":"0","updateTime":"2023-11-14 16:49:36","updateUser":"0","ticketId":"1724348845887848448","relationType":"PRODUCT","relationId":"1645714128343400448","name":"测试规格","showImage":"","state":9,"finishTime":"2023-11-14 17:13:08","isDelete":0,"tenantCode":"1195","canWipedNumber":1}],"userName":null,"userAvatar":null,"userPhone":null},{"id":"1724352764873539584","createTime":"2023-11-14 17:05:11","createUser":"1640233401329909760","updateTime":"2023-11-14 17:05:11","updateUser":"1640233401329909760","ticketId":"1724348917321039872","ticketCode":"T202311141649539811200006","ticketName":"台湾粽 ","ticketItemIds":["1724348917371371520"],"finishTime":"2023-11-14 17:05:11","wipedUserId":"1640233401329909760","wipedUserName":"郑州小吃街","wipedStoreId":"0","isDelete":0,"tenantCode":"1195","ticket":{"id":"1724348917321039872","createTime":"2023-11-14 16:49:53","createUser":"0","updateTime":"2023-11-14 16:49:53","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724348875256365056","orderProductId":"1724348875348639744","productId":"1645981572022665216","productSkuId":"1645981572102356992","ticketWipedTimeTemplateId":null,"amount":"10.00","name":"台湾粽 ","code":"T202311141649539811200006","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 16:49:53","finishTime":null,"type":"NORMAL","source":null,"takeType":null,"style":"","state":2,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195"},"ticketItems":[{"id":"1724348917371371520","createTime":"2023-11-14 16:49:53","createUser":"0","updateTime":"2023-11-14 16:49:53","updateUser":"0","ticketId":"1724348917321039872","relationType":"PRODUCT","relationId":"1645981572102356992","name":"测试票券项目22","showImage":"","state":9,"finishTime":"2023-11-14 17:05:11","isDelete":0,"tenantCode":"1195","canWipedNumber":1}],"userName":null,"userAvatar":null,"userPhone":null}] + +class TicketRecord { + TicketRecord({ + num pageNum, + num pageSize, + num size, + num pages, + bool hasPreviousPage, + bool hasNextPage, + String total, + List list,}){ + _pageNum = pageNum; + _pageSize = pageSize; + _size = size; + _pages = pages; + _hasPreviousPage = hasPreviousPage; + _hasNextPage = hasNextPage; + _total = total; + _list = list; +} + + TicketRecord.fromJson(dynamic json) { + _pageNum = json['pageNum']; + _pageSize = json['pageSize']; + _size = json['size']; + _pages = json['pages']; + _hasPreviousPage = json['hasPreviousPage']; + _hasNextPage = json['hasNextPage']; + _total = json['total']; + if (json['list'] != null) { + _list = []; + json['list'].forEach((v) { + _list.add(TicketRecordList.fromJson(v)); + }); + } + } + num _pageNum; + num _pageSize; + num _size; + num _pages; + bool _hasPreviousPage; + bool _hasNextPage; + String _total; + List _list; +TicketRecord copyWith({ num pageNum, + num pageSize, + num size, + num pages, + bool hasPreviousPage, + bool hasNextPage, + String total, + List list, +}) => TicketRecord( pageNum: pageNum ?? _pageNum, + pageSize: pageSize ?? _pageSize, + size: size ?? _size, + pages: pages ?? _pages, + hasPreviousPage: hasPreviousPage ?? _hasPreviousPage, + hasNextPage: hasNextPage ?? _hasNextPage, + total: total ?? _total, + list: list ?? _list, +); + num get pageNum => _pageNum; + num get pageSize => _pageSize; + num get size => _size; + num get pages => _pages; + bool get hasPreviousPage => _hasPreviousPage; + bool get hasNextPage => _hasNextPage; + String get total => _total; + List get list => _list; + + Map toJson() { + final map = {}; + map['pageNum'] = _pageNum; + map['pageSize'] = _pageSize; + map['size'] = _size; + map['pages'] = _pages; + map['hasPreviousPage'] = _hasPreviousPage; + map['hasNextPage'] = _hasNextPage; + map['total'] = _total; + if (_list != null) { + map['list'] = _list.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// id : "1724705264982032384" +/// createTime : "2023-11-15 16:25:53" +/// createUser : "1640233401329909760" +/// updateTime : "2023-11-15 16:25:53" +/// updateUser : "1640233401329909760" +/// ticketId : "1724374425798705152" +/// ticketCode : "T202311141831153237860001" +/// ticketName : "四神汤 " +/// ticketItemIds : ["1724374425903562752"] +/// finishTime : "2023-11-15 16:25:53" +/// wipedUserId : "1640233401329909760" +/// wipedUserName : "郑州小吃街" +/// wipedStoreId : "0" +/// isDelete : 0 +/// tenantCode : "1195" +/// ticket : {"id":"1724374425798705152","createTime":"2023-11-14 18:31:15","createUser":"0","updateTime":"2023-11-14 18:31:15","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724374364566061056","orderProductId":"1724374364817719296","productId":"1645714128276291584","productSkuId":"1645714128343400448","ticketWipedTimeTemplateId":"0","amount":"0.01","name":"四神汤 ","code":"T202311141831153237860001","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 18:31:15","finishTime":"2023-11-15 16:25:54","type":"NORMAL","source":null,"takeType":null,"style":"","state":9,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195"} +/// ticketItems : [{"id":"1724374425903562752","createTime":"2023-11-14 18:31:15","createUser":"0","updateTime":"2023-11-14 18:31:15","updateUser":"0","ticketId":"1724374425798705152","relationType":"PRODUCT","relationId":"1645714128343400448","name":"测试规格222","showImage":"","state":9,"finishTime":"2023-11-15 16:25:53","isDelete":0,"tenantCode":"1195","canWipedNumber":1}] +/// userName : null +/// userAvatar : null +/// userPhone : null + +class TicketRecordList { + TicketRecordList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String ticketId, + String ticketCode, + String ticketName, + List ticketItemIds, + String finishTime, + String wipedUserId, + String wipedUserName, + String wipedStoreId, + num isDelete, + String tenantCode, + Ticket ticket, + List ticketItems, + dynamic userName, + dynamic userAvatar, + dynamic userPhone,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _ticketId = ticketId; + _ticketCode = ticketCode; + _ticketName = ticketName; + _ticketItemIds = ticketItemIds; + _finishTime = finishTime; + _wipedUserId = wipedUserId; + _wipedUserName = wipedUserName; + _wipedStoreId = wipedStoreId; + _isDelete = isDelete; + _tenantCode = tenantCode; + _ticket = ticket; + _ticketItems = ticketItems; + _userName = userName; + _userAvatar = userAvatar; + _userPhone = userPhone; +} + + TicketRecordList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _ticketId = json['ticketId']; + _ticketCode = json['ticketCode']; + _ticketName = json['ticketName']; + _ticketItemIds = json['ticketItemIds'] != null ? json['ticketItemIds'].cast() : []; + _finishTime = json['finishTime']; + _wipedUserId = json['wipedUserId']; + _wipedUserName = json['wipedUserName']; + _wipedStoreId = json['wipedStoreId']; + _isDelete = json['isDelete']; + _tenantCode = json['tenantCode']; + _ticket = json['ticket'] != null ? Ticket.fromJson(json['ticket']) : null; + if (json['ticketItems'] != null) { + _ticketItems = []; + json['ticketItems'].forEach((v) { + _ticketItems.add(TicketItems.fromJson(v)); + }); + } + _userName = json['userName']; + _userAvatar = json['userAvatar']; + _userPhone = json['userPhone']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _ticketId; + String _ticketCode; + String _ticketName; + List _ticketItemIds; + String _finishTime; + String _wipedUserId; + String _wipedUserName; + String _wipedStoreId; + num _isDelete; + String _tenantCode; + Ticket _ticket; + List _ticketItems; + dynamic _userName; + dynamic _userAvatar; + dynamic _userPhone; + TicketRecordList copyWith({ String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String ticketId, + String ticketCode, + String ticketName, + List ticketItemIds, + String finishTime, + String wipedUserId, + String wipedUserName, + String wipedStoreId, + num isDelete, + String tenantCode, + Ticket ticket, + List ticketItems, + dynamic userName, + dynamic userAvatar, + dynamic userPhone, +}) => TicketRecordList( id: id ?? _id, + createTime: createTime ?? _createTime, + createUser: createUser ?? _createUser, + updateTime: updateTime ?? _updateTime, + updateUser: updateUser ?? _updateUser, + ticketId: ticketId ?? _ticketId, + ticketCode: ticketCode ?? _ticketCode, + ticketName: ticketName ?? _ticketName, + ticketItemIds: ticketItemIds ?? _ticketItemIds, + finishTime: finishTime ?? _finishTime, + wipedUserId: wipedUserId ?? _wipedUserId, + wipedUserName: wipedUserName ?? _wipedUserName, + wipedStoreId: wipedStoreId ?? _wipedStoreId, + isDelete: isDelete ?? _isDelete, + tenantCode: tenantCode ?? _tenantCode, + ticket: ticket ?? _ticket, + ticketItems: ticketItems ?? _ticketItems, + userName: userName ?? _userName, + userAvatar: userAvatar ?? _userAvatar, + userPhone: userPhone ?? _userPhone, +); + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get ticketId => _ticketId; + String get ticketCode => _ticketCode; + String get ticketName => _ticketName; + List get ticketItemIds => _ticketItemIds; + String get finishTime => _finishTime; + String get wipedUserId => _wipedUserId; + String get wipedUserName => _wipedUserName; + String get wipedStoreId => _wipedStoreId; + num get isDelete => _isDelete; + String get tenantCode => _tenantCode; + Ticket get ticket => _ticket; + List get ticketItems => _ticketItems; + dynamic get userName => _userName; + dynamic get userAvatar => _userAvatar; + dynamic get userPhone => _userPhone; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['ticketId'] = _ticketId; + map['ticketCode'] = _ticketCode; + map['ticketName'] = _ticketName; + map['ticketItemIds'] = _ticketItemIds; + map['finishTime'] = _finishTime; + map['wipedUserId'] = _wipedUserId; + map['wipedUserName'] = _wipedUserName; + map['wipedStoreId'] = _wipedStoreId; + map['isDelete'] = _isDelete; + map['tenantCode'] = _tenantCode; + if (_ticket != null) { + map['ticket'] = _ticket.toJson(); + } + if (_ticketItems != null) { + map['ticketItems'] = _ticketItems.map((v) => v.toJson()).toList(); + } + map['userName'] = _userName; + map['userAvatar'] = _userAvatar; + map['userPhone'] = _userPhone; + return map; + } + +} + +/// id : "1724374425903562752" +/// createTime : "2023-11-14 18:31:15" +/// createUser : "0" +/// updateTime : "2023-11-14 18:31:15" +/// updateUser : "0" +/// ticketId : "1724374425798705152" +/// relationType : "PRODUCT" +/// relationId : "1645714128343400448" +/// name : "测试规格222" +/// showImage : "" +/// state : 9 +/// finishTime : "2023-11-15 16:25:53" +/// isDelete : 0 +/// tenantCode : "1195" +/// canWipedNumber : 1 + +class TicketItems { + TicketItems({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String ticketId, + String relationType, + String relationId, + String name, + String showImage, + num state, + String finishTime, + num isDelete, + String tenantCode, + num canWipedNumber,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _ticketId = ticketId; + _relationType = relationType; + _relationId = relationId; + _name = name; + _showImage = showImage; + _state = state; + _finishTime = finishTime; + _isDelete = isDelete; + _tenantCode = tenantCode; + _canWipedNumber = canWipedNumber; +} + + TicketItems.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _ticketId = json['ticketId']; + _relationType = json['relationType']; + _relationId = json['relationId']; + _name = json['name']; + _showImage = json['showImage']; + _state = json['state']; + _finishTime = json['finishTime']; + _isDelete = json['isDelete']; + _tenantCode = json['tenantCode']; + _canWipedNumber = json['canWipedNumber']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _ticketId; + String _relationType; + String _relationId; + String _name; + String _showImage; + num _state; + String _finishTime; + num _isDelete; + String _tenantCode; + num _canWipedNumber; +TicketItems copyWith({ String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String ticketId, + String relationType, + String relationId, + String name, + String showImage, + num state, + String finishTime, + num isDelete, + String tenantCode, + num canWipedNumber, +}) => TicketItems( id: id ?? _id, + createTime: createTime ?? _createTime, + createUser: createUser ?? _createUser, + updateTime: updateTime ?? _updateTime, + updateUser: updateUser ?? _updateUser, + ticketId: ticketId ?? _ticketId, + relationType: relationType ?? _relationType, + relationId: relationId ?? _relationId, + name: name ?? _name, + showImage: showImage ?? _showImage, + state: state ?? _state, + finishTime: finishTime ?? _finishTime, + isDelete: isDelete ?? _isDelete, + tenantCode: tenantCode ?? _tenantCode, + canWipedNumber: canWipedNumber ?? _canWipedNumber, +); + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get ticketId => _ticketId; + String get relationType => _relationType; + String get relationId => _relationId; + String get name => _name; + String get showImage => _showImage; + num get state => _state; + String get finishTime => _finishTime; + num get isDelete => _isDelete; + String get tenantCode => _tenantCode; + num get canWipedNumber => _canWipedNumber; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['ticketId'] = _ticketId; + map['relationType'] = _relationType; + map['relationId'] = _relationId; + map['name'] = _name; + map['showImage'] = _showImage; + map['state'] = _state; + map['finishTime'] = _finishTime; + map['isDelete'] = _isDelete; + map['tenantCode'] = _tenantCode; + map['canWipedNumber'] = _canWipedNumber; + return map; + } + +} + +/// id : "1724374425798705152" +/// createTime : "2023-11-14 18:31:15" +/// createUser : "0" +/// updateTime : "2023-11-14 18:31:15" +/// updateUser : "0" +/// mid : "1379254113602109440" +/// storeId : "1645318098540036096" +/// orderId : "1724374364566061056" +/// orderProductId : "1724374364817719296" +/// productId : "1645714128276291584" +/// productSkuId : "1645714128343400448" +/// ticketWipedTimeTemplateId : "0" +/// amount : "0.01" +/// name : "四神汤 " +/// code : "T202311141831153237860001" +/// useStartTime : "2023-11-14 00:00:00" +/// useEndTime : "2023-12-13 18:31:15" +/// finishTime : "2023-11-15 16:25:54" +/// type : "NORMAL" +/// source : null +/// takeType : null +/// style : "" +/// state : 9 +/// canSettlement : true +/// canSubscribe : true +/// isDelete : 0 +/// tenantCode : "1195" + +class Ticket { + Ticket({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String mid, + String storeId, + String orderId, + String orderProductId, + String productId, + String productSkuId, + String ticketWipedTimeTemplateId, + String amount, + String name, + String code, + String useStartTime, + String useEndTime, + String finishTime, + String type, + dynamic source, + dynamic takeType, + String style, + num state, + bool canSettlement, + bool canSubscribe, + num isDelete, + String tenantCode,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _mid = mid; + _storeId = storeId; + _orderId = orderId; + _orderProductId = orderProductId; + _productId = productId; + _productSkuId = productSkuId; + _ticketWipedTimeTemplateId = ticketWipedTimeTemplateId; + _amount = amount; + _name = name; + _code = code; + _useStartTime = useStartTime; + _useEndTime = useEndTime; + _finishTime = finishTime; + _type = type; + _source = source; + _takeType = takeType; + _style = style; + _state = state; + _canSettlement = canSettlement; + _canSubscribe = canSubscribe; + _isDelete = isDelete; + _tenantCode = tenantCode; +} + + Ticket.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _mid = json['mid']; + _storeId = json['storeId']; + _orderId = json['orderId']; + _orderProductId = json['orderProductId']; + _productId = json['productId']; + _productSkuId = json['productSkuId']; + _ticketWipedTimeTemplateId = json['ticketWipedTimeTemplateId']; + _amount = json['amount']; + _name = json['name']; + _code = json['code']; + _useStartTime = json['useStartTime']; + _useEndTime = json['useEndTime']; + _finishTime = json['finishTime']; + _type = json['type']; + _source = json['source']; + _takeType = json['takeType']; + _style = json['style']; + _state = json['state']; + _canSettlement = json['canSettlement']; + _canSubscribe = json['canSubscribe']; + _isDelete = json['isDelete']; + _tenantCode = json['tenantCode']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _mid; + String _storeId; + String _orderId; + String _orderProductId; + String _productId; + String _productSkuId; + String _ticketWipedTimeTemplateId; + String _amount; + String _name; + String _code; + String _useStartTime; + String _useEndTime; + String _finishTime; + String _type; + dynamic _source; + dynamic _takeType; + String _style; + num _state; + bool _canSettlement; + bool _canSubscribe; + num _isDelete; + String _tenantCode; +Ticket copyWith({ String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String mid, + String storeId, + String orderId, + String orderProductId, + String productId, + String productSkuId, + String ticketWipedTimeTemplateId, + String amount, + String name, + String code, + String useStartTime, + String useEndTime, + String finishTime, + String type, + dynamic source, + dynamic takeType, + String style, + num state, + bool canSettlement, + bool canSubscribe, + num isDelete, + String tenantCode, +}) => Ticket( id: id ?? _id, + createTime: createTime ?? _createTime, + createUser: createUser ?? _createUser, + updateTime: updateTime ?? _updateTime, + updateUser: updateUser ?? _updateUser, + mid: mid ?? _mid, + storeId: storeId ?? _storeId, + orderId: orderId ?? _orderId, + orderProductId: orderProductId ?? _orderProductId, + productId: productId ?? _productId, + productSkuId: productSkuId ?? _productSkuId, + ticketWipedTimeTemplateId: ticketWipedTimeTemplateId ?? _ticketWipedTimeTemplateId, + amount: amount ?? _amount, + name: name ?? _name, + code: code ?? _code, + useStartTime: useStartTime ?? _useStartTime, + useEndTime: useEndTime ?? _useEndTime, + finishTime: finishTime ?? _finishTime, + type: type ?? _type, + source: source ?? _source, + takeType: takeType ?? _takeType, + style: style ?? _style, + state: state ?? _state, + canSettlement: canSettlement ?? _canSettlement, + canSubscribe: canSubscribe ?? _canSubscribe, + isDelete: isDelete ?? _isDelete, + tenantCode: tenantCode ?? _tenantCode, +); + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get mid => _mid; + String get storeId => _storeId; + String get orderId => _orderId; + String get orderProductId => _orderProductId; + String get productId => _productId; + String get productSkuId => _productSkuId; + String get ticketWipedTimeTemplateId => _ticketWipedTimeTemplateId; + String get amount => _amount; + String get name => _name; + String get code => _code; + String get useStartTime => _useStartTime; + String get useEndTime => _useEndTime; + String get finishTime => _finishTime; + String get type => _type; + dynamic get source => _source; + dynamic get takeType => _takeType; + String get style => _style; + num get state => _state; + bool get canSettlement => _canSettlement; + bool get canSubscribe => _canSubscribe; + num get isDelete => _isDelete; + String get tenantCode => _tenantCode; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['mid'] = _mid; + map['storeId'] = _storeId; + map['orderId'] = _orderId; + map['orderProductId'] = _orderProductId; + map['productId'] = _productId; + map['productSkuId'] = _productSkuId; + map['ticketWipedTimeTemplateId'] = _ticketWipedTimeTemplateId; + map['amount'] = _amount; + map['name'] = _name; + map['code'] = _code; + map['useStartTime'] = _useStartTime; + map['useEndTime'] = _useEndTime; + map['finishTime'] = _finishTime; + map['type'] = _type; + map['source'] = _source; + map['takeType'] = _takeType; + map['style'] = _style; + map['state'] = _state; + map['canSettlement'] = _canSettlement; + map['canSubscribe'] = _canSubscribe; + map['isDelete'] = _isDelete; + map['tenantCode'] = _tenantCode; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/ticket_show.dart b/lib/retrofit/data/ticket_show.dart new file mode 100644 index 00000000..83ae281c --- /dev/null +++ b/lib/retrofit/data/ticket_show.dart @@ -0,0 +1,380 @@ +/// pageNum : 1 +/// pageSize : 10 +/// size : 10 +/// pages : 15 +/// hasPreviousPage : false +/// hasNextPage : true +/// total : "141" +/// list : [{"id":"1726808185014059008","createTime":"2023-11-21 11:42:09","createUser":"0","updateTime":"2023-11-21 11:42:09","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1726808134187483136","orderProductId":"1726808134355255296","productId":"1645714128276291584","productSkuId":"1645714128343400448","ticketWipedTimeTemplateId":"0","amount":"0.01","name":"四神汤 ","code":"T202311211142080717340001","useStartTime":"2023-11-21 00:00:00","useEndTime":"2023-12-20 11:42:08","finishTime":null,"type":"NORMAL","source":null,"takeType":null,"style":"","state":1,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195","nickName":null,"userAvatar":null,"userPhone":null},{"id":"1724374425849036800","createTime":"2023-11-14 18:31:15","createUser":"0","updateTime":"2023-11-14 18:31:15","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724374364566061056","orderProductId":"1724374364817719296","productId":"1645714128276291584","productSkuId":"1645714128343400448","ticketWipedTimeTemplateId":"0","amount":"0.01","name":"四神汤 ","code":"T202311141831155981340002","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 18:31:15","finishTime":null,"type":"NORMAL","source":null,"takeType":null,"style":"","state":1,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195","nickName":null,"userAvatar":null,"userPhone":null},{"id":"1724374425798705152","createTime":"2023-11-14 18:31:15","createUser":"0","updateTime":"2023-11-14 18:31:15","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724374364566061056","orderProductId":"1724374364817719296","productId":"1645714128276291584","productSkuId":"1645714128343400448","ticketWipedTimeTemplateId":"0","amount":"0.01","name":"四神汤 ","code":"T202311141831153237860001","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 18:31:15","finishTime":"2023-11-15 16:25:54","type":"NORMAL","source":null,"takeType":null,"style":"","state":9,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195","nickName":null,"userAvatar":null,"userPhone":null},{"id":"1724358600903622656","createTime":"2023-11-14 17:28:22","createUser":"0","updateTime":"2023-11-14 17:28:22","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724358540404981760","orderProductId":"1724358540778274816","productId":"1645714128276291584","productSkuId":"1645714128343400448","ticketWipedTimeTemplateId":"0","amount":"0.01","name":"四神汤 ","code":"T202311141728226409980002","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 17:28:22","finishTime":null,"type":"NORMAL","source":null,"takeType":null,"style":"","state":2,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195","nickName":null,"userAvatar":null,"userPhone":null},{"id":"1724358600836513792","createTime":"2023-11-14 17:28:22","createUser":"0","updateTime":"2023-11-14 17:28:22","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724358540404981760","orderProductId":"1724358540723748864","productId":"1645981572022665216","productSkuId":"1645981572102356992","ticketWipedTimeTemplateId":null,"amount":"10.00","name":"台湾粽 ","code":"T202311141728222105430001","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 17:28:22","finishTime":null,"type":"NORMAL","source":null,"takeType":null,"style":"","state":2,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195","nickName":null,"userAvatar":null,"userPhone":null},{"id":"1724349046040035328","createTime":"2023-11-14 16:50:24","createUser":"0","updateTime":"2023-11-14 16:50:24","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724349002641571840","orderProductId":"1724349002704486400","productId":"1645714128276291584","productSkuId":"1645714128343400448","ticketWipedTimeTemplateId":"0","amount":"0.01","name":"四神汤 ","code":"T202311141650240387860007","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 16:50:24","finishTime":null,"type":"NORMAL","source":null,"takeType":null,"style":"","state":2,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195","nickName":null,"userAvatar":null,"userPhone":null},{"id":"1724348917321039872","createTime":"2023-11-14 16:49:53","createUser":"0","updateTime":"2023-11-14 16:49:53","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724348875256365056","orderProductId":"1724348875348639744","productId":"1645981572022665216","productSkuId":"1645981572102356992","ticketWipedTimeTemplateId":null,"amount":"10.00","name":"台湾粽 ","code":"T202311141649539811200006","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 16:49:53","finishTime":null,"type":"NORMAL","source":null,"takeType":null,"style":"","state":2,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195","nickName":null,"userAvatar":null,"userPhone":null},{"id":"1724348845887848448","createTime":"2023-11-14 16:49:36","createUser":"0","updateTime":"2023-11-14 16:49:36","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724348797322002432","orderProductId":"1724348797389111296","productId":"1645714128276291584","productSkuId":"1645714128343400448","ticketWipedTimeTemplateId":"0","amount":"0.01","name":"四神汤 ","code":"T202311141649367069660005","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 16:49:36","finishTime":"2023-11-15 10:09:22","type":"NORMAL","source":null,"takeType":null,"style":"","state":9,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195","nickName":null,"userAvatar":null,"userPhone":null},{"id":"1724348766061854720","createTime":"2023-11-14 16:49:17","createUser":"0","updateTime":"2023-11-14 16:49:17","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724348724877983744","orderProductId":"1724348724940898304","productId":"1645981572022665216","productSkuId":"1645981572102356992","ticketWipedTimeTemplateId":null,"amount":"10.00","name":"台湾粽 ","code":"T202311141649173932870004","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 16:49:17","finishTime":null,"type":"NORMAL","source":null,"takeType":null,"style":"","state":1,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195","nickName":null,"userAvatar":null,"userPhone":null},{"id":"1724348609991802880","createTime":"2023-11-14 16:48:40","createUser":"0","updateTime":"2023-11-14 16:48:40","updateUser":"0","mid":"1379254113602109440","storeId":"1645318098540036096","orderId":"1724348544648740864","orderProductId":"1724348544715849728","productId":"1645981572022665216","productSkuId":"1645981572102356992","ticketWipedTimeTemplateId":null,"amount":"10.00","name":"台湾粽 ","code":"T202311141648406370470003","useStartTime":"2023-11-14 00:00:00","useEndTime":"2023-12-13 16:48:40","finishTime":null,"type":"NORMAL","source":null,"takeType":null,"style":"","state":2,"canSettlement":true,"canSubscribe":true,"isDelete":0,"tenantCode":"1195","nickName":null,"userAvatar":null,"userPhone":null}] + +class TicketShow { + TicketShow({ + num pageNum, + num pageSize, + num size, + num pages, + bool hasPreviousPage, + bool hasNextPage, + String total, + List list,}){ + _pageNum = pageNum; + _pageSize = pageSize; + _size = size; + _pages = pages; + _hasPreviousPage = hasPreviousPage; + _hasNextPage = hasNextPage; + _total = total; + _list = list; +} + + TicketShow.fromJson(dynamic json) { + _pageNum = json['pageNum']; + _pageSize = json['pageSize']; + _size = json['size']; + _pages = json['pages']; + _hasPreviousPage = json['hasPreviousPage']; + _hasNextPage = json['hasNextPage']; + _total = json['total']; + if (json['list'] != null) { + _list = []; + json['list'].forEach((v) { + _list.add(TicketShowList.fromJson(v)); + }); + } + } + num _pageNum; + num _pageSize; + num _size; + num _pages; + bool _hasPreviousPage; + bool _hasNextPage; + String _total; + List _list; +TicketShow copyWith({ num pageNum, + num pageSize, + num size, + num pages, + bool hasPreviousPage, + bool hasNextPage, + String total, + List list, +}) => TicketShow( pageNum: pageNum ?? _pageNum, + pageSize: pageSize ?? _pageSize, + size: size ?? _size, + pages: pages ?? _pages, + hasPreviousPage: hasPreviousPage ?? _hasPreviousPage, + hasNextPage: hasNextPage ?? _hasNextPage, + total: total ?? _total, + list: list ?? _list, +); + num get pageNum => _pageNum; + num get pageSize => _pageSize; + num get size => _size; + num get pages => _pages; + bool get hasPreviousPage => _hasPreviousPage; + bool get hasNextPage => _hasNextPage; + String get total => _total; + List get list => _list; + + Map toJson() { + final map = {}; + map['pageNum'] = _pageNum; + map['pageSize'] = _pageSize; + map['size'] = _size; + map['pages'] = _pages; + map['hasPreviousPage'] = _hasPreviousPage; + map['hasNextPage'] = _hasNextPage; + map['total'] = _total; + if (_list != null) { + map['list'] = _list.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// id : "1726808185014059008" +/// createTime : "2023-11-21 11:42:09" +/// createUser : "0" +/// updateTime : "2023-11-21 11:42:09" +/// updateUser : "0" +/// mid : "1379254113602109440" +/// storeId : "1645318098540036096" +/// orderId : "1726808134187483136" +/// orderProductId : "1726808134355255296" +/// productId : "1645714128276291584" +/// productSkuId : "1645714128343400448" +/// ticketWipedTimeTemplateId : "0" +/// amount : "0.01" +/// name : "四神汤 " +/// code : "T202311211142080717340001" +/// useStartTime : "2023-11-21 00:00:00" +/// useEndTime : "2023-12-20 11:42:08" +/// finishTime : null +/// type : "NORMAL" +/// source : null +/// takeType : null +/// style : "" +/// state : 1 +/// canSettlement : true +/// canSubscribe : true +/// isDelete : 0 +/// tenantCode : "1195" +/// nickName : null +/// userAvatar : null +/// userPhone : null + +class TicketShowList { + TicketShowList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String mid, + String storeId, + String orderId, + String orderProductId, + String productId, + String productSkuId, + String ticketWipedTimeTemplateId, + String amount, + String name, + String code, + String useStartTime, + String useEndTime, + dynamic finishTime, + String type, + dynamic source, + dynamic takeType, + String style, + num state, + bool canSettlement, + bool canSubscribe, + num isDelete, + String tenantCode, + dynamic nickName, + dynamic userAvatar, + dynamic userPhone,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _mid = mid; + _storeId = storeId; + _orderId = orderId; + _orderProductId = orderProductId; + _productId = productId; + _productSkuId = productSkuId; + _ticketWipedTimeTemplateId = ticketWipedTimeTemplateId; + _amount = amount; + _name = name; + _code = code; + _useStartTime = useStartTime; + _useEndTime = useEndTime; + _finishTime = finishTime; + _type = type; + _source = source; + _takeType = takeType; + _style = style; + _state = state; + _canSettlement = canSettlement; + _canSubscribe = canSubscribe; + _isDelete = isDelete; + _tenantCode = tenantCode; + _nickName = nickName; + _userAvatar = userAvatar; + _userPhone = userPhone; +} + + TicketShowList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _mid = json['mid']; + _storeId = json['storeId']; + _orderId = json['orderId']; + _orderProductId = json['orderProductId']; + _productId = json['productId']; + _productSkuId = json['productSkuId']; + _ticketWipedTimeTemplateId = json['ticketWipedTimeTemplateId']; + _amount = json['amount']; + _name = json['name']; + _code = json['code']; + _useStartTime = json['useStartTime']; + _useEndTime = json['useEndTime']; + _finishTime = json['finishTime']; + _type = json['type']; + _source = json['source']; + _takeType = json['takeType']; + _style = json['style']; + _state = json['state']; + _canSettlement = json['canSettlement']; + _canSubscribe = json['canSubscribe']; + _isDelete = json['isDelete']; + _tenantCode = json['tenantCode']; + _nickName = json['nickName']; + _userAvatar = json['userAvatar']; + _userPhone = json['userPhone']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _mid; + String _storeId; + String _orderId; + String _orderProductId; + String _productId; + String _productSkuId; + String _ticketWipedTimeTemplateId; + String _amount; + String _name; + String _code; + String _useStartTime; + String _useEndTime; + dynamic _finishTime; + String _type; + dynamic _source; + dynamic _takeType; + String _style; + num _state; + bool _canSettlement; + bool _canSubscribe; + num _isDelete; + String _tenantCode; + dynamic _nickName; + dynamic _userAvatar; + dynamic _userPhone; + TicketShowList copyWith({ String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String mid, + String storeId, + String orderId, + String orderProductId, + String productId, + String productSkuId, + String ticketWipedTimeTemplateId, + String amount, + String name, + String code, + String useStartTime, + String useEndTime, + dynamic finishTime, + String type, + dynamic source, + dynamic takeType, + String style, + num state, + bool canSettlement, + bool canSubscribe, + num isDelete, + String tenantCode, + dynamic nickName, + dynamic userAvatar, + dynamic userPhone, +}) => TicketShowList( id: id ?? _id, + createTime: createTime ?? _createTime, + createUser: createUser ?? _createUser, + updateTime: updateTime ?? _updateTime, + updateUser: updateUser ?? _updateUser, + mid: mid ?? _mid, + storeId: storeId ?? _storeId, + orderId: orderId ?? _orderId, + orderProductId: orderProductId ?? _orderProductId, + productId: productId ?? _productId, + productSkuId: productSkuId ?? _productSkuId, + ticketWipedTimeTemplateId: ticketWipedTimeTemplateId ?? _ticketWipedTimeTemplateId, + amount: amount ?? _amount, + name: name ?? _name, + code: code ?? _code, + useStartTime: useStartTime ?? _useStartTime, + useEndTime: useEndTime ?? _useEndTime, + finishTime: finishTime ?? _finishTime, + type: type ?? _type, + source: source ?? _source, + takeType: takeType ?? _takeType, + style: style ?? _style, + state: state ?? _state, + canSettlement: canSettlement ?? _canSettlement, + canSubscribe: canSubscribe ?? _canSubscribe, + isDelete: isDelete ?? _isDelete, + tenantCode: tenantCode ?? _tenantCode, + nickName: nickName ?? _nickName, + userAvatar: userAvatar ?? _userAvatar, + userPhone: userPhone ?? _userPhone, +); + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get mid => _mid; + String get storeId => _storeId; + String get orderId => _orderId; + String get orderProductId => _orderProductId; + String get productId => _productId; + String get productSkuId => _productSkuId; + String get ticketWipedTimeTemplateId => _ticketWipedTimeTemplateId; + String get amount => _amount; + String get name => _name; + String get code => _code; + String get useStartTime => _useStartTime; + String get useEndTime => _useEndTime; + dynamic get finishTime => _finishTime; + String get type => _type; + dynamic get source => _source; + dynamic get takeType => _takeType; + String get style => _style; + num get state => _state; + bool get canSettlement => _canSettlement; + bool get canSubscribe => _canSubscribe; + num get isDelete => _isDelete; + String get tenantCode => _tenantCode; + dynamic get nickName => _nickName; + dynamic get userAvatar => _userAvatar; + dynamic get userPhone => _userPhone; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['mid'] = _mid; + map['storeId'] = _storeId; + map['orderId'] = _orderId; + map['orderProductId'] = _orderProductId; + map['productId'] = _productId; + map['productSkuId'] = _productSkuId; + map['ticketWipedTimeTemplateId'] = _ticketWipedTimeTemplateId; + map['amount'] = _amount; + map['name'] = _name; + map['code'] = _code; + map['useStartTime'] = _useStartTime; + map['useEndTime'] = _useEndTime; + map['finishTime'] = _finishTime; + map['type'] = _type; + map['source'] = _source; + map['takeType'] = _takeType; + map['style'] = _style; + map['state'] = _state; + map['canSettlement'] = _canSettlement; + map['canSubscribe'] = _canSubscribe; + map['isDelete'] = _isDelete; + map['tenantCode'] = _tenantCode; + map['nickName'] = _nickName; + map['userAvatar'] = _userAvatar; + map['userPhone'] = _userPhone; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/ticket_stats_list.dart b/lib/retrofit/data/ticket_stats_list.dart new file mode 100644 index 00000000..77cf9ee2 --- /dev/null +++ b/lib/retrofit/data/ticket_stats_list.dart @@ -0,0 +1,90 @@ +/// wipedDate : "2023-11-10" +/// infoList : [{"ticketName":"四神汤 ","ticketItemName":"测试规格222","wipedNumber":1},{"ticketName":"四神汤 ","ticketItemName":"测试规格","wipedNumber":1}] + +class TicketStatsList { + TicketStatsList({ + String wipedDate, + List infoList,}){ + _wipedDate = wipedDate; + _infoList = infoList; +} + + TicketStatsList.fromJson(dynamic json) { + _wipedDate = json['wipedDate']; + if (json['infoList'] != null) { + _infoList = []; + json['infoList'].forEach((v) { + _infoList.add(InfoList.fromJson(v)); + }); + } + } + String _wipedDate; + List _infoList; +TicketStatsList copyWith({ String wipedDate, + List infoList, +}) => TicketStatsList( wipedDate: wipedDate ?? _wipedDate, + infoList: infoList ?? _infoList, +); + String get wipedDate => _wipedDate; + List get infoList => _infoList; + + Map toJson() { + final map = {}; + map['wipedDate'] = _wipedDate; + if (_infoList != null) { + map['infoList'] = _infoList.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// ticketName : "四神汤 " +/// ticketItemName : "测试规格222" +/// wipedNumber : 1 + +class InfoList { + InfoList({ + String ticketName, + String ticketItemName, + num wipedNumber,}){ + _ticketName = ticketName; + _ticketItemName = ticketItemName; + _wipedNumber = wipedNumber; +} + + InfoList.fromJson(dynamic json) { + _ticketName = json['ticketName']; + _ticketItemName = json['ticketItemName']; + _wipedNumber = json['wipedNumber']; + } + String _ticketName; + String _ticketItemName; + num _wipedNumber; + String _wipedDate; +InfoList copyWith({ String ticketName, + String ticketItemName, + num wipedNumber, +}) => InfoList( ticketName: ticketName ?? _ticketName, + ticketItemName: ticketItemName ?? _ticketItemName, + wipedNumber: wipedNumber ?? _wipedNumber, +); + String get ticketName => _ticketName; + String get ticketItemName => _ticketItemName; + num get wipedNumber => _wipedNumber; + + String get wipedDate => _wipedDate; + + set wipedDate(String value) { + _wipedDate = value; + } + + Map toJson() { + final map = {}; + map['ticketName'] = _ticketName; + map['ticketItemName'] = _ticketItemName; + map['wipedNumber'] = _wipedNumber; + return map; + } + +} \ No newline at end of file