Commit 058f5eded1a89101abb9cb73c1b3fe5a3c499a54

Authored by weixin_45529955
1 parent ffdd771f

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

@@ -20,19 +20,19 @@ if (flutterRoot == null) { @@ -20,19 +20,19 @@ if (flutterRoot == null) {
20 20
21 21
22 22
23 -def flutterVersionCode = "563" 23 +def flutterVersionCode = "564"
24 if (flutterVersionCode == null) { 24 if (flutterVersionCode == null) {
25 - flutterVersionCode = '563' 25 + flutterVersionCode = '564'
26 26
27 27
28 28
29 } 29 }
30 30
31 31
32 -def flutterVersionName = "5.6.3" 32 +def flutterVersionName = "5.6.4"
33 33
34 if (flutterVersionName == null) { 34 if (flutterVersionName == null) {
35 - flutterVersionName = '5.6.3' 35 + flutterVersionName = '5.6.4'
36 36
37 } 37 }
38 38
@@ -350,9 +350,9 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -350,9 +350,9 @@ class NoteBookPageState extends State<NoteBookPage> {
350 //获取已预订列表 350 //获取已预订列表
351 _getReserveList({bool needLoading = false, bool showLoading = true}) async { 351 _getReserveList({bool needLoading = false, bool showLoading = true}) async {
352 if (Utils.isBeforeToday(dateTimeNow!)) { 352 if (Utils.isBeforeToday(dateTimeNow!)) {
353 - await noteBookModel.getSellerHideConf(  
354 - context,  
355 - ); 353 + await noteBookModel.getSellerHideConf(
  354 + context,
  355 + );
356 } 356 }
357 357
358 Map<String, String?> params = { 358 Map<String, String?> params = {
@@ -412,6 +412,11 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -412,6 +412,11 @@ class NoteBookPageState extends State<NoteBookPage> {
412 412
413 //获取订单统计数目 413 //获取订单统计数目
414 _reserveCountDay() async { 414 _reserveCountDay() async {
  415 + if (Utils.isBeforeToday(dateTimeNow!)) {
  416 + await noteBookModel.getSellerHideConf(
  417 + context,
  418 + );
  419 + }
415 NoteBookModel model = Provider.of<NoteBookModel>(context, listen: false); 420 NoteBookModel model = Provider.of<NoteBookModel>(context, listen: false);
416 Map<String, String?> params = { 421 Map<String, String?> params = {
417 "sid": userModel.user!.sellerid, 422 "sid": userModel.user!.sellerid,
@@ -426,7 +431,7 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -426,7 +431,7 @@ class NoteBookPageState extends State<NoteBookPage> {
426 if (!isall) { 431 if (!isall) {
427 params["account"] = userModel.user!.account; 432 params["account"] = userModel.user!.account;
428 } 433 }
429 - await model.getReserveCountDay(context, params); 434 + await model.getReserveCountDay(context, params, now: dateTimeNow);
430 } 435 }
431 436
432 //构建List表头 437 //构建List表头
@@ -552,6 +557,7 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -552,6 +557,7 @@ class NoteBookPageState extends State<NoteBookPage> {
552 if (Utils.isOneDay(day, dateTimeNow!)) return; //日期没变 557 if (Utils.isOneDay(day, dateTimeNow!)) return; //日期没变
553 _refreshPageCalendar(day); 558 _refreshPageCalendar(day);
554 ddateSoltSelect = currTimeIndex.toString(); 559 ddateSoltSelect = currTimeIndex.toString();
  560 + noteBookModel.sellerHideConfiData = [];
555 getMealSectionByDay(); 561 getMealSectionByDay();
556 _reserveCountDay(); 562 _reserveCountDay();
557 } 563 }
@@ -1774,6 +1780,7 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -1774,6 +1780,7 @@ class NoteBookPageState extends State<NoteBookPage> {
1774 dateText = '更多\n日期'; 1780 dateText = '更多\n日期';
1775 }); 1781 });
1776 ddateSoltSelect = currTimeIndex.toString(); 1782 ddateSoltSelect = currTimeIndex.toString();
  1783 + noteBookModel.sellerHideConfiData = [];
1777 getMealSectionByDay(); 1784 getMealSectionByDay();
1778 1785
1779 _reserveCountDay(); 1786 _reserveCountDay();
@@ -1847,6 +1854,8 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -1847,6 +1854,8 @@ class NoteBookPageState extends State<NoteBookPage> {
1847 }); 1854 });
1848 ddateSoltSelect = 1855 ddateSoltSelect =
1849 currTimeIndex.toString(); 1856 currTimeIndex.toString();
  1857 + noteBookModel.sellerHideConfiData =
  1858 + [];
1850 getMealSectionByDay(); 1859 getMealSectionByDay();
1851 1860
1852 _reserveCountDay(); 1861 _reserveCountDay();
@@ -244,7 +244,8 @@ class NoteBookModel extends ChangeNotifier { @@ -244,7 +244,8 @@ class NoteBookModel extends ChangeNotifier {
244 } 244 }
245 245
246 //获取订单统计数目 246 //获取订单统计数目
247 - getReserveCountDay(BuildContext context, Map<String, String?> params) async { 247 + getReserveCountDay(BuildContext context, Map<String, String?> params,
  248 + {DateTime? now}) async {
248 try { 249 try {
249 BaseResp<Map<String, dynamic>?> baseResp = await DioUtil() 250 BaseResp<Map<String, dynamic>?> baseResp = await DioUtil()
250 .request<Map<String, dynamic>>( 251 .request<Map<String, dynamic>>(
@@ -256,6 +257,54 @@ class NoteBookModel extends ChangeNotifier { @@ -256,6 +257,54 @@ class NoteBookModel extends ChangeNotifier {
256 int night = int.parse(baseResp.data!["night"].toString()); 257 int night = int.parse(baseResp.data!["night"].toString());
257 int meal1 = int.parse(baseResp.data!["four"].toString()); 258 int meal1 = int.parse(baseResp.data!["four"].toString());
258 int meal2 = int.parse(baseResp.data!["five"].toString()); 259 int meal2 = int.parse(baseResp.data!["five"].toString());
  260 + if (now != null) {
  261 + print(sellerHideConfiData);
  262 + int limitNum = -1;
  263 + if (sellerHideConfiData!.length > 0) {
  264 + int index = sellerHideConfiData!
  265 + .indexWhere((element) => element.sid == params['sid']);
  266 + if (index != -1) {
  267 + //存在配置
  268 +
  269 + // "str": "3-2"
  270 + // 判断请求的日期是周一到周四还是其他
  271 +
  272 + String str = sellerHideConfiData![index].str ?? '';
  273 +
  274 + List<String> config = str.split('-');
  275 +
  276 + if (now.weekday == 1 ||
  277 + now.weekday == 2 ||
  278 + now.weekday == 3 ||
  279 + now.weekday == 4) {
  280 + //周一到周四
  281 +
  282 + limitNum = int.parse(config[0]);
  283 + } else {
  284 + limitNum = int.parse(config[1]);
  285 + }
  286 + }
  287 + }
  288 +
  289 + if (limitNum != -1) {
  290 + if (morning > limitNum) {
  291 + morning = limitNum;
  292 + }
  293 + if (noon > limitNum) {
  294 + noon = limitNum;
  295 + }
  296 + if (night > limitNum) {
  297 + night = limitNum;
  298 + }
  299 + if (meal1 > limitNum) {
  300 + meal1 = limitNum;
  301 + }
  302 + if (meal2 > limitNum) {
  303 + meal2 = limitNum;
  304 + }
  305 + }
  306 + }
  307 +
259 // UserModel userModel = Provider.of<UserModel>(context, listen: false); 308 // UserModel userModel = Provider.of<UserModel>(context, listen: false);
260 // total = "已订" + (morning + noon + night).toString(); 309 // total = "已订" + (morning + noon + night).toString();
261 // if (userModel.user.morning.isNotEmpty) { 310 // if (userModel.user.morning.isNotEmpty) {
@@ -186,6 +186,8 @@ class TableManagerModelOrReserve with ChangeNotifier { @@ -186,6 +186,8 @@ class TableManagerModelOrReserve with ChangeNotifier {
186 // showLoading = true; 186 // showLoading = true;
187 // } 187 // }
188 188
  189 + sellerHideConfiData = [];
  190 +
189 if (Utils.isBeforeToday(datetime)) { 191 if (Utils.isBeforeToday(datetime)) {
190 await getSellerHideConf( 192 await getSellerHideConf(
191 context, 193 context,