Commit 0e649f199095c17de3e394dcba0b3bafbeaada94

Authored by wdn127929
1 parent 08dca753

包间置满管理UI

@@ -11,14 +11,14 @@ if (flutterRoot == null) { @@ -11,14 +11,14 @@ if (flutterRoot == null) {
11 throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 11 throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 } 12 }
13 13
14 -def flutterVersionCode = "295" 14 +def flutterVersionCode = "296"
15 if (flutterVersionCode == null) { 15 if (flutterVersionCode == null) {
16 - flutterVersionCode = '295' 16 + flutterVersionCode = '296'
17 } 17 }
18 18
19 -def flutterVersionName = "2.9.5" 19 +def flutterVersionName = "2.9.6"
20 if (flutterVersionName == null) { 20 if (flutterVersionName == null) {
21 - flutterVersionName = '2.9.5' 21 + flutterVersionName = '2.9.6'
22 } 22 }
23 23
24 apply plugin: 'com.android.application' 24 apply plugin: 'com.android.application'
  1 +import 'package:json_annotation/json_annotation.dart';
  2 +
  3 +part 'seller_table_class_entity.g.dart';
  4 +
  5 +
  6 +@JsonSerializable()
  7 +class SellerTableClassEntity extends Object {
  8 +
  9 + @JsonKey(name: 'id')
  10 + String id;
  11 +
  12 + @JsonKey(name: 'sellerid')
  13 + String sellerid;
  14 +
  15 + @JsonKey(name: 'tableid')
  16 + String tableid;
  17 +
  18 + @JsonKey(name: 'name')
  19 + String name;
  20 +
  21 + @JsonKey(name: 'max')
  22 + String max;
  23 +
  24 + @JsonKey(name: 'low')
  25 + String low;
  26 +
  27 + @JsonKey(name: 'status')
  28 + dynamic status;
  29 +
  30 + @JsonKey(name: 'isFull')
  31 + dynamic isFull;//1 置满
  32 +
  33 + @JsonKey(name: 'isorderFull')
  34 + dynamic isorderFull;//1 订满
  35 +
  36 + @JsonKey(name: 'cdate')
  37 + String cdate;
  38 +
  39 + SellerTableClassEntity(this.id,this.sellerid,this.tableid,this.name,this.max,this.low,this.status,this.isFull,this.isorderFull,this.cdate,);
  40 +
  41 + factory SellerTableClassEntity.fromJson(Map<String, dynamic> srcJson) => _$SellerTableClassEntityFromJson(srcJson);
  42 +
  43 + Map<String, dynamic> toJson() => _$SellerTableClassEntityToJson(this);
  44 +
  45 +}
  46 +
  47 +
  1 +// GENERATED CODE - DO NOT MODIFY BY HAND
  2 +
  3 +part of 'seller_table_class_entity.dart';
  4 +
  5 +// **************************************************************************
  6 +// JsonSerializableGenerator
  7 +// **************************************************************************
  8 +
  9 +SellerTableClassEntity _$SellerTableClassEntityFromJson(
  10 + Map<String, dynamic> json) {
  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);
  22 +}
  23 +
  24 +Map<String, dynamic> _$SellerTableClassEntityToJson(
  25 + SellerTableClassEntity instance) =>
  26 + <String, dynamic>{
  27 + 'id': instance.id,
  28 + 'sellerid': instance.sellerid,
  29 + 'tableid': instance.tableid,
  30 + 'name': instance.name,
  31 + 'max': instance.max,
  32 + 'low': instance.low,
  33 + 'status': instance.status,
  34 + 'isFull':instance.isFull,
  35 + 'isorderFull':instance.isorderFull,
  36 + 'cdate': instance.cdate
  37 + };
