Commit 058f5eded1a89101abb9cb73c1b3fe5a3c499a54

Authored by weixin_45529955
1 parent ffdd771f

预订餐段显示预订数量根据配置显示

... ... @@ -20,19 +20,19 @@ if (flutterRoot == null) {
def flutterVersionCode = "563"
def flutterVersionCode = "564"
if (flutterVersionCode == null) {
flutterVersionCode = '563'
flutterVersionCode = '564'
}
def flutterVersionName = "5.6.3"
def flutterVersionName = "5.6.4"
if (flutterVersionName == null) {
flutterVersionName = '5.6.3'
flutterVersionName = '5.6.4'
}
... ...
... ... @@ -350,9 +350,9 @@ class NoteBookPageState extends State<NoteBookPage> {
//获取已预订列表
_getReserveList({bool needLoading = false, bool showLoading = true}) async {
if (Utils.isBeforeToday(dateTimeNow!)) {
await noteBookModel.getSellerHideConf(
context,
);
await noteBookModel.getSellerHideConf(
context,
);
}
Map<String, String?> params = {
... ... @@ -412,6 +412,11 @@ class NoteBookPageState extends State<NoteBookPage> {
//获取订单统计数目
_reserveCountDay() async {
if (Utils.isBeforeToday(dateTimeNow!)) {
await noteBookModel.getSellerHideConf(
context,
);
}
NoteBookModel model = Provider.of<NoteBookModel>(context, listen: false);
Map<String, String?> params = {
"sid": userModel.user!.sellerid,
... ... @@ -426,7 +431,7 @@ class NoteBookPageState extends State<NoteBookPage> {
if (!isall) {
params["account"] = userModel.user!.account;
}
await model.getReserveCountDay(context, params);
await model.getReserveCountDay(context, params, now: dateTimeNow);
}
//构建List表头
... ... @@ -552,6 +557,7 @@ class NoteBookPageState extends State<NoteBookPage> {
if (Utils.isOneDay(day, dateTimeNow!)) return; //日期没变
_refreshPageCalendar(day);
ddateSoltSelect = currTimeIndex.toString();
noteBookModel.sellerHideConfiData = [];
getMealSectionByDay();
_reserveCountDay();
}
... ... @@ -1774,6 +1780,7 @@ class NoteBookPageState extends State<NoteBookPage> {
dateText = '更多\n日期';
});
ddateSoltSelect = currTimeIndex.toString();
noteBookModel.sellerHideConfiData = [];
getMealSectionByDay();
_reserveCountDay();
... ... @@ -1847,6 +1854,8 @@ class NoteBookPageState extends State<NoteBookPage> {
});
ddateSoltSelect =
currTimeIndex.toString();
noteBookModel.sellerHideConfiData =
[];
getMealSectionByDay();
_reserveCountDay();
... ...
... ... @@ -244,7 +244,8 @@ class NoteBookModel extends ChangeNotifier {
}
//获取订单统计数目
getReserveCountDay(BuildContext context, Map<String, String?> params) async {
getReserveCountDay(BuildContext context, Map<String, String?> params,
{DateTime? now}) async {
try {
BaseResp<Map<String, dynamic>?> baseResp = await DioUtil()
.request<Map<String, dynamic>>(
... ... @@ -256,6 +257,54 @@ class NoteBookModel extends ChangeNotifier {
int night = int.parse(baseResp.data!["night"].toString());
int meal1 = int.parse(baseResp.data!["four"].toString());
int meal2 = int.parse(baseResp.data!["five"].toString());
if (now != null) {
print(sellerHideConfiData);
int limitNum = -1;
if (sellerHideConfiData!.length > 0) {
int index = sellerHideConfiData!
.indexWhere((element) => element.sid == params['sid']);
if (index != -1) {
//存在配置
// "str": "3-2"
// 判断请求的日期是周一到周四还是其他
String str = sellerHideConfiData![index].str ?? '';
List<String> config = str.split('-');
if (now.weekday == 1 ||
now.weekday == 2 ||
now.weekday == 3 ||
now.weekday == 4) {
//周一到周四
limitNum = int.parse(config[0]);
} else {
limitNum = int.parse(config[1]);
}
}
}
if (limitNum != -1) {
if (morning > limitNum) {
morning = limitNum;
}
if (noon > limitNum) {
noon = limitNum;
}
if (night > limitNum) {
night = limitNum;
}
if (meal1 > limitNum) {
meal1 = limitNum;
}
if (meal2 > limitNum) {
meal2 = limitNum;
}
}
}
// UserModel userModel = Provider.of<UserModel>(context, listen: false);
// total = "已订" + (morning + noon + night).toString();
// if (userModel.user.morning.isNotEmpty) {
... ...
... ... @@ -186,6 +186,8 @@ class TableManagerModelOrReserve with ChangeNotifier {
// showLoading = true;
// }
sellerHideConfiData = [];
if (Utils.isBeforeToday(datetime)) {
await getSellerHideConf(
context,
... ...