Browse Source

生意总览更改改;

wr_2023_business
wurong 1 year ago
parent
commit
469b45b23b
  1. 26
      lib/business_system/home/business_home_page.dart
  2. 95
      lib/business_system/home/flow_page.dart
  3. 3
      lib/business_system/home/home_view/home_sideslip_dialog.dart
  4. 73
      lib/business_system/home/overview/trade_goods.dart
  5. 2
      lib/business_system/home/overview/trade_overview_page.dart
  6. 616
      lib/business_system/home/overview/trade_summary.dart
  7. 9
      lib/retrofit/business_api.dart
  8. 23
      lib/retrofit/business_api.g.dart
  9. 110
      lib/retrofit/data/trade_summary_list.dart
  10. 3
      lib/setting/setting_page.dart

26
lib/business_system/home/business_home_page.dart

@ -205,7 +205,9 @@ class _BusinessHomePage extends State<BusinessHomePage>
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
header: MyHeader(
color: Color(0xFF30415B),
),
physics: BouncingScrollPhysics(),
scrollController: scrollController,
footer: CustomFooter(
@ -906,10 +908,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
daySelectIndex = 1;
queryPopularList();
});
},
child: Container(
padding:
@ -940,10 +940,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
daySelectIndex = 2;
daySelectIndex = 7;
queryPopularList();
});
},
child: Container(
padding:
@ -952,7 +950,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
margin: EdgeInsets.only(right: 16.w, bottom: 16.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2.w),
color: daySelectIndex == 2
color: daySelectIndex == 7
? Color(0xFF30415B)
: Colors.transparent,
border: Border.all(
@ -965,7 +963,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: daySelectIndex == 2
color: daySelectIndex == 7
? Colors.white
: Color(0XFF30415B),
),
@ -974,10 +972,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
daySelectIndex = 3;
daySelectIndex = 30;
queryPopularList();
});
},
child: Container(
padding:
@ -986,7 +982,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
margin: EdgeInsets.only(right: 16.w, bottom: 16.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2.w),
color: daySelectIndex == 3
color: daySelectIndex == 30
? Color(0xFF30415B)
: Colors.transparent,
border: Border.all(
@ -999,7 +995,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: daySelectIndex == 3
color: daySelectIndex == 30
? Colors.white
: Color(0XFF30415B),
),
@ -1012,7 +1008,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
child: (popularSalesList == null ||
popularSalesList.saleProductList.length == 0)
? NoDataView(
src: "assets/image/xiao_fei.webp",
src: "assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "暂无数据",
fontSize: 16.sp,
@ -1176,7 +1172,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
height: 360.h,
child: (dayFlowList.length == null || dayFlowList?.length == 0)
? NoDataView(
src: "assets/image/xiao_fei.webp",
src: "assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "暂无数据",
fontSize: 16.sp,

95
lib/business_system/home/flow_page.dart

@ -2,6 +2,7 @@ import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:intl/intl.dart';
@ -14,8 +15,10 @@ import '../../retrofit/business_api.dart';
import '../../retrofit/data/base_data.dart';
import '../../retrofit/data/day_flow_list.dart';
import '../../utils/business_instance.dart';
import '../../utils/flutter_utils.dart';
import '../../view_widget/classic_header.dart';
import '../../view_widget/my_footer.dart';
import '../../view_widget/no_data_view.dart';
class FlowPage extends StatefulWidget {
final arguments;
@ -33,44 +36,67 @@ class _FlowPage extends State<FlowPage> {
String storeId;
BusinessApiService businessService;
List<DayFlowList> dayFlowList = [];
int _loadCount = 0;
@override
void initState() {
super.initState();
storeId = widget.arguments["storeId"];
_onRefresh();
}
_onRefresh() async {
EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
SharedPreferences.getInstance().then((value) {
businessService = BusinessApiService(Dio(),
context: context,
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: storeId);
queryDayFlow(DateFormat("yyyy-MM-dd").format(DateTime.now()), "0");
queryDayFlow(DateFormat("yyyy-MM-dd").format(DateTime.now()), "0",
isSing: false);
});
}
addLoadCount() {
_loadCount += 1;
if (_loadCount == 1) {
_loadCount = 0;
EasyLoading.dismiss();
if (refreshController.isRefresh) refreshController.refreshCompleted();
if (mounted) setState(() {});
}
}
////isMonth=0()isMonth=1()
queryDayFlow(yearMonth, isMonth) async {
queryDayFlow(yearMonth, isMonth, {isSing = true}) async {
if (isSing)
EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
try {
BaseData<List<DayFlowList>> baseData = await businessService
.dayFlow(
// "${DateFormat("yyyy-MM-dd").format(DateTime.now())}",
yearMonth,
isMonth)
.catchError((error) {});
BaseData<List<DayFlowList>> baseData =
await businessService.dayFlow(yearMonth, isMonth).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
});
if (baseData != null && baseData.isSuccess) {
if (isMonth == "0") {
dayFlowList = baseData.data;
} else {
dayFlowList.firstWhere((element) => element.localDate == yearMonth)
dayFlowList
.firstWhere((element) => element.localDate == yearMonth)
.detailList = baseData.data;
}
setState(() {});
}
} finally {
if (isSing) {
setState(() {});
EasyLoading.dismiss();
} else {
addLoadCount();
}
}
}
@ -90,14 +116,14 @@ class _FlowPage extends State<FlowPage> {
enablePullDown: true,
enablePullUp: false,
header: MyHeader(
color: Colors.white,
color: Color(0xFF30415B),
),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: () {},
onRefresh: _onRefresh,
physics: BouncingScrollPhysics(),
scrollController: ScrollController(),
child: SingleChildScrollView(
@ -114,7 +140,7 @@ class _FlowPage extends State<FlowPage> {
child: Row(
children: [
Text(
"2023年6月",
DateFormat("yyyy年MM月").format(DateTime.now()),
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
@ -132,7 +158,15 @@ class _FlowPage extends State<FlowPage> {
SizedBox(
height: 16.h,
),
ListView.builder(
(dayFlowList == null || dayFlowList.length == 0)
? NoDataView(
src: "assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "暂无数据",
fontSize: 16.sp,
margin: EdgeInsets.all(20.h),
)
: ListView.builder(
padding: EdgeInsets.zero,
itemCount: dayFlowList?.length ?? 0,
scrollDirection: Axis.vertical,
@ -166,11 +200,11 @@ class _FlowPage extends State<FlowPage> {
children: [
GestureDetector(
onTap: () {
if(dayFlowList.detailList != null){
setState((){
if (dayFlowList.detailList != null) {
setState(() {
dayFlowList.detailList = null;
});
}else{
} else {
queryDayFlow(dayFlowList?.localDate ?? "", "1");
}
},
@ -222,9 +256,9 @@ class _FlowPage extends State<FlowPage> {
SizedBox(
height: 20.h,
),
if(dayFlowList.detailList != null)
if (dayFlowList.detailList != null)
Column(
children:dayFlowList.detailList.map((e) {
children: dayFlowList.detailList.map((e) {
return billIDetailsItem(e);
}).toList(),
)
@ -246,7 +280,7 @@ class _FlowPage extends State<FlowPage> {
Padding(
padding: EdgeInsets.only(bottom: 15.h),
child: Text(
detailList?.localDateTime ??"",
detailList?.localDateTime ?? "",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
@ -255,7 +289,10 @@ class _FlowPage extends State<FlowPage> {
),
),
Text(
detailList?.phone ?? detailList?.nickname ?? detailList?.storeName ??"",
detailList?.nickname ??
AppUtils.phoneEncode(detailList?.phone) ??
detailList?.storeName ??
"",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
@ -269,7 +306,7 @@ class _FlowPage extends State<FlowPage> {
TextSpan(
children: [
TextSpan(
text: "+",
text: (detailList?.amount != "0.00") ? "+" : "-",
style: TextStyle(
fontSize: 18.sp,
fontWeight: MyFontWeight.medium,
@ -277,7 +314,9 @@ class _FlowPage extends State<FlowPage> {
),
),
TextSpan(
text: detailList?.amount ?? "",
text: (detailList?.amount != "0.00")
? (detailList?.amount ?? "")
: (detailList?.refundAmount ?? ""),
style: TextStyle(
fontSize: 18.sp,
fontWeight: MyFontWeight.medium,
@ -294,7 +333,7 @@ class _FlowPage extends State<FlowPage> {
showDateSelector() {
DatePicker.showDatePicker(context,
showTitleActions: true,
minTime: DateTime.now(),
minTime: DateTime.now().subtract(const Duration(days: 360)),
maxTime: DateTime.now(),
theme: DatePickerTheme(
headerColor: Colors.white,
@ -303,13 +342,13 @@ class _FlowPage extends State<FlowPage> {
color: Colors.black,
fontWeight: MyFontWeight.bold,
fontSize: 18),
doneStyle: TextStyle(color: Color(0xFF32A060), fontSize: 16.sp)),
doneStyle: TextStyle(color: Color(0xFF30415B), fontSize: 16.sp)),
onChanged: (date) {
print('change $date in time zone ' +
date.timeZoneOffset.inHours.toString());
}, onConfirm: (date) {
// "2023-09-04";
setState(() {});
// setState(() {});
}, currentTime: DateTime.now(), locale: LocaleType.zh);
}
}

3
lib/business_system/home/home_view/home_sideslip_dialog.dart

@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../../generated/l10n.dart';
import '../../../retrofit/data/business_login_info.dart';
import '../../../utils/flutter_utils.dart';
import '../../../view_widget/custom_image.dart';
@ -202,7 +203,7 @@ class _HomeSideslipDialog extends State<HomeSideslipDialog>
borderRadius: BorderRadius.circular(4.w),
),
child: Text(
"退出登录",
S.of(context).tuichudenglu,
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,

73
lib/business_system/home/overview/trade_goods.dart

@ -73,16 +73,12 @@ class _TradeGoods extends State<TradeGoods> {
storeId: widget.storeId);
querySingleSales(
dayDate.replaceAll("", "-").replaceAll("", "-").replaceAll("", ""),
dayDate
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", ""));
dayDate.replaceAll("", "-").replaceAll("", "-").replaceAll("", ""),
isSing: false);
queryGoodsSalesList(
dayDate.replaceAll("", "-").replaceAll("", "-").replaceAll("", ""),
dayDate
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", ""));
dayDate.replaceAll("", "-").replaceAll("", "-").replaceAll("", ""),
isSing: false);
});
}
@ -97,7 +93,11 @@ class _TradeGoods extends State<TradeGoods> {
}
///
queryGoodsSalesList(date, endDat) async {
queryGoodsSalesList(date, endDat, {isSing = true}) async {
if (isSing)
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
try {
BaseData<List<GoodsTypeSalesList>> baseData =
await businessService.goodsSalesList({
@ -115,12 +115,21 @@ class _TradeGoods extends State<TradeGoods> {
goodsTypeSalesList = baseData.data;
}
} finally {
if (isSing) {
setState(() {});
EasyLoading.dismiss();
} else {
addLoadCount();
}
}
}
///
querySingleSales(date, endDate) async {
querySingleSales(date, endDate, {isSing = true}) async {
if (isSing)
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
try {
BaseData<List<SingleSalesList>> baseData =
await businessService.singleSales({
@ -130,17 +139,19 @@ class _TradeGoods extends State<TradeGoods> {
"orderBy": 1,
"searchType": 2,
"type": 1
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
});
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
singleSalesList = baseData.data;
}
} finally {
if (isSing) {
setState(() {});
EasyLoading.dismiss();
} else {
addLoadCount();
}
}
}
@override
Widget build(BuildContext context) {
@ -158,7 +169,9 @@ class _TradeGoods extends State<TradeGoods> {
controller: _refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
header: MyHeader(
color: Color(0xFF30415B),
),
physics: BouncingScrollPhysics(),
scrollController: scrollController,
footer: CustomFooter(
@ -187,7 +200,6 @@ class _TradeGoods extends State<TradeGoods> {
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
dateIndex = 0;
querySingleSales(
timeDate()
@ -211,7 +223,6 @@ class _TradeGoods extends State<TradeGoods> {
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10));
});
},
child: Container(
alignment: Alignment.center,
@ -238,7 +249,6 @@ class _TradeGoods extends State<TradeGoods> {
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
dateIndex = 1;
querySingleSales(
timeDate()
@ -262,7 +272,6 @@ class _TradeGoods extends State<TradeGoods> {
.replaceAll("", "-")
.replaceAll("", "")
.substring(12, 23));
});
},
child: Container(
alignment: Alignment.center,
@ -289,7 +298,6 @@ class _TradeGoods extends State<TradeGoods> {
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
dateIndex = 2;
querySingleSales(
timeDate()
@ -305,7 +313,6 @@ class _TradeGoods extends State<TradeGoods> {
.replaceAll("", "")
.substring(0, 10),
"");
});
},
child: Container(
alignment: Alignment.center,
@ -332,7 +339,6 @@ class _TradeGoods extends State<TradeGoods> {
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
dateIndex = 3;
querySingleSales(
timeDate()
@ -344,7 +350,9 @@ class _TradeGoods extends State<TradeGoods> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10));
.substring(
timeDate().length <= 15 ? 0 : 12,
timeDate().length <= 15 ? 10 : 23));
queryGoodsSalesList(
timeDate()
.replaceAll("", "-")
@ -355,8 +363,9 @@ class _TradeGoods extends State<TradeGoods> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10));
});
.substring(
timeDate().length <= 15 ? 0 : 12,
timeDate().length <= 15 ? 10 : 23));
},
child: Container(
alignment: Alignment.center,
@ -391,7 +400,6 @@ class _TradeGoods extends State<TradeGoods> {
Navigator.of(context)
.pushNamed('/router/day_report_page')
.then((value) {
setState(() {
selectedDate = value;
querySingleSales(
timeDate()
@ -416,12 +424,10 @@ class _TradeGoods extends State<TradeGoods> {
.replaceAll("", "")
.substring(0, 10));
});
});
} else if (dateIndex == 1) {
Navigator.of(context)
.pushNamed('/router/week_report_page')
.then((value) {
setState(() {
weekDate = value;
querySingleSales(
timeDate()
@ -446,12 +452,10 @@ class _TradeGoods extends State<TradeGoods> {
.replaceAll("", "")
.substring(12, 23));
});
});
} else if (dateIndex == 2) {
Navigator.of(context)
.pushNamed('/router/monthly_report_page')
.then((value) {
setState(() {
monthlyDate = value;
querySingleSales(
timeDate()
@ -476,12 +480,10 @@ class _TradeGoods extends State<TradeGoods> {
.replaceAll("", "")
.substring(0, 10));
});
});
} else if (dateIndex == 3) {
Navigator.of(context)
.pushNamed('/router/custom_page')
.then((value) {
setState(() {
customDate = value;
querySingleSales(
timeDate()
@ -506,7 +508,6 @@ class _TradeGoods extends State<TradeGoods> {
.replaceAll("", "")
.substring(12, 23));
});
});
}
},
child: Container(
@ -676,7 +677,7 @@ class _TradeGoods extends State<TradeGoods> {
),
(goodsTypeSalesList == null || goodsTypeSalesList.length == 0)
? NoDataView(
src: "assets/image/xiao_fei.webp",
src: "assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "暂无数据",
fontSize: 16.sp,
@ -850,11 +851,11 @@ class _TradeGoods extends State<TradeGoods> {
),
(singleSalesList == null || singleSalesList.length == 0)
? NoDataView(
src: "assets/image/xiao_fei.webp",
src: "assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "暂无数据",
fontSize: 16.sp,
margin: EdgeInsets.all(20.h),
margin: EdgeInsets.all(20),
)
: Container(
height: 243.h,

2
lib/business_system/home/overview/trade_overview_page.dart

@ -69,7 +69,7 @@ class _TradeOverviewPage extends State<TradeOverviewPage> with SingleTickerProvi
),
body: TabBarView(
children: [
TradeSummary(),
TradeSummary(storeId),
TradeOrder(),
TradeGoods(storeId),],
),

616
lib/business_system/home/overview/trade_summary.dart

@ -1,19 +1,32 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.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:intl/intl.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../../generated/l10n.dart';
import '../../../retrofit/business_api.dart';
import '../../../retrofit/data/base_data.dart';
import '../../../retrofit/data/trade_summary_list.dart';
import '../../../utils/business_instance.dart';
import '../../../utils/flutter_utils.dart';
import '../../../utils/font_weight.dart';
import '../../date_select/monthly_report_page.dart';
import '../../../view_widget/no_data_view.dart';
import '../home_view/donut_auto_label_chart.dart';
import '../home_view/my_line_chart.dart';
import 'package:charts_flutter/flutter.dart' as charts;
class TradeSummary extends StatefulWidget {
final storeId;
TradeSummary(this.storeId);
@override
State<StatefulWidget> createState() {
return _TradeSummary();
@ -28,29 +41,35 @@ class _TradeSummary extends State<TradeSummary> {
int dateIndex = 0;
String selectedDate = "";
String dayDate = "${DateFormat("yyyy年MM月dd日").format(DateTime.now())}";
String weekDate ="";
String weekDateNum = "${DateFormat("yyyy年MM月dd日").format(DateTime.now().subtract(Duration(days:6)))}"
String weekDate = "";
String weekDateNum =
"${DateFormat("yyyy年MM月dd日").format(DateTime.now().subtract(Duration(days: 6)))}"
"${DateFormat("yyyy年MM月dd日").format(DateTime.now())}";
String monthlyDate ="";
String monthlyDateNum = "${DateFormat("yyyy年MM月").format(DateTime.now())}";
String customDate ="";
String monthlyDate = "";
String monthlyDateNum = "${DateFormat("yyyy年MM月dd").format(DateTime.now())}";
String customDate = "";
String customDateNum = "${DateFormat("yyyy年MM月dd日").format(DateTime.now())}";
List<LineChartSample2Data> lineChartSample2DataAmount =
[LineChartSample2Data(0,40,"2023-03-09"),
LineChartSample2Data(1,10,"2023-03-10"),
LineChartSample2Data(2,50,"2023-03-11"),
LineChartSample2Data(3,35,"2023-03-12"),
LineChartSample2Data(4,20,"2023-03-13"),
LineChartSample2Data(5,55,"2023-03-14"),
LineChartSample2Data(6,100,"2023-03-15")];
List<LineChartSample2Data> lineChartSample2DataNum =
[LineChartSample2Data(0,20,"2023-03-09"),
LineChartSample2Data(1,30,"2023-03-10"),
LineChartSample2Data(2,50,"2023-03-11"),
LineChartSample2Data(3,60,"2023-03-12"),
LineChartSample2Data(4,5,"2023-03-13"),
LineChartSample2Data(5,55,"2023-03-14"),
LineChartSample2Data(6,95,"2023-03-15")];
int _loadCount = 0;
BusinessApiService businessService;
TradeSummaryList tradeSummaryList;
List<LineChartSample2Data> lineChartSample2DataAmount = [
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")
];
List<LineChartSample2Data> lineChartSample2DataNum = [
LineChartSample2Data(0, 0, "2023-03-09"),
LineChartSample2Data(1, 0, "2023-03-10"),
LineChartSample2Data(2, 0, "2023-03-11"),
LineChartSample2Data(3, 0, "2023-03-12"),
LineChartSample2Data(4, 0, "2023-03-13"),
LineChartSample2Data(5, 0, "2023-03-14"),
LineChartSample2Data(6, 0, "2023-03-15")
];
@override
void dispose() {
@ -61,9 +80,84 @@ class _TradeSummary extends State<TradeSummary> {
@override
void initState() {
super.initState();
_onRefresh();
}
_onRefresh() async {
EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
SharedPreferences.getInstance().then((value) {
businessService = BusinessApiService(Dio(),
context: context,
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.storeId);
queryBusinessAnalysis(
dayDate.replaceAll("", "-").replaceAll("", "-").replaceAll("", ""),
dayDate.replaceAll("", "-").replaceAll("", "-").replaceAll("", ""),
"day",
isSing: false);
});
}
addLoadCount() {
_loadCount += 1;
if (_loadCount == 1) {
_loadCount = 0;
EasyLoading.dismiss();
if (_refreshController.isRefresh) _refreshController.refreshCompleted();
if (mounted) setState(() {});
}
}
///
queryBusinessAnalysis(selectDay, selectEndDay, queryRange,
{isSing = true}) async {
if (isSing)
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
try {
BaseData<TradeSummaryList> baseData = await businessService
.saleBusinessAnalysis({
"selectDay": selectDay,
"selectEndDay": selectEndDay,
"queryRange": queryRange
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
});
if (baseData != null && baseData.isSuccess) {
int amountIndex = 0;
int numIndex = 0;
if (baseData.data.saleBusinessAnalysisVOS.isNotEmpty) {
lineChartSample2DataAmount.clear();
lineChartSample2DataNum.clear();
}
tradeSummaryList = baseData.data;
tradeSummaryList.saleBusinessAnalysisVOS.forEach((element) {
lineChartSample2DataAmount.add(LineChartSample2Data(
amountIndex.toDouble(),
double.tryParse(element.localDateBigDecimal.toString()),
element.localDateTime.substring(0, 10)));
amountIndex += 1;
});
tradeSummaryList.saleBusinessAnalysisVOS.forEach((element) {
lineChartSample2DataNum.add(LineChartSample2Data(
numIndex.toDouble(),
double.tryParse(element.localDateCount.toString()),
element.localDateTime.substring(0, 10)));
numIndex += 1;
});
}
} finally {
if (isSing) {
setState(() {});
EasyLoading.dismiss();
} else {
addLoadCount();
}
}
}
@override
@ -77,11 +171,14 @@ class _TradeSummary extends State<TradeSummary> {
width: double.infinity,
height: 1.h,
),
Expanded(child: SmartRefresher(
Expanded(
child: SmartRefresher(
controller: _refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
header: MyHeader(
color: Color(0xFF30415B),
),
physics: BouncingScrollPhysics(),
scrollController: scrollController,
footer: CustomFooter(
@ -89,11 +186,7 @@ class _TradeSummary extends State<TradeSummary> {
return MyFooter(mode);
},
),
onRefresh: () {
setState(() {
_onRefresh();
});
},
onRefresh: _onRefresh,
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Column(
@ -103,25 +196,38 @@ class _TradeSummary extends State<TradeSummary> {
decoration: BoxDecoration(
color: Color(0xFFF6F6F6),
borderRadius: BorderRadius.circular(2),
border: Border.all(color: Color(0xFFCFD0D1),
width: 1.w),
border:
Border.all(color: Color(0xFFCFD0D1), width: 1.w),
),
margin: EdgeInsets.only(
top: 16.h, right: 20.w, left: 20.w, bottom: 12.h),
child: Row(
children: [
Expanded(child: GestureDetector(
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
setState((){
onTap: () {
dateIndex = 0;
});
queryBusinessAnalysis(
timeDate()
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
timeDate()
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
"day");
},
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: dateIndex == 0 ? Color(0xFF30415B):Colors.transparent,
color: dateIndex == 0
? Color(0xFF30415B)
: Colors.transparent,
),
padding: EdgeInsets.symmetric(vertical: 9.h),
child: Text(
@ -129,22 +235,38 @@ class _TradeSummary extends State<TradeSummary> {
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: dateIndex == 0 ? Colors.white:Color(0xFF30415B),
color: dateIndex == 0
? Colors.white
: Color(0xFF30415B),
),
),
),
)),
Expanded(child: GestureDetector(
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
setState((){
onTap: () {
dateIndex = 1;
});},
queryBusinessAnalysis(
timeDate()
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
timeDate()
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(12, 23),
"week");
},
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: dateIndex == 1 ? Color(0xFF30415B):Colors.transparent,
color: dateIndex == 1
? Color(0xFF30415B)
: Colors.transparent,
),
padding: EdgeInsets.symmetric(vertical: 9.h),
child: Text(
@ -152,22 +274,38 @@ class _TradeSummary extends State<TradeSummary> {
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: dateIndex == 1 ? Colors.white:Color(0xFF30415B),
color: dateIndex == 1
? Colors.white
: Color(0xFF30415B),
),
),
),
),)),
Expanded(child: GestureDetector(
)),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
setState((){
onTap: () {
dateIndex = 2;
});
queryBusinessAnalysis(
timeDate()
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
timeDate()
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
"month");
},
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: dateIndex == 2 ? Color(0xFF30415B):Colors.transparent,
color: dateIndex == 2
? Color(0xFF30415B)
: Colors.transparent,
),
padding: EdgeInsets.symmetric(vertical: 9.h),
child: Text(
@ -175,22 +313,40 @@ class _TradeSummary extends State<TradeSummary> {
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: dateIndex == 2 ? Colors.white:Color(0xFF30415B),
color: dateIndex == 2
? Colors.white
: Color(0xFF30415B),
),
),
),)),
Expanded(child: GestureDetector(
),
)),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
setState((){
onTap: () {
dateIndex = 3;
});
queryBusinessAnalysis(
timeDate()
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
timeDate()
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(
timeDate().length <= 15 ? 0 : 12,
timeDate().length <= 15 ? 10 : 23),
"custom");
},
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: dateIndex == 3 ? Color(0xFF30415B):Colors.transparent,
color: dateIndex == 3
? Color(0xFF30415B)
: Colors.transparent,
),
padding: EdgeInsets.symmetric(vertical: 9.h),
child: Text(
@ -198,43 +354,92 @@ class _TradeSummary extends State<TradeSummary> {
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: dateIndex == 3 ? Colors.white:Color(0xFF30415B),
color: dateIndex == 3
? Colors.white
: Color(0xFF30415B),
),
),
),
),)),
)),
],
),
),
Align(alignment: Alignment.center,
Align(
alignment: Alignment.center,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
if(dateIndex == 0){
Navigator.of(context).pushNamed('/router/day_report_page').then((value) {
setState((){
onTap: () {
if (dateIndex == 0) {
Navigator.of(context)
.pushNamed('/router/day_report_page')
.then((value) {
selectedDate = value;
queryBusinessAnalysis(
timeDate()
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
timeDate()
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
"day");
});
});
}
else if(dateIndex == 1){
Navigator.of(context).pushNamed('/router/week_report_page').then((value) {
setState((){
} else if (dateIndex == 1) {
Navigator.of(context)
.pushNamed('/router/week_report_page')
.then((value) {
weekDate = value;
queryBusinessAnalysis(
timeDate()
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
timeDate()
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(12, 23),
"week");
});
});
}
else if(dateIndex == 2){
Navigator.of(context).pushNamed('/router/monthly_report_page').then((value) {
setState((){
} else if (dateIndex == 2) {
Navigator.of(context)
.pushNamed('/router/monthly_report_page')
.then((value) {
monthlyDate = value;
queryBusinessAnalysis(
timeDate()
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
timeDate()
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
"month");
});
});
}
else if(dateIndex == 3){
Navigator.of(context).pushNamed('/router/custom_page').then((value){
setState((){
} else if (dateIndex == 3) {
Navigator.of(context)
.pushNamed('/router/custom_page')
.then((value) {
customDate = value;
});
queryBusinessAnalysis(
timeDate()
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
timeDate()
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(12, 23),
"custom");
});
}
},
@ -246,13 +451,19 @@ class _TradeSummary extends State<TradeSummary> {
color: Color(0xFFF6F6F6),
borderRadius: BorderRadius.circular(2),
),
margin: EdgeInsets.only(bottom:16.h),
margin: EdgeInsets.only(bottom: 16.h),
child: Row(
children: [
Expanded(child:Container(
Expanded(
child: Container(
alignment: Alignment.center,
child: Text(
timeDate(),
dateIndex == 2
? ((monthlyDateNum.substring(0, 8) ==
timeDate().substring(0, 8))
? "${timeDate().substring(0, 8)}(当月)"
: timeDate().substring(0, 8))
: timeDate(),
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
@ -262,15 +473,17 @@ class _TradeSummary extends State<TradeSummary> {
)),
Image.asset(
"assets/image/bs_calendar_logo.webp",
width:15,
height:15,
width: 15,
height: 15,
),
],
),
),
),),
Padding(padding:EdgeInsets.only(left:16.w,bottom:15.h),
child:Text(
),
),
Padding(
padding: EdgeInsets.only(left: 16.w, bottom: 15.h),
child: Text(
"经营分析",
style: TextStyle(
fontSize: 18.sp,
@ -287,56 +500,69 @@ class _TradeSummary extends State<TradeSummary> {
expensesAnalysis(),
],
)),
),)
),
)
],
),
);
}
String timeDate(){
if(dateIndex == 0){
return (selectedDate == "" || selectedDate == null) ? "${dayDate ?? ""}(今日)":(dayDate == DateFormat("yyyy年MM月dd日").format(DateTime.parse(selectedDate))
?"${DateFormat("yyyy年MM月dd日").format(DateTime.parse(selectedDate))}(今日)":DateFormat("yyyy年MM月dd日").format(DateTime.parse(selectedDate)));
String timeDate() {
if (dateIndex == 0) {
return (selectedDate == "" || selectedDate == null)
? "${dayDate ?? ""}(今日)"
: (dayDate ==
DateFormat("yyyy年MM月dd日").format(DateTime.parse(selectedDate))
? "${DateFormat("yyyy年MM月dd日").format(DateTime.parse(selectedDate))}(今日)"
: DateFormat("yyyy年MM月dd日").format(DateTime.parse(selectedDate)));
} else if (dateIndex == 1) {
return (weekDate == "" || weekDate == null) ? weekDateNum : weekDate;
} else if (dateIndex == 2) {
return (monthlyDate == "" || monthlyDate == null)
? "${monthlyDateNum ?? ""}"
: (monthlyDateNum ==
(DateFormat("yyyy年MM月dd日")
.format(DateTime.parse(monthlyDate)))
? "${(DateFormat("yyyy年MM月dd日").format(DateTime.parse(monthlyDate)))}"
: DateFormat("yyyy年MM月dd日").format(DateTime.parse(monthlyDate)));
} else if (dateIndex == 3) {
return (customDate == "" || customDate == null)
? "${customDateNum ?? ""}(今日)"
: customDate;
}
else if(dateIndex == 1){
return (weekDate == "" || weekDate == null) ? weekDateNum : weekDate;}
else if(dateIndex == 2){
return (monthlyDate == "" || monthlyDate == null) ? "${monthlyDateNum ?? ""}(当月)":
(monthlyDateNum == (DateFormat("yyyy年MM月dd日").format(DateTime.parse(monthlyDate)).substring(0,8))?
"${(DateFormat("yyyy年MM月dd日").format(DateTime.parse(monthlyDate)).substring(0,8))}(当月)"
:DateFormat("yyyy年MM月dd日").format(DateTime.parse(monthlyDate)).substring(0,8));
}
else if(dateIndex == 3){
return (customDate == "" || customDate == null) ? "${customDateNum??""}(今日)" : customDate;}
}
///
Widget operateAnalysis(){
Widget operateAnalysis() {
return Column(
children: [
Padding(padding: EdgeInsets.only(left:21.w,bottom: 1.h),
Padding(
padding: EdgeInsets.only(left: 21.w, bottom: 1.h),
child: Row(
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
setState((){
onTap: () {
setState(() {
operateSelect = 0;
});
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(padding:EdgeInsets.only(bottom: 10.h),
child:Text(
Padding(
padding: EdgeInsets.only(bottom: 10.h),
child: Text(
"营业额",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
color: operateSelect == 0 ? Colors.black:Color(0xFF969696),
color: operateSelect == 0
? Colors.black
: Color(0xFF969696),
),
)),
if(operateSelect == 0)
if (operateSelect == 0)
Container(
height: 2.h,
width: 44.w,
@ -348,26 +574,32 @@ class _TradeSummary extends State<TradeSummary> {
],
),
),
SizedBox(width:47.w,),
SizedBox(
width: 47.w,
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
setState((){
onTap: () {
setState(() {
operateSelect = 1;
});},
child:Column(
});
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(padding:EdgeInsets.only(bottom: 10.h),
child:Text(
Padding(
padding: EdgeInsets.only(bottom: 10.h),
child: Text(
"交易笔数",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
color: operateSelect == 1 ? Colors.black:Color(0xFF969696),
color: operateSelect == 1
? Colors.black
: Color(0xFF969696),
),
)),
if(operateSelect == 1)
if (operateSelect == 1)
Container(
height: 2.h,
width: 44.w,
@ -380,72 +612,93 @@ class _TradeSummary extends State<TradeSummary> {
),
),
],
),),
),
),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xFFD8D8D8),
margin: EdgeInsets.only(bottom:30.h),
),
if(operateSelect== 0)
Container(padding: EdgeInsets.symmetric(horizontal: 20.w),
child:LineChartSample2(lineChartSample2DataAmount,"金额"),),
if(operateSelect == 1)
Padding(padding: EdgeInsets.symmetric(horizontal: 20.w),
child:LineChartSample2(lineChartSample2DataNum,"交易笔数"),),
SizedBox(height:16.h,),
margin: EdgeInsets.only(bottom: 30.h),
),
if (operateSelect == 0)
// lineChartSample2DataAmount.isNotEmpty
// ? NoDataView(
// src: "assets/image/bs_no data_logo.webp",
// isShowBtn: false,
// text: "暂无数据",
// fontSize: 16.sp,
// margin: EdgeInsets.all(20.h),
// )
// :
Container(
padding: EdgeInsets.symmetric(horizontal: 20.w),
child: LineChartSample2(lineChartSample2DataAmount, "金额"),
),
if (operateSelect == 1)
Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w),
child: LineChartSample2(lineChartSample2DataNum, "交易笔数"),
),
SizedBox(
height: 16.h,
),
],
);
}
///退
Widget expensesAnalysis(){
Widget expensesAnalysis() {
return Container(
padding: EdgeInsets.only(top:12.h,bottom: 33.h),
padding: EdgeInsets.only(top: 12.h, bottom: 33.h),
child: Column(
children: [
Padding(padding:EdgeInsets.only(left:16.w,bottom: 15.h),
child:Row(
Padding(
padding: EdgeInsets.only(left: 16.w, bottom: 15.h),
child: Row(
children: [
Container(
width: 4.w,
height: 16.h,
color: Color(0xFF30415B),
margin: EdgeInsets.only(right:12.w),
margin: EdgeInsets.only(right: 12.w),
),
Text(
"收退款分析",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color:Color(0xFF0D0D0D),
color: Color(0xFF0D0D0D),
),
)
],
)),
Padding(padding: EdgeInsets.only(left:21.w,bottom: 1.h),
Padding(
padding: EdgeInsets.only(left: 21.w, bottom: 1.h),
child: Row(
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
setState((){
onTap: () {
setState(() {
expensesSelect = 0;
});
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(padding:EdgeInsets.only(bottom: 10.h),
child:Text(
Padding(
padding: EdgeInsets.only(bottom: 10.h),
child: Text(
"交易金额",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
color: expensesSelect == 0 ? Colors.black:Color(0xFF969696),
color: expensesSelect == 0
? Colors.black
: Color(0xFF969696),
),
)),
if(expensesSelect == 0)
if (expensesSelect == 0)
Container(
height: 2.h,
width: 44.w,
@ -457,26 +710,32 @@ class _TradeSummary extends State<TradeSummary> {
],
),
),
SizedBox(width:37.w,),
SizedBox(
width: 37.w,
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
setState((){
onTap: () {
setState(() {
expensesSelect = 1;
});},
child:Column(
});
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(padding:EdgeInsets.only(bottom: 10.h),
child:Text(
Padding(
padding: EdgeInsets.only(bottom: 10.h),
child: Text(
"交易笔数",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
color: expensesSelect == 1 ? Colors.black:Color(0xFF969696),
color: expensesSelect == 1
? Colors.black
: Color(0xFF969696),
),
)),
if(expensesSelect == 1)
if (expensesSelect == 1)
Container(
height: 2.h,
width: 44.w,
@ -489,22 +748,28 @@ class _TradeSummary extends State<TradeSummary> {
),
),
],
),),
if(expensesSelect == 0)
),
),
if (expensesSelect == 0)
Container(
height:150.h,
height: 150.h,
child: DonutAutoLabelChart([
new charts.Series<LinearSales, int>(
id: 'Sales',
colorFn: (LinearSales sales, __) =>
sales.color,
domainFn: (LinearSales sales, _) =>
sales.year,
measureFn: (LinearSales sales, _) =>
sales.sales,
colorFn: (LinearSales sales, __) => sales.color,
domainFn: (LinearSales sales, _) => sales.year,
measureFn: (LinearSales sales, _) => sales.sales,
data: [
new LinearSales(0, 78100, charts.Color.fromHex(code: "#313CA9")),
new LinearSales(1, 135458, charts.Color.fromHex(code: "#30415B"))
new LinearSales(
0,
int.parse((tradeSummaryList?.collectionAmount ?? "0")
.replaceAll(".", "")),
charts.Color.fromHex(code: "#313CA9")),
new LinearSales(
1,
int.parse((tradeSummaryList?.refundAmount ?? "0")
.replaceAll(".", "")),
charts.Color.fromHex(code: "#30415B"))
],
// Set a label accessor to control the text of the arc label.
labelAccessorFn: (LinearSales row, _) =>
@ -512,26 +777,24 @@ class _TradeSummary extends State<TradeSummary> {
)
]),
),
if(expensesSelect == 1)
if (expensesSelect == 1)
Container(
height:150.h,
height: 150.h,
child: DonutAutoLabelChart([
new charts.Series<LinearSales, int>(
id: 'Sales',
colorFn: (LinearSales sales, __) =>
sales.color,
domainFn: (LinearSales sales, _) =>
sales.year,
measureFn: (LinearSales sales, _) =>
sales.sales,
colorFn: (LinearSales sales, __) => sales.color,
domainFn: (LinearSales sales, _) => sales.year,
measureFn: (LinearSales sales, _) => sales.sales,
data: [
new LinearSales(0, 66, charts.Color.fromHex(code: "#313CA9")),
new LinearSales(1, 998, charts.Color.fromHex(code: "#30415B")),
new LinearSales(2, 155, charts.Color.fromHex(code: "#30415B")),
new LinearSales(0, tradeSummaryList?.collectionCount ?? 0,
charts.Color.fromHex(code: "#313CA9")),
new LinearSales(2, tradeSummaryList?.refundCount ?? 0,
charts.Color.fromHex(code: "#30415B")),
],
// Set a label accessor to control the text of the arc label.
labelAccessorFn: (LinearSales row, _) =>
'${(row.sales)}',
labelAccessorFn: (LinearSales row, _) => '${(row.sales)}',
),
]),
),
@ -539,5 +802,4 @@ class _TradeSummary extends State<TradeSummary> {
),
);
}
}

9
lib/retrofit/business_api.dart

@ -6,18 +6,17 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/retrofit/data/business_login_info.dart';
import 'package:huixiang/retrofit/data/day_count.dart';
import 'package:huixiang/retrofit/data/order_trend.dart';
import 'package:huixiang/retrofit/data/vip_counts_info.dart';
import 'package:retrofit/retrofit.dart';
import '../utils/flutter_utils.dart';
import 'data/base_data.dart';
import 'data/day_flow_list.dart';
import 'data/goods_type_sales_list.dart';
import 'data/popular_sales_list.dart';
import 'data/single_sales_list.dart';
import 'data/trade_summary_list.dart';
part 'business_api.g.dart';
@ -137,7 +136,7 @@ abstract class BusinessApiService {
@POST("comprehensiveReport/getDayCounts")
Future<BaseData<DayCount>> getDayCounts(@Body() Map<String, dynamic> param);
////
////,01773030
@GET("dashBoard/store/?offsetDay={offsetDay}")
Future<BaseData<PopularSalesList>> popularList(
@Path("offsetDay") String offsetDay);
@ -164,4 +163,8 @@ abstract class BusinessApiService {
@POST("audit/allKindsSalesStatistics")
Future<BaseData<List<GoodsTypeSalesList>>> goodsSalesList(@Body() Map<String, dynamic> param);
//// day week month custom
@POST("largeScreenReport/saleBusinessAnalysis")
Future<BaseData<TradeSummaryList>> saleBusinessAnalysis(@Body() Map<String, dynamic> param);
}

23
lib/retrofit/business_api.g.dart

@ -209,4 +209,27 @@ class _BusinessApiService implements BusinessApiService {
return value;
}
@override
Future<BaseData<TradeSummaryList>> saleBusinessAnalysis(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>(
'largeScreenReport/saleBusinessAnalysis',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<TradeSummaryList>.fromJson(
_result.data,
(json) => json == "" ? null :TradeSummaryList.fromJson(json),
);
return value;
}
}

110
lib/retrofit/data/trade_summary_list.dart

@ -0,0 +1,110 @@
/// saleBusinessAnalysisVOS : [{"localDateTime":"2023-08-29 00:00:00","localDateBigDecimal":"22.00","localDateCount":"1"},{"localDateTime":"2023-08-13 00:00:00","localDateBigDecimal":"12.00","localDateCount":"1"},{"localDateTime":"2023-08-12 00:00:00","localDateBigDecimal":"485.00","localDateCount":"23"},{"localDateTime":"2023-08-11 00:00:00","localDateBigDecimal":"1105.00","localDateCount":"40"},{"localDateTime":"2023-08-10 00:00:00","localDateBigDecimal":"720.00","localDateCount":"28"},{"localDateTime":"2023-08-09 00:00:00","localDateBigDecimal":"311.50","localDateCount":"26"},{"localDateTime":"2023-08-08 00:00:00","localDateBigDecimal":"273.50","localDateCount":"18"},{"localDateTime":"2023-08-07 00:00:00","localDateBigDecimal":"411.00","localDateCount":"19"},{"localDateTime":"2023-08-06 00:00:00","localDateBigDecimal":"26.00","localDateCount":"4"},{"localDateTime":"2023-08-05 00:00:00","localDateBigDecimal":"131.00","localDateCount":"6"},{"localDateTime":"2023-08-04 00:00:00","localDateBigDecimal":"53.00","localDateCount":"4"},{"localDateTime":"2023-08-01 00:00:00","localDateBigDecimal":"442.00","localDateCount":"3"}]
/// collectionAmount : "2816.00"
/// collectionCount : 173
/// refundAmount : "0"
/// refundCount : 0
class TradeSummaryList {
TradeSummaryList({
List<SaleBusinessAnalysisVos> saleBusinessAnalysisVOS,
String collectionAmount,
num collectionCount,
String refundAmount,
num refundCount,}){
_saleBusinessAnalysisVOS = saleBusinessAnalysisVOS;
_collectionAmount = collectionAmount;
_collectionCount = collectionCount;
_refundAmount = refundAmount;
_refundCount = refundCount;
}
TradeSummaryList.fromJson(dynamic json) {
if (json['saleBusinessAnalysisVOS'] != null) {
_saleBusinessAnalysisVOS = [];
json['saleBusinessAnalysisVOS'].forEach((v) {
_saleBusinessAnalysisVOS.add(SaleBusinessAnalysisVos.fromJson(v));
});
}
_collectionAmount = json['collectionAmount'];
_collectionCount = json['collectionCount'];
_refundAmount = json['refundAmount'];
_refundCount = json['refundCount'];
}
List<SaleBusinessAnalysisVos> _saleBusinessAnalysisVOS;
String _collectionAmount;
num _collectionCount;
String _refundAmount;
num _refundCount;
TradeSummaryList copyWith({ List<SaleBusinessAnalysisVos> saleBusinessAnalysisVOS,
String collectionAmount,
num collectionCount,
String refundAmount,
num refundCount,
}) => TradeSummaryList( saleBusinessAnalysisVOS: saleBusinessAnalysisVOS ?? _saleBusinessAnalysisVOS,
collectionAmount: collectionAmount ?? _collectionAmount,
collectionCount: collectionCount ?? _collectionCount,
refundAmount: refundAmount ?? _refundAmount,
refundCount: refundCount ?? _refundCount,
);
List<SaleBusinessAnalysisVos> get saleBusinessAnalysisVOS => _saleBusinessAnalysisVOS;
String get collectionAmount => _collectionAmount;
num get collectionCount => _collectionCount;
String get refundAmount => _refundAmount;
num get refundCount => _refundCount;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
if (_saleBusinessAnalysisVOS != null) {
map['saleBusinessAnalysisVOS'] = _saleBusinessAnalysisVOS.map((v) => v.toJson()).toList();
}
map['collectionAmount'] = _collectionAmount;
map['collectionCount'] = _collectionCount;
map['refundAmount'] = _refundAmount;
map['refundCount'] = _refundCount;
return map;
}
}
/// localDateTime : "2023-08-29 00:00:00"
/// localDateBigDecimal : "22.00"
/// localDateCount : "1"
class SaleBusinessAnalysisVos {
SaleBusinessAnalysisVos({
String localDateTime,
String localDateBigDecimal,
String localDateCount,}){
_localDateTime = localDateTime;
_localDateBigDecimal = localDateBigDecimal;
_localDateCount = localDateCount;
}
SaleBusinessAnalysisVos.fromJson(dynamic json) {
_localDateTime = json['localDateTime'];
_localDateBigDecimal = json['localDateBigDecimal'];
_localDateCount = json['localDateCount'];
}
String _localDateTime;
String _localDateBigDecimal;
String _localDateCount;
SaleBusinessAnalysisVos copyWith({ String localDateTime,
String localDateBigDecimal,
String localDateCount,
}) => SaleBusinessAnalysisVos( localDateTime: localDateTime ?? _localDateTime,
localDateBigDecimal: localDateBigDecimal ?? _localDateBigDecimal,
localDateCount: localDateCount ?? _localDateCount,
);
String get localDateTime => _localDateTime;
String get localDateBigDecimal => _localDateBigDecimal;
String get localDateCount => _localDateCount;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['localDateTime'] = _localDateTime;
map['localDateBigDecimal'] = _localDateBigDecimal;
map['localDateCount'] = _localDateCount;
return map;
}
}

3
lib/setting/setting_page.dart

@ -292,6 +292,9 @@ class _SettingPage extends State<SettingPage> {
sharedPreferences.setString("userId", "");
sharedPreferences.setString("mobile", "");
sharedPreferences.setString("nick", "");
sharedPreferences.setString("account", "");
sharedPreferences.setString("password", "");
Navigator.of(context)
.pushNamedAndRemoveUntil('/router/new_login_page', (route) => false);

Loading…
Cancel
Save