|
|
|
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: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 '../../../view_widget/no_data_view.dart';
|
|
|
|
import '../home_view/my_line_chart.dart';
|
|
|
|
|
|
|
|
class TradeOrder extends StatefulWidget {
|
|
|
|
final storeId;
|
|
|
|
|
|
|
|
TradeOrder(this.storeId);
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _TradeOrder();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _TradeOrder extends State<TradeOrder> {
|
|
|
|
final RefreshController _refreshController = RefreshController();
|
|
|
|
final ScrollController scrollController = ScrollController();
|
|
|
|
List<LineChartSample2Data> lineChartSample2DataOrderAmount = [
|
|
|
|
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> lineChartSample2DataOrderNum = [
|
|
|
|
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")
|
|
|
|
];
|
|
|
|
|
|
|
|
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)))} 至 "
|
|
|
|
"${DateFormat("yyyy年MM月dd日").format(DateTime.now())}";
|
|
|
|
String monthlyDate = "";
|
|
|
|
String monthlyDateNum = "${DateFormat("yyyy年MM月dd").format(DateTime.now())}";
|
|
|
|
String customDate = "";
|
|
|
|
String customDateNum = "${DateFormat("yyyy年MM月dd日").format(DateTime.now())}";
|
|
|
|
int _loadCount = 0;
|
|
|
|
BusinessApiService businessService;
|
|
|
|
TradeSummaryList tradeSummaryList;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
super.dispose();
|
|
|
|
_refreshController.dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
@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);
|
|
|
|
if (dateIndex == 0) {
|
|
|
|
queryBusinessAnalysis(
|
|
|
|
timeDate()
|
|
|
|
.replaceAll("年", "-")
|
|
|
|
.replaceAll("月", "-")
|
|
|
|
.replaceAll("日", "")
|
|
|
|
.substring(0, 10),
|
|
|
|
timeDate()
|
|
|
|
.replaceAll("年", "-")
|
|
|
|
.replaceAll("月", "-")
|
|
|
|
.replaceAll("日", "")
|
|
|
|
.substring(0, 10),
|
|
|
|
"day",
|
|
|
|
isSing: false);
|
|
|
|
} else if (dateIndex == 1) {
|
|
|
|
queryBusinessAnalysis(
|
|
|
|
timeDate()
|
|
|
|
.replaceAll("年", "-")
|
|
|
|
.replaceAll("月", "-")
|
|
|
|
.replaceAll("日", "")
|
|
|
|
.substring(0, 10),
|
|
|
|
timeDate()
|
|
|
|
.replaceAll("年", "-")
|
|
|
|
.replaceAll("月", "-")
|
|
|
|
.replaceAll("日", "")
|
|
|
|
.substring(12, 23),
|
|
|
|
"week",
|
|
|
|
isSing: false);
|
|
|
|
} else if (dateIndex == 2) {
|
|
|
|
queryBusinessAnalysis(
|
|
|
|
timeDate()
|
|
|
|
.replaceAll("年", "-")
|
|
|
|
.replaceAll("月", "-")
|
|
|
|
.replaceAll("日", "")
|
|
|
|
.substring(0, 10),
|
|
|
|
timeDate()
|
|
|
|
.replaceAll("年", "-")
|
|
|
|
.replaceAll("月", "-")
|
|
|
|
.replaceAll("日", "")
|
|
|
|
.substring(0, 10),
|
|
|
|
"month",
|
|
|
|
isSing: false);
|
|
|
|
} else if (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",
|
|
|
|
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) {
|
|
|
|
double amountIndex = 0;
|
|
|
|
double numIndex = 0;
|
|
|
|
if (baseData.data.saleBusinessAnalysisVOS.isNotEmpty) {
|
|
|
|
lineChartSample2DataOrderAmount.clear();
|
|
|
|
lineChartSample2DataOrderNum.clear();
|
|
|
|
}
|
|
|
|
tradeSummaryList = baseData.data;
|
|
|
|
tradeSummaryList.saleBusinessAnalysisVOS.forEach((element) {
|
|
|
|
lineChartSample2DataOrderAmount.add(LineChartSample2Data(
|
|
|
|
amountIndex,
|
|
|
|
double.tryParse(element.localDateBigDecimal.toString()),
|
|
|
|
element.localDateTime.substring(0, 10)));
|
|
|
|
amountIndex += 1;
|
|
|
|
});
|
|
|
|
tradeSummaryList.saleBusinessAnalysisVOS.forEach((element) {
|
|
|
|
lineChartSample2DataOrderNum.add(LineChartSample2Data(
|
|
|
|
numIndex,
|
|
|
|
double.tryParse(element.localDateCount.toString()),
|
|
|
|
element.localDateTime.substring(0, 10)));
|
|
|
|
numIndex += 1;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
if (isSing) {
|
|
|
|
setState(() {});
|
|
|
|
EasyLoading.dismiss();
|
|
|
|
} else {
|
|
|
|
addLoadCount();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
body: Column(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
color: Color(0xFFD8D8D8),
|
|
|
|
width: double.infinity,
|
|
|
|
height: 1.h,
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: SmartRefresher(
|
|
|
|
controller: _refreshController,
|
|
|
|
enablePullDown: true,
|
|
|
|
enablePullUp: false,
|
|
|
|
header: MyHeader(),
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
scrollController: scrollController,
|
|
|
|
footer: CustomFooter(
|
|
|
|
builder: (context, mode) {
|
|
|
|
return MyFooter(mode);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
onRefresh: _onRefresh,
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0xFFF6F6F6),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
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(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
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,
|
|
|
|
),
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 9.h),
|
|
|
|
child: Text(
|
|
|
|
"日报",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: dateIndex == 0
|
|
|
|
? Colors.white
|
|
|
|
: Color(0xFF30415B),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Expanded(
|
|
|
|
child: GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
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,
|
|
|
|
),
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 9.h),
|
|
|
|
child: Text(
|
|
|
|
"周报",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: dateIndex == 1
|
|
|
|
? Colors.white
|
|
|
|
: Color(0xFF30415B),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Expanded(
|
|
|
|
child: GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
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,
|
|
|
|
),
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 9.h),
|
|
|
|
child: Text(
|
|
|
|
"月报",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: dateIndex == 2
|
|
|
|
? Colors.white
|
|
|
|
: Color(0xFF30415B),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Expanded(
|
|
|
|
child: GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
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,
|
|
|
|
),
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 9.h),
|
|
|
|
child: Text(
|
|
|
|
"自定义",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: dateIndex == 3
|
|
|
|
? Colors.white
|
|
|
|
: Color(0xFF30415B),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Align(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
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) {
|
|
|
|
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) {
|
|
|
|
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) {
|
|
|
|
customDate = value;
|
|
|
|
queryBusinessAnalysis(
|
|
|
|
timeDate()
|
|
|
|
.replaceAll("年", "-")
|
|
|
|
.replaceAll("月", "-")
|
|
|
|
.replaceAll("日", "")
|
|
|
|
.substring(0, 10),
|
|
|
|
timeDate()
|
|
|
|
.replaceAll("年", "-")
|
|
|
|
.replaceAll("月", "-")
|
|
|
|
.replaceAll("日", "")
|
|
|
|
.substring(12, 23),
|
|
|
|
"custom");
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
width: 200.w,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
padding: EdgeInsets.all(8),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0xFFF6F6F6),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
margin: EdgeInsets.only(bottom: 16.h),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Text(
|
|
|
|
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,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/bs_calendar_logo.webp",
|
|
|
|
width: 15,
|
|
|
|
height: 15,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: 16.w, bottom: 15.h),
|
|
|
|
child: Text(
|
|
|
|
"订单分析",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 18.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
orderAmount(),
|
|
|
|
orderNumTrend(),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
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.substring(0,11)} ""${customDate.substring(21,34)}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///订单金额
|
|
|
|
Widget orderAmount() {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
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),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"订单金额",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
color: Color(0xFF0D0D0D),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 8.w,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"近12周",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF666666),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
(tradeSummaryList == null ||
|
|
|
|
tradeSummaryList.saleBusinessAnalysisVOS.length == 0)
|
|
|
|
? NoDataView(
|
|
|
|
src: "assets/image/bs_no data_logo.webp",
|
|
|
|
isShowBtn: false,
|
|
|
|
text: "暂无数据",
|
|
|
|
fontSize: 16.sp,
|
|
|
|
margin: EdgeInsets.all(20.h),
|
|
|
|
)
|
|
|
|
:
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 20.w),
|
|
|
|
child: LineChartSample2(lineChartSample2DataOrderAmount, "金额"),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 16.h,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///订单量趋势
|
|
|
|
Widget orderNumTrend() {
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.only(top: 12.h, bottom: 33.h),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
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),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"订单量趋势",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
color: Color(0xFF0D0D0D),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
(tradeSummaryList == null ||
|
|
|
|
tradeSummaryList.saleBusinessAnalysisVOS.length == 0)
|
|
|
|
? NoDataView(
|
|
|
|
src: "assets/image/bs_no data_logo.webp",
|
|
|
|
isShowBtn: false,
|
|
|
|
text: "暂无数据",
|
|
|
|
fontSize: 16.sp,
|
|
|
|
margin: EdgeInsets.all(20.h),
|
|
|
|
)
|
|
|
|
: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 20.w),
|
|
|
|
child: LineChartSample2(lineChartSample2DataOrderNum, "订单量"),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 16.h,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|