Browse Source

管理系统日期部分优化更改

wr_2023_business
wurong 1 year ago
parent
commit
fbee0ab5ee
  1. 259
      lib/business_system/home/overview/trade_goods.dart
  2. 259
      lib/business_system/home/overview/trade_order.dart
  3. 43
      lib/business_system/order/business_order_page.dart

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

@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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';
@ -17,6 +18,16 @@ class TradeGoods extends StatefulWidget {
class _TradeGoods extends State<TradeGoods> {
final RefreshController _refreshController = RefreshController();
final ScrollController scrollController = ScrollController();
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月").format(DateTime.now())}";
String customDate ="";
String customDateNum = "${DateFormat("yyyy年MM月dd日").format(DateTime.now())}";
@override
void dispose() {
@ -76,100 +87,163 @@ class _TradeGoods extends State<TradeGoods> {
top: 16.h, right: 20.w, left: 20.w, bottom: 12.h),
child: Row(
children: [
Expanded(child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: Color(0xFF30415B),
),
padding: EdgeInsets.symmetric(vertical: 9.h),
child: Text(
"日报",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
Expanded(child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
setState((){
dateIndex = 0;
});
},
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: dateIndex == 0 ? Color(0xFF30415B):Colors.transparent,
),
),
),),
Expanded(child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
// color: Color(0xFF30415B),
),
padding: EdgeInsets.symmetric(vertical: 9.h),
child: Text(
"周报",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B),
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: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
// color: Color(0xFF30415B),
),
padding: EdgeInsets.symmetric(vertical: 9.h),
child: Text(
"月报",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B),
)),
Expanded(child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
setState((){
dateIndex = 1;
});},
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: dateIndex == 1 ? Color(0xFF30415B):Colors.transparent,
),
),
),),
Expanded(child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
// color: Color(0xFF30415B),
),
padding: EdgeInsets.symmetric(vertical: 9.h),
child: Text(
"自定义",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B),
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: (){
setState((){
dateIndex = 2;
});
},
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: (){
setState((){
dateIndex = 3;
});
},
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: Container(
width: 154.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: [
Padding(padding: EdgeInsets.only(right: 20.w),
child: Text(
"2023年06月01日(今日)",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
if(dateIndex == 0){
Navigator.of(context).pushNamed('/router/day_report_page').then((value) {
setState((){
selectedDate = value;
});
});
}
else if(dateIndex == 1){
Navigator.of(context).pushNamed('/router/week_report_page').then((value) {
setState((){
weekDate = value;
});
});
}
else if(dateIndex == 2){
Navigator.of(context).pushNamed('/router/monthly_report_page').then((value) {
setState((){
monthlyDate = value;
});
});
}
else if(dateIndex == 3){
Navigator.of(context).pushNamed('/router/custom_page').then((value){
setState((){
customDate = value;
});
});
}
},
child: Container(
width: 194.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(
timeDate(),
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
),
),),
Image.asset(
"assets/image/bs_calendar_logo.webp",
width:15,
height:15,
),
],
)),
Image.asset(
"assets/image/bs_calendar_logo.webp",
width:15,
height:15,
),
],
),
),
),),
Padding(padding:EdgeInsets.only(left:16.w,bottom:15.h),
@ -197,6 +271,23 @@ class _TradeGoods extends State<TradeGoods> {
);
}
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)).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 goodsTypeRecord(){
return Column(

259
lib/business_system/home/overview/trade_order.dart

@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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';
@ -34,6 +35,16 @@ class _TradeOrder extends State<TradeOrder> {
LineChartSample2Data(4,5,"2023-03-13"),
LineChartSample2Data(5,55,"2023-03-14"),
LineChartSample2Data(6,98,"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月").format(DateTime.now())}";
String customDate ="";
String customDateNum = "${DateFormat("yyyy年MM月dd日").format(DateTime.now())}";
@override
void dispose() {
@ -93,100 +104,163 @@ class _TradeOrder extends State<TradeOrder> {
top: 16.h, right: 20.w, left: 20.w, bottom: 12.h),
child: Row(
children: [
Expanded(child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: Color(0xFF30415B),
),
padding: EdgeInsets.symmetric(vertical: 9.h),
child: Text(
"日报",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
Expanded(child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
setState((){
dateIndex = 0;
});
},
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: dateIndex == 0 ? Color(0xFF30415B):Colors.transparent,
),
),
),),
Expanded(child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
// color: Color(0xFF30415B),
),
padding: EdgeInsets.symmetric(vertical: 9.h),
child: Text(
"周报",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B),
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: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
// color: Color(0xFF30415B),
),
padding: EdgeInsets.symmetric(vertical: 9.h),
child: Text(
"月报",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B),
)),
Expanded(child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
setState((){
dateIndex = 1;
});},
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: dateIndex == 1 ? Color(0xFF30415B):Colors.transparent,
),
),
),),
Expanded(child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
// color: Color(0xFF30415B),
),
padding: EdgeInsets.symmetric(vertical: 9.h),
child: Text(
"自定义",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B),
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: (){
setState((){
dateIndex = 2;
});
},
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: (){
setState((){
dateIndex = 3;
});
},
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: Container(
width: 154.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: [
Padding(padding: EdgeInsets.only(right: 20.w),
child: Text(
"2023年06月01日(今日)",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
if(dateIndex == 0){
Navigator.of(context).pushNamed('/router/day_report_page').then((value) {
setState((){
selectedDate = value;
});
});
}
else if(dateIndex == 1){
Navigator.of(context).pushNamed('/router/week_report_page').then((value) {
setState((){
weekDate = value;
});
});
}
else if(dateIndex == 2){
Navigator.of(context).pushNamed('/router/monthly_report_page').then((value) {
setState((){
monthlyDate = value;
});
});
}
else if(dateIndex == 3){
Navigator.of(context).pushNamed('/router/custom_page').then((value){
setState((){
customDate = value;
});
});
}
},
child: Container(
width: 194.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(
timeDate(),
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
),
),),
Image.asset(
"assets/image/bs_calendar_logo.webp",
width:15,
height:15,
),
],
)),
Image.asset(
"assets/image/bs_calendar_logo.webp",
width:15,
height:15,
),
],
),
),
),),
Padding(padding:EdgeInsets.only(left:16.w,bottom:15.h),
@ -208,6 +282,23 @@ class _TradeOrder extends State<TradeOrder> {
);
}
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)).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 orderAmount(){
return Column(

43
lib/business_system/order/business_order_page.dart

@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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';
@ -27,6 +28,9 @@ class _BusinessOrderPage extends State<BusinessOrderPage>
final TextEditingController editingController = TextEditingController();
FocusNode _focusNode = FocusNode();
bool isKeyBoardShow = false;
String selectTimeDate ="";
String selectTimeDateNum = "${DateFormat("yyyy年MM月dd日").format(DateTime.now().subtract(Duration(days:1)))}"
"${DateFormat("yyyy年MM月dd日").format(DateTime.now())}";
@override
void initState() {
@ -182,7 +186,12 @@ class _BusinessOrderPage extends State<BusinessOrderPage>
return Container(
color: Colors.white,
child: GestureDetector(
onTap: (){},
onTap: (){
Navigator.of(context).pushNamed('/router/custom_page').then((value){
setState((){
selectTimeDate = value;
});
});},
child: Container(
decoration: BoxDecoration(
color: Color(0xFFF7F8FA),
@ -194,27 +203,27 @@ class _BusinessOrderPage extends State<BusinessOrderPage>
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'2022-08-24 16:23',
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF30415B),
fontWeight: MyFontWeight.regular),
),
Padding(padding:EdgeInsets.only(left:22.w,right: 26.w),
child: Text(
'',
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF30415B),
fontWeight: MyFontWeight.regular),
),),
Text(
'2022-08-24 16:50',
(selectTimeDate == "" || selectTimeDate == null) ? selectTimeDateNum : selectTimeDate,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF30415B),
fontWeight: MyFontWeight.regular),
),
// Padding(padding:EdgeInsets.only(left:22.w,right: 26.w),
// child: Text(
// '',
// style: TextStyle(
// fontSize: 14.sp,
// color: Color(0xFF30415B),
// fontWeight: MyFontWeight.regular),
// ),),
// Text(
// '2022-08-24 16:50',
// style: TextStyle(
// fontSize: 14.sp,
// color: Color(0xFF30415B),
// fontWeight: MyFontWeight.regular),
// ),
],
),
),

Loading…
Cancel
Save