Commit a7260a9592b0af7e4b1ab4fa7335be6e36cfa0ab

Authored by wdn127929
1 parent 0e649f19

包间类型置满 - 按钮点击置满与否时刷新日历包间置满UI未做

@@ -36,7 +36,10 @@ class SellerTableClassEntity extends Object { @@ -36,7 +36,10 @@ class SellerTableClassEntity extends Object {
36 @JsonKey(name: 'cdate') 36 @JsonKey(name: 'cdate')
37 String cdate; 37 String cdate;
38 38
39 - SellerTableClassEntity(this.id,this.sellerid,this.tableid,this.name,this.max,this.low,this.status,this.isFull,this.isorderFull,this.cdate,); 39 + @JsonKey(name: 'fid')
  40 + String fid;
  41 +
  42 + SellerTableClassEntity(this.id,this.sellerid,this.tableid,this.name,this.max,this.low,this.status,this.isFull,this.isorderFull,this.cdate,this.fid);
40 43
41 factory SellerTableClassEntity.fromJson(Map<String, dynamic> srcJson) => _$SellerTableClassEntityFromJson(srcJson); 44 factory SellerTableClassEntity.fromJson(Map<String, dynamic> srcJson) => _$SellerTableClassEntityFromJson(srcJson);
42 45
@@ -9,16 +9,18 @@ part of 'seller_table_class_entity.dart'; @@ -9,16 +9,18 @@ part of 'seller_table_class_entity.dart';
9 SellerTableClassEntity _$SellerTableClassEntityFromJson( 9 SellerTableClassEntity _$SellerTableClassEntityFromJson(
10 Map<String, dynamic> json) { 10 Map<String, dynamic> json) {
11 return SellerTableClassEntity( 11 return SellerTableClassEntity(
12 - json['id'] as String,  
13 - json['sellerid'] as String,  
14 - json['tableid'] as String,  
15 - json['name'] as String,  
16 - json['max'] as String,  
17 - json['low'] as String,  
18 - json['status'] as dynamic,  
19 - json['isFull'] as dynamic,  
20 - json['isorderFull'] as dynamic,  
21 - json['cdate'] as String); 12 + json['id'] as String,
  13 + json['sellerid'] as String,
  14 + json['tableid'] as String,
  15 + json['name'] as String,
  16 + json['max'] as String,
  17 + json['low'] as String,
  18 + json['status'] as dynamic,
  19 + json['isFull'] as dynamic,
  20 + json['isorderFull'] as dynamic,
  21 + json['cdate'] as String,
  22 + json['fid'] as String,
  23 + );
22 } 24 }
23 25
24 Map<String, dynamic> _$SellerTableClassEntityToJson( 26 Map<String, dynamic> _$SellerTableClassEntityToJson(
@@ -31,7 +33,8 @@ Map<String, dynamic> _$SellerTableClassEntityToJson( @@ -31,7 +33,8 @@ Map<String, dynamic> _$SellerTableClassEntityToJson(
31 'max': instance.max, 33 'max': instance.max,
32 'low': instance.low, 34 'low': instance.low,
33 'status': instance.status, 35 'status': instance.status,
34 - 'isFull':instance.isFull,  
35 - 'isorderFull':instance.isorderFull,  
36 - 'cdate': instance.cdate 36 + 'isFull': instance.isFull,
  37 + 'isorderFull': instance.isorderFull,
  38 + 'cdate': instance.cdate,
  39 + 'fid': instance.fid,
37 }; 40 };
  1 +import 'package:json_annotation/json_annotation.dart';
  2 +
  3 +part 'table_fill_up_date_model.g.dart';
  4 +
  5 +
  6 +@JsonSerializable()
  7 + class TableFillUpDateModel extends Object {
  8 +
  9 + @JsonKey(name: 'ret')
  10 + int ret;
  11 +
  12 + @JsonKey(name: 'data')
  13 + List<String> data;
  14 +
  15 + @JsonKey(name: 'msg')
  16 + String msg;
  17 +
  18 + TableFillUpDateModel(this.ret,this.data,this.msg,);
  19 +
  20 + factory TableFillUpDateModel.fromJson(Map<String, dynamic> srcJson) => _$TableFillUpDateModelFromJson(srcJson);
  21 +
  22 + Map<String, dynamic> toJson() => _$TableFillUpDateModelToJson(this);
  23 +
  24 +}
  25 +
  26 +
  1 +// GENERATED CODE - DO NOT MODIFY BY HAND
  2 +
  3 +part of 'table_fill_up_date_model.dart';
  4 +
  5 +// **************************************************************************
  6 +// JsonSerializableGenerator
  7 +// **************************************************************************
  8 +
  9 +TableFillUpDateModel _$TableFillUpDateModelFromJson(Map<String, dynamic> json) {
  10 + return TableFillUpDateModel(
  11 + json['ret'] as int,
  12 + (json['data'] as List)?.map((e) => e as String)?.toList(),
  13 + json['msg'] as String,
  14 + );
  15 +}
  16 +
  17 +Map<String, dynamic> _$TableFillUpDateModelToJson(
  18 + TableFillUpDateModel instance) =>
  19 + <String, dynamic>{
  20 + 'ret': instance.ret,
  21 + 'data': instance.data,
  22 + 'msg': instance.msg,
  23 + };
@@ -126,4 +126,10 @@ class HttpUrl { @@ -126,4 +126,10 @@ class HttpUrl {
126 static const String get_seller_tableclass = 126 static const String get_seller_tableclass =
127 "?service=App.Seller.GetSellerTableClass"; //获取商家包间类型 127 "?service=App.Seller.GetSellerTableClass"; //获取商家包间类型
128 128
  129 + static const String set_table_class_full =
  130 + "?service=App.Seller.SetTableClassFull"; // 在线预订配置-置满包间分类
  131 +
  132 + static const String get_table_fill_update =
  133 + "?service=App.Customer.GetTableFillUpDate"; // 根据指定日期,返回当前商家包间类型置满情况的日期
  134 +
129 } 135 }
@@ -321,7 +321,9 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -321,7 +321,9 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
321 title: "包间类型置满管理", 321 title: "包间类型置满管理",
322 content: "", 322 content: "",
323 callback: () { 323 callback: () {
324 - Utils.goMiniProgramZm(context, "roomtype/roomtype"); 324 + // Utils.goMiniProgramZm(context, "roomtype/roomtype");
  325 + NavigatorUtil.goStoreTypeFillManagePage(context);
  326 +
325 }, 327 },
326 ), 328 ),
327 MyDivider( 329 MyDivider(
@@ -5,6 +5,7 @@ import 'package:one_key/provider/user_model.dart'; @@ -5,6 +5,7 @@ import 'package:one_key/provider/user_model.dart';
5 import 'package:one_key/res/colors.dart'; 5 import 'package:one_key/res/colors.dart';
6 import 'package:one_key/utils/utils.dart'; 6 import 'package:one_key/utils/utils.dart';
7 import 'package:one_key/widgets/h_empty_view.dart'; 7 import 'package:one_key/widgets/h_empty_view.dart';
  8 +import 'package:one_key/widgets/system_app_bar.dart';
8 import 'package:one_key/widgets/v_empty_view.dart'; 9 import 'package:one_key/widgets/v_empty_view.dart';
9 import 'package:provider/provider.dart'; 10 import 'package:provider/provider.dart';
10 import 'package:table_calendar/table_calendar.dart'; 11 import 'package:table_calendar/table_calendar.dart';
@@ -13,11 +14,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -13,11 +14,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
13 import '../../app.dart'; 14 import '../../app.dart';
14 15
15 class StoreTypeFillManagePage extends StatefulWidget { 16 class StoreTypeFillManagePage extends StatefulWidget {
16 - int timeMills; //日期  
17 - int ddate_solt; //时段  
18 -  
19 - StoreTypeFillManagePage({Key key, this.timeMills, this.ddate_solt})  
20 - : super(key: key); 17 + StoreTypeFillManagePage({Key key}) : super(key: key);
21 18
22 @override 19 @override
23 State<StatefulWidget> createState() { 20 State<StatefulWidget> createState() {
@@ -41,6 +38,9 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> { @@ -41,6 +38,9 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
41 38
42 int timeIndex = 0; //当前时段 39 int timeIndex = 0; //当前时段
43 int enableIndex = 0; //最早可用时段 40 int enableIndex = 0; //最早可用时段
  41 + int timeMills;
  42 +
  43 + List<String> fillTimes = [];
44 44
45 //早市,午市,晚市时间段 45 //早市,午市,晚市时间段
46 Map<String, String> daily = {"morning": "", "noon": "", "night": ""}; 46 Map<String, String> daily = {"morning": "", "noon": "", "night": ""};
@@ -49,16 +49,30 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> { @@ -49,16 +49,30 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
49 List<SellerTableClassEntity> tables = []; 49 List<SellerTableClassEntity> tables = [];
50 50
51 //已选包间数量 51 //已选包间数量
52 - Map<int, int> roomNum = {0: 0, 1: 0, 2: 0, 3: 0}; 52 + // Map<int, int> roomNum = {0: 0, 1: 0, 2: 0, 3: 0};
53 53
54 //已选包间下标 54 //已选包间下标
55 - List<int> rooms = []; 55 + // List<int> rooms = [];
56 56
57 //获取店铺详情 57 //获取店铺详情
58 _getStoreDetail() { 58 _getStoreDetail() {
59 _initTime(); 59 _initTime();
60 _currTimeIndex(); 60 _currTimeIndex();
61 _getSellerTableClass(); 61 _getSellerTableClass();
  62 + _getTableFillUpDate();
  63 + }
  64 +
  65 + _getTableFillUpDate() async {
  66 + Map<String, String> params = {
  67 + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  68 + "type": 'month',
  69 + "date":
  70 + "${_selectDateTime.year}-${Utils.addZeroNumber(_selectDateTime.month)}"
  71 + };
  72 + StoreDetailModel detailModel =
  73 + Provider.of<StoreDetailModel>(context, listen: false);
  74 + fillTimes = await detailModel.getTableFillUpDate(context, params);
  75 + setState(() {});
62 } 76 }
63 77
64 //当前选中时间段 78 //当前选中时间段
@@ -90,18 +104,6 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> { @@ -90,18 +104,6 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
90 timeIndex = -1; 104 timeIndex = -1;
91 enableIndex = 3; 105 enableIndex = 3;
92 } 106 }
93 -  
94 - if (widget.timeMills != 0 && widget.ddate_solt != 0) {  
95 - _selectDateTime = DateTime.fromMillisecondsSinceEpoch(widget.timeMills);  
96 - timeIndex = widget.ddate_solt;  
97 - if (!Utils.isOneDay(_selectDateTime, DateTime.now())) {  
98 - //不是今天  
99 - enableIndex = 0;  
100 - }  
101 - widget.timeMills = 0;  
102 - widget.ddate_solt = 0;  
103 - }  
104 -  
105 setState(() {}); 107 setState(() {});
106 } 108 }
107 109
@@ -120,10 +122,8 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> { @@ -120,10 +122,8 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
120 StoreDetailModel detailModel = 122 StoreDetailModel detailModel =
121 Provider.of<StoreDetailModel>(context, listen: false); 123 Provider.of<StoreDetailModel>(context, listen: false);
122 tables = await detailModel.getSellerTableClass(context, params); 124 tables = await detailModel.getSellerTableClass(context, params);
123 - for (int i = 0; i < tables.length; i++) {  
124 - roomNum[i] = 0;  
125 - }  
126 - rooms.clear(); 125 + // tables.any((element) => element.isFull == 1);
  126 + // rooms.clear();
127 setState(() {}); 127 setState(() {});
128 } 128 }
129 129
@@ -134,7 +134,9 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> { @@ -134,7 +134,9 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
134 tables = []; 134 tables = [];
135 _calendarController = CalendarController(); 135 _calendarController = CalendarController();
136 _events = {}; 136 _events = {};
137 - _getStoreDetail(); 137 + WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
  138 + _getStoreDetail();
  139 + });
138 } 140 }
139 141
140 @override 142 @override
@@ -156,80 +158,16 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> { @@ -156,80 +158,16 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
156 daily = {"morning": morning, "noon": noon, "night": night}; 158 daily = {"morning": morning, "noon": noon, "night": night};
157 } 159 }
158 160
159 - //构建已选包间  
160 - _buildSelectRooms() {  
161 - List<Widget> selectRooms = [];  
162 - for (int i in rooms) {  
163 - selectRooms.add(Container(  
164 - margin: EdgeInsets.only(right: ScreenUtil().setWidth(10)),  
165 - child: Stack(  
166 - children: <Widget>[  
167 - Container(  
168 - width: ScreenUtil().setWidth(150),  
169 - height: ScreenUtil().setWidth(70),  
170 - margin: EdgeInsets.only(  
171 - right: ScreenUtil().setWidth(12),  
172 - top: ScreenUtil().setWidth(12)),  
173 - alignment: Alignment.center,  
174 - decoration: BoxDecoration(  
175 - color: MyColours.color_199095,  
176 - border: Border.all(  
177 - color: MyColours.color_199095,  
178 - width: ScreenUtil().setWidth(2)),  
179 - borderRadius:  
180 - BorderRadius.circular(ScreenUtil().setWidth(10))),  
181 - child: Text(  
182 - "${tables[i].name}",  
183 - maxLines: 1,  
184 - overflow: TextOverflow.ellipsis,  
185 - style: TextStyle(  
186 - fontSize: ScreenUtil().setSp(30),  
187 - color: MyColours.color_199095,  
188 - fontWeight: FontWeight.bold,  
189 - ),  
190 - ),  
191 - ),  
192 - Positioned(  
193 - top: 0,  
194 - right: 0,  
195 - child: GestureDetector(  
196 - onTap: () {  
197 - rooms.remove(i);  
198 - roomNum[i]--;  
199 - setState(() {});  
200 - },  
201 - child: Image.asset(  
202 - "assets/icon_clear.png",  
203 - width: ScreenUtil().setWidth(36),  
204 - height: ScreenUtil().setWidth(36),  
205 - ),  
206 - ),  
207 - )  
208 - ],  
209 - ),  
210 - ));  
211 - }  
212 - return selectRooms;  
213 - }  
214 -  
215 //构建时段 161 //构建时段
216 Widget _buildShiduan() { 162 Widget _buildShiduan() {
217 return Container( 163 return Container(
218 padding: EdgeInsets.only( 164 padding: EdgeInsets.only(
219 left: ScreenUtil().setWidth(30), 165 left: ScreenUtil().setWidth(30),
220 - top: ScreenUtil().setWidth(80), 166 + top: ScreenUtil().setWidth(60),
221 right: ScreenUtil().setWidth(30)), 167 right: ScreenUtil().setWidth(30)),
222 child: Column( 168 child: Column(
223 crossAxisAlignment: CrossAxisAlignment.start, 169 crossAxisAlignment: CrossAxisAlignment.start,
224 children: <Widget>[ 170 children: <Widget>[
225 - Text(  
226 - "预订时段",  
227 - style: TextStyle(  
228 - fontSize: ScreenUtil().setSp(36),  
229 - color: MyColours.color_333333,  
230 - fontWeight: FontWeight.bold),  
231 - ),  
232 - VEmptyView(30),  
233 Stack( 171 Stack(
234 children: <Widget>[ 172 children: <Widget>[
235 Container( 173 Container(
@@ -439,6 +377,11 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> { @@ -439,6 +377,11 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
439 //解析返回显示的日期 377 //解析返回显示的日期
440 _parseDateDay(DateTime dateTime) { 378 _parseDateDay(DateTime dateTime) {
441 DateTime now = DateTime.now(); 379 DateTime now = DateTime.now();
  380 + String dateTimeStr =
  381 + "${dateTime.year}-${Utils.addZeroNumber(dateTime.month)}-${Utils.addZeroNumber(dateTime.day)}";
  382 + if (fillTimes.length > 0 && fillTimes.contains(dateTimeStr)) {
  383 + return "置";
  384 + }
442 if (Utils.isOneDay(dateTime, now)) { 385 if (Utils.isOneDay(dateTime, now)) {
443 return "今"; 386 return "今";
444 } else if (Utils.isOneDay(dateTime, now.add(Duration(days: 1)))) { 387 } else if (Utils.isOneDay(dateTime, now.add(Duration(days: 1)))) {
@@ -454,10 +397,15 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> { @@ -454,10 +397,15 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
454 Widget build(BuildContext context) { 397 Widget build(BuildContext context) {
455 userModel = Provider.of<UserModel>(context, listen: false); 398 userModel = Provider.of<UserModel>(context, listen: false);
456 return Scaffold( 399 return Scaffold(
  400 + appBar: SystemAppBar(
  401 + userModel.user.sellername,
  402 + onTap: () {
  403 + Navigator.pop(context);
  404 + },
  405 + ),
457 body: Consumer<StoreDetailModel>( 406 body: Consumer<StoreDetailModel>(
458 builder: (context, model, child) { 407 builder: (context, model, child) {
459 - Widget widget = Container();  
460 - Container( 408 + return Container(
461 width: double.infinity, 409 width: double.infinity,
462 height: double.infinity, 410 height: double.infinity,
463 color: MyColours.color_ffffff, 411 color: MyColours.color_ffffff,
@@ -484,14 +432,13 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> { @@ -484,14 +432,13 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
484 availableGestures: AvailableGestures.none, 432 availableGestures: AvailableGestures.none,
485 events: _events, 433 events: _events,
486 locale: "zh_CN", 434 locale: "zh_CN",
487 - initialCalendarFormat:  
488 - CalendarFormat.twoWeeks, 435 + initialCalendarFormat: CalendarFormat.month,
489 headerStyle: HeaderStyle( 436 headerStyle: HeaderStyle(
490 decoration: BoxDecoration( 437 decoration: BoxDecoration(
491 color: MyColours.color_F9F9F9), 438 color: MyColours.color_F9F9F9),
492 headerPadding: EdgeInsets.zero, 439 headerPadding: EdgeInsets.zero,
493 formatButtonVisible: false, 440 formatButtonVisible: false,
494 - centerHeaderTitle: true, 441 + centerHeaderTitle: false,
495 titleTextBuilder: (dateTime, _) { 442 titleTextBuilder: (dateTime, _) {
496 return dateTime.year.toString() + 443 return dateTime.year.toString() +
497 "年-" + 444 "年-" +
@@ -652,32 +599,12 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> { @@ -652,32 +599,12 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
652 width: double.infinity, 599 width: double.infinity,
653 padding: EdgeInsets.only( 600 padding: EdgeInsets.only(
654 left: ScreenUtil().setWidth(30), 601 left: ScreenUtil().setWidth(30),
655 - top: ScreenUtil().setWidth(48), 602 + top: ScreenUtil().setWidth(20),
656 right: ScreenUtil().setWidth(30)), 603 right: ScreenUtil().setWidth(30)),
657 child: Column( 604 child: Column(
658 crossAxisAlignment: CrossAxisAlignment.start, 605 crossAxisAlignment: CrossAxisAlignment.start,
659 children: <Widget>[ 606 children: <Widget>[
660 - Container(  
661 - height: ScreenUtil().setWidth(82),  
662 - child: Row(  
663 - crossAxisAlignment:  
664 - CrossAxisAlignment.end,  
665 - children: <Widget>[  
666 - Text(  
667 - "选择包间",  
668 - style: TextStyle(  
669 - fontSize: ScreenUtil().setSp(36),  
670 - color: MyColours.color_333333,  
671 - fontWeight: FontWeight.bold),  
672 - ),  
673 - HEmptyView(24),  
674 - Wrap(  
675 - children: _buildSelectRooms(),  
676 - )  
677 - ],  
678 - ),  
679 - ),  
680 - VEmptyView(30), 607 + VEmptyView(60),
681 Selector<StoreDetailModel, 608 Selector<StoreDetailModel,
682 List<SellerTableClassEntity>>( 609 List<SellerTableClassEntity>>(
683 shouldRebuild: (pre, next) => true, 610 shouldRebuild: (pre, next) => true,
@@ -695,39 +622,57 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> { @@ -695,39 +622,57 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
695 itemBuilder: (context, index) { 622 itemBuilder: (context, index) {
696 return GestureDetector( 623 return GestureDetector(
697 onTap: () { 624 onTap: () {
698 - if (tables[index]  
699 - .status  
700 - .toString() ==  
701 - "0") return;  
702 - if ((tables[index]  
703 - .status  
704 - .toString() ==  
705 - "1" &&  
706 - ((tables[index].isFull !=  
707 - null &&  
708 - tables[index]  
709 - .isFull  
710 - .toString() ==  
711 - "1") ||  
712 - (tables[index]  
713 - .isorderFull !=  
714 - null &&  
715 - tables[index]  
716 - .isorderFull  
717 - .toString() ==  
718 - "1")))) return;  
719 - int selectNum = 0;  
720 - roomNum.forEach((index, value) {  
721 - selectNum += value;  
722 - });  
723 - if (selectNum >= 3) {  
724 - Utils.showToast("最多可选3个包间");  
725 - return; 625 + // if (tables[index]
  626 + // .status
  627 + // .toString() ==
  628 + // "0") return;
  629 + // if ((tables[index]
  630 + // .status
  631 + // .toString() ==
  632 + // "1" &&
  633 + // ((tables[index].isFull !=
  634 + // null &&
  635 + // tables[index]
  636 + // .isFull
  637 + // .toString() ==
  638 + // "1") ||
  639 + // (tables[index]
  640 + // .isorderFull !=
  641 + // null &&
  642 + // tables[index]
  643 + // .isorderFull
  644 + // .toString() ==
  645 + // "1")))) return;
  646 + // int selectNum = 0;
  647 + // roomNum.forEach((index, value) {
  648 + // selectNum += value;
  649 + // });
  650 + // if (selectNum >= 3) {
  651 + // Utils.showToast("最多可选3个包间");
  652 + // return;
  653 + // }
  654 + // setState(() {
  655 + // roomNum[index]++;
  656 + // rooms.add(index);
  657 + // });
  658 + Map<String, String> params = {
  659 + "classid": tables[index].id,
  660 + "day": (DateTime.parse(
  661 + "${_selectDateTime.year}-${Utils.addZeroNumber(_selectDateTime.month)}-${Utils.addZeroNumber(_selectDateTime.day)} 00:00:00")
  662 + .millisecondsSinceEpoch /
  663 + 1000)
  664 + .floor()
  665 + .toString(),
  666 + "interval":
  667 + (timeIndex + 1).toString()
  668 + };
  669 + if (tables[index].isFull == 1 &&
  670 + tables[index].fid != null) {
  671 + params['id'] =
  672 + tables[index].fid;
726 } 673 }
727 - setState(() {  
728 - roomNum[index]++;  
729 - rooms.add(index);  
730 - }); 674 + model.setTableClassFull(
  675 + context, params, index);
731 }, 676 },
732 child: Stack( 677 child: Stack(
733 children: <Widget>[ 678 children: <Widget>[
@@ -750,12 +695,8 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> { @@ -750,12 +695,8 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
750 ScreenUtil() 695 ScreenUtil()
751 .setWidth(10)), 696 .setWidth(10)),
752 border: Border.all( 697 border: Border.all(
753 - color: roomNum[index] >  
754 - 0  
755 - ? MyColours  
756 - .color_199095  
757 - : MyColours  
758 - .color_cccccc, 698 + color: MyColours
  699 + .color_cccccc,
759 width: ScreenUtil() 700 width: ScreenUtil()
760 .setWidth(2)), 701 .setWidth(2)),
761 ), 702 ),
@@ -824,7 +765,10 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> { @@ -824,7 +765,10 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
824 Positioned( 765 Positioned(
825 right: 0, 766 right: 0,
826 top: 0, 767 top: 0,
827 - child: roomNum[index] > 0 768 + child: tables[index].isFull !=
  769 + null &&
  770 + tables[index].isFull >
  771 + 0
828 ? Container( 772 ? Container(
829 width: ScreenUtil() 773 width: ScreenUtil()
830 .setWidth(92), 774 .setWidth(92),
@@ -835,14 +779,7 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> { @@ -835,14 +779,7 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
835 decoration: 779 decoration:
836 BoxDecoration( 780 BoxDecoration(
837 color: MyColours 781 color: MyColours
838 - .color_F4FAFF,  
839 - border: Border.all(  
840 - color: MyColours  
841 - .color_199095,  
842 - width:  
843 - ScreenUtil()  
844 - .setWidth(  
845 - 2)), 782 + .color_dfdfdf,
846 borderRadius: BorderRadius.only( 783 borderRadius: BorderRadius.only(
847 topRight: Radius.circular( 784 topRight: Radius.circular(
848 ScreenUtil() 785 ScreenUtil()
@@ -854,71 +791,18 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> { @@ -854,71 +791,18 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
854 10))), 791 10))),
855 ), 792 ),
856 child: Text( 793 child: Text(
857 - "已选${roomNum[index]}", 794 + "置满",
858 style: TextStyle( 795 style: TextStyle(
859 - fontSize:  
860 - ScreenUtil()  
861 - .setSp(  
862 - 24),  
863 - color: MyColours  
864 - .color_199095),  
865 - ),  
866 - ) 796 + fontSize:
  797 + ScreenUtil()
  798 + .setSp(
  799 + 24),
  800 + color: MyColours
  801 + .color_333333,
  802 + ),
  803 + ))
867 : Container(), 804 : Container(),
868 ), 805 ),
869 - (tables[index]  
870 - .status  
871 - .toString() ==  
872 - "1" &&  
873 - ((tables[index].isFull !=  
874 - null &&  
875 - tables[index]  
876 - .isFull  
877 - .toString() ==  
878 - "1") ||  
879 - (tables[index]  
880 - .isorderFull !=  
881 - null &&  
882 - tables[index]  
883 - .isorderFull  
884 - .toString() ==  
885 - "1")))  
886 - ? Positioned(  
887 - right: 0,  
888 - bottom: 0,  
889 - child: Container(  
890 - width: ScreenUtil()  
891 - .setWidth(90),  
892 - height: ScreenUtil()  
893 - .setWidth(76),  
894 - child: Container(  
895 - child: Text(  
896 - "订满",  
897 - style: TextStyle(  
898 - color: MyColours  
899 - .color_999999,  
900 - fontSize:  
901 - ScreenUtil()  
902 - .setSp(  
903 - 24)),  
904 - ),  
905 - margin: EdgeInsets.only(  
906 - left: ScreenUtil()  
907 - .setWidth(  
908 - 28),  
909 - top: ScreenUtil()  
910 - .setWidth(  
911 - 28)),  
912 - ),  
913 - decoration: BoxDecoration(  
914 - image: DecorationImage(  
915 - image: AssetImage(  
916 - "assets/icon_man.png"),  
917 - fit: BoxFit  
918 - .cover)),  
919 - ),  
920 - )  
921 - : Container()  
922 ], 806 ],
923 ), 807 ),
924 ); 808 );
@@ -938,57 +822,8 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> { @@ -938,57 +822,8 @@ class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
938 ), 822 ),
939 ), 823 ),
940 ), 824 ),
941 - Offstage(  
942 - offstage: enableIndex > 2,  
943 - child: Container(  
944 - height: ScreenUtil().setWidth(116),  
945 - alignment: Alignment.center,  
946 - decoration: BoxDecoration(  
947 - color: MyColours.color_ffffff,  
948 - boxShadow: [  
949 - BoxShadow(  
950 - color: MyColours.color_EEF0F2,  
951 - blurRadius: ScreenUtil().setWidth(8))  
952 - ]),  
953 - child: GestureDetector(  
954 - onTap: () {  
955 - if (rooms.length <= 0) {  
956 - Utils.showToast("请选择包间");  
957 - return;  
958 - }  
959 - },  
960 - child: Container(  
961 - width: ScreenUtil().setWidth(670),  
962 - height: ScreenUtil().setWidth(84),  
963 - decoration: rooms.length > 0  
964 - ? BoxDecoration(  
965 - gradient: LinearGradient(colors: [  
966 - MyColours.color_2bb5b7,  
967 - MyColours.color_199095  
968 - ]),  
969 - borderRadius: BorderRadius.circular(  
970 - ScreenUtil().setWidth(44)),  
971 - )  
972 - : BoxDecoration(  
973 - color: MyColours.color_cccccc,  
974 - borderRadius: BorderRadius.circular(  
975 - ScreenUtil().setWidth(44)),  
976 - ),  
977 - alignment: Alignment.center,  
978 - child: Text(  
979 - "选好了",  
980 - style: TextStyle(  
981 - fontSize: ScreenUtil().setSp(36),  
982 - color: MyColours.color_ffffff,  
983 - fontWeight: FontWeight.bold),  
984 - ),  
985 - ),  
986 - ),  
987 - ),  
988 - )  
989 ], 825 ],
990 )); 826 ));
991 - return widget;  
992 }, 827 },
993 ), 828 ),
994 ); 829 );
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:one_key/constant/constant.dart'; 2 import 'package:one_key/constant/constant.dart';
3 import 'package:one_key/models/seller_table_class_entity.dart'; 3 import 'package:one_key/models/seller_table_class_entity.dart';
  4 +import 'package:one_key/models/table_fill_up_date_model.dart';
4 import 'package:one_key/net/base_resp.dart'; 5 import 'package:one_key/net/base_resp.dart';
5 import 'package:one_key/net/dio_util.dart'; 6 import 'package:one_key/net/dio_util.dart';
6 import 'package:one_key/net/http_url.dart'; 7 import 'package:one_key/net/http_url.dart';
@@ -17,40 +18,71 @@ class StoreDetailModel with ChangeNotifier { @@ -17,40 +18,71 @@ class StoreDetailModel with ChangeNotifier {
17 //获取商家包间类型 18 //获取商家包间类型
18 Future<List<SellerTableClassEntity>> getSellerTableClass( 19 Future<List<SellerTableClassEntity>> getSellerTableClass(
19 BuildContext context, Map<String, String> params) async { 20 BuildContext context, Map<String, String> params) async {
20 -// pageState=PageState.Loading;  
21 -// notifyListeners();  
22 BaseResp<List> baseResp = await DioUtil() 21 BaseResp<List> baseResp = await DioUtil()
23 .request<List>(context, Method.get, HttpUrl.get_seller_tableclass, 22 .request<List>(context, Method.get, HttpUrl.get_seller_tableclass,
24 data: params, showLoading: false) 23 data: params, showLoading: false)
25 .catchError((error) { 24 .catchError((error) {
26 print(error.toString()); 25 print(error.toString());
27 -// if(error is MyError){  
28 -// switch(error.type){  
29 -// case 1:  
30 -// pageState=PageState.ConnectivityError;  
31 -// break;  
32 -// case 2:  
33 -// pageState=PageState.ConnectivityTimeOut;  
34 -// break;  
35 -// default:  
36 -// pageState=PageState.ConnectivityError;  
37 -// break;  
38 -// }  
39 -// }  
40 -// notifyListeners();  
41 }); 26 });
42 if (baseResp != null && baseResp.code == Constant.status_success) { 27 if (baseResp != null && baseResp.code == Constant.status_success) {
43 tables.clear(); 28 tables.clear();
44 tables.addAll(baseResp.data.map<SellerTableClassEntity>((value) { 29 tables.addAll(baseResp.data.map<SellerTableClassEntity>((value) {
45 return SellerTableClassEntity.fromJson(value); 30 return SellerTableClassEntity.fromJson(value);
46 }).toList()); 31 }).toList());
47 -// pageState=PageState.Success;  
48 } else { 32 } else {
49 tables.clear(); 33 tables.clear();
50 -// pageState=PageState.ConnectivityError;  
51 Utils.showToast(baseResp.msg ?? ""); 34 Utils.showToast(baseResp.msg ?? "");
52 } 35 }
53 notifyListeners(); 36 notifyListeners();
54 return tables; 37 return tables;
55 } 38 }
  39 +
  40 + //在线预订配置-置满包间分类
  41 + Future<bool> setTableClassFull(
  42 + BuildContext context, Map<String, String> params, int index) async {
  43 + BaseResp<dynamic> baseResp = await DioUtil()
  44 + .request<dynamic>(context, Method.get, HttpUrl.set_table_class_full,
  45 + data: params, showLoading: false)
  46 + .catchError((error) {
  47 + print(error.toString());
  48 + });
  49 + if (baseResp != null && baseResp.code == Constant.status_success) {
  50 + if (params.containsKey('id')) {
  51 + if (baseResp.data == true) {
  52 + tables[index].isFull = null;
  53 + tables[index].fid = null;
  54 + }
  55 + } else {
  56 + if (baseResp.data != null) {
  57 + tables[index].isFull = 1;
  58 + tables[index].fid = baseResp.data;
  59 + }
  60 + }
  61 + notifyListeners();
  62 + } else {
  63 + Utils.showToast(baseResp.msg ?? "");
  64 + }
  65 + return false;
  66 + }
  67 +
  68 +// 根据指定日期,返回当前商家包间类型置满情况的日期
  69 + Future<List<String>> getTableFillUpDate(
  70 + BuildContext context, Map<String, String> params) async {
  71 + BaseResp<List> baseResp = await DioUtil()
  72 + .request<List>(context, Method.get, HttpUrl.get_table_fill_update,
  73 + data: params, showLoading: false)
  74 + .catchError((error) {
  75 + print(error.toString());
  76 + });
  77 + List<String> fillTimes = []; //置满的时间 2020-11-01
  78 + if (baseResp != null && baseResp.code == Constant.status_success) {
  79 + if (baseResp.data.length > 0) {
  80 + fillTimes = TableFillUpDateModel.fromJson(baseResp.responseData).data;
  81 + }
  82 + } else {
  83 + Utils.showToast(baseResp.msg ?? "");
  84 + }
  85 +
  86 + return fillTimes;
  87 + }
56 } 88 }
@@ -334,4 +334,11 @@ class NavigatorUtil { @@ -334,4 +334,11 @@ class NavigatorUtil {
334 "${Routes.statistics_sms_page}?selectData=${FluroConvertUtils.object2string(selectData)}", 334 "${Routes.statistics_sms_page}?selectData=${FluroConvertUtils.object2string(selectData)}",
335 replace: replace); 335 replace: replace);
336 } 336 }
  337 +
  338 + /// 包间类型置满
  339 + static Future<dynamic> goStoreTypeFillManagePage(BuildContext context,
  340 + {replace = false}) {
  341 + return _navigateTo(context, "${Routes.store_type_fill_manage_page}",
  342 + replace: replace);
  343 + }
337 } 344 }