Commit 0e649f199095c17de3e394dcba0b3bafbeaada94

Authored by wdn127929
1 parent 08dca753

包间置满管理UI

... ... @@ -11,14 +11,14 @@ if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = "295"
def flutterVersionCode = "296"
if (flutterVersionCode == null) {
flutterVersionCode = '295'
flutterVersionCode = '296'
}
def flutterVersionName = "2.9.5"
def flutterVersionName = "2.9.6"
if (flutterVersionName == null) {
flutterVersionName = '2.9.5'
flutterVersionName = '2.9.6'
}
apply plugin: 'com.android.application'
... ...
import 'package:json_annotation/json_annotation.dart';
part 'seller_table_class_entity.g.dart';
@JsonSerializable()
class SellerTableClassEntity extends Object {
@JsonKey(name: 'id')
String id;
@JsonKey(name: 'sellerid')
String sellerid;
@JsonKey(name: 'tableid')
String tableid;
@JsonKey(name: 'name')
String name;
@JsonKey(name: 'max')
String max;
@JsonKey(name: 'low')
String low;
@JsonKey(name: 'status')
dynamic status;
@JsonKey(name: 'isFull')
dynamic isFull;//1 置满
@JsonKey(name: 'isorderFull')
dynamic isorderFull;//1 订满
@JsonKey(name: 'cdate')
String cdate;
SellerTableClassEntity(this.id,this.sellerid,this.tableid,this.name,this.max,this.low,this.status,this.isFull,this.isorderFull,this.cdate,);
factory SellerTableClassEntity.fromJson(Map<String, dynamic> srcJson) => _$SellerTableClassEntityFromJson(srcJson);
Map<String, dynamic> toJson() => _$SellerTableClassEntityToJson(this);
}
... ...
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'seller_table_class_entity.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
SellerTableClassEntity _$SellerTableClassEntityFromJson(
Map<String, dynamic> json) {
return SellerTableClassEntity(
json['id'] as String,
json['sellerid'] as String,
json['tableid'] as String,
json['name'] as String,
json['max'] as String,
json['low'] as String,
json['status'] as dynamic,
json['isFull'] as dynamic,
json['isorderFull'] as dynamic,
json['cdate'] as String);
}
Map<String, dynamic> _$SellerTableClassEntityToJson(
SellerTableClassEntity instance) =>
<String, dynamic>{
'id': instance.id,
'sellerid': instance.sellerid,
'tableid': instance.tableid,
'name': instance.name,
'max': instance.max,
'low': instance.low,
'status': instance.status,
'isFull':instance.isFull,
'isorderFull':instance.isorderFull,
'cdate': instance.cdate
};
... ...
... ... @@ -123,4 +123,7 @@ class HttpUrl {
static const String get_statistics_list =
"?service=App.Reserve.ReserveStatistics"; //App订单统计
static const String get_seller_tableclass =
"?service=App.Seller.GetSellerTableClass"; //获取商家包间类型
}
... ...
import 'package:flutter/material.dart';
import 'package:one_key/models/seller_table_class_entity.dart';
import 'package:one_key/provider/store_detail_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import 'package:table_calendar/table_calendar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../app.dart';
class StoreTypeFillManagePage extends StatefulWidget {
int timeMills; //日期
int ddate_solt; //时段
StoreTypeFillManagePage({Key key, this.timeMills, this.ddate_solt})
: super(key: key);
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return StoreTypeFillManagePageState();
}
}
class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
CalendarController _calendarController;
Map<DateTime, List> _events;
DateTime _selectDateTime = DateTime.now();
UserModel userModel;
DateTime dateTimeNow; //当前日期
String morning; //早市时间段
String noon; //午市时间段
String night; //晚市时间段
int timeIndex = 0; //当前时段
int enableIndex = 0; //最早可用时段
//早市,午市,晚市时间段
Map<String, String> daily = {"morning": "", "noon": "", "night": ""};
//包间
List<SellerTableClassEntity> tables = [];
//已选包间数量
Map<int, int> roomNum = {0: 0, 1: 0, 2: 0, 3: 0};
//已选包间下标
List<int> rooms = [];
//获取店铺详情
_getStoreDetail() {
_initTime();
_currTimeIndex();
_getSellerTableClass();
}
//当前选中时间段
_currTimeIndex() {
DateTime now = DateTime.now();
String ymd =
"${_selectDateTime.year}-${Utils.addZeroNumber(_selectDateTime.month)}-${Utils.addZeroNumber(_selectDateTime.day)} ";
DateTime morningStart =
DateTime.parse("$ymd${daily['morning'].split('-')[0]}:00");
DateTime morningEnd =
DateTime.parse("$ymd${daily['morning'].split('-')[1]}:00");
DateTime noonStart =
DateTime.parse("$ymd${daily['noon'].split('-')[0]}:00");
DateTime noonEnd = DateTime.parse("$ymd${daily['noon'].split('-')[1]}:00");
DateTime nightStart =
DateTime.parse("$ymd${daily['night'].split('-')[0]}:00");
DateTime nightEnd =
DateTime.parse("$ymd${daily['night'].split('-')[1]}:00");
if (daily["morning"] != "00:00-00:00" && now.isBefore(morningEnd)) {
timeIndex = 0;
enableIndex = 0;
} else if (daily["noon"] != "00:00-00:00" && now.isBefore(noonEnd)) {
timeIndex = 1;
enableIndex = 1;
} else if (daily["night"] != "00:00-00:00" && now.isBefore(nightEnd)) {
timeIndex = 2;
enableIndex = 2;
} else {
timeIndex = -1;
enableIndex = 3;
}
if (widget.timeMills != 0 && widget.ddate_solt != 0) {
_selectDateTime = DateTime.fromMillisecondsSinceEpoch(widget.timeMills);
timeIndex = widget.ddate_solt;
if (!Utils.isOneDay(_selectDateTime, DateTime.now())) {
//不是今天
enableIndex = 0;
}
widget.timeMills = 0;
widget.ddate_solt = 0;
}
setState(() {});
}
//获取商家包间类型
_getSellerTableClass() async {
Map<String, String> params = {
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
"day": (DateTime.parse(
"${_selectDateTime.year}-${Utils.addZeroNumber(_selectDateTime.month)}-${Utils.addZeroNumber(_selectDateTime.day)} 00:00:00")
.millisecondsSinceEpoch /
1000)
.floor()
.toString(),
"interval": (timeIndex + 1).toString()
};
StoreDetailModel detailModel =
Provider.of<StoreDetailModel>(context, listen: false);
tables = await detailModel.getSellerTableClass(context, params);
for (int i = 0; i < tables.length; i++) {
roomNum[i] = 0;
}
rooms.clear();
setState(() {});
}
@override
void initState() {
// TODO: implement initState
super.initState();
tables = [];
_calendarController = CalendarController();
_events = {};
_getStoreDetail();
}
@override
void dispose() {
// TODO: implement dispose
_calendarController.dispose();
super.dispose();
}
//初始化时间
_initTime() {
dateTimeNow = DateTime.now();
morning =
userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning;
noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon;
night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night;
daily = {"morning": morning, "noon": noon, "night": night};
}
//构建已选包间
_buildSelectRooms() {
List<Widget> selectRooms = [];
for (int i in rooms) {
selectRooms.add(Container(
margin: EdgeInsets.only(right: ScreenUtil().setWidth(10)),
child: Stack(
children: <Widget>[
Container(
width: ScreenUtil().setWidth(150),
height: ScreenUtil().setWidth(70),
margin: EdgeInsets.only(
right: ScreenUtil().setWidth(12),
top: ScreenUtil().setWidth(12)),
alignment: Alignment.center,
decoration: BoxDecoration(
color: MyColours.color_199095,
border: Border.all(
color: MyColours.color_199095,
width: ScreenUtil().setWidth(2)),
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(10))),
child: Text(
"${tables[i].name}",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: MyColours.color_199095,
fontWeight: FontWeight.bold,
),
),
),
Positioned(
top: 0,
right: 0,
child: GestureDetector(
onTap: () {
rooms.remove(i);
roomNum[i]--;
setState(() {});
},
child: Image.asset(
"assets/icon_clear.png",
width: ScreenUtil().setWidth(36),
height: ScreenUtil().setWidth(36),
),
),
)
],
),
));
}
return selectRooms;
}
//构建时段
Widget _buildShiduan() {
return Container(
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(30),
top: ScreenUtil().setWidth(80),
right: ScreenUtil().setWidth(30)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"预订时段",
style: TextStyle(
fontSize: ScreenUtil().setSp(36),
color: MyColours.color_333333,
fontWeight: FontWeight.bold),
),
VEmptyView(30),
Stack(
children: <Widget>[
Container(
height: ScreenUtil().setWidth(90),
width: ScreenUtil().setWidth(690),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border.all(
color: MyColours.color_cccccc,
width: ScreenUtil().setWidth(2)),
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(10))),
),
Container(
height: ScreenUtil().setWidth(90),
width: ScreenUtil().setWidth(690),
child: Flex(
direction: Axis.horizontal,
children: <Widget>[
Expanded(
flex: daily["morning"] == "00:00-00:00" ? 0 : 1,
child: daily["morning"] == "00:00-00:00"
? Container()
: GestureDetector(
onTap: () {
if (enableIndex > 0) return;
if (timeIndex == 0) return;
setState(() {
timeIndex = 0;
_getSellerTableClass();
});
},
child: Container(
height: ScreenUtil().setWidth(90),
decoration: timeIndex == 0
? BoxDecoration(
color: MyColours.color_F4FAFF,
border: Border.all(
color: MyColours.color_199095,
width: ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.all(
Radius.circular(
ScreenUtil().setWidth(10))))
: BoxDecoration(),
alignment: Alignment.center,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
"早餐",
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: enableIndex > 0
? MyColours.color_999999
: timeIndex == 0
? MyColours.color_199095
: MyColours.color_333333,
fontWeight: timeIndex == 0
? FontWeight.bold
: FontWeight.normal),
),
Text(
"${daily["morning"]}",
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: enableIndex > 0
? MyColours.color_999999
: timeIndex == 0
? MyColours.color_199095
: MyColours.color_333333,
fontWeight: timeIndex == 0
? FontWeight.bold
: FontWeight.normal),
)
],
),
),
)),
Expanded(
flex: daily["noon"] == "00:00-00:00" ? 0 : 1,
child: daily["noon"] == "00:00-00:00"
? Container()
: GestureDetector(
onTap: () {
if (enableIndex > 1) return;
if (timeIndex == 1) return;
setState(() {
timeIndex = 1;
_getSellerTableClass();
});
},
child: Container(
height: ScreenUtil().setWidth(90),
decoration: timeIndex == 1
? BoxDecoration(
color: MyColours.color_F4FAFF,
border: Border.all(
color: MyColours.color_199095,
width: ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.all(
Radius.circular(
ScreenUtil().setWidth(10))))
: BoxDecoration(),
alignment: Alignment.center,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
"午餐",
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: enableIndex > 1
? MyColours.color_999999
: timeIndex == 1
? MyColours.color_199095
: MyColours.color_333333,
fontWeight: timeIndex == 1
? FontWeight.bold
: FontWeight.normal),
),
Text(
"${daily["noon"]}",
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: enableIndex > 1
? MyColours.color_999999
: timeIndex == 1
? MyColours.color_199095
: MyColours.color_333333,
fontWeight: timeIndex == 1
? FontWeight.bold
: FontWeight.normal),
)
],
),
),
)),
Expanded(
flex: daily["night"] == "00:00-00:00" ? 0 : 1,
child: daily["night"] == "00:00-00:00"
? Container()
: GestureDetector(
onTap: () {
if (enableIndex > 2) return;
if (timeIndex == 2) return;
setState(() {
timeIndex = 2;
_getSellerTableClass();
});
},
child: Container(
height: ScreenUtil().setWidth(90),
decoration: timeIndex == 2
? BoxDecoration(
color: MyColours.color_F4FAFF,
border: Border.all(
color: MyColours.color_199095,
width: ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.all(
Radius.circular(
ScreenUtil().setWidth(10))))
: BoxDecoration(),
alignment: Alignment.center,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
"晚餐",
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: enableIndex > 2
? MyColours.color_999999
: timeIndex == 2
? MyColours.color_199095
: MyColours.color_333333,
fontWeight: timeIndex == 2
? FontWeight.bold
: FontWeight.normal),
),
Text(
"${daily["night"]}",
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: enableIndex > 2
? MyColours.color_999999
: timeIndex == 2
? MyColours.color_199095
: MyColours.color_333333,
fontWeight: timeIndex == 2
? FontWeight.bold
: FontWeight.normal),
)
],
),
),
)),
],
),
)
],
)
],
),
);
}
//解析返回显示的日期
_parseDateDay(DateTime dateTime) {
DateTime now = DateTime.now();
if (Utils.isOneDay(dateTime, now)) {
return "今";
} else if (Utils.isOneDay(dateTime, now.add(Duration(days: 1)))) {
return "明";
} else if (Utils.isOneDay(dateTime, now.add(Duration(days: 2)))) {
return "后";
} else {
return dateTime.day.toString();
}
}
@override
Widget build(BuildContext context) {
userModel = Provider.of<UserModel>(context, listen: false);
return Scaffold(
body: Consumer<StoreDetailModel>(
builder: (context, model, child) {
Widget widget = Container();
Container(
width: double.infinity,
height: double.infinity,
color: MyColours.color_ffffff,
child: Column(
children: <Widget>[
Expanded(
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Container(
color: MyColours.color_F9F9F9,
child: TableCalendar(
calendarController: _calendarController,
initialSelectedDay: _selectDateTime,
startDay: DateTime.now(),
onDaySelected: (day, _, holidays) {
if (!Utils.isOneDay(day, _selectDateTime)) {
//不是一天
_selectDateTime = day;
_currTimeIndex();
_getSellerTableClass();
}
},
availableGestures: AvailableGestures.none,
events: _events,
locale: "zh_CN",
initialCalendarFormat:
CalendarFormat.twoWeeks,
headerStyle: HeaderStyle(
decoration: BoxDecoration(
color: MyColours.color_F9F9F9),
headerPadding: EdgeInsets.zero,
formatButtonVisible: false,
centerHeaderTitle: true,
titleTextBuilder: (dateTime, _) {
return dateTime.year.toString() +
"年-" +
Utils.addZeroNumber(dateTime.month) +
"月";
},
titleTextStyle: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(32)),
// leftChevronIcon: Image(
// image: AssetImage(
// Utils.getImgPath('left_arrow')),
// alignment: Alignment.center,
// ),
// rightChevronIcon: const Icon(
// Icons.keyboard_arrow_right,
// color: MyColours.font_color_333333),
),
calendarStyle: CalendarStyle(
contentPadding:
const EdgeInsets.only(bottom: 4.0),
weekdayStyle: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(32)),
weekendStyle: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(32)),
selectedColor: MyColours.color_199095,
),
builders: CalendarBuilders(
dayBuilder: (context, dateTime, events) {
return Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
),
alignment: Alignment.center,
margin: const EdgeInsets.all(6.0),
padding: const EdgeInsets.only(
bottom: 4.0,
left: 8.0,
right: 8.0,
top: 4.0),
child: Text(
"${_parseDateDay(dateTime)}",
style: TextStyle().copyWith(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_333333,
fontWeight: FontWeight.bold),
),
);
},
unavailableDayBuilder:
(context, dateTime, events) {
return Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
),
alignment: Alignment.center,
margin: const EdgeInsets.all(6.0),
padding: const EdgeInsets.only(
bottom: 4.0,
left: 8.0,
right: 8.0,
top: 4.0),
child: Text(
"${_parseDateDay(dateTime)}",
style: TextStyle().copyWith(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_999999),
),
);
},
dowWeekdayBuilder: (context, weekday) {
return Container(
color: MyColours.color_F9F9F9,
alignment: Alignment.center,
padding: EdgeInsets.symmetric(
vertical:
ScreenUtil().setHeight(25)),
child: Text(
weekday,
style: TextStyle(
color: (MyColours.color_999999),
fontSize: ScreenUtil().setSp(32)),
),
);
},
selectedDayBuilder: (context, date, _) {
return Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(
colors: [
MyColours.color_24A4A8,
MyColours.color_199095
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter),
// border: Border.all(color: MyColours.color_FFB116)
),
alignment: Alignment.center,
margin: const EdgeInsets.all(6.0),
padding: const EdgeInsets.only(
bottom: 4.0,
left: 8.0,
right: 8.0,
top: 4.0),
child: Text(
"${_parseDateDay(date)}",
style: TextStyle().copyWith(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_ffffff,
fontWeight: FontWeight.bold),
),
);
},
todayDayBuilder: (context, date, _) {
return Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: MyColours.color_199095,
width: 1)),
alignment: Alignment.center,
margin: const EdgeInsets.all(6.0),
padding: const EdgeInsets.only(
bottom: 4.0,
left: 8.0,
right: 8.0,
top: 4.0),
child: Text(
'今',
style: TextStyle().copyWith(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_199095,
fontWeight: FontWeight.bold),
),
);
},
singleMarkerBuilder:
(context, dateTime, event) {
return Container(
width: ScreenUtil().setWidth(6),
height: ScreenUtil().setWidth(6),
margin: const EdgeInsets.symmetric(
horizontal: 0.3),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: MyColours.color_ff0000,
),
);
},
))),
_buildShiduan(),
Offstage(
offstage: enableIndex > 2,
child: Container(
width: double.infinity,
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(30),
top: ScreenUtil().setWidth(48),
right: ScreenUtil().setWidth(30)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
height: ScreenUtil().setWidth(82),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.end,
children: <Widget>[
Text(
"选择包间",
style: TextStyle(
fontSize: ScreenUtil().setSp(36),
color: MyColours.color_333333,
fontWeight: FontWeight.bold),
),
HEmptyView(24),
Wrap(
children: _buildSelectRooms(),
)
],
),
),
VEmptyView(30),
Selector<StoreDetailModel,
List<SellerTableClassEntity>>(
shouldRebuild: (pre, next) => true,
selector: (context, model) => model.tables,
builder: (context, tables, child) {
return GridView.builder(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing:
ScreenUtil().setWidth(20),
crossAxisSpacing:
ScreenUtil().setWidth(30),
childAspectRatio: 2.4),
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
if (tables[index]
.status
.toString() ==
"0") return;
if ((tables[index]
.status
.toString() ==
"1" &&
((tables[index].isFull !=
null &&
tables[index]
.isFull
.toString() ==
"1") ||
(tables[index]
.isorderFull !=
null &&
tables[index]
.isorderFull
.toString() ==
"1")))) return;
int selectNum = 0;
roomNum.forEach((index, value) {
selectNum += value;
});
if (selectNum >= 3) {
Utils.showToast("最多可选3个包间");
return;
}
setState(() {
roomNum[index]++;
rooms.add(index);
});
},
child: Stack(
children: <Widget>[
Container(
height: ScreenUtil()
.setWidth(140),
padding: EdgeInsets.only(
left: ScreenUtil()
.setWidth(30)),
decoration: BoxDecoration(
color: tables[index]
.status
.toString() ==
"1"
? MyColours.color_ffffff
: MyColours
.color_f5f5f5,
borderRadius:
BorderRadius.circular(
ScreenUtil()
.setWidth(10)),
border: Border.all(
color: roomNum[index] >
0
? MyColours
.color_199095
: MyColours
.color_cccccc,
width: ScreenUtil()
.setWidth(2)),
),
alignment:
Alignment.centerLeft,
child: Column(
mainAxisSize:
MainAxisSize.min,
mainAxisAlignment:
MainAxisAlignment
.center,
crossAxisAlignment:
CrossAxisAlignment
.start,
children: <Widget>[
Text("${tables[index].name}",
style: TextStyle(
fontSize:
ScreenUtil()
.setSp(
30),
color: MyColours
.color_333333,
fontWeight:
FontWeight
.normal)),
int.parse(tables[index]
.max ??
"0") >
0
? Text(
"最多可坐${tables[index].max}人",
style: TextStyle(
fontSize:
ScreenUtil()
.setSp(
24),
color: MyColours
.color_333333,
fontWeight:
FontWeight
.normal),
)
: Container(),
int.parse(tables[index]
.low ??
"0") >
0
? Text(
"最低消费${tables[index].low}元",
style: TextStyle(
fontSize:
ScreenUtil()
.setSp(
20),
color: MyColours
.color_999999,
fontWeight:
FontWeight
.normal),
)
: Container()
],
),
),
Positioned(
right: 0,
top: 0,
child: roomNum[index] > 0
? Container(
width: ScreenUtil()
.setWidth(92),
height: ScreenUtil()
.setWidth(40),
alignment:
Alignment.center,
decoration:
BoxDecoration(
color: MyColours
.color_F4FAFF,
border: Border.all(
color: MyColours
.color_199095,
width:
ScreenUtil()
.setWidth(
2)),
borderRadius: BorderRadius.only(
topRight: Radius.circular(
ScreenUtil()
.setWidth(
10)),
bottomLeft: Radius.circular(
ScreenUtil()
.setWidth(
10))),
),
child: Text(
"已选${roomNum[index]}",
style: TextStyle(
fontSize:
ScreenUtil()
.setSp(
24),
color: MyColours
.color_199095),
),
)
: Container(),
),
(tables[index]
.status
.toString() ==
"1" &&
((tables[index].isFull !=
null &&
tables[index]
.isFull
.toString() ==
"1") ||
(tables[index]
.isorderFull !=
null &&
tables[index]
.isorderFull
.toString() ==
"1")))
? Positioned(
right: 0,
bottom: 0,
child: Container(
width: ScreenUtil()
.setWidth(90),
height: ScreenUtil()
.setWidth(76),
child: Container(
child: Text(
"订满",
style: TextStyle(
color: MyColours
.color_999999,
fontSize:
ScreenUtil()
.setSp(
24)),
),
margin: EdgeInsets.only(
left: ScreenUtil()
.setWidth(
28),
top: ScreenUtil()
.setWidth(
28)),
),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
"assets/icon_man.png"),
fit: BoxFit
.cover)),
),
)
: Container()
],
),
);
},
itemCount: tables.length,
shrinkWrap: true,
physics:
new NeverScrollableScrollPhysics(),
);
},
)
],
),
),
)
],
),
),
),
Offstage(
offstage: enableIndex > 2,
child: Container(
height: ScreenUtil().setWidth(116),
alignment: Alignment.center,
decoration: BoxDecoration(
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
color: MyColours.color_EEF0F2,
blurRadius: ScreenUtil().setWidth(8))
]),
child: GestureDetector(
onTap: () {
if (rooms.length <= 0) {
Utils.showToast("请选择包间");
return;
}
},
child: Container(
width: ScreenUtil().setWidth(670),
height: ScreenUtil().setWidth(84),
decoration: rooms.length > 0
? BoxDecoration(
gradient: LinearGradient(colors: [
MyColours.color_2bb5b7,
MyColours.color_199095
]),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(44)),
)
: BoxDecoration(
color: MyColours.color_cccccc,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(44)),
),
alignment: Alignment.center,
child: Text(
"选好了",
style: TextStyle(
fontSize: ScreenUtil().setSp(36),
color: MyColours.color_ffffff,
fontWeight: FontWeight.bold),
),
),
),
),
)
],
));
return widget;
},
),
);
}
}
... ...
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/models/seller_table_class_entity.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
import 'package:one_key/utils/utils.dart';
/**
* 餐厅详情
*/
class StoreDetailModel with ChangeNotifier {
List<SellerTableClassEntity> tables = []; //商家包间类型
int _money;
int get money => _money;
//获取商家包间类型
Future<List<SellerTableClassEntity>> getSellerTableClass(
BuildContext context, Map<String, String> params) async {
// pageState=PageState.Loading;
// notifyListeners();
BaseResp<List> baseResp = await DioUtil()
.request<List>(context, Method.get, HttpUrl.get_seller_tableclass,
data: params, showLoading: false)
.catchError((error) {
print(error.toString());
// if(error is MyError){
// switch(error.type){
// case 1:
// pageState=PageState.ConnectivityError;
// break;
// case 2:
// pageState=PageState.ConnectivityTimeOut;
// break;
// default:
// pageState=PageState.ConnectivityError;
// break;
// }
// }
// notifyListeners();
});
if (baseResp != null && baseResp.code == Constant.status_success) {
tables.clear();
tables.addAll(baseResp.data.map<SellerTableClassEntity>((value) {
return SellerTableClassEntity.fromJson(value);
}).toList());
// pageState=PageState.Success;
} else {
tables.clear();
// pageState=PageState.ConnectivityError;
Utils.showToast(baseResp.msg ?? "");
}
notifyListeners();
return tables;
}
}
... ...
import 'package:flutter/material.dart';
class MyColours {
static const Color color_F4FAFF = Color(0xffF4FAFF);
static const Color app_main = Color(0xFF24A4A8);
static const Color color_ffffff = Color(0xffffffff);
static const Color color_fefefe = Color(0xfffefefe);
... ...
... ... @@ -39,6 +39,7 @@ import 'package:one_key/pages/my/contant_page.dart';
import 'package:one_key/pages/my/my_integral_page.dart';
import 'package:one_key/pages/my/receive_orders_time_set.dart';
import 'package:one_key/pages/my/remark_manager_page.dart';
import 'package:one_key/pages/my/store_type_fill_manage_page.dart';
import 'package:one_key/pages/notebook/statistics_page.dart';
import 'package:one_key/pages/notebook/statistics_sms_page.dart';
import 'package:one_key/pages/online_check/invoice_detail_page.dart';
... ... @@ -60,6 +61,7 @@ import 'package:one_key/provider/order_food_provider.dart';
import 'package:one_key/provider/other_login_provider.dart';
import 'package:one_key/provider/remark_manager_model.dart';
import 'package:one_key/provider/statistics_provider.dart';
import 'package:one_key/provider/store_detail_model.dart';
import 'package:one_key/provider/table_photo_manager_provider.dart';
import 'package:one_key/provider/upload_img_provider.dart';
import 'package:one_key/utils/fluro_convert_utils.dart';
... ... @@ -508,3 +510,16 @@ var statisticsSmsPageHandler = new Handler(
// return ChangeNotifierProvider<UploadImageProvider>(
// create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage());
});
///包间置满管理
var storeTypeFillManagePageHandler = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode(
// FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first)));
// String tid = params["tid"].first;
return ChangeNotifierProvider<StoreDetailModel>(
create: (_) => StoreDetailModel(), child: StoreTypeFillManagePage());
// return ChangeNotifierProvider<UploadImageProvider>(
// create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage());
});
... ...
... ... @@ -46,6 +46,8 @@ class Routes {
static String table_photo_manager = "/table_photo_manager"; //桌位照片管理
static String statistics_page = "/statistics_page"; //统计页
static String statistics_sms_page = "/statistics_sms_page"; //统计页发短信
static String store_type_fill_manage_page =
"/store_type_fill_manage_page"; //包间置满管理
static void configureRoutes(FluroRouter router) {
router.notFoundHandler = new Handler(
... ... @@ -99,5 +101,7 @@ class Routes {
router.define(table_photo_manager, handler: tablePhotoManagerHandler);
router.define(statistics_page, handler: statisticsPageHandler);
router.define(statistics_sms_page, handler: statisticsSmsPageHandler);
router.define(store_type_fill_manage_page,
handler: storeTypeFillManagePageHandler);
}
}
... ...