diff --git a/assets/image/2x/icon_new_vip.webp b/assets/image/2x/icon_new_vip.webp new file mode 100644 index 00000000..e864fc11 Binary files /dev/null and b/assets/image/2x/icon_new_vip.webp differ diff --git a/assets/image/2x/icon_vip_total.webp b/assets/image/2x/icon_vip_total.webp new file mode 100644 index 00000000..36173261 Binary files /dev/null and b/assets/image/2x/icon_vip_total.webp differ diff --git a/assets/image/2x/ion_vip_recharge.webp b/assets/image/2x/ion_vip_recharge.webp new file mode 100644 index 00000000..64131bdc Binary files /dev/null and b/assets/image/2x/ion_vip_recharge.webp differ diff --git a/assets/image/3x/icon_new_vip.webp b/assets/image/3x/icon_new_vip.webp new file mode 100644 index 00000000..262388d7 Binary files /dev/null and b/assets/image/3x/icon_new_vip.webp differ diff --git a/assets/image/3x/icon_vip_total.webp b/assets/image/3x/icon_vip_total.webp new file mode 100644 index 00000000..c79134cf Binary files /dev/null and b/assets/image/3x/icon_vip_total.webp differ diff --git a/assets/image/3x/ion_vip_recharge.webp b/assets/image/3x/ion_vip_recharge.webp new file mode 100644 index 00000000..3d9f6b2c Binary files /dev/null and b/assets/image/3x/ion_vip_recharge.webp differ diff --git a/assets/image/icon_new_vip.webp b/assets/image/icon_new_vip.webp new file mode 100644 index 00000000..a434d2d0 Binary files /dev/null and b/assets/image/icon_new_vip.webp differ diff --git a/assets/image/icon_vip_total.webp b/assets/image/icon_vip_total.webp new file mode 100644 index 00000000..e5134362 Binary files /dev/null and b/assets/image/icon_vip_total.webp differ diff --git a/assets/image/ion_vip_recharge.webp b/assets/image/ion_vip_recharge.webp new file mode 100644 index 00000000..4f848639 Binary files /dev/null and b/assets/image/ion_vip_recharge.webp differ diff --git a/lib/business_system/home/business_home_page.dart b/lib/business_system/home/business_home_page.dart index b100f9d2..532d77fa 100644 --- a/lib/business_system/home/business_home_page.dart +++ b/lib/business_system/home/business_home_page.dart @@ -45,13 +45,13 @@ class _BusinessHomePage extends State PopularSalesList popularSalesList; List orderTrend = []; List lineChartSample2Data = [ - LineChartSample2Data(0, 100, "2023-03-09"), - LineChartSample2Data(1, 200, "2023-03-10"), - LineChartSample2Data(2, 400, "2023-03-11"), - LineChartSample2Data(3, 10, "2023-03-12"), - LineChartSample2Data(4, 250, "2023-03-13"), - LineChartSample2Data(5, 175, "2023-03-14"), - LineChartSample2Data(6, 500, "2023-03-15") + LineChartSample2Data(0, 0, "2023-03-09"), + LineChartSample2Data(1, 0, "2023-03-10"), + LineChartSample2Data(2, 0, "2023-03-11"), + LineChartSample2Data(3, 0, "2023-03-12"), + LineChartSample2Data(4, 0, "2023-03-13"), + LineChartSample2Data(5, 0, "2023-03-14"), + LineChartSample2Data(6, 0, "2023-03-15") ]; @override @@ -80,7 +80,7 @@ class _BusinessHomePage extends State : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id); queryDayAmount(); queryPopularList(); - queryPopularList(); + queryOrderTrend(); }); } @@ -127,7 +127,15 @@ class _BusinessHomePage extends State BaseData> baseData = await businessService.orderTrend().catchError((error) {}); if (baseData != null && baseData.isSuccess) { + double index = 0; + if(baseData.data.isNotEmpty){ + orderTrend.clear(); + } orderTrend = baseData.data; + orderTrend.forEach((element) { + lineChartSample2Data.add(LineChartSample2Data(index,element.number,element.date)); + index += 1; + }); } } finally { addLoadCount(); @@ -495,6 +503,7 @@ class _BusinessHomePage extends State SizedBox( height: 18.h, ), + if(lineChartSample2Data.isNotEmpty) LineChartSample2(lineChartSample2Data, "销售量"), ], ), diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index 89c369b2..4fd4e75a 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -49,12 +49,12 @@ class _MineItem extends State { BusinessInstance.instance.businessToken = businessLoginInfo.token; if (businessLoginInfo.storeList.length > 1) { Navigator.of(context) - .pushReplacementNamed('/router/select_shop', arguments: { + .pushNamed('/router/select_shop', arguments: { "businessLoginInfo": businessLoginInfo, }); } else { Navigator.of(context) - .pushReplacementNamed('/router/business_page', arguments: { + .pushNamed('/router/business_page', arguments: { "businessLoginInfo": businessLoginInfo, }); } diff --git a/lib/retrofit/business_api.dart b/lib/retrofit/business_api.dart index 1001c0e4..ba598b42 100644 --- a/lib/retrofit/business_api.dart +++ b/lib/retrofit/business_api.dart @@ -9,6 +9,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/retrofit/data/business_login_info.dart'; import 'package:huixiang/retrofit/data/day_count.dart'; import 'package:huixiang/retrofit/data/order_trend.dart'; +import 'package:huixiang/retrofit/data/vip_counts_info.dart'; import 'package:retrofit/retrofit.dart'; import '../utils/flutter_utils.dart'; @@ -18,9 +19,9 @@ import 'data/popular_sales_list.dart'; part 'business_api.g.dart'; ///本地 -// const localBaseUrl = "http://admin-api.test.yixinhuixiang.com/"; +const localBaseUrl = "http://admin-api.test.yixinhuixiang.com/"; ///测试 -const localBaseUrl = "http://test-merchant.lotus-wallet.com/test-merchant/"; +// const localBaseUrl = "http://test-merchant.lotus-wallet.com/test-merchant/"; ///线上 const serviceBaseUrl = "http://pos.tenant.lotus-wallet.com/test-merchant/"; @@ -99,8 +100,8 @@ abstract class BusinessApiService { }, onError: (DioError e) { if (EasyLoading.isShow) EasyLoading.dismiss(); // SmartDialog.showToast("网络错误,请切换网络或稍后再试!", alignment: Alignment.center); - SmartDialog.showToast(AppUtils.dioErrorTypeToString(e.type), - alignment: Alignment.center); + // SmartDialog.showToast(AppUtils.dioErrorTypeToString(e.type), + // alignment: Alignment.center); debugPrint("\n======================= 错误响应数据 ======================="); debugPrint("type = ${e.type}"); debugPrint("message = ${e.message}"); @@ -134,11 +135,16 @@ abstract class BusinessApiService { Future> getDayCounts(@Body() Map param); ///商家概览/热销榜单 - @GET("dashBoard/store/{offsetDay}") + @GET("dashBoard/store/?offsetDay={offsetDay}") Future> popularList( @Path("offsetDay") String offsetDay); ///生意总览/订单量趋势 @GET("trend/orderTrend") Future>> orderTrend(); + + ///会员数量统计/用户概览 + @GET("largeScreenReport/getDayCounts?date={date}") + Future> vipCounts( + @Path("date") String date); } diff --git a/lib/retrofit/business_api.g.dart b/lib/retrofit/business_api.g.dart index a86e9ca5..59638941 100644 --- a/lib/retrofit/business_api.g.dart +++ b/lib/retrofit/business_api.g.dart @@ -74,7 +74,7 @@ class _BusinessApiService implements BusinessApiService { final queryParameters = {}; final _data = {}; final _result = await _dio.request>( - 'dashBoard/store/$offsetDay', + 'dashBoard/store/?offsetDay=$offsetDay', queryParameters: queryParameters, options: RequestOptions( method: 'GET', @@ -112,4 +112,26 @@ class _BusinessApiService implements BusinessApiService { return value; } + @override + Future> vipCounts(date) async { + ArgumentError.checkNotNull(date, 'date'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + 'largeScreenReport/getDayCounts?date=$date', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => VipCountsInfo.fromJson(json), + ); + return value; + } + } diff --git a/lib/retrofit/data/vip_counts_info.dart b/lib/retrofit/data/vip_counts_info.dart new file mode 100644 index 00000000..48dc0af0 --- /dev/null +++ b/lib/retrofit/data/vip_counts_info.dart @@ -0,0 +1,141 @@ +/// dayMoney : "0" +/// yesterdayMoney : "0" +/// paySum : "0" +/// yesterdayPaySum : "0" +/// rechargeMoney : "0" +/// weekRechargeMoney : "0" +/// lastWeekRechargeMoney : "0" +/// orderNum : 0 +/// yesterdayOrderNum : 0 +/// memberNum : 21800 +/// lastWeekMemberNum : 4 +/// weekMemberNum : 1 +/// newMemberNum : 0 +/// yesterdayNewMemberNum : 0 + +class VipCountsInfo { + VipCountsInfo({ + String dayMoney, + String yesterdayMoney, + String paySum, + String yesterdayPaySum, + String rechargeMoney, + String weekRechargeMoney, + String lastWeekRechargeMoney, + num orderNum, + num yesterdayOrderNum, + num memberNum, + num lastWeekMemberNum, + num weekMemberNum, + num newMemberNum, + num yesterdayNewMemberNum,}){ + _dayMoney = dayMoney; + _yesterdayMoney = yesterdayMoney; + _paySum = paySum; + _yesterdayPaySum = yesterdayPaySum; + _rechargeMoney = rechargeMoney; + _weekRechargeMoney = weekRechargeMoney; + _lastWeekRechargeMoney = lastWeekRechargeMoney; + _orderNum = orderNum; + _yesterdayOrderNum = yesterdayOrderNum; + _memberNum = memberNum; + _lastWeekMemberNum = lastWeekMemberNum; + _weekMemberNum = weekMemberNum; + _newMemberNum = newMemberNum; + _yesterdayNewMemberNum = yesterdayNewMemberNum; +} + + VipCountsInfo.fromJson(dynamic json) { + _dayMoney = json['dayMoney']; + _yesterdayMoney = json['yesterdayMoney']; + _paySum = json['paySum']; + _yesterdayPaySum = json['yesterdayPaySum']; + _rechargeMoney = json['rechargeMoney']; + _weekRechargeMoney = json['weekRechargeMoney']; + _lastWeekRechargeMoney = json['lastWeekRechargeMoney']; + _orderNum = json['orderNum']; + _yesterdayOrderNum = json['yesterdayOrderNum']; + _memberNum = json['memberNum']; + _lastWeekMemberNum = json['lastWeekMemberNum']; + _weekMemberNum = json['weekMemberNum']; + _newMemberNum = json['newMemberNum']; + _yesterdayNewMemberNum = json['yesterdayNewMemberNum']; + } + String _dayMoney; + String _yesterdayMoney; + String _paySum; + String _yesterdayPaySum; + String _rechargeMoney; + String _weekRechargeMoney; + String _lastWeekRechargeMoney; + num _orderNum; + num _yesterdayOrderNum; + num _memberNum; + num _lastWeekMemberNum; + num _weekMemberNum; + num _newMemberNum; + num _yesterdayNewMemberNum; +VipCountsInfo copyWith({ String dayMoney, + String yesterdayMoney, + String paySum, + String yesterdayPaySum, + String rechargeMoney, + String weekRechargeMoney, + String lastWeekRechargeMoney, + num orderNum, + num yesterdayOrderNum, + num memberNum, + num lastWeekMemberNum, + num weekMemberNum, + num newMemberNum, + num yesterdayNewMemberNum, +}) => VipCountsInfo( dayMoney: dayMoney ?? _dayMoney, + yesterdayMoney: yesterdayMoney ?? _yesterdayMoney, + paySum: paySum ?? _paySum, + yesterdayPaySum: yesterdayPaySum ?? _yesterdayPaySum, + rechargeMoney: rechargeMoney ?? _rechargeMoney, + weekRechargeMoney: weekRechargeMoney ?? _weekRechargeMoney, + lastWeekRechargeMoney: lastWeekRechargeMoney ?? _lastWeekRechargeMoney, + orderNum: orderNum ?? _orderNum, + yesterdayOrderNum: yesterdayOrderNum ?? _yesterdayOrderNum, + memberNum: memberNum ?? _memberNum, + lastWeekMemberNum: lastWeekMemberNum ?? _lastWeekMemberNum, + weekMemberNum: weekMemberNum ?? _weekMemberNum, + newMemberNum: newMemberNum ?? _newMemberNum, + yesterdayNewMemberNum: yesterdayNewMemberNum ?? _yesterdayNewMemberNum, +); + String get dayMoney => _dayMoney; + String get yesterdayMoney => _yesterdayMoney; + String get paySum => _paySum; + String get yesterdayPaySum => _yesterdayPaySum; + String get rechargeMoney => _rechargeMoney; + String get weekRechargeMoney => _weekRechargeMoney; + String get lastWeekRechargeMoney => _lastWeekRechargeMoney; + num get orderNum => _orderNum; + num get yesterdayOrderNum => _yesterdayOrderNum; + num get memberNum => _memberNum; + num get lastWeekMemberNum => _lastWeekMemberNum; + num get weekMemberNum => _weekMemberNum; + num get newMemberNum => _newMemberNum; + num get yesterdayNewMemberNum => _yesterdayNewMemberNum; + + Map toJson() { + final map = {}; + map['dayMoney'] = _dayMoney; + map['yesterdayMoney'] = _yesterdayMoney; + map['paySum'] = _paySum; + map['yesterdayPaySum'] = _yesterdayPaySum; + map['rechargeMoney'] = _rechargeMoney; + map['weekRechargeMoney'] = _weekRechargeMoney; + map['lastWeekRechargeMoney'] = _lastWeekRechargeMoney; + map['orderNum'] = _orderNum; + map['yesterdayOrderNum'] = _yesterdayOrderNum; + map['memberNum'] = _memberNum; + map['lastWeekMemberNum'] = _lastWeekMemberNum; + map['weekMemberNum'] = _weekMemberNum; + map['newMemberNum'] = _newMemberNum; + map['yesterdayNewMemberNum'] = _yesterdayNewMemberNum; + return map; + } + +} \ No newline at end of file