@@ -123,4 +123,7 @@ class HttpUrl { @@ -123,4 +123,7 @@ class HttpUrl {
123 static const String get_statistics_list = 123 static const String get_statistics_list =
124 "?service=App.Reserve.ReserveStatistics"; //App订单统计 124 "?service=App.Reserve.ReserveStatistics"; //App订单统计
125 125
  126 + static const String get_seller_tableclass =
  127 + "?service=App.Seller.GetSellerTableClass"; //获取商家包间类型
  128 +
126 } 129 }
  1 +import 'package:flutter/material.dart';
  2 +import 'package:one_key/models/seller_table_class_entity.dart';
  3 +import 'package:one_key/provider/store_detail_model.dart';
  4 +import 'package:one_key/provider/user_model.dart';
  5 +import 'package:one_key/res/colors.dart';
  6 +import 'package:one_key/utils/utils.dart';
  7 +import 'package:one_key/widgets/h_empty_view.dart';
  8 +import 'package:one_key/widgets/v_empty_view.dart';
  9 +import 'package:provider/provider.dart';
  10 +import 'package:table_calendar/table_calendar.dart';
  11 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  12 +
  13 +import '../../app.dart';
  14 +
  15 +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);
  21 +
  22 + @override
  23 + State<StatefulWidget> createState() {
  24 + // TODO: implement createState
  25 + return StoreTypeFillManagePageState();
  26 + }
  27 +}
  28 +
  29 +class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
  30 + CalendarController _calendarController;
  31 +
  32 + Map<DateTime, List> _events;
  33 +
  34 + DateTime _selectDateTime = DateTime.now();
  35 +
  36 + UserModel userModel;
  37 + DateTime dateTimeNow; //当前日期
  38 + String morning; //早市时间段
  39 + String noon; //午市时间段
  40 + String night; //晚市时间段
  41 +
  42 + int timeIndex = 0; //当前时段
  43 + int enableIndex = 0; //最早可用时段
  44 +
  45 + //早市,午市,晚市时间段
  46 + Map<String, String> daily = {"morning": "", "noon": "", "night": ""};
  47 +
  48 + //包间
  49 + List<SellerTableClassEntity> tables = [];
  50 +
  51 + //已选包间数量
  52 + Map<int, int> roomNum = {0: 0, 1: 0, 2: 0, 3: 0};
  53 +
  54 + //已选包间下标
  55 + List<int> rooms = [];
  56 +
  57 + //获取店铺详情
  58 + _getStoreDetail() {
  59 + _initTime();
  60 + _currTimeIndex();
  61 + _getSellerTableClass();
  62 + }
  63 +
  64 + //当前选中时间段
  65 + _currTimeIndex() {
  66 + DateTime now = DateTime.now();
  67 + String ymd =
  68 + "${_selectDateTime.year}-${Utils.addZeroNumber(_selectDateTime.month)}-${Utils.addZeroNumber(_selectDateTime.day)} ";
  69 + DateTime morningStart =
  70 + DateTime.parse("$ymd${daily['morning'].split('-')[0]}:00");
  71 + DateTime morningEnd =
  72 + DateTime.parse("$ymd${daily['morning'].split('-')[1]}:00");
  73 + DateTime noonStart =
  74 + DateTime.parse("$ymd${daily['noon'].split('-')[0]}:00");
  75 + DateTime noonEnd = DateTime.parse("$ymd${daily['noon'].split('-')[1]}:00");
  76 + DateTime nightStart =
  77 + DateTime.parse("$ymd${daily['night'].split('-')[0]}:00");
  78 + DateTime nightEnd =
  79 + DateTime.parse("$ymd${daily['night'].split('-')[1]}:00");
  80 + if (daily["morning"] != "00:00-00:00" && now.isBefore(morningEnd)) {
  81 + timeIndex = 0;
  82 + enableIndex = 0;
  83 + } else if (daily["noon"] != "00:00-00:00" && now.isBefore(noonEnd)) {
  84 + timeIndex = 1;
  85 + enableIndex = 1;
  86 + } else if (daily["night"] != "00:00-00:00" && now.isBefore(nightEnd)) {
  87 + timeIndex = 2;
  88 + enableIndex = 2;
  89 + } else {
  90 + timeIndex = -1;
  91 + enableIndex = 3;
  92 + }
  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(() {});
  106 + }
  107 +
  108 + //获取商家包间类型
  109 + _getSellerTableClass() async {
  110 + Map<String, String> params = {
  111 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  112 + "day": (DateTime.parse(
  113 + "${_selectDateTime.year}-${Utils.addZeroNumber(_selectDateTime.month)}-${Utils.addZeroNumber(_selectDateTime.day)} 00:00:00")
  114 + .millisecondsSinceEpoch /
  115 + 1000)
  116 + .floor()
  117 + .toString(),
  118 + "interval": (timeIndex + 1).toString()
  119 + };
  120 + StoreDetailModel detailModel =
  121 + Provider.of<StoreDetailModel>(context, listen: false);
  122 + tables = await detailModel.getSellerTableClass(context, params);
  123 + for (int i = 0; i < tables.length; i++) {
  124 + roomNum[i] = 0;
  125 + }
  126 + rooms.clear();
  127 + setState(() {});
  128 + }
  129 +
  130 + @override
  131 + void initState() {
  132 + // TODO: implement initState
  133 + super.initState();
  134 + tables = [];
  135 + _calendarController = CalendarController();
  136 + _events = {};
  137 + _getStoreDetail();
  138 + }
  139 +
  140 + @override
  141 + void dispose() {
  142 + // TODO: implement dispose
  143 + _calendarController.dispose();
  144 + super.dispose();
  145 + }
  146 +
  147 + //初始化时间
  148 + _initTime() {
  149 + dateTimeNow = DateTime.now();
  150 +
  151 + morning =
  152 + userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning;
  153 + noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon;
  154 + night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night;
  155 +
  156 + daily = {"morning": morning, "noon": noon, "night": night};
  157 + }
  158 +
  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 + //构建时段
  216 + Widget _buildShiduan() {
  217 + return Container(
  218 + padding: EdgeInsets.only(
  219 + left: ScreenUtil().setWidth(30),
  220 + top: ScreenUtil().setWidth(80),
  221 + right: ScreenUtil().setWidth(30)),
  222 + child: Column(
  223 + crossAxisAlignment: CrossAxisAlignment.start,
  224 + 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(
  234 + children: <Widget>[
  235 + Container(
  236 + height: ScreenUtil().setWidth(90),
  237 + width: ScreenUtil().setWidth(690),
  238 + decoration: BoxDecoration(
  239 + color: MyColours.color_ffffff,
  240 + border: Border.all(
  241 + color: MyColours.color_cccccc,
  242 + width: ScreenUtil().setWidth(2)),
  243 + borderRadius:
  244 + BorderRadius.circular(ScreenUtil().setWidth(10))),
  245 + ),
  246 + Container(
  247 + height: ScreenUtil().setWidth(90),
  248 + width: ScreenUtil().setWidth(690),
  249 + child: Flex(
  250 + direction: Axis.horizontal,
  251 + children: <Widget>[
  252 + Expanded(
  253 + flex: daily["morning"] == "00:00-00:00" ? 0 : 1,
  254 + child: daily["morning"] == "00:00-00:00"
  255 + ? Container()
  256 + : GestureDetector(
  257 + onTap: () {
  258 + if (enableIndex > 0) return;
  259 + if (timeIndex == 0) return;
  260 + setState(() {
  261 + timeIndex = 0;
  262 + _getSellerTableClass();
  263 + });
  264 + },
  265 + child: Container(
  266 + height: ScreenUtil().setWidth(90),
  267 + decoration: timeIndex == 0
  268 + ? BoxDecoration(
  269 + color: MyColours.color_F4FAFF,
  270 + border: Border.all(
  271 + color: MyColours.color_199095,
  272 + width: ScreenUtil().setWidth(2)),
  273 + borderRadius: BorderRadius.all(
  274 + Radius.circular(
  275 + ScreenUtil().setWidth(10))))
  276 + : BoxDecoration(),
  277 + alignment: Alignment.center,
  278 + child: Column(
  279 + mainAxisSize: MainAxisSize.min,
  280 + children: <Widget>[
  281 + Text(
  282 + "早餐",
  283 + style: TextStyle(
  284 + fontSize: ScreenUtil().setSp(30),
  285 + color: enableIndex > 0
  286 + ? MyColours.color_999999
  287 + : timeIndex == 0
  288 + ? MyColours.color_199095
  289 + : MyColours.color_333333,
  290 + fontWeight: timeIndex == 0
  291 + ? FontWeight.bold
  292 + : FontWeight.normal),
  293 + ),
  294 + Text(
  295 + "${daily["morning"]}",
  296 + style: TextStyle(
  297 + fontSize: ScreenUtil().setSp(24),
  298 + color: enableIndex > 0
  299 + ? MyColours.color_999999
  300 + : timeIndex == 0
  301 + ? MyColours.color_199095
  302 + : MyColours.color_333333,
  303 + fontWeight: timeIndex == 0
  304 + ? FontWeight.bold
  305 + : FontWeight.normal),
  306 + )
  307 + ],
  308 + ),
  309 + ),
  310 + )),
  311 + Expanded(
  312 + flex: daily["noon"] == "00:00-00:00" ? 0 : 1,
  313 + child: daily["noon"] == "00:00-00:00"
  314 + ? Container()
  315 + : GestureDetector(
  316 + onTap: () {
  317 + if (enableIndex > 1) return;
  318 + if (timeIndex == 1) return;
  319 + setState(() {
  320 + timeIndex = 1;
  321 + _getSellerTableClass();
  322 + });
  323 + },
  324 + child: Container(
  325 + height: ScreenUtil().setWidth(90),
  326 + decoration: timeIndex == 1
  327 + ? BoxDecoration(
  328 + color: MyColours.color_F4FAFF,
  329 + border: Border.all(
  330 + color: MyColours.color_199095,
  331 + width: ScreenUtil().setWidth(2)),
  332 + borderRadius: BorderRadius.all(
  333 + Radius.circular(
  334 + ScreenUtil().setWidth(10))))
  335 + : BoxDecoration(),
  336 + alignment: Alignment.center,
  337 + child: Column(
  338 + mainAxisSize: MainAxisSize.min,
  339 + children: <Widget>[
  340 + Text(
  341 + "午餐",
  342 + style: TextStyle(
  343 + fontSize: ScreenUtil().setSp(30),
  344 + color: enableIndex > 1
  345 + ? MyColours.color_999999
  346 + : timeIndex == 1
  347 + ? MyColours.color_199095
  348 + : MyColours.color_333333,
  349 + fontWeight: timeIndex == 1
  350 + ? FontWeight.bold
  351 + : FontWeight.normal),
  352 + ),
  353 + Text(
  354 + "${daily["noon"]}",
  355 + style: TextStyle(
  356 + fontSize: ScreenUtil().setSp(24),
  357 + color: enableIndex > 1
  358 + ? MyColours.color_999999
  359 + : timeIndex == 1
  360 + ? MyColours.color_199095
  361 + : MyColours.color_333333,
  362 + fontWeight: timeIndex == 1
  363 + ? FontWeight.bold
  364 + : FontWeight.normal),
  365 + )
  366 + ],
  367 + ),
  368 + ),
  369 + )),
  370 + Expanded(
  371 + flex: daily["night"] == "00:00-00:00" ? 0 : 1,
  372 + child: daily["night"] == "00:00-00:00"
  373 + ? Container()
  374 + : GestureDetector(
  375 + onTap: () {
  376 + if (enableIndex > 2) return;
  377 + if (timeIndex == 2) return;
  378 + setState(() {
  379 + timeIndex = 2;
  380 + _getSellerTableClass();
  381 + });
  382 + },
  383 + child: Container(
  384 + height: ScreenUtil().setWidth(90),
  385 + decoration: timeIndex == 2
  386 + ? BoxDecoration(
  387 + color: MyColours.color_F4FAFF,
  388 + border: Border.all(
  389 + color: MyColours.color_199095,
  390 + width: ScreenUtil().setWidth(2)),
  391 + borderRadius: BorderRadius.all(
  392 + Radius.circular(
  393 + ScreenUtil().setWidth(10))))
  394 + : BoxDecoration(),
  395 + alignment: Alignment.center,
  396 + child: Column(
  397 + mainAxisSize: MainAxisSize.min,
  398 + children: <Widget>[
  399 + Text(
  400 + "晚餐",
  401 + style: TextStyle(
  402 + fontSize: ScreenUtil().setSp(30),
  403 + color: enableIndex > 2
  404 + ? MyColours.color_999999
  405 + : timeIndex == 2
  406 + ? MyColours.color_199095
  407 + : MyColours.color_333333,
  408 + fontWeight: timeIndex == 2
  409 + ? FontWeight.bold
  410 + : FontWeight.normal),
  411 + ),
  412 + Text(
  413 + "${daily["night"]}",
  414 + style: TextStyle(
  415 + fontSize: ScreenUtil().setSp(24),
  416 + color: enableIndex > 2
  417 + ? MyColours.color_999999
  418 + : timeIndex == 2
  419 + ? MyColours.color_199095
  420 + : MyColours.color_333333,
  421 + fontWeight: timeIndex == 2
  422 + ? FontWeight.bold
  423 + : FontWeight.normal),
  424 + )
  425 + ],
  426 + ),
  427 + ),
  428 + )),
  429 + ],
  430 + ),
  431 + )
  432 + ],
  433 + )
  434 + ],
  435 + ),
  436 + );
  437 + }
  438 +
  439 + //解析返回显示的日期
  440 + _parseDateDay(DateTime dateTime) {
  441 + DateTime now = DateTime.now();
  442 + if (Utils.isOneDay(dateTime, now)) {
  443 + return "今";
  444 + } else if (Utils.isOneDay(dateTime, now.add(Duration(days: 1)))) {
  445 + return "明";
  446 + } else if (Utils.isOneDay(dateTime, now.add(Duration(days: 2)))) {
  447 + return "后";
  448 + } else {
  449 + return dateTime.day.toString();
  450 + }
  451 + }
  452 +
  453 + @override
  454 + Widget build(BuildContext context) {
  455 + userModel = Provider.of<UserModel>(context, listen: false);
  456 + return Scaffold(
  457 + body: Consumer<StoreDetailModel>(
  458 + builder: (context, model, child) {
  459 + Widget widget = Container();
  460 + Container(
  461 + width: double.infinity,
  462 + height: double.infinity,
  463 + color: MyColours.color_ffffff,
  464 + child: Column(
  465 + children: <Widget>[
  466 + Expanded(
  467 + child: SingleChildScrollView(
  468 + child: Column(
  469 + children: <Widget>[
  470 + Container(
  471 + color: MyColours.color_F9F9F9,
  472 + child: TableCalendar(
  473 + calendarController: _calendarController,
  474 + initialSelectedDay: _selectDateTime,
  475 + startDay: DateTime.now(),
  476 + onDaySelected: (day, _, holidays) {
  477 + if (!Utils.isOneDay(day, _selectDateTime)) {
  478 + //不是一天
  479 + _selectDateTime = day;
  480 + _currTimeIndex();
  481 + _getSellerTableClass();
  482 + }
  483 + },
  484 + availableGestures: AvailableGestures.none,
  485 + events: _events,
  486 + locale: "zh_CN",
  487 + initialCalendarFormat:
  488 + CalendarFormat.twoWeeks,
  489 + headerStyle: HeaderStyle(
  490 + decoration: BoxDecoration(
  491 + color: MyColours.color_F9F9F9),
  492 + headerPadding: EdgeInsets.zero,
  493 + formatButtonVisible: false,
  494 + centerHeaderTitle: true,
  495 + titleTextBuilder: (dateTime, _) {
  496 + return dateTime.year.toString() +
  497 + "年-" +
  498 + Utils.addZeroNumber(dateTime.month) +
  499 + "月";
  500 + },
  501 + titleTextStyle: TextStyle(
  502 + color: MyColours.color_333333,
  503 + fontSize: ScreenUtil().setSp(32)),
  504 + // leftChevronIcon: Image(
  505 + // image: AssetImage(
  506 + // Utils.getImgPath('left_arrow')),
  507 + // alignment: Alignment.center,
  508 + // ),
  509 + // rightChevronIcon: const Icon(
  510 + // Icons.keyboard_arrow_right,
  511 + // color: MyColours.font_color_333333),
  512 + ),
  513 + calendarStyle: CalendarStyle(
  514 + contentPadding:
  515 + const EdgeInsets.only(bottom: 4.0),
  516 + weekdayStyle: TextStyle(
  517 + color: MyColours.color_333333,
  518 + fontSize: ScreenUtil().setSp(32)),
  519 + weekendStyle: TextStyle(
  520 + color: MyColours.color_199095,
  521 + fontSize: ScreenUtil().setSp(32)),
  522 + selectedColor: MyColours.color_199095,
  523 + ),
  524 + builders: CalendarBuilders(
  525 + dayBuilder: (context, dateTime, events) {
  526 + return Container(
  527 + decoration: BoxDecoration(
  528 + shape: BoxShape.circle,
  529 + ),
  530 + alignment: Alignment.center,
  531 + margin: const EdgeInsets.all(6.0),
  532 + padding: const EdgeInsets.only(
  533 + bottom: 4.0,
  534 + left: 8.0,
  535 + right: 8.0,
  536 + top: 4.0),
  537 + child: Text(
  538 + "${_parseDateDay(dateTime)}",
  539 + style: TextStyle().copyWith(
  540 + fontSize: ScreenUtil().setSp(32),
  541 + color: MyColours.color_333333,
  542 + fontWeight: FontWeight.bold),
  543 + ),
  544 + );
  545 + },
  546 + unavailableDayBuilder:
  547 + (context, dateTime, events) {
  548 + return Container(
  549 + decoration: BoxDecoration(
  550 + shape: BoxShape.circle,
  551 + ),
  552 + alignment: Alignment.center,
  553 + margin: const EdgeInsets.all(6.0),
  554 + padding: const EdgeInsets.only(
  555 + bottom: 4.0,
  556 + left: 8.0,
  557 + right: 8.0,
  558 + top: 4.0),
  559 + child: Text(
  560 + "${_parseDateDay(dateTime)}",
  561 + style: TextStyle().copyWith(
  562 + fontSize: ScreenUtil().setSp(32),
  563 + color: MyColours.color_999999),
  564 + ),
  565 + );
  566 + },
  567 + dowWeekdayBuilder: (context, weekday) {
  568 + return Container(
  569 + color: MyColours.color_F9F9F9,
  570 + alignment: Alignment.center,
  571 + padding: EdgeInsets.symmetric(
  572 + vertical:
  573 + ScreenUtil().setHeight(25)),
  574 + child: Text(
  575 + weekday,
  576 + style: TextStyle(
  577 + color: (MyColours.color_999999),
  578 + fontSize: ScreenUtil().setSp(32)),
  579 + ),
  580 + );
  581 + },
  582 + selectedDayBuilder: (context, date, _) {
  583 + return Container(
  584 + decoration: BoxDecoration(
  585 + shape: BoxShape.circle,
  586 + gradient: LinearGradient(
  587 + colors: [
  588 + MyColours.color_24A4A8,
  589 + MyColours.color_199095
  590 + ],
  591 + begin: Alignment.topCenter,
  592 + end: Alignment.bottomCenter),
  593 +// border: Border.all(color: MyColours.color_FFB116)
  594 + ),
  595 + alignment: Alignment.center,
  596 + margin: const EdgeInsets.all(6.0),
  597 + padding: const EdgeInsets.only(
  598 + bottom: 4.0,
  599 + left: 8.0,
  600 + right: 8.0,
  601 + top: 4.0),
  602 + child: Text(
  603 + "${_parseDateDay(date)}",
  604 + style: TextStyle().copyWith(
  605 + fontSize: ScreenUtil().setSp(32),
  606 + color: MyColours.color_ffffff,
  607 + fontWeight: FontWeight.bold),
  608 + ),
  609 + );
  610 + },
  611 + todayDayBuilder: (context, date, _) {
  612 + return Container(
  613 + decoration: BoxDecoration(
  614 + shape: BoxShape.circle,
  615 + border: Border.all(
  616 + color: MyColours.color_199095,
  617 + width: 1)),
  618 + alignment: Alignment.center,
  619 + margin: const EdgeInsets.all(6.0),
  620 + padding: const EdgeInsets.only(
  621 + bottom: 4.0,
  622 + left: 8.0,
  623 + right: 8.0,
  624 + top: 4.0),
  625 + child: Text(
  626 + '今',
  627 + style: TextStyle().copyWith(
  628 + fontSize: ScreenUtil().setSp(32),
  629 + color: MyColours.color_199095,
  630 + fontWeight: FontWeight.bold),
  631 + ),
  632 + );
  633 + },
  634 + singleMarkerBuilder:
  635 + (context, dateTime, event) {
  636 + return Container(
  637 + width: ScreenUtil().setWidth(6),
  638 + height: ScreenUtil().setWidth(6),
  639 + margin: const EdgeInsets.symmetric(
  640 + horizontal: 0.3),
  641 + decoration: BoxDecoration(
  642 + shape: BoxShape.circle,
  643 + color: MyColours.color_ff0000,
  644 + ),
  645 + );
  646 + },
  647 + ))),
  648 + _buildShiduan(),
  649 + Offstage(
  650 + offstage: enableIndex > 2,
  651 + child: Container(
  652 + width: double.infinity,
  653 + padding: EdgeInsets.only(
  654 + left: ScreenUtil().setWidth(30),
  655 + top: ScreenUtil().setWidth(48),
  656 + right: ScreenUtil().setWidth(30)),
  657 + child: Column(
  658 + crossAxisAlignment: CrossAxisAlignment.start,
  659 + 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),
  681 + Selector<StoreDetailModel,
  682 + List<SellerTableClassEntity>>(
  683 + shouldRebuild: (pre, next) => true,
  684 + selector: (context, model) => model.tables,
  685 + builder: (context, tables, child) {
  686 + return GridView.builder(
  687 + gridDelegate:
  688 + SliverGridDelegateWithFixedCrossAxisCount(
  689 + crossAxisCount: 2,
  690 + mainAxisSpacing:
  691 + ScreenUtil().setWidth(20),
  692 + crossAxisSpacing:
  693 + ScreenUtil().setWidth(30),
  694 + childAspectRatio: 2.4),
  695 + itemBuilder: (context, index) {
  696 + return GestureDetector(
  697 + 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;
  726 + }
  727 + setState(() {
  728 + roomNum[index]++;
  729 + rooms.add(index);
  730 + });
  731 + },
  732 + child: Stack(
  733 + children: <Widget>[
  734 + Container(
  735 + height: ScreenUtil()
  736 + .setWidth(140),
  737 + padding: EdgeInsets.only(
  738 + left: ScreenUtil()
  739 + .setWidth(30)),
  740 + decoration: BoxDecoration(
  741 + color: tables[index]
  742 + .status
  743 + .toString() ==
  744 + "1"
  745 + ? MyColours.color_ffffff
  746 + : MyColours
  747 + .color_f5f5f5,
  748 + borderRadius:
  749 + BorderRadius.circular(
  750 + ScreenUtil()
  751 + .setWidth(10)),
  752 + border: Border.all(
  753 + color: roomNum[index] >
  754 + 0
  755 + ? MyColours
  756 + .color_199095
  757 + : MyColours
  758 + .color_cccccc,
  759 + width: ScreenUtil()
  760 + .setWidth(2)),
  761 + ),
  762 + alignment:
  763 + Alignment.centerLeft,
  764 + child: Column(
  765 + mainAxisSize:
  766 + MainAxisSize.min,
  767 + mainAxisAlignment:
  768 + MainAxisAlignment
  769 + .center,
  770 + crossAxisAlignment:
  771 + CrossAxisAlignment
  772 + .start,
  773 + children: <Widget>[
  774 + Text("${tables[index].name}",
  775 + style: TextStyle(
  776 + fontSize:
  777 + ScreenUtil()
  778 + .setSp(
  779 + 30),
  780 + color: MyColours
  781 + .color_333333,
  782 + fontWeight:
  783 + FontWeight
  784 + .normal)),
  785 + int.parse(tables[index]
  786 + .max ??
  787 + "0") >
  788 + 0
  789 + ? Text(
  790 + "最多可坐${tables[index].max}人",
  791 + style: TextStyle(
  792 + fontSize:
  793 + ScreenUtil()
  794 + .setSp(
  795 + 24),
  796 + color: MyColours
  797 + .color_333333,
  798 + fontWeight:
  799 + FontWeight
  800 + .normal),
  801 + )
  802 + : Container(),
  803 + int.parse(tables[index]
  804 + .low ??
  805 + "0") >
  806 + 0
  807 + ? Text(
  808 + "最低消费${tables[index].low}元",
  809 + style: TextStyle(
  810 + fontSize:
  811 + ScreenUtil()
  812 + .setSp(
  813 + 20),
  814 + color: MyColours
  815 + .color_999999,
  816 + fontWeight:
  817 + FontWeight
  818 + .normal),
  819 + )
  820 + : Container()
  821 + ],
  822 + ),
  823 + ),
  824 + Positioned(
  825 + right: 0,
  826 + top: 0,
  827 + child: roomNum[index] > 0
  828 + ? Container(
  829 + width: ScreenUtil()
  830 + .setWidth(92),
  831 + height: ScreenUtil()
  832 + .setWidth(40),
  833 + alignment:
  834 + Alignment.center,
  835 + decoration:
  836 + BoxDecoration(
  837 + color: MyColours
  838 + .color_F4FAFF,
  839 + border: Border.all(
  840 + color: MyColours
  841 + .color_199095,
  842 + width:
  843 + ScreenUtil()
  844 + .setWidth(
  845 + 2)),
  846 + borderRadius: BorderRadius.only(
  847 + topRight: Radius.circular(
  848 + ScreenUtil()
  849 + .setWidth(
  850 + 10)),
  851 + bottomLeft: Radius.circular(
  852 + ScreenUtil()
  853 + .setWidth(
  854 + 10))),
  855 + ),
  856 + child: Text(
  857 + "已选${roomNum[index]}",
  858 + style: TextStyle(
  859 + fontSize:
  860 + ScreenUtil()
  861 + .setSp(
  862 + 24),
  863 + color: MyColours
  864 + .color_199095),
  865 + ),
  866 + )
  867 + : Container(),
  868 + ),
  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 + ],
  923 + ),
  924 + );
  925 + },
  926 + itemCount: tables.length,
  927 + shrinkWrap: true,
  928 + physics:
  929 + new NeverScrollableScrollPhysics(),
  930 + );
  931 + },
  932 + )
  933 + ],
  934 + ),
  935 + ),
  936 + )
  937 + ],
  938 + ),
  939 + ),
  940 + ),
  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 + ],
  990 + ));
  991 + return widget;
  992 + },
  993 + ),
  994 + );
  995 + }
  996 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:one_key/constant/constant.dart';
  3 +import 'package:one_key/models/seller_table_class_entity.dart';
  4 +import 'package:one_key/net/base_resp.dart';
  5 +import 'package:one_key/net/dio_util.dart';
  6 +import 'package:one_key/net/http_url.dart';
  7 +import 'package:one_key/utils/utils.dart';
  8 +
  9 +/**
  10 + * 餐厅详情
  11 + */
  12 +class StoreDetailModel with ChangeNotifier {
  13 + List<SellerTableClassEntity> tables = []; //商家包间类型
  14 + int _money;
  15 + int get money => _money;
  16 +
  17 + //获取商家包间类型
  18 + Future<List<SellerTableClassEntity>> getSellerTableClass(
  19 + BuildContext context, Map<String, String> params) async {
  20 +// pageState=PageState.Loading;
  21 +// notifyListeners();
  22 + BaseResp<List> baseResp = await DioUtil()
  23 + .request<List>(context, Method.get, HttpUrl.get_seller_tableclass,
  24 + data: params, showLoading: false)
  25 + .catchError((error) {
  26 + 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 + });
  42 + if (baseResp != null && baseResp.code == Constant.status_success) {
  43 + tables.clear();
  44 + tables.addAll(baseResp.data.map<SellerTableClassEntity>((value) {
  45 + return SellerTableClassEntity.fromJson(value);
  46 + }).toList());
  47 +// pageState=PageState.Success;
  48 + } else {
  49 + tables.clear();
  50 +// pageState=PageState.ConnectivityError;
  51 + Utils.showToast(baseResp.msg ?? "");
  52 + }
  53 + notifyListeners();
  54 + return tables;
  55 + }
  56 +}
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 2
3 class MyColours { 3 class MyColours {
  4 +
  5 + static const Color color_F4FAFF = Color(0xffF4FAFF);
4 static const Color app_main = Color(0xFF24A4A8); 6 static const Color app_main = Color(0xFF24A4A8);
5 static const Color color_ffffff = Color(0xffffffff); 7 static const Color color_ffffff = Color(0xffffffff);
6 static const Color color_fefefe = Color(0xfffefefe); 8 static const Color color_fefefe = Color(0xfffefefe);
@@ -39,6 +39,7 @@ import 'package:one_key/pages/my/contant_page.dart'; @@ -39,6 +39,7 @@ import 'package:one_key/pages/my/contant_page.dart';
39 import 'package:one_key/pages/my/my_integral_page.dart'; 39 import 'package:one_key/pages/my/my_integral_page.dart';
40 import 'package:one_key/pages/my/receive_orders_time_set.dart'; 40 import 'package:one_key/pages/my/receive_orders_time_set.dart';
41 import 'package:one_key/pages/my/remark_manager_page.dart'; 41 import 'package:one_key/pages/my/remark_manager_page.dart';
  42 +import 'package:one_key/pages/my/store_type_fill_manage_page.dart';
42 import 'package:one_key/pages/notebook/statistics_page.dart'; 43 import 'package:one_key/pages/notebook/statistics_page.dart';
43 import 'package:one_key/pages/notebook/statistics_sms_page.dart'; 44 import 'package:one_key/pages/notebook/statistics_sms_page.dart';
44 import 'package:one_key/pages/online_check/invoice_detail_page.dart'; 45 import 'package:one_key/pages/online_check/invoice_detail_page.dart';
@@ -60,6 +61,7 @@ import 'package:one_key/provider/order_food_provider.dart'; @@ -60,6 +61,7 @@ import 'package:one_key/provider/order_food_provider.dart';
60 import 'package:one_key/provider/other_login_provider.dart'; 61 import 'package:one_key/provider/other_login_provider.dart';
61 import 'package:one_key/provider/remark_manager_model.dart'; 62 import 'package:one_key/provider/remark_manager_model.dart';
62 import 'package:one_key/provider/statistics_provider.dart'; 63 import 'package:one_key/provider/statistics_provider.dart';
  64 +import 'package:one_key/provider/store_detail_model.dart';
63 import 'package:one_key/provider/table_photo_manager_provider.dart'; 65 import 'package:one_key/provider/table_photo_manager_provider.dart';
64 import 'package:one_key/provider/upload_img_provider.dart'; 66 import 'package:one_key/provider/upload_img_provider.dart';
65 import 'package:one_key/utils/fluro_convert_utils.dart'; 67 import 'package:one_key/utils/fluro_convert_utils.dart';
@@ -508,3 +510,16 @@ var statisticsSmsPageHandler = new Handler( @@ -508,3 +510,16 @@ var statisticsSmsPageHandler = new Handler(
508 // return ChangeNotifierProvider<UploadImageProvider>( 510 // return ChangeNotifierProvider<UploadImageProvider>(
509 // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage()); 511 // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage());
510 }); 512 });
  513 +
  514 +///包间置满管理
  515 +var storeTypeFillManagePageHandler = new Handler(
  516 + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
  517 + // CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode(
  518 + // FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first)));
  519 + // String tid = params["tid"].first;
  520 +
  521 + return ChangeNotifierProvider<StoreDetailModel>(
  522 + create: (_) => StoreDetailModel(), child: StoreTypeFillManagePage());
  523 + // return ChangeNotifierProvider<UploadImageProvider>(
  524 + // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage());
  525 +});
