Browse Source

流水详情更改;

首页生意总览更改;
setState的调用更改;
wr_2023_business
huixiang_app 1 year ago
parent
commit
d634866a2f
  1. 63
      lib/business_system/home/business_home_page.dart
  2. 27
      lib/business_system/home/flow_page.dart
  3. 8
      lib/retrofit/data/day_flow_list.dart

63
lib/business_system/home/business_home_page.dart

@ -51,7 +51,6 @@ class _BusinessHomePage extends State<BusinessHomePage>
List<OrderTrend> orderTrend = [];
VipCountsInfo vipCountsInfo;
int daySelectIndex = 0;
String offsetDay;
List<DayFlowList> dayFlowList = [];
List<LineChartSample2Data> lineChartSample2Data = [
LineChartSample2Data(0, 0, "2023-03-09"),
@ -88,7 +87,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
? "0"
: widget.businessLoginInfo.storeList[widget.selectStoreIndex].id);
queryDayAmount();
queryPopularList(offsetDay);
queryPopularList(isSing: false);
queryOrderTrend();
queryVipCounts();
queryDayFlow();
@ -123,18 +122,27 @@ class _BusinessHomePage extends State<BusinessHomePage>
}
///
queryPopularList(offsetDay) async {
queryPopularList({isSing = true}) async {
try {
BaseData<PopularSalesList> baseData =
await businessService.popularList(offsetDay).catchError((error) {});
if (isSing)
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
BaseData<PopularSalesList> baseData = await businessService
.popularList(daySelectIndex.toString())
.catchError((error) {});
if (baseData != null && baseData.isSuccess) {
popularSalesList = baseData.data;
setState(() {});
}
} finally {
if (isSing) {
setState(() {});
EasyLoading.dismiss();
} else {
addLoadCount();
}
}
}
///
queryOrderTrend() async {
@ -144,7 +152,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
if (baseData != null && baseData.isSuccess) {
double index = 0;
if (baseData.data.isNotEmpty) {
orderTrend.clear();
lineChartSample2Data.clear();
}
orderTrend = baseData.data;
orderTrend.forEach((element) {
@ -176,14 +184,10 @@ class _BusinessHomePage extends State<BusinessHomePage>
queryDayFlow() async {
try {
BaseData<List<DayFlowList>> baseData = await businessService
.dayFlow(
// "${DateFormat("yyyy-MM-dd").format(DateTime.now())}",
"2023-09-04",
"1")
.dayFlow(DateFormat("yyyy-MM-dd").format(DateTime.now()), "1")
.catchError((error) {});
if (baseData != null && baseData.isSuccess) {
dayFlowList = baseData.data;
setState(() {});
}
} finally {
addLoadCount();
@ -559,16 +563,17 @@ class _BusinessHomePage extends State<BusinessHomePage>
SizedBox(
height: 18.h,
),
// if (lineChartSample2Data.isNotEmpty)
(lineChartSample2Data.isNotEmpty)
? NoDataView(
src: "assets/image/xiao_fei.webp",
isShowBtn: false,
text: "暂无数据",
fontSize: 16.sp,
margin: EdgeInsets.all(20.h),
)
: LineChartSample2(lineChartSample2Data, "销售量"),
if (lineChartSample2Data.isNotEmpty)
// (lineChartSample2Data.isNotEmpty)
// ? NoDataView(
// src: "assets/image/xiao_fei.webp",
// isShowBtn: false,
// text: "暂无数据",
// fontSize: 16.sp,
// margin: EdgeInsets.all(20.h),
// )
// :
LineChartSample2(lineChartSample2Data, "销售量"),
],
),
);
@ -868,10 +873,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
daySelectIndex = 0;
queryPopularList("0");
});
queryPopularList();
},
child: Container(
padding:
@ -905,7 +908,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
onTap: () {
setState(() {
daySelectIndex = 1;
queryPopularList("1");
queryPopularList();
});
},
child: Container(
@ -939,7 +942,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
onTap: () {
setState(() {
daySelectIndex = 2;
queryPopularList("7");
queryPopularList();
});
},
child: Container(
@ -973,7 +976,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
onTap: () {
setState(() {
daySelectIndex = 3;
queryPopularList("30");
queryPopularList();
});
},
child: Container(
@ -1130,8 +1133,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pushNamed('/router/flow_page',
arguments: {
Navigator.of(context)
.pushNamed('/router/flow_page', arguments: {
"storeName": widget?.businessLoginInfo
?.storeList[widget.selectStoreIndex].name ??
"",

27
lib/business_system/home/flow_page.dart

@ -4,6 +4,7 @@ import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/my_appbar.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';
@ -43,7 +44,7 @@ class _FlowPage extends State<FlowPage> {
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: storeId);
queryDayFlow("2023-09-04", "0");
queryDayFlow(DateFormat("yyyy-MM-dd").format(DateTime.now()), "0");
});
}
@ -62,9 +63,9 @@ class _FlowPage extends State<FlowPage> {
if (isMonth == "0") {
dayFlowList = baseData.data;
} else {
dayFlowList
.firstWhere((element) => element.localDate == yearMonth)
.detailList = baseData.data.first.detailList;
dayFlowList.firstWhere((element) => element.localDate == yearMonth)
.detailList = baseData.data;
}
setState(() {});
}
@ -170,7 +171,7 @@ class _FlowPage extends State<FlowPage> {
dayFlowList.detailList = null;
});
}else{
queryDayFlow("2023-09-04", "1");
queryDayFlow(dayFlowList?.localDate ?? "", "1");
}
},
child: Row(
@ -227,20 +228,6 @@ class _FlowPage extends State<FlowPage> {
return billIDetailsItem(e);
}).toList(),
)
// if (isShowMore)
// ListView.builder(
// padding: EdgeInsets.zero,
// itemCount: 5,
// scrollDirection: Axis.vertical,
// shrinkWrap: true,
// physics: BouncingScrollPhysics(),
// itemBuilder: (context, position) {
// return GestureDetector(
// onTap: () {},
// child: billIDetailsItem(),
// );
// },
// )
],
),
);
@ -268,7 +255,7 @@ class _FlowPage extends State<FlowPage> {
),
),
Text(
detailList?.phone ?? "",
detailList?.phone ?? detailList?.nickname ?? detailList?.storeName ??"",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,

8
lib/retrofit/data/day_flow_list.dart

@ -61,7 +61,6 @@ DayFlowList copyWith({ dynamic localDate,
storeName: storeName ?? _storeName,
nickname: nickname ?? _nickname,
phone: phone ?? _phone,
);
dynamic get localDate => _localDate;
String get localDateTime => _localDateTime;
@ -71,9 +70,14 @@ DayFlowList copyWith({ dynamic localDate,
String get storeName => _storeName;
dynamic get nickname => _nickname;
dynamic get phone => _phone;
List<DayFlowList> detailList;
List<DayFlowList> _detailList;
List<DayFlowList> get detailList => _detailList;
set detailList(List<DayFlowList> value) {
_detailList = value;
}
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};

Loading…
Cancel
Save