Commit 56591f9f6f53fb76f1e39544a5126ce404969fa1

Authored by wdn127929
1 parent bd18d244

占座方硕新修改

... ... @@ -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 = "315"
def flutterVersionCode = "316"
if (flutterVersionCode == null) {
flutterVersionCode = '315'
flutterVersionCode = '316'
}
def flutterVersionName = "3.1.5"
def flutterVersionName = "3.1.6"
if (flutterVersionName == null) {
flutterVersionName = '3.1.5'
flutterVersionName = '3.1.6'
}
apply plugin: 'com.android.application'
... ...
import 'package:easy_contact_picker/easy_contact_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/provider/notebook_detail_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/misc.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
/**
* 填写预订联系人页面
*/
class EditReserverPage extends StatefulWidget {
final String rid;
EditReserverPage(this.rid, {Key key}) : super(key: key);
@override
_EditReserverPageState createState() => _EditReserverPageState();
}
class _EditReserverPageState extends State<EditReserverPage> {
NotebookDetailModel detailModel;
String nameStr;
FocusNode _nameNode = FocusNode();
FocusNode _phoneNode = FocusNode();
bool showPhoneHistory = false; //显示客户历史记录
EasyContactPicker _contactPicker = EasyContactPicker();
_openAddressBook() async {
if (!(await checkContactPermission())) {
PermissionStatus permissionStatus = await contactPermissionStatus();
if (permissionStatus == PermissionStatus.permanentlyDenied) {
//用户选择不在弹出权限提示框
print('never');
DialogUtil.openAlertDialog(
context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置', 340.0,
onTap: () {
openSetting();
Navigator.pop(context, '');
});
} else {
// 申请权限
bool canContacts = await requestContactPermission();
if (canContacts) {
_getContactData();
} else {
//拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处
DialogUtil.openAlertDialog(
context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启。", '去设置', 340.0,
onTap: () {
openSetting();
Navigator.pop(context, '');
});
}
}
} else {
_getContactData();
}
}
_getContactData() async {
Contact contact = await _contactPicker.selectContactWithNative();
setState(() {
String fullName =
contact.fullName.replaceAll(new RegExp(r"\s+\b|\b\s"), "");
String phone =
contact.phoneNumber.replaceAll(new RegExp(r"\s+\b|\b\s"), "");
if (fullName.compareTo(phone) == 0) {
fullName = '';
} else {
fullName = contact.fullName;
}
detailModel.phoneController.text =
contact.phoneNumber.replaceAll(new RegExp(r"\s+"), "");
nameStr = fullName;
// _homeEnterModel.nameController.text = fullName + _nameSuffix();
_addNameSuffix(fullName, _nameSuffix());
});
}
_addNameSuffix(String name, String suffix) {
if (name == detailModel.nameController.text &&
detailModel.nameController.text.endsWith(suffix)) {
return;
}
detailModel.nameController.text = name + suffix;
}
//姓名后缀
_nameSuffix() {
for (var item in detailModel.sexList) {
if (item['select'] == true) {
return item['title'];
}
}
}
Widget _callButton(
{GestureTapCallback onPress,
content,
hasLeftBorder = true,
isSelect = false}) {
return InkWell(
onTap: onPress,
child: Container(
width: ScreenUtil().setWidth(84),
height: ScreenUtil().setHeight(48),
decoration: BoxDecoration(
color: isSelect ? MyColours.color_199095 : MyColours.color_fefefe,
border: Border(
bottom: BorderSide(
color: MyColours.color_6AB6B9,
width: ScreenUtil().setWidth(2)),
top: BorderSide(
color: MyColours.color_6AB6B9,
width: ScreenUtil().setWidth(2)),
left: hasLeftBorder
? BorderSide(
color: MyColours.color_6AB6B9,
width: ScreenUtil().setWidth(2))
: BorderSide.none,
right: BorderSide(
color: MyColours.color_6AB6B9,
width: ScreenUtil().setWidth(2)))),
child: Align(
alignment: Alignment.center,
child: Text(
content,
style: TextStyle(
color: isSelect ? Colors.white : MyColours.color_353535,
fontSize: ScreenUtil().setSp(28)),
),
),
),
);
}
@override
Widget build(BuildContext context) {
detailModel = Provider.of<NotebookDetailModel>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'录入预订人信息',
onTap: () {
Navigator.pop(context);
},
),
body: Padding(
padding:
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
child: Column(children: [
//第一行 顾客姓名
VEmptyView(40),
Expanded(
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Container(
height: ScreenUtil().setWidth(60),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color: MyColours.color_efefef))),
child: TextField(
maxLines: 1,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: MyColours.color_353535),
controller: detailModel.nameController,
focusNode: _nameNode,
// textAlignVertical: TextAlignVertical.top,
decoration: InputDecoration(
hintText: "客人姓名",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(30),
),
// contentPadding:
// EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
border: InputBorder.none,
),
onChanged: (value) {
print('ggg');
nameStr = value;
},
onEditingComplete: () {
print('fff');
_nameNode.unfocus();
// _homeEnterModel.nameController.text =
// nameStr + _nameSuffix();
_addNameSuffix(nameStr, _nameSuffix());
},
keyboardType: TextInputType.text,
),
),
),
// HEmptyView(40),
Row(
children: detailModel.sexList.map((value) {
return _callButton(
onPress: () {
for (var item in detailModel.sexList) {
item['select'] = false;
if (item['title'] == value['title']) {
item['select'] = true;
// _homeEnterModel.nameController.text =
// nameStr + item['title'];
if (nameStr != null && nameStr != '') {
_addNameSuffix(nameStr, item['title']);
}
}
}
detailModel.notifyListeners();
},
content: value['title'],
hasLeftBorder: value['hasLeftBorder'],
isSelect: value['select']);
}).toList()),
],
),
// VEmptyView(30),
// MyDivider(double.infinity,
// ScreenUtil().setWidth(2),
// color:
// MyColours.color_efefef),
//电话
VEmptyView(20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Container(
height: ScreenUtil().setWidth(60),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color: MyColours.color_efefef))),
child: TextField(
maxLines: 1,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: MyColours.color_353535),
controller: detailModel.phoneController,
focusNode: _phoneNode,
// textAlignVertical: TextAlignVertical.top,
decoration: InputDecoration(
hintText: "电话",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(30),
),
// contentPadding:
// EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
border: InputBorder.none,
),
onChanged: (value) {
if (value.isEmpty || value.length > 11) {
//内容为空,或 超过11位
setState(() {
detailModel.userHistorys.clear();
});
return;
}
Map<String, String> params = {
"keywords": value,
"sid": Provider.of<UserModel>(context,
listen: false)
.user
.sellerid,
};
detailModel.getUserHistorys(context, params);
},
onEditingComplete: () {
_phoneNode.unfocus();
},
onTap: () {
setState(() {
showPhoneHistory = true;
});
// Future.delayed(Duration(milliseconds: 300), () {
// _controller.jumpTo(_controller.position.maxScrollExtent);
// });
},
keyboardType: TextInputType.number,
)),
),
InkWell(
onTap: () {
_openAddressBook();
},
child: Container(
width: ScreenUtil().setWidth(84) * 3,
height: ScreenUtil().setWidth(48),
alignment: Alignment.centerRight,
child: Text('一键录入',
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(28),
decoration: TextDecoration.underline)),
),
),
],
),
Stack(
children: [
Container(
height: ScreenUtil().setWidth(180),
width: double.infinity,
color: MyColours.color_ffffff,
),
Offstage(
offstage: !(showPhoneHistory &&
detailModel.userHistorys.length > 0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.white),
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
color: MyColours.color_e5e5e5,
blurRadius: ScreenUtil().setWidth(20))
]),
width: ScreenUtil().setWidth(440),
height: detailModel.userHistorys.length > 1
? ScreenUtil().setWidth(180)
: ScreenUtil().setWidth(104),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(30)),
child: Align(
alignment: Alignment.topCenter,
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: ListView.builder(
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
setState(() {
showPhoneHistory = false;
detailModel.phoneController.text =
detailModel
.userHistorys[index].phone;
// _homeEnterModel.nameController.text =
// _homeEnterModel
// .userHistorys[index].rname +
// _nameSuffix();
_addNameSuffix(
detailModel
.userHistorys[index].rname,
_nameSuffix());
nameStr = detailModel
.userHistorys[index].rname;
_phoneNode.unfocus();
detailModel.userHistorys.clear();
});
},
child: Container(
width: double.infinity,
height: ScreenUtil().setWidth(102),
decoration: BoxDecoration(
border: Border(
bottom: (index !=
(detailModel
.userHistorys
.length -
1) &&
detailModel
.userHistorys
.length >
1)
? BorderSide(
color: MyColours
.color_e5e5e5,
width: ScreenUtil()
.setWidth(2))
: BorderSide.none)),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
detailModel
.userHistorys[index].phone,
style: TextStyle(
color:
MyColours.color_333333,
fontSize:
ScreenUtil().setSp(32)),
),
Expanded(
child: Text(
detailModel
.userHistorys[index].rname,
style: TextStyle(
color:
MyColours.color_333333,
fontSize:
ScreenUtil().setSp(32)),
))
],
),
),
);
},
itemExtent: ScreenUtil().setWidth(104),
itemCount: detailModel.userHistorys.length,
))),
),
)
],
),
],
)),
Padding(
padding: EdgeInsets.only(top: ScreenUtil().setWidth(60)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
RoundButton(
text: '返回',
fontSize: 28,
isBold: false,
height: ScreenUtil().setWidth(70),
width: ScreenUtil().setWidth(180),
radius: ScreenUtil().setWidth(10),
gradientStart: MyColours.color_ffffff,
textColor: MyColours.color_333333,
borderColor: MyColours.color_199095,
gradientEnd: MyColours.color_ffffff,
onPressed: () {
setState(() {
nameStr = '';
detailModel.nameController.text = '';
detailModel.phoneController.text = '';
});
},
),
RoundButton(
text: '保存',
fontSize: 28,
isBold: false,
height: ScreenUtil().setWidth(70),
width: ScreenUtil().setWidth(180),
radius: ScreenUtil().setWidth(10),
onPressed: () async {
if (nameStr == null || nameStr.trim().length == 0) {
Utils.showToast('请填写客人姓名');
return;
}
if (detailModel.phoneController.text.trim().length ==
0) {
Utils.showToast('请填写电话');
return;
}
String sex = '1';
for (var item in detailModel.sexList) {
if (item['select']) {
sex = item['code'];
}
}
bool sucess = await detailModel.upReserveInfo(
context, widget.rid,
name: nameStr,
sex: sex,
phone: detailModel.phoneController.text);
if (sucess) {
EventBus().emit("refresh_tablemanager"); //刷新桌位
bus.emit("refresh_book_list"); //刷新已预订列表
bus.emit("refresh_detail");
Navigator.pop(context);
}
},
)
],
)),
VEmptyView(40)
])));
}
}
... ...
This diff could not be displayed because it is too large.
... ... @@ -826,7 +826,7 @@ class InvicationPageState extends State<InvicationPage> {
ScreenUtil().setWidth(40)),
child: Column(children: [
RoundButton(
text: '通知客户',
text: '微信通知',
width: double.infinity,
height: ScreenUtil().setWidth(84),
gradientStart: MyColours.color_199095,
... ...
... ... @@ -27,79 +27,85 @@ class AreaItemTableState extends State<AreaItemTable> {
Area area = widget.area;
bool isSelected = area.name == widget.currentArea;
return GestureDetector(
onTap: () {
if (widget.selectCallback != null) {
widget.selectCallback(widget.area);
}
},
child: Stack(
overflow: Overflow.visible,
alignment: Alignment.topLeft,
children: <Widget>[
Container(
width: ScreenUtil().setWidth(104 * 2),
height: ScreenUtil().setWidth(80),
margin: EdgeInsets.only(
right: ScreenUtil().setWidth(20),
top: ScreenUtil().setWidth(20),
),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(10)),
alignment: Alignment.center,
decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
color: isSelected
? MyColours.color_199095
: MyColours.color_ffffff,
border: Border.all(
color: MyColours.color_E0E0E0,
width: ScreenUtil().setWidth(2))),
child: Text(
area.name,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: isSelected
? MyColours.color_ffffff
: MyColours.color_333333,
fontSize: ScreenUtil().setSp(28),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
),
),
!widget.showBadge
? SizedBox()
: area.count == -1
? Container()
: Positioned(
right: ScreenUtil().setWidth(12),
top: ScreenUtil().setWidth(6),
child: Container(
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setWidth(6),
horizontal: ScreenUtil().setWidth(4)),
// width: ScreenUtil().setWidth(78),
// height: ScreenUtil().setWidth(30),
alignment: Alignment.center,
decoration: BoxDecoration(
color: area.count <= 0
? MyColours.color_999999
: MyColours.color_199095,
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(ScreenUtil().setWidth(10)),
// topRight: Radius.circular(ScreenUtil().setWidth(15)),
// bottomRight:
// Radius.circular(ScreenUtil().setWidth(15)))
),
child: Text(area.count <= 0 ? "满座" : "${area.count}",
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(26),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal)),
),
),
],
));
onTap: () {
if (widget.selectCallback != null) {
widget.selectCallback(widget.area);
}
},
child:
// Stack(
// overflow: Overflow.visible,
// alignment: Alignment.topLeft,
// children: <Widget>[
Container(
// width: ScreenUtil().setWidth(104 * 2),
// height: ScreenUtil().setWidth(10),
margin: EdgeInsets.only(
right: ScreenUtil().setWidth(15),
top: ScreenUtil().setWidth(20),
),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(14),
// vertical: ScreenUtil().setWidth(4)
),
alignment: Alignment.center,
decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
color: isSelected
? MyColours.color_199095
: widget.showBadge && area.count != -1 && area.count <= 0
? Color.fromRGBO(154, 154, 154, 1)
: MyColours.color_ffffff,
border: Border.all(
color: MyColours.color_E0E0E0,
width: ScreenUtil().setWidth(2))),
child: Text(
area.name,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: isSelected ||
(widget.showBadge && area.count != -1 && area.count <= 0)
? MyColours.color_ffffff
: MyColours.color_333333,
fontSize: ScreenUtil().setSp(24),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
),
),
// !widget.showBadge
// ? SizedBox()
// : area.count == -1
// ? Container()
// : Positioned(
// right: ScreenUtil().setWidth(12),
// top: ScreenUtil().setWidth(6),
// child: Container(
// padding: EdgeInsets.symmetric(
// vertical: ScreenUtil().setWidth(6),
// horizontal: ScreenUtil().setWidth(4)),
// // width: ScreenUtil().setWidth(78),
// // height: ScreenUtil().setWidth(30),
// alignment: Alignment.center,
// decoration: BoxDecoration(
// color: area.count <= 0
// ? MyColours.color_999999
// : MyColours.color_199095,
// // borderRadius: BorderRadius.only(
// // topLeft: Radius.circular(ScreenUtil().setWidth(10)),
// // topRight: Radius.circular(ScreenUtil().setWidth(15)),
// // bottomRight:
// // Radius.circular(ScreenUtil().setWidth(15)))
// ),
// child: Text(area.count <= 0 ? "满座" : "${area.count}",
// style: TextStyle(
// color: MyColours.color_ffffff,
// fontSize: ScreenUtil().setSp(26),
// decoration: TextDecoration.none,
// fontWeight: FontWeight.normal)),
// ),
// ),
// ],
// )
);
}
}
... ...
... ... @@ -32,6 +32,7 @@ import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import 'dart:convert' as convert;
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import 'package:one_key/models/table_list.dart' as table;
const scrollDuration = Duration(microseconds: 500);
... ... @@ -55,7 +56,7 @@ class TableManagerPageState extends State<TableManagerPage> {
List<String> personNumList = [];
bool isSelected = true; //全部按钮
ScrollController _scrollCrl = ScrollController();
// ScrollController _scrollCrl = ScrollController();
final ItemPositionsListener itemPositionsListener =
ItemPositionsListener.create();
... ... @@ -264,10 +265,10 @@ class TableManagerPageState extends State<TableManagerPage> {
tableManagerModel.selectTables
.removeWhere((t) => t.id == table.id);
}
if (tableManagerModel.selectTables.length > 1) {
_scrollCrl.position
.didUpdateScrollPositionBy(0); //这里触发更新滚动条
}
// if (tableManagerModel.selectTables.length > 1) {
// _scrollCrl.position
// .didUpdateScrollPositionBy(0); //这里触发更新滚动条
// }
});
}
// DialogUtil.showTableManagerDialog(context, table).then((value) {
... ... @@ -349,268 +350,455 @@ class TableManagerPageState extends State<TableManagerPage> {
///选中的桌子widget
Widget _selectTableWidget() {
return Expanded(
flex: 1,
child: Container(
// constraints: BoxConstraints(minHeight: ScreenUtil().setWidth(600)),
// height: ScreenUtil().setWidth(400),
width: double.infinity,
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(40),
right: ScreenUtil().setWidth(40),
top: ScreenUtil().setWidth(30)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
color: MyColours.color_333333,
blurRadius: ScreenUtil().setWidth(14))
],
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ScreenUtil().setWidth(30)),
topRight: Radius.circular(ScreenUtil().setWidth(30)),
)),
child: Row(
// mainAxisSize: MainAxisSize.min,
return Container(
// constraints: BoxConstraints(maxHeight: ScreenUtil().setWidth(760)),
// height: ScreenUtil().setWidth(400),
width: double.infinity,
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(40),
right: ScreenUtil().setWidth(40),
top: ScreenUtil().setWidth(15)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
color: MyColours.color_333333,
blurRadius: ScreenUtil().setWidth(14))
],
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ScreenUtil().setWidth(30)),
topRight: Radius.circular(ScreenUtil().setWidth(30)),
)),
child: Column(
// mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
tableManagerModel.selectDateStr,
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(28)),
fontSize: ScreenUtil().setSp(45),
fontWeight: FontWeight.bold),
),
VEmptyView(15),
Text(
'已选桌位:',
tableManagerModel.selectWeekAndLunarCalendar,
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(26)),
fontSize: ScreenUtil().setSp(30)),
),
VEmptyView(15),
Expanded(
child: Container(
width: ScreenUtil.screenWidthDp -
ScreenUtil().setWidth(100 + 180),
// height: ScreenUtil().setWidth(200),
// color: Colors.blueAccent,
child:
// ListView.builder(
// shrinkWrap: true,
// itemBuilder: (BuildContext context, int index) {
// return
Scrollbar(
isAlwaysShown: true, //设置滚动条常亮
controller: _scrollCrl, //必须设置一个controller
///添加进度条
child: SingleChildScrollView(
controller: _scrollCrl,
child: Container(
width: ScreenUtil.screenWidthDp -
ScreenUtil().setWidth(100 + 180),
child: Wrap(
spacing: ScreenUtil().setWidth(20),
runSpacing:
ScreenUtil().setWidth(20),
children: _buildAlwayItems())),
))
// },
// itemCount: 1,
// ),
))
],
),
HEmptyView(20),
Spacer(),
Padding(
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(6),
),
child: Text(
tableManagerModel.doltStr,
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(48),
fontWeight: FontWeight.bold),
),
),
],
),
VEmptyView(40),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// HEmptyView(15),
Padding(
// width: ScreenUtil().setWidth(120),
padding: EdgeInsets.only(top: ScreenUtil().setWidth(10)),
child: Text(
'已选桌位:',
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(26)),
)),
HEmptyView(15),
// Expanded(
// child:
// width: ScreenUtil.screenWidthDp -
// ScreenUtil().setWidth(160),
// constraints:
// BoxConstraints(maxHeight: ScreenUtil().setWidth(140)),
// color: Colors.blueAccent,
// ListView.builder(
// shrinkWrap: true,
// itemBuilder: (BuildContext context, int index) {
// return
// Scrollbar(
// isAlwaysShown: true, //设置滚动条常亮
// controller: _scrollCrl, //必须设置一个controller
// ///添加进度条
// child:
// SingleChildScrollView(
// controller: _scrollCrl,
// child:
Container(
// width: ScreenUtil().setWidth(100),
// color: Colors.red,
constraints: BoxConstraints(
minHeight: ScreenUtil().setWidth(500),
// color: Colors.red,
width: ScreenUtil.screenWidthDp -
ScreenUtil().setWidth(100 + 130),
child: Wrap(
spacing: ScreenUtil().setWidth(20),
runSpacing: ScreenUtil().setWidth(20),
children: _buildAlwayItems())),
// )
// )
// },
// itemCount: 1,
// ),
// )
],
),
VEmptyView(40),
Container(
// width: ScreenUtil().setWidth(100),
// color: Colors.red,
// constraints: BoxConstraints(
// minHeight: ScreenUtil().setWidth(500),
// ),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
InkWell(
onTap: () {
tableManagerModel.selectTables = [];
for (t.Table item in tableManagerModel.tablesShow) {
item.selected = false;
}
tableManagerModel.areaTableMapShow.forEach((key, value) {
value.forEach((element) {
element.selected = false;
});
});
tableManagerModel.notifyListeners();
},
child: Container(
padding: EdgeInsets.all(
ScreenUtil().setWidth(30),
),
child: Text(
'取消重置',
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(26)),
),
),
),
child: Column(
children: [
RoundButton(
onPressed: () async {
SunReserveInfoModel _model = await tableManagerModel
.setReserveInfo(context, needKeep: true);
if (_model != null &&
ObjectUtil.isNotEmpty(_model.row) &&
ObjectUtil.isNotEmpty(_model.row.id)) {
print('成功');
tableManagerModel.selectTables = [];
// _homeEnterModel.clearData();
bus.emit("refresh_tablemanager"); //刷新当前页面
bus.emit("refresh_book_list"); //刷新已预订列表
//进入订座详情页面
NavigatorUtil.goNotebookDetailPage(
context,
_model.row.id,
Provider.of<UserModel>(context, listen: false)
.user
.openid,
);
// String ddate_solt = '';
// if (_model.row.isSetDdate == '1') {
// String createtime =
// _model.row.ddate.toString() + '000';
// DateTime createTime =
// DateTime.fromMillisecondsSinceEpoch(
// int.parse(createtime));
// ddate_solt = DateUtil.formatDate(createTime,
// format: DateFormats.h_m);
// } else {
// if (_model.row.ddateSolt == '1') {
// ddate_solt = '早餐';
// } else if (_model.row.ddateSolt == '2') {
// ddate_solt = '午餐';
// } else if (_model.row.ddateSolt == '3') {
// ddate_solt = '晚餐';
// }
// }
// List<dynamic> tableinfo =
// convert.jsonDecode(_model.row.tableinfo);
// print(tableinfo);
RoundButton(
onPressed: () async {
SunReserveInfoModel _model = await tableManagerModel
.setReserveInfo(context, needKeep: true);
if (_model != null &&
ObjectUtil.isNotEmpty(_model.row) &&
ObjectUtil.isNotEmpty(_model.row.id)) {
print('成功');
tableManagerModel.selectTables = [];
// _homeEnterModel.clearData();
bus.emit("refresh_tablemanager"); //刷新当前页面
bus.emit("refresh_book_list"); //刷新已预订列表
//进入订座详情页面
NavigatorUtil.goNotebookDetailPage(
context,
_model.row.id,
Provider.of<UserModel>(context, listen: false)
.user
.openid,
);
// String ddate_solt = '';
// if (_model.row.isSetDdate == '1') {
// String createtime =
// _model.row.ddate.toString() + '000';
// DateTime createTime =
// DateTime.fromMillisecondsSinceEpoch(
// int.parse(createtime));
// ddate_solt = DateUtil.formatDate(createTime,
// format: DateFormats.h_m);
// } else {
// if (_model.row.ddateSolt == '1') {
// ddate_solt = '早餐';
// } else if (_model.row.ddateSolt == '2') {
// ddate_solt = '午餐';
// } else if (_model.row.ddateSolt == '3') {
// ddate_solt = '晚餐';
// }
// }
// List<dynamic> tableinfo =
// convert.jsonDecode(_model.row.tableinfo);
// print(tableinfo);
// String _nameStr =
// t.TableList.fromJson(tableinfo[0]).name;
// if (tableinfo.length > 1) {
// _nameStr = t.TableList.fromJson(tableinfo[0]).name +
// '等${tableinfo.length}桌';
// }
// LogUtil.v(_nameStr);
// String _tid = '';
// for (int i = 0; i < tableinfo.length; i++) {
// _tid += '${t.TableList.fromJson(tableinfo[i]).id},';
// }
// if (_tid.endsWith(',')) {
// _tid = _tid.substring(0, _tid.length - 1);
// }
// NavigatorUtil.goInvicationPage(
// context,
// _model.row.id,
// _nameStr,
// _model.row.ddate,
// ddate_solt,
// _model.row.phone,
// _model.row.ddateSolt,
// tid: _tid,
// replace: false);
// //今天 明天 其他天
// String tempTime = _homeEnterModel.ddateStr;
// if (_homeEnterModel.ddateStr == '') {
// if (currTimeIndex == 1) {
// tempTime = '08:00';
// } else if (currTimeIndex == 2) {
// tempTime = '12:00';
// } else if (currTimeIndex == 3) {
// tempTime = '18:00';
// }
// }
// print(_model.row.tableinfo);
// _clearData();
// String timeStr = dateText + ' ' + tempTime + ':00';
// String _nameStr =
// t.TableList.fromJson(tableinfo[0]).name;
// if (tableinfo.length > 1) {
// _nameStr = t.TableList.fromJson(tableinfo[0]).name +
// '等${tableinfo.length}桌';
// }
// LogUtil.v(_nameStr);
// String _tid = '';
// for (int i = 0; i < tableinfo.length; i++) {
// _tid += '${t.TableList.fromJson(tableinfo[i]).id},';
// }
// if (_tid.endsWith(',')) {
// _tid = _tid.substring(0, _tid.length - 1);
// }
// NavigatorUtil.goInvicationPage(
// context,
// _model.row.id,
// _nameStr,
// _model.row.ddate,
// ddate_solt,
// _model.row.phone,
// _model.row.ddateSolt,
// tid: _tid,
// replace: false);
// //今天 明天 其他天
// String tempTime = _homeEnterModel.ddateStr;
// if (_homeEnterModel.ddateStr == '') {
// if (currTimeIndex == 1) {
// tempTime = '08:00';
// } else if (currTimeIndex == 2) {
// tempTime = '12:00';
// } else if (currTimeIndex == 3) {
// tempTime = '18:00';
// }
// }
// print(_model.row.tableinfo);
// _clearData();
// String timeStr = dateText + ' ' + tempTime + ':00';
// LogUtil.v(timeStr);
// int ddate = DateUtil.getDateMsByTimeStr(timeStr);
// LogUtil.v(timeStr);
// int ddate = DateUtil.getDateMsByTimeStr(timeStr);
// _homeEnterModel.getNewTableList(context, '${ddate}',
// currTimeIndex.toString(), pnum);
// _homeEnterModel.getNewTableList(context, '${ddate}',
// currTimeIndex.toString(), pnum);
// EventBus().emit("refresh_tablemanager"); //刷新桌位
} else {
Utils.showToast("预订失败!");
}
},
text: '预订',
fontSize: 48,
isBold: true,
width: ScreenUtil().setWidth(180),
height: ScreenUtil().setWidth(140),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(4)),
textColor: MyColours.color_ffffff,
gradientStart: MyColours.color_199095,
gradientEnd: MyColours.color_199095,
radius: ScreenUtil().setWidth(10),
borderColor: MyColours.color_199095,
),
InkWell(
onTap: () {
tableManagerModel.selectTables = [];
for (t.Table item in tableManagerModel.tablesShow) {
item.selected = false;
// EventBus().emit("refresh_tablemanager"); //刷新桌位
} else {
Utils.showToast("预订失败!");
}
},
text: '仅预订',
fontSize: 32,
isBold: false,
width: ScreenUtil().setWidth(180),
height: ScreenUtil().setWidth(90),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(4)),
textColor: MyColours.color_199095,
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
radius: ScreenUtil().setWidth(10),
borderColor: MyColours.color_199095,
),
RoundButton(
onPressed: () async {
SunReserveInfoModel _model = await tableManagerModel
.setReserveInfo(context, needKeep: true);
if (_model != null &&
ObjectUtil.isNotEmpty(_model.row) &&
ObjectUtil.isNotEmpty(_model.row.id)) {
print('成功');
tableManagerModel.selectTables = [];
// _homeEnterModel.clearData();
bus.emit("refresh_tablemanager"); //刷新当前页面
bus.emit("refresh_book_list"); //刷新已预订列表
// //进入订座详情页面
// NavigatorUtil.goNotebookDetailPage(
// context,
// _model.row.id,
// Provider.of<UserModel>(context, listen: false)
// .user
// .openid,
// );
String ddate_solt = '';
if (_model.row.isSetDdate == '1') {
String createtime = _model.row.ddate.toString() + '000';
DateTime createTime =
DateTime.fromMillisecondsSinceEpoch(
int.parse(createtime));
ddate_solt = DateUtil.formatDate(createTime,
format: DateFormats.h_m);
} else {
if (_model.row.ddateSolt == '1') {
ddate_solt = '早餐';
} else if (_model.row.ddateSolt == '2') {
ddate_solt = '午餐';
} else if (_model.row.ddateSolt == '3') {
ddate_solt = '晚餐';
}
tableManagerModel.areaTableMapShow
.forEach((key, value) {
value.forEach((element) {
element.selected = false;
});
});
}
List<dynamic> tableinfo =
convert.jsonDecode(_model.row.tableinfo);
print(tableinfo);
tableManagerModel.notifyListeners();
},
child: Padding(
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(30),
right: ScreenUtil().setWidth(30),
top: ScreenUtil().setWidth(15)),
child: Text(
'取消重置',
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(26)),
),
),
),
],
String _nameStr =
table.TableList.fromJson(tableinfo[0]).name;
if (tableinfo.length > 1) {
_nameStr = table.TableList.fromJson(tableinfo[0]).name +
'等${tableinfo.length}桌';
}
LogUtil.v(_nameStr);
String _tid = '';
for (int i = 0; i < tableinfo.length; i++) {
_tid += '${table.TableList.fromJson(tableinfo[i]).id},';
}
if (_tid.endsWith(',')) {
_tid = _tid.substring(0, _tid.length - 1);
}
NavigatorUtil.goInvicationPage(
context,
_model.row.id,
_nameStr,
_model.row.ddate,
ddate_solt,
_model.row.phone,
_model.row.ddateSolt,
tid: _tid,
replace: false);
// //今天 明天 其他天
// String tempTime = _homeEnterModel.ddateStr;
// if (_homeEnterModel.ddateStr == '') {
// if (currTimeIndex == 1) {
// tempTime = '08:00';
// } else if (currTimeIndex == 2) {
// tempTime = '12:00';
// } else if (currTimeIndex == 3) {
// tempTime = '18:00';
// }
// }
// print(_model.row.tableinfo);
// _clearData();
// String timeStr = dateText + ' ' + tempTime + ':00';
// LogUtil.v(timeStr);
// int ddate = DateUtil.getDateMsByTimeStr(timeStr);
// _homeEnterModel.getNewTableList(context, '${ddate}',
// currTimeIndex.toString(), pnum);
// EventBus().emit("refresh_tablemanager"); //刷新桌位
} else {
Utils.showToast("预订失败!");
}
},
text: '预订并通知',
fontSize: 32,
isBold: false,
width: ScreenUtil().setWidth(220),
height: ScreenUtil().setWidth(90),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(4)),
textColor: MyColours.color_ffffff,
gradientStart: MyColours.color_199095,
gradientEnd: MyColours.color_199095,
radius: ScreenUtil().setWidth(10),
borderColor: MyColours.color_199095,
),
)
],
],
),
),
));
VEmptyView(40),
],
),
);
}
//构建常用备注
List<Widget> _buildAlwayItems() {
List<Widget> tables = [];
for (t.Table table in tableManagerModel.selectTables) {
tables.add(Container(
if (tableManagerModel.selectTables.length < 6) {
for (t.Table table in tableManagerModel.selectTables) {
tables.add(Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(10),
vertical: ScreenUtil().setWidth(6)),
decoration: BoxDecoration(
color: MyColours.color_199095,
// border: Border.all(
// color: MyColours.color_E0E0E0,
// width: ScreenUtil().setWidth(2)),
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(10))),
child: Text(
table.name,
style: TextStyle(
fontSize: ScreenUtil().setSp(36),
color: MyColours.color_ffffff,
fontWeight: FontWeight.bold),
))
// RoundButton(
// onPressed: () async {},
// text: table.name,
// fontSize: 26,
// isBold: false,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(20),
// vertical: ScreenUtil().setWidth(4)),
// height: ScreenUtil().setWidth(48),
// textColor: MyColours.color_333333,
// gradientStart: MyColours.color_ffffff,
// gradientEnd: MyColours.color_ffffff,
// radius: ScreenUtil().setWidth(10),
// borderColor: MyColours.color_E0E0E0,
// )
);
}
} else {
for (int i = 0; i < 6; i++) {
if (i == 5) {
tables.add(Container(
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(10),
right: ScreenUtil().setWidth(10),
top: ScreenUtil().setWidth(10)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
// border: Border.all(
// color: MyColours.color_E0E0E0,
// width: ScreenUtil().setWidth(2)),
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(10))),
child: Text(
'等${tableManagerModel.selectTables.length}个桌位',
style: TextStyle(
fontSize: ScreenUtil().setSp(26),
color: MyColours.color_199095,
),
)));
return tables;
} else {
tables.add(Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(4)),
horizontal: ScreenUtil().setWidth(10),
vertical: ScreenUtil().setWidth(6)),
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_E0E0E0,
width: ScreenUtil().setWidth(2)),
color: MyColours.color_199095,
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(10))),
child: Text(
table.name,
tableManagerModel.selectTables[i].name,
style: TextStyle(
fontSize: ScreenUtil().setSp(26),
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(36),
color: MyColours.color_ffffff,
fontWeight: FontWeight.bold),
))
// RoundButton(
// onPressed: () async {},
// text: table.name,
// fontSize: 26,
// isBold: false,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(20),
// vertical: ScreenUtil().setWidth(4)),
// height: ScreenUtil().setWidth(48),
// textColor: MyColours.color_333333,
// gradientStart: MyColours.color_ffffff,
// gradientEnd: MyColours.color_ffffff,
// radius: ScreenUtil().setWidth(10),
// borderColor: MyColours.color_E0E0E0,
// )
);
)));
}
}
}
return tables;
... ... @@ -618,10 +806,12 @@ class TableManagerPageState extends State<TableManagerPage> {
///早餐、午餐、晚餐点击方法
_clickMorAndNoonAndNig() async {
tableManagerModel.selectDateStr = tableManagerModel.returnDayDateWeekStr(
tableManagerModel.dateTimeSelect, tableManagerModel.currTimeIndex);
await tableManagerModel.getReserveList(context, needLoading: true);
tableManagerModel.selectDateStr =
tableManagerModel.returnDayDateStr(tableManagerModel.dateTimeSelect);
tableManagerModel.selectWeekAndLunarCalendar = tableManagerModel
.returnWeekAndLunarCalendar(tableManagerModel.dateTimeSelect);
await tableManagerModel.getReserveList(context,
needLoading: true, showMsg: true);
}
@override
... ... @@ -629,8 +819,9 @@ class TableManagerPageState extends State<TableManagerPage> {
tableManagerModel = Provider.of<TableManagerModel>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar("桌位", showLeading: false),
body: Consumer<TableManagerModel>(
body: SafeArea(child:
// appBar: SystemAppBar("桌位", showLeading: false),
Consumer<TableManagerModel>(
builder: (context, model, child) {
int sum = 3;
int hide = 0;
... ... @@ -647,6 +838,7 @@ class TableManagerPageState extends State<TableManagerPage> {
btnNum = sum - hide;
return Column(
children: <Widget>[
VEmptyView(40),
Container(
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(
... ... @@ -658,9 +850,11 @@ class TableManagerPageState extends State<TableManagerPage> {
onTap: () {
DialogUtil.showCalendarDialog(
context, tableManagerModel.dateTime)
.then((day) {
.then((day) async {
if (day != null) {
tableManagerModel.createDateText(context, day);
await tableManagerModel.getReserveList(context,
needLoading: true, showMsg: true);
}
});
},
... ... @@ -684,7 +878,7 @@ class TableManagerPageState extends State<TableManagerPage> {
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(28)),
)),
HEmptyView(10),
// HEmptyView(10),
Image.asset(
Utils.getImgPath('f_arrow_right'),
width: ScreenUtil().setWidth(25),
... ... @@ -704,9 +898,9 @@ class TableManagerPageState extends State<TableManagerPage> {
width: btnNum == 3 &&
(tableManagerModel.currTimeIndex == 3 ||
tableManagerModel.currTimeIndex == 1)
? ScreenUtil().setWidth(206) +
? ScreenUtil().setWidth(300) +
ScreenUtil().setWidth(4)
: ScreenUtil().setWidth(206),
: ScreenUtil().setWidth(300),
height: ScreenUtil().setWidth(74),
decoration: BoxDecoration(
color: Color.fromRGBO(232, 232, 232, 1),
... ... @@ -734,7 +928,7 @@ class TableManagerPageState extends State<TableManagerPage> {
"00:00-00:00"
? true
: false,
width: ScreenUtil().setWidth(206) / btnNum,
width: ScreenUtil().setWidth(300) / btnNum,
onPress: () {
if (tableManagerModel.currTimeIndex == 1)
return;
... ... @@ -763,7 +957,7 @@ class TableManagerPageState extends State<TableManagerPage> {
? 1
: 0,
fontSize: 28,
width: ScreenUtil().setWidth(206) / btnNum,
width: ScreenUtil().setWidth(300) / btnNum,
left:
tableManagerModel.morning == "00:00-00:00"
? true
... ... @@ -804,7 +998,7 @@ class TableManagerPageState extends State<TableManagerPage> {
? 1
: 0,
fontSize: 28,
width: ScreenUtil().setWidth(206) / btnNum,
width: ScreenUtil().setWidth(300) / btnNum,
onPress: () {
if (tableManagerModel.currTimeIndex == 3)
return;
... ... @@ -822,7 +1016,7 @@ class TableManagerPageState extends State<TableManagerPage> {
],
),
),
VEmptyView(30),
VEmptyView(10),
model.pageState != PageState.Success
? Expanded(
... ... @@ -845,9 +1039,9 @@ class TableManagerPageState extends State<TableManagerPage> {
children: [
Container(
color: MyColours.color_ffffff,
height: ScreenUtil().setWidth(92),
height: ScreenUtil().setWidth(82),
margin: EdgeInsets.only(
bottom: ScreenUtil().setWidth(30)),
bottom: ScreenUtil().setWidth(24)),
child: Row(
children: [
HEmptyView(20),
... ... @@ -907,8 +1101,8 @@ class TableManagerPageState extends State<TableManagerPage> {
DottedBorder(
dashPattern: [5, 5, 5, 5],
borderType: BorderType.RRect,
radius: Radius.circular(
ScreenUtil().setWidth(10)),
// radius: Radius.circular(
// ScreenUtil().setWidth(10)),
// padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
color: MyColours.color_199095,
strokeWidth:
... ... @@ -922,7 +1116,7 @@ class TableManagerPageState extends State<TableManagerPage> {
height: ScreenUtil()
.setWidth(25 * 2),
width: ScreenUtil()
.setWidth(104 * 2),
.setWidth(70 * 2),
child: Column(
mainAxisAlignment:
MainAxisAlignment
... ... @@ -959,12 +1153,12 @@ class TableManagerPageState extends State<TableManagerPage> {
height: ScreenUtil().setWidth(80),
margin: EdgeInsets.only(
right:
ScreenUtil().setWidth(20),
ScreenUtil().setWidth(15),
top: ScreenUtil().setWidth(20),
),
padding: EdgeInsets.symmetric(
horizontal:
ScreenUtil().setWidth(20),
ScreenUtil().setWidth(14),
vertical: ScreenUtil()
.setWidth(10)),
alignment: Alignment.center,
... ... @@ -987,7 +1181,7 @@ class TableManagerPageState extends State<TableManagerPage> {
: MyColours
.color_333333,
fontSize:
ScreenUtil().setSp(28),
ScreenUtil().setSp(24),
decoration:
TextDecoration.none,
fontWeight:
... ... @@ -1055,7 +1249,7 @@ class TableManagerPageState extends State<TableManagerPage> {
'f_swich_on')
: Utils.getImgPath(
'f_swich_off'),
width: ScreenUtil().setWidth(90),
width: ScreenUtil().setWidth(60),
// height: ScreenUtil().setWidth(82),
),
HEmptyView(20),
... ... @@ -1063,7 +1257,7 @@ class TableManagerPageState extends State<TableManagerPage> {
'仅看\n空座',
style: TextStyle(
fontSize:
ScreenUtil().setSp(28),
ScreenUtil().setSp(23),
color: MyColours.color_333333,
),
),
... ... @@ -1075,7 +1269,7 @@ class TableManagerPageState extends State<TableManagerPage> {
),
),
Expanded(
flex: 2,
// flex: 2,
child: Container(
constraints: BoxConstraints(
minHeight: ScreenUtil().setWidth(100)),
... ... @@ -1137,6 +1331,6 @@ class TableManagerPageState extends State<TableManagerPage> {
],
);
},
));
)));
}
}
... ...
... ... @@ -58,7 +58,8 @@ class TableManagerModel with ChangeNotifier {
Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟
bool swichState = false; //仅看空座
String selectDateStr = '';
String selectWeekAndLunarCalendar = '';
String doltStr = '';
DateTime dateTimeSelect;
int selectNumber;
... ... @@ -131,7 +132,8 @@ class TableManagerModel with ChangeNotifier {
//过了晚市
currTimeIndex = 3;
}
selectDateStr = returnDayDateWeekStr(dateTime, currTimeIndex);
selectDateStr = returnDayDateStr(dateTime);
selectWeekAndLunarCalendar = returnWeekAndLunarCalendar(dateTime);
List temp = await getTableList(context);
if (temp.length > 0) {
getReserveList(context);
... ... @@ -697,28 +699,59 @@ class TableManagerModel with ChangeNotifier {
if (Utils.isOneDay(day, dateTime)) return; //日期没变
dateTimeSelect = day;
dateText = _returnDate(day);
selectDateStr = returnDayDateWeekStr(day, currTimeIndex);
selectDateStr = returnDayDateStr(day);
selectWeekAndLunarCalendar = returnWeekAndLunarCalendar(day);
dateTime = day;
getReserveList(context, needLoading: true);
}
_returnDate(DateTime day) {
String time = Utils.lunarCalendarHolidays(day);
// String time = Utils.lunarCalendarHolidays(day);
String date = _returnDayDateWeek(day);
date += ' ${time}';
// date += ' ${time}';
return date;
}
String returnDayDateWeekStr(DateTime day, int index) {
String date = _returnDayDateWeek(day);
_getDoltStr() {
if (currTimeIndex == 1) {
doltStr = '早餐';
} else if (currTimeIndex == 2) {
doltStr = '午餐';
} else if (currTimeIndex == 3) {
doltStr = '晚餐';
}
}
// String returnDayDateWeekStr(DateTime day, int index) {
// String date = _returnDayDate(day);
// // if (index == 1) {
// // date += ' 早餐';
// // } else if (index == 2) {
// // date += ' 午餐';
// // } else if (index == 3) {
// // date += ' 晚餐';
// // }
// return date;
// }
String returnDayDateStr(DateTime day) {
String date = '';
DateTime dateNow = DateTime.now();
String ymd = "${day.year}-" +
Utils.addZeroNumber(day.month) +
"-" +
Utils.addZeroNumber(day.day);
if (index == 1) {
date += ' 早餐';
} else if (index == 2) {
date += ' 午餐';
} else if (index == 3) {
date += ' 晚餐';
if (Utils.isOneDay(day, dateNow)) {
date += "今天 ";
} else if (Utils.isOneDay(day, dateNow.add(Duration(days: 1)))) {
date += "明天 ";
} else if (Utils.isOneDay(day, dateNow.add(Duration(days: 2)))) {
date += "后天 ";
}
date += ymd;
// date += " 星期${Utils.formatWeekDayNum(day.weekday)}";
return date;
}
... ... @@ -742,6 +775,13 @@ class TableManagerModel with ChangeNotifier {
return date;
}
String returnWeekAndLunarCalendar(DateTime day) {
String date = "星期${Utils.formatWeekDayNum(day.weekday)} 农历 ";
date += Utils.lunarCalendarHolidays(day);
_getDoltStr();
return date;
}
//获取桌位数据
Future<dynamic> setSwitchStatus(
BuildContext context, Map<String, String> params) async {
... ...
... ... @@ -501,4 +501,11 @@ class NavigatorUtil {
context, "${Routes.personnel_password_edit_page}?idstr=${idstr}",
replace: replace);
}
/// 填写预订联系人页面
static Future<dynamic> goEditReserverPage(BuildContext context,String rid,
{replace = false }) {
return _navigateTo(context, "${Routes.edit_reserver_page}?rid=${rid}",
replace: replace);
}
}
... ...
... ... @@ -26,6 +26,7 @@ import 'package:one_key/pages/create_store/enter_store_position.dart';
import 'package:one_key/pages/create_store/enter_store_time.dart';
import 'package:one_key/pages/create_store/map_choice_point.dart';
import 'package:one_key/pages/create_store/play_video.dart';
import 'package:one_key/pages/detail/edit_reserver_page.dart';
import 'package:one_key/pages/detail/notebook_detail_change_page.dart';
import 'package:one_key/pages/detail/notebook_detail_change_page_f.dart';
import 'package:one_key/pages/detail/select_tables_f_page.dart';
... ... @@ -129,6 +130,23 @@ var reserveDetailHandler = new Handler(
))));
});
// 填写预订人信息
var editReserverPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
String rid = params['rid'].first;
// String mid = params['mid'].first;
// String uid = params['uid'].first;
// bool fromNotify = FluroConvertUtils.string2bool(params["fromNotify"].first);
return ChangeNotifierProvider<NotebookDetailModel>(
create: (_) => NotebookDetailModel(),
child: EditReserverPage(
rid,
// mid: mid,
// uid: uid,
// fromNotify: fromNotify,
));
});
// 跳转到处理在线预订
var handleOnlineHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
... ...
... ... @@ -66,6 +66,8 @@ class Routes {
"/personnel_password_edit_page"; //密码修改页
static String change_detail_f = "/change_detail_f"; //变更预订_方硕新修改页面
static String photo_manager_page = "/photo_manager_page"; //照片管理
static String edit_reserver_page = "/edit_reserver_page"; //填写预订联系人
static void configureRoutes(FluroRouter router) {
router.notFoundHandler = new Handler(
... ... @@ -140,5 +142,8 @@ class Routes {
handler: personnelPasswordEditPageHandle);
router.define(change_detail_f, handler: noteBookChangeFPageHandle);
router.define(photo_manager_page, handler: photoManagerPageHandle);
router.define(edit_reserver_page, handler: editReserverPageHandle);
}
}
... ...
... ... @@ -63,25 +63,25 @@ class Utils {
"1223": "过小年",
"0100": "除夕"
};
Map<String, String> holiday2 = {
"0101": '元旦',
"0214": "情人节",
"0308": "妇女节",
"0501": "劳动节",
"0504": "青年节",
"0601": "国际儿童节",
"0801": "八一建军节",
"0910": "教师节",
"1001": "国庆节",
"1224": "平安夜",
"1225": "圣诞节",
};
// Map<String, String> holiday2 = {
// "0101": '元旦',
// "0214": "情人节",
// "0308": "妇女节",
// "0501": "劳动节",
// "0504": "青年节",
// "0601": "国际儿童节",
// "0801": "八一建军节",
// "0910": "教师节",
// "1001": "国庆节",
// "1224": "平安夜",
// "1225": "圣诞节",
// };
if (holiday1.containsKey(keyLunar)) {
return holiday1[keyLunar];
}
if (holiday2.containsKey(keySolar)) {
return holiday2[keySolar];
}
// if (holiday2.containsKey(keySolar)) {
// return holiday2[keySolar];
// }
return lunarCalendarUtils(day);
}
... ...