|
|
|
@ -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(); |
|
|
|
@ -29,28 +42,34 @@ class _TradeSummary extends State<TradeSummary> {
|
|
|
|
|
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 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 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((){ |
|
|
|
|
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((){ |
|
|
|
|
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((){ |
|
|
|
|
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((){ |
|
|
|
|
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((){ |
|
|
|
|
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"); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -249,10 +454,16 @@ class _TradeSummary extends State<TradeSummary> {
|
|
|
|
|
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, |
|
|
|
@ -268,8 +479,10 @@ class _TradeSummary extends State<TradeSummary> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
),), |
|
|
|
|
Padding(padding:EdgeInsets.only(left:16.w,bottom:15.h), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.only(left: 16.w, bottom: 15.h), |
|
|
|
|
child: Text( |
|
|
|
|
"经营分析", |
|
|
|
|
style: TextStyle( |
|
|
|
@ -287,7 +500,8 @@ class _TradeSummary extends State<TradeSummary> {
|
|
|
|
|
expensesAnalysis(), |
|
|
|
|
], |
|
|
|
|
)), |
|
|
|
|
),) |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
@ -295,26 +509,35 @@ class _TradeSummary extends State<TradeSummary> {
|
|
|
|
|
|
|
|
|
|
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))); |
|
|
|
|
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() { |
|
|
|
|
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( |
|
|
|
@ -327,13 +550,16 @@ class _TradeSummary extends State<TradeSummary> {
|
|
|
|
|
child: Column( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
Padding(padding:EdgeInsets.only(bottom: 10.h), |
|
|
|
|
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) |
|
|
|
@ -348,23 +574,29 @@ class _TradeSummary extends State<TradeSummary> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox(width:47.w,), |
|
|
|
|
SizedBox( |
|
|
|
|
width: 47.w, |
|
|
|
|
), |
|
|
|
|
GestureDetector( |
|
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
|
onTap: () { |
|
|
|
|
setState(() { |
|
|
|
|
operateSelect = 1; |
|
|
|
|
});}, |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child: Column( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
Padding(padding:EdgeInsets.only(bottom: 10.h), |
|
|
|
|
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) |
|
|
|
@ -380,7 +612,8 @@ class _TradeSummary extends State<TradeSummary> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
),), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Container( |
|
|
|
|
width: double.infinity, |
|
|
|
|
height: 1.h, |
|
|
|
@ -388,12 +621,27 @@ class _TradeSummary extends State<TradeSummary> {
|
|
|
|
|
margin: EdgeInsets.only(bottom: 30.h), |
|
|
|
|
), |
|
|
|
|
if (operateSelect == 0) |
|
|
|
|
Container(padding: EdgeInsets.symmetric(horizontal: 20.w), |
|
|
|
|
child:LineChartSample2(lineChartSample2DataAmount,"金额"),), |
|
|
|
|
// 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,), |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 20.w), |
|
|
|
|
child: LineChartSample2(lineChartSample2DataNum, "交易笔数"), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 16.h, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
@ -404,7 +652,8 @@ class _TradeSummary extends State<TradeSummary> {
|
|
|
|
|
padding: EdgeInsets.only(top: 12.h, bottom: 33.h), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Padding(padding:EdgeInsets.only(left:16.w,bottom: 15.h), |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.only(left: 16.w, bottom: 15.h), |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
|
Container( |
|
|
|
@ -423,7 +672,8 @@ class _TradeSummary extends State<TradeSummary> {
|
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
)), |
|
|
|
|
Padding(padding: EdgeInsets.only(left:21.w,bottom: 1.h), |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.only(left: 21.w, bottom: 1.h), |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
|
GestureDetector( |
|
|
|
@ -436,13 +686,16 @@ class _TradeSummary extends State<TradeSummary> {
|
|
|
|
|
child: Column( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
Padding(padding:EdgeInsets.only(bottom: 10.h), |
|
|
|
|
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) |
|
|
|
@ -457,23 +710,29 @@ class _TradeSummary extends State<TradeSummary> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox(width:37.w,), |
|
|
|
|
SizedBox( |
|
|
|
|
width: 37.w, |
|
|
|
|
), |
|
|
|
|
GestureDetector( |
|
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
|
onTap: () { |
|
|
|
|
setState(() { |
|
|
|
|
expensesSelect = 1; |
|
|
|
|
});}, |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child: Column( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
Padding(padding:EdgeInsets.only(bottom: 10.h), |
|
|
|
|
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) |
|
|
|
@ -489,22 +748,28 @@ class _TradeSummary extends State<TradeSummary> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
),), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
if (expensesSelect == 0) |
|
|
|
|
Container( |
|
|
|
|
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, _) => |
|
|
|
@ -518,20 +783,18 @@ class _TradeSummary extends State<TradeSummary> {
|
|
|
|
|
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> {
|
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|