@@ -46,6 +46,8 @@ class Routes { @@ -46,6 +46,8 @@ class Routes {
46 static String table_photo_manager = "/table_photo_manager"; //桌位照片管理 46 static String table_photo_manager = "/table_photo_manager"; //桌位照片管理
47 static String statistics_page = "/statistics_page"; //统计页 47 static String statistics_page = "/statistics_page"; //统计页
48 static String statistics_sms_page = "/statistics_sms_page"; //统计页发短信 48 static String statistics_sms_page = "/statistics_sms_page"; //统计页发短信
  49 + static String store_type_fill_manage_page =
  50 + "/store_type_fill_manage_page"; //包间置满管理
49 51
50 static void configureRoutes(FluroRouter router) { 52 static void configureRoutes(FluroRouter router) {
51 router.notFoundHandler = new Handler( 53 router.notFoundHandler = new Handler(
@@ -99,5 +101,7 @@ class Routes { @@ -99,5 +101,7 @@ class Routes {
99 router.define(table_photo_manager, handler: tablePhotoManagerHandler); 101 router.define(table_photo_manager, handler: tablePhotoManagerHandler);
100 router.define(statistics_page, handler: statisticsPageHandler); 102 router.define(statistics_page, handler: statisticsPageHandler);
101 router.define(statistics_sms_page, handler: statisticsSmsPageHandler); 103 router.define(statistics_sms_page, handler: statisticsSmsPageHandler);
  104 + router.define(store_type_fill_manage_page,
  105 + handler: storeTypeFillManagePageHandler);
102 } 106 }
103 } 107 }