Commit d5f31213b717fde0351997fc61d83732b5f1d081

Authored by wdn
1 parent 06e16d8d

选择桌位选中状态

... ... @@ -24,6 +24,13 @@
android:windowSoftInputMode="adjustResize"
android:exported="true"
>
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
... ...
... ... @@ -23,6 +23,7 @@ import 'package:flutter/services.dart';
Future<void> main() async {
FlutterBugly.postCatchedException(() async {
WidgetsFlutterBinding.ensureInitialized();
Router router = Router();
Routes.configureRoutes(router);
App.router = router;
... ... @@ -30,17 +31,22 @@ Future<void> main() async {
LogUtil.init(isDebug: true, tag: 'ONE_KEY');
Provider.debugCheckInvalidValueType = null;
await initializeDateFormatting();
runApp(MultiProvider(
providers: [
ChangeNotifierProvider<UserModel>(
create: (_) => UserModel(),
),
ChangeNotifierProvider<MessageDialogModel>(
create: (_) => MessageDialogModel()..init(),
),
],
child: MyApp(),
));
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown])
.then((_) {
runApp(MultiProvider(
providers: [
ChangeNotifierProvider<UserModel>(
create: (_) => UserModel(),
),
ChangeNotifierProvider<MessageDialogModel>(
create: (_) => MessageDialogModel()..init(),
),
],
child: MyApp(),
));
});
FlutterBugly.init(androidAppId: "f71a313f42", iOSAppId: "3089e4587e");
});
}
... ...
import 'package:json_annotation/json_annotation.dart';
part 'reserve_info_model.g.dart';
@JsonSerializable()
class ReserveInfoModel extends Object {
@JsonKey(name: 'ret')
int ret;
@JsonKey(name: 'data')
SunReserveInfoModel data;
@JsonKey(name: 'msg')
String msg;
ReserveInfoModel(this.ret,this.data,this.msg,);
factory ReserveInfoModel.fromJson(Map<String, dynamic> srcJson) => _$ReserveInfoModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$ReserveInfoModelToJson(this);
}
@JsonSerializable()
class SunReserveInfoModel extends Object {
@JsonKey(name: 'row')
RowModel row;
@JsonKey(name: 'list')
List<dynamic> list;
@JsonKey(name: 'table')
List<dynamic> table;
SunReserveInfoModel(this.row,this.list,this.table,);
factory SunReserveInfoModel.fromJson(Map<String, dynamic> srcJson) => _$SunReserveInfoModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$SunReserveInfoModelToJson(this);
}
@JsonSerializable()
class RowModel extends Object {
@JsonKey(name: 'id')
String id;
@JsonKey(name: 'tableinfo')
String tableinfo;
@JsonKey(name: 'tid')
String tid;
@JsonKey(name: 'rname')
String rname;
@JsonKey(name: 'sex')
String sex;
@JsonKey(name: 'phone')
String phone;
@JsonKey(name: 'cusman')
String cusman;
@JsonKey(name: 'ddate')
String ddate;
@JsonKey(name: 'cdate')
String cdate;
@JsonKey(name: 'cusdem')
String cusdem;
@JsonKey(name: 'status')
String status;
@JsonKey(name: 'action')
String action;
@JsonKey(name: 'is_set_ddate')
String isSetDdate;
@JsonKey(name: 'ddate_solt')
String ddateSolt;
@JsonKey(name: 'type')
String type;
@JsonKey(name: 'name')
String name;
RowModel(this.id,this.tableinfo,this.tid,this.rname,this.sex,this.phone,this.cusman,this.ddate,this.cdate,this.cusdem,this.status,this.action,this.isSetDdate,this.ddateSolt,this.type,this.name,);
factory RowModel.fromJson(Map<String, dynamic> srcJson) => _$RowModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$RowModelToJson(this);
}
... ...
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'reserve_info_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
ReserveInfoModel _$ReserveInfoModelFromJson(Map<String, dynamic> json) {
return ReserveInfoModel(
json['ret'] as int,
json['data'] == null
? null
: SunReserveInfoModel.fromJson(json['data'] as Map<String, dynamic>),
json['msg'] as String);
}
Map<String, dynamic> _$ReserveInfoModelToJson(ReserveInfoModel instance) =>
<String, dynamic>{
'ret': instance.ret,
'data': instance.data,
'msg': instance.msg
};
SunReserveInfoModel _$SunReserveInfoModelFromJson(Map<String, dynamic> json) {
return SunReserveInfoModel(
json['row'] == null
? null
: RowModel.fromJson(json['row'] as Map<String, dynamic>),
json['list'] as List,
json['table'] as List);
}
Map<String, dynamic> _$SunReserveInfoModelToJson(
SunReserveInfoModel instance) =>
<String, dynamic>{
'row': instance.row,
'list': instance.list,
'table': instance.table
};
RowModel _$RowModelFromJson(Map<String, dynamic> json) {
return RowModel(
json['id'] as String,
json['tableinfo'] as String,
json['tid'] as String,
json['rname'] as String,
json['sex'] as String,
json['phone'] as String,
json['cusman'] as String,
json['ddate'] as String,
json['cdate'] as String,
json['cusdem'] as String,
json['status'] as String,
json['action'] as String,
json['is_set_ddate'] as String,
json['ddate_solt'] as String,
json['type'] as String,
json['name'] as String);
}
Map<String, dynamic> _$RowModelToJson(RowModel instance) => <String, dynamic>{
'id': instance.id,
'tableinfo': instance.tableinfo,
'tid': instance.tid,
'rname': instance.rname,
'sex': instance.sex,
'phone': instance.phone,
'cusman': instance.cusman,
'ddate': instance.ddate,
'cdate': instance.cdate,
'cusdem': instance.cusdem,
'status': instance.status,
'action': instance.action,
'is_set_ddate': instance.isSetDdate,
'ddate_solt': instance.ddateSolt,
'type': instance.type,
'name': instance.name
};
... ...
... ... @@ -5,92 +5,92 @@ part 'table.g.dart';
@JsonSerializable()
class Table {
Table();
Table();
String id; //主键id
String rid; //关联区域id
String tid; //桌位类型 1散座 2包间 3卡座
String name; //桌位名称
String table_pnum; //桌位最少可做人数
String most_pnum; //桌位最多可做人数
String order_o; //桌位排序编号
String status; //桌位状态 0未使用 1使用中 2已删除
String tablestatus; //桌位状态 0未使用 1使用中 2已删除
String enable; //0禁用 1启用
String spell; //1拼桌
String rname; //关联区域名称
String max; //最多可做人数
String low; //最低消费
String sign; //标签 桌位状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单
String reserver; //订餐人
String notebookId; //桌位对应的预订id
bool selected; //是否选中
String id;//主键id
String rid;//关联区域id
String tid;//桌位类型 1散座 2包间 3卡座
String name;//桌位名称
String table_pnum;//桌位最少可做人数
String most_pnum;//桌位最多可做人数
String order_o;//桌位排序编号
String status;//桌位状态 0未使用 1使用中 2已删除
String tablestatus;//桌位状态 0未使用 1使用中 2已删除
String enable;//0禁用 1启用
String spell;//1拼桌
String rname;//关联区域名称
String max;//最多可做人数
String low;//最低消费
String sign;//标签 桌位状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单
String reserver;//订餐人
String notebookId;//桌位对应的预订id
bool selected;//是否选中
//获取桌位类型
String get tidStr{
switch(tid){
case "1":
return "散座";
case "2":
return "包间";
case "3":
return "卡座";
}
//获取桌位类型
String get tidStr {
switch (tid) {
case "1":
return "散座";
case "2":
return "包间";
case "3":
return "卡座";
}
}
String get maxText{
if(max==null||max=="0"||max=="null"){
return "";
}else{
return "最多可坐"+max+"人";
}
String get maxText {
if (max == null || max == "0" || max == "null") {
return "";
} else {
return "最多可坐" + max + "人";
}
}
//获取桌位可坐人数
String get tableNum{
if(table_pnum==null||table_pnum.isEmpty||table_pnum=="0"){
return "";
}else if(most_pnum!=null&&most_pnum.isNotEmpty&&most_pnum!="0"&&most_pnum!="null"){
if(table_pnum==most_pnum){
return "$table_pnum人";
}else{
return "$table_pnum-$most_pnum人";
}
}else{
return "$table_pnum人";
}
//获取桌位可坐人数
String get tableNum {
if (table_pnum == null || table_pnum.isEmpty || table_pnum == "0") {
return "";
} else if (most_pnum != null &&
most_pnum.isNotEmpty &&
most_pnum != "0" &&
most_pnum != "null") {
if (table_pnum == most_pnum) {
return "$table_pnum人";
} else {
return "$table_pnum-$most_pnum人";
}
} else {
return "$table_pnum人";
}
}
//获取最低消费
String get lowStr{
return (low==null||low.isEmpty||low=="0")?"":"最低消费\n$low元";
}
//获取最低消费
String get lowStr {
return (low == null || low.isEmpty || low == "0") ? "" : "最低消费\n$low元";
}
String get signStr{
if(enable=="0")return "已停用";
if(sign!=null){
switch(sign){
case "1"://已预订
case "5"://已安排包间
return "已预订";
case "2"://用餐中
return "用餐中";
default:
return "";
}
}
return "";
String get signStr {
if (enable == "0") return "已停用";
if (sign != null) {
switch (sign) {
case "1": //已预订
case "5": //已安排包间
return "已预订";
case "2": //用餐中
return "用餐中";
default:
return "";
}
}
return "";
}
factory Table.fromJson(Map<String,dynamic> json) => _$TableFromJson(json);
Map<String, dynamic> toJson() => _$TableToJson(this);
factory Table.fromJson(Map<String, dynamic> json) => _$TableFromJson(json);
Map<String, dynamic> toJson() => _$TableToJson(this);
@override
String toString() {
return 'Table{id: $id, rid: $rid, tid: $tid, name: $name, table_pnum: $table_pnum, most_pnum: $most_pnum, order_o: $order_o, status: $status, tablestatus: $tablestatus, enable: $enable, spell: $spell, rname: $rname, max: $max, low: $low}';
}
@override
String toString() {
return 'Table{id: $id, rid: $rid, tid: $tid, name: $name, table_pnum: $table_pnum, most_pnum: $most_pnum, order_o: $order_o, status: $status, tablestatus: $tablestatus, enable: $enable, spell: $spell, rname: $rname, max: $max, low: $low}';
}
}
... ...
... ... @@ -90,6 +90,10 @@ class TableList extends Object {
@JsonKey(name: 'rname')
String rname;
@JsonKey(name: 'region_name')
String regionName;
String table_pnum; //桌位最少可做人数
String most_pnum; //桌位最多可做人数
String low; //最低消费
... ... @@ -107,18 +111,18 @@ class TableList extends Object {
}
String reserver; //订餐人
String notebookId; //桌位对应的预订id
// String notebookId; //桌位对应的预订id
bool selected = false; //是否选中
String max; //最多可做人数
// String max; //最多可做人数
String sign; //标签 桌位状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单
String get maxText {
if (max == null || max == "0" || max == "null") {
return "";
} else {
return "最多可坐" + max + "人";
}
}
// String get maxText {
// if (max == null || max == "0" || max == "null") {
// return "";
// } else {
// return "最多可坐" + max + "人";
// }
// }
//获取桌位可坐人数
String get tableNum {
... ... @@ -174,7 +178,7 @@ class TableList extends Object {
this.enable,
this.spell,
this.cdate,
this.rname);
this.rname,this.regionName);
factory TableList.fromJson(Map<String, dynamic> srcJson) =>
_$TableListFromJson(srcJson);
... ...
... ... @@ -52,7 +52,8 @@ TableList _$TableListFromJson(Map<String, dynamic> json) {
json['enable'] as String,
json['spell'] as String,
json['cdate'] as String,
json['rname'] as String);
json['rname'] as String,
json['region_name'] as String);
}
Map<String, dynamic> _$TableListToJson(TableList instance) => <String, dynamic>{
... ... @@ -70,5 +71,6 @@ Map<String, dynamic> _$TableListToJson(TableList instance) => <String, dynamic>{
'enable': instance.enable,
'spell': instance.spell,
'cdate': instance.cdate,
'rname': instance.rname
'rname': instance.rname,
'region_name': instance.regionName
};
... ...
... ... @@ -31,4 +31,6 @@ class HttpUrl {
"?service=App.Seller.SaveCallRecord"; //上传通讯录
static const String get_table_list =
"?service=Android.Reserve.NewGetTableList"; //根据商家ID 获取桌位信息列表: 1:散座 2:包间 默认:获取所有数据
static const String set_reserve_info =
"?service=Android.Customer.SetReserveInfo"; //录入顾客订座相关信息,同时更新商家桌位状态
}
... ...
... ... @@ -64,7 +64,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
});
setMessageStatus();
} else {
managers = await detailModel.getManagers(context);
managers = await detailModel.getManagers(context);
}
});
}
... ... @@ -114,13 +114,13 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
),
onPressed: () async {
Navigator.of(context).pop();
String tid = await NavigatorUtil.goSelectTablePage(
Map temp = await NavigatorUtil.goSelectTablePage(
context,
widget.rid,
int.parse(detailEntity.ddate) * 1000,
detailEntity.ddate_solt);
if (tid != null) {
setReserveStatus("5", tid: tid);
if (temp['tid'] != null) {
setReserveStatus("5", tid: temp['tid']);
}
},
)
... ...
import 'dart:convert';
import 'dart:ui';
import 'package:common_utils/common_utils.dart';
... ... @@ -5,10 +6,15 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/models/notebook_detail.dart';
import 'package:one_key/models/reserve_info_model.dart';
import 'package:one_key/provider/notebook_detail_change_model.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/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/app_bar.dart';
import 'package:one_key/widgets/common_button.dart';
... ... @@ -17,6 +23,7 @@ import 'package:one_key/widgets/new_table_item.dart';
import 'package:one_key/widgets/table_item.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import 'package:one_key/models/table_list.dart' as t;
typedef clickCallback = void Function(String value);
... ... @@ -42,6 +49,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
FocusNode _phoneNode = FocusNode();
FocusNode _nameNode = FocusNode();
FocusNode _needNode = FocusNode();
NotebookDetailModel detailModel = NotebookDetailModel();
// //生成日期文本
// _createDateText(DateTime day) {
... ... @@ -177,6 +185,30 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
}
}
//处理在线预订
setReserveStatus(String status, {String tid = ""}) async {
// bus.emit("remove_untreated_message", widget.mid);
UserModel userModel = Provider.of<UserModel>(context, listen: false);
Map<String, String> causeMap = {
"uid": userModel.user.openid,
"uname": userModel.user.account,
"desc": "",
};
Map<String, String> params = {
"rid": widget.rid,
"status": status, //5安排包间 6 拒绝订单
"tid": tid,
// "mid": widget.mid,
"cause": json.encode(causeMap)
};
// detailModel.setReserveStatus(context, params);
bool success =
await detailModel.setReserveStatus(context, params, ifPush: false);
if (success) {
_notebookDetailChangeModel.getNewTableList(context);
}
}
_topWidget() {
return Container(
padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
... ... @@ -372,14 +404,18 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
),
InkWell(
onTap: () async {
String tid = await NavigatorUtil.goSelectTablePage(
Map temp = await NavigatorUtil.goSelectTablePage(
context,
widget.rid,
int.parse(widget.detailEntity.ddate) * 1000,
widget.detailEntity.ddate_solt);
if (tid != null) {
// setReserveStatus("5", tid: tid);
widget.detailEntity.ddate_solt,
canChoose: true,
object: {'object': _notebookDetailChangeModel.tableList});
if (temp['tid'] != null) {
setReserveStatus("5", tid: temp['tid']);
}
_notebookDetailChangeModel.tableList = temp['object'];
_notebookDetailChangeModel.notifyListeners();
},
child: Row(
children: [
... ... @@ -413,7 +449,16 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
itemBuilder: (BuildContext contxt, int index) {
return NewTableItem(
_notebookDetailChangeModel.tableList[index],
height: 160,
isRegionName: true,
canSelected: true,
onSelected: (table) {
if ((table as t.TableList).selected) {
_notebookDetailChangeModel.tableList.add(table);
} else {
_notebookDetailChangeModel.tableList
.removeWhere((t) => t.id == table.id);
}
},
);
},
itemCount: _notebookDetailChangeModel.tableList.length > 3
... ... @@ -674,6 +719,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
tempMndList[index]['title']) {
item['select'] = true;
widget.detailEntity.is_set_ddate = '1';
_notebookDetailChangeModel.isSetDate = "1";
_notebookDetailChangeModel.ddateStr =
item['title'];
}
... ... @@ -770,8 +816,36 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
fontSize: 34,
content: "确定修改",
state: 2,
onPress: () {
_notebookDetailChangeModel.setReserveInfo(context);
onPress: () async {
String name =
_notebookDetailChangeModel.nameController.text.trim();
if (ObjectUtil.isEmpty(name)) {
Utils.showToast("请填写客户姓名");
return;
}
SunReserveInfoModel _model =
await _notebookDetailChangeModel
.setReserveInfo(context);
if (ObjectUtil.isNotEmpty(_model.row) ||
ObjectUtil.isNotEmpty(_model.row.id)) {
print('变更成功');
// _notebookDetailChangeModel.clearData();
bus.emit("refresh_detail");
String ddate_solt = '';
if (_model.row.ddateSolt == '1') {
ddate_solt = '早餐';
} else if (_model.row.ddateSolt == '2') {
ddate_solt = '午餐';
} else if (_model.row.ddateSolt == '3') {
ddate_solt = '晚餐';
}
NavigatorUtil.goInvicationPage(context, _model.row.id,
_model.row.name, _model.row.ddate, ddate_solt,
replace: true);
} else {
Utils.showToast("变更预订订单失败,请重试!");
}
// messageDialogModel.removeMessage(message.id);
// NavigatorUtil.goHandleOnlinePage(
// context, message.rid.toString(), message.id,
... ... @@ -832,8 +906,11 @@ class _ButtonState extends State<CustomButton> {
children: [
widget.isTextFiled
? Container(
width: ScreenUtil().setWidth(70),
alignment: Alignment.center,
// color: Colors.red,
width: ScreenUtil().setWidth(110),
height: ScreenUtil().setWidth(50),
// padding: EdgeInsets.zero,
child: TextField(
controller: widget.model.numController,
maxLines: 1,
... ... @@ -901,12 +978,14 @@ class _ButtonState extends State<CustomButton> {
? MyColours.color_fefefe
: MyColours.color_199095,
fontSize: ScreenUtil().setSp(widget.fontSize))),
widget.isImage ? HEmptyView(20) : Container(),
widget.isImage && !widget.isTextFiled
? HEmptyView(20)
: Container(),
widget.isImage
? Image.asset(
widget.isSelect
? 'assets/message_selected.png'
: 'assets/message_default.png',
? 'assets/calender_select.png'
: 'assets/calender_narmol.png',
width: ScreenUtil().setWidth(36))
: Text(widget.dayText,
style: TextStyle(
... ...
... ... @@ -9,6 +9,7 @@ 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/log_util.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
... ... @@ -69,16 +70,24 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
_cancelNode.addListener(() {
if (_cancelNode.hasFocus) {
print('得到焦点');
paddingTop = 125;
paddingTop = 80;
} else {
print('失去焦点');
paddingTop = 138;
}
_cancelState(() {});
});
bus.on("refresh_detail", (args) {
_getReserveDetail();
});
});
}
@override
void dispose() {
bus.off("refresh_detail");
}
_getReserveDetail() async {
detailEntity = await detailModel.getReserveDetail(context, {
"rid": widget.rid,
... ... @@ -206,8 +215,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
_initCancel();
Navigator.of(context).pop();
},
child: Image.asset(
'assets/message_selected.png',
child: Image.asset('assets/close.png',
width: ScreenUtil().setWidth(32)),
))
],
... ... @@ -236,8 +244,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
children: [
Image.asset(
value['select']
? 'assets/message_selected.png'
: 'assets/message_default.png',
? 'assets/select.png'
: 'assets/unselect.png',
width: ScreenUtil().setWidth(44)),
HEmptyView(30),
Text(value['title'],
... ... @@ -331,7 +339,9 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
@override
Widget build(BuildContext context) {
// TODO: implement build
if (MediaQuery.of(context).viewInsets.bottom == 0) {
_cancelNode.unfocus();
}
return detailEntity == null
? Container(
width: double.infinity,
... ...
import 'dart:ffi';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/area.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/models/tableOuter.dart';
import 'package:one_key/models/table_list.dart';
import 'package:one_key/provider/choose_table_model.dart';
import 'package:one_key/provider/notebook_detail_change_model.dart';
import 'package:one_key/provider/notebook_model.dart';
import 'package:one_key/provider/select_table_model.dart';
import 'package:one_key/provider/user_model.dart';
... ... @@ -14,14 +19,17 @@ import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/table_item.dart';
import 'package:one_key/models/table.dart' as t;
import 'package:provider/provider.dart';
import 'dart:convert' as convert;
class SelectTablePage extends StatefulWidget{
final String rid;//预订id
final DateTime dateTime;//日期
final String ddate_slot;//时段
class SelectTablePage extends StatefulWidget {
final String rid; //预订id
final DateTime dateTime; //日期
final String ddate_slot; //时段
final bool canChoose; //变更预订可以取消原来已预订的选中状态
final List<TableList> tableList;
SelectTablePage(this.rid,this.dateTime,this.ddate_slot);
SelectTablePage(this.rid, this.dateTime, this.ddate_slot,
{this.canChoose = false, this.tableList});
@override
State<StatefulWidget> createState() {
... ... @@ -30,37 +38,51 @@ class SelectTablePage extends StatefulWidget{
}
}
class SelectTablePageState extends State<SelectTablePage>{
class SelectTablePageState extends State<SelectTablePage> {
List<Area> areas = []; //区域列表
List<t.Table> selectTables = []; //选择的桌位
List<Area> areas=[];//区域列表
List<t.Table> selectTables=[];//选择的桌位
List<TableOuter> tableOuterList = []; //区域-桌位列表
List<TableOuter> tableOuterList=[];//区域-桌位列表
Map<String, List<t.Table>> areaTableMap = {}; //区域-桌位Map
Map<String,List<t.Table>> areaTableMap={};//区域-桌位Map
SelectTableModel selectTableModel = new SelectTableModel();
SelectTableModel selectTableModel=new SelectTableModel();
ChooseTableModel _chooseTableModel;
Map<String,Notebook> tableMap={};//记录已预订桌位对应的订单
Map<String, Notebook> tableMap = {}; //记录已预订桌位对应的订单
String currentArea;//当前选中区域
String currentArea; //当前选中区域
@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_){
WidgetsBinding.instance.addPostFrameCallback((_) {
getTableList();
});
}
//获取桌位列表
getTableList() async {
UserModel userModel=Provider.of<UserModel>(context,listen:false);
Map<String,String> params={
"sellerid":userModel.user.sellerid
};
tableOuterList= await selectTableModel.getTableList(context, params);
UserModel userModel = Provider.of<UserModel>(context, listen: false);
Map<String, String> params = {"sellerid": userModel.user.sellerid};
tableOuterList = await selectTableModel.getTableList(context, params);
for (TableOuter item in tableOuterList) {
// if (item.name == "推荐") {
// itemModelList.remove(item);
// }
for (var item in item.list) {
for (var table in widget.tableList) {
if (item.id == table.id) {
item.selected = true;
// if (!tableList.contains(item)) {
// tableList.add(item);
// }
}
}
}
}
_getReserveList(userModel.user.sellerid);
}
... ... @@ -76,150 +98,208 @@ class SelectTablePageState extends State<SelectTablePage>{
"keywords": "",
"sort": "1"
};
List<Notebook> noteBooks=await model.getReserveList(context, params);
for(Notebook notebook in noteBooks){
if(notebook.tid.isEmpty)continue;
if(notebook.status=="1"||notebook.status=="2"||notebook.status=="5"){//已预订,用餐中,已安排
List<String> tids=notebook.tid.split(",");
for(String tid in tids){
tableMap["$tid"]=notebook;
List<Notebook> noteBooks = await model.getReserveList(context, params);
for (Notebook notebook in noteBooks) {
if (notebook.tid.isEmpty) continue;
if (notebook.status == "1" ||
notebook.status == "2" ||
notebook.status == "5") {
//已预订,用餐中,已安排
List<String> tids = notebook.tid.split(",");
for (String tid in tids) {
tableMap["$tid"] = notebook;
}
}
}
}
initData();
}
//初始桌位数据
initData(){
for(TableOuter outer in tableOuterList){
int count=0;
for(t.Table table in outer.list){
if(table.tablestatus=="0"){//没有用餐中
if(tableMap["${table.id}"]!=null){
Notebook notebook=tableMap["${table.id}"];
table.sign=notebook.status;
table.notebookId=notebook.id;
table.reserver=notebook.rnameStr;
}else{
table.sign="";
table.notebookId="";
if(table.enable=="1"){
initData() {
for (TableOuter outer in tableOuterList) {
int count = 0;
for (t.Table table in outer.list) {
if (table.tablestatus == "0") {
//没有用餐中
if (tableMap["${table.id}"] != null) {
Notebook notebook = tableMap["${table.id}"];
table.sign = notebook.status;
table.notebookId = notebook.id;
table.reserver = notebook.rnameStr;
} else {
table.sign = "";
table.notebookId = "";
if (table.enable == "1") {
count++;
}
}
}else{
table.sign="2";
table.notebookId="";
} else {
table.sign = "2";
table.notebookId = "";
}
}
areaTableMap["${outer.name}"]=outer.list;
Area area=Area();
area.name=outer.name;
area.count=count;
areaTableMap["${outer.name}"] = outer.list;
Area area = Area();
area.name = outer.name;
area.count = count;
areas.add(area);
}
currentArea=areaTableMap.keys.first;
setState(() {
});
currentArea = areaTableMap.keys.first;
setState(() {});
}
//获取一天开始-结束时间字符串
String _getRdate() {
//一天开始时间
double startDay = (DateTime.parse((widget.dateTime.year.toString() +
"-" +
Utils.addZeroNumber(widget.dateTime.month) +
"-" +
Utils.addZeroNumber(widget.dateTime.day) +
" 00:00:00"))
.millisecondsSinceEpoch) /
"-" +
Utils.addZeroNumber(widget.dateTime.month) +
"-" +
Utils.addZeroNumber(widget.dateTime.day) +
" 00:00:00"))
.millisecondsSinceEpoch) /
1000;
//一天结束时间
double endDay = (DateTime.parse((widget.dateTime.year.toString() +
"-" +
Utils.addZeroNumber(widget.dateTime.month) +
"-" +
Utils.addZeroNumber(widget.dateTime.day) +
" 23:59:59"))
.millisecondsSinceEpoch) /
"-" +
Utils.addZeroNumber(widget.dateTime.month) +
"-" +
Utils.addZeroNumber(widget.dateTime.day) +
" 23:59:59"))
.millisecondsSinceEpoch) /
1000;
return startDay.floor().toString() + "-" + endDay.floor().toString();
}
@override
Widget build(BuildContext context) {
// TODO: implement build
_chooseTableModel = Provider.of<ChooseTableModel>(context);
return SafeArea(
child: areaTableMap.isEmpty?Container(
width: double.infinity,
height: double.infinity,
color: MyColours.color_ffffff,
):Column(
children: <Widget>[
MyAppBar(
"选择桌位",
showBack: true,
),
Expanded(
child: Container(
child: areaTableMap.isEmpty
? Container(
width: double.infinity,
height: double.infinity,
color: MyColours.color_ffffff,
child: Row(
children: <Widget>[
Container(
width: ScreenUtil().setWidth(189),
height: double.infinity,
color: MyColours.color_f1f1f1,
child: ListView.builder(itemBuilder: (context,index){
return AreaItem(areas[index],currentArea,(area){
setState(() {
currentArea=(area as Area).name;
});
});
},itemExtent: ScreenUtil().setHeight(207),itemCount: areas.length,),
)
: Column(
children: <Widget>[
MyAppBar(
"选择桌位",
showBack: true,
),
Expanded(
child: Container(
color: MyColours.color_ffffff,
child: Row(
children: <Widget>[
Container(
width: ScreenUtil().setWidth(189),
height: double.infinity,
color: MyColours.color_f1f1f1,
child: ListView.builder(
itemBuilder: (context, index) {
return AreaItem(areas[index], currentArea,
(area) {
setState(() {
currentArea = (area as Area).name;
});
});
},
itemExtent: ScreenUtil().setHeight(207),
itemCount: areas.length,
),
),
Expanded(
child: Padding(
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setHeight(10),
horizontal: ScreenUtil().setWidth(9)),
child: GridView.builder(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, childAspectRatio: 0.8),
itemBuilder: (context, index) {
return TableItem(
areaTableMap[currentArea][index],
onSelected: (table) {
if ((table as t.Table).selected) {
selectTables.add(table);
Map<String, dynamic> temp =
modelToJson(table);
TableList tableList =
TableList.fromJson(temp);
widget.tableList.add(tableList);
} else {
widget.tableList
.removeWhere((t) => t.id == table.id);
selectTables
.removeWhere((t) => t.id == table.id);
}
},
canSelected: true,
canChoose: widget.canChoose,
);
},
itemCount: areaTableMap[currentArea].length,
),
),
)
],
),
),
Expanded(
child: Padding(padding: EdgeInsets.symmetric(vertical: ScreenUtil().setHeight(10),horizontal: ScreenUtil().setWidth(9)),child: GridView.builder(gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3,childAspectRatio: 0.8),itemBuilder: (context,index){
return TableItem(areaTableMap[currentArea][index],onSelected:(table){
if((table as t.Table).selected){
selectTables.add(table);
}else{
selectTables.removeWhere((t)=>t.id==table.id);
),
Container(
width: double.infinity,
height: ScreenUtil().setHeight(100),
alignment: Alignment.center,
decoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border(
top: BorderSide(
color: MyColours.color_bfbfbf,
width: ScreenUtil().setHeight(1)))),
child: CommonButton(
content: "确定",
width: 600,
height: 76,
fontSize: 34,
state: 1,
onPress: () {
if (selectTables.length > 0) {
String tid = "";
for (t.Table table in selectTables) {
tid += table.id + ",";
}
tid = tid.substring(0, tid.length - 1);
Map temp = {'object': widget.tableList, 'tid': tid};
Navigator.of(context).pop(temp);
}
},canSelected: true,);
},itemCount: areaTableMap[currentArea].length,),),
)
],
),
),
),
Container(
width: double.infinity,
height: ScreenUtil().setHeight(100),
alignment: Alignment.center,
decoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border(top: BorderSide(color: MyColours.color_bfbfbf,width: ScreenUtil().setHeight(1)))
},
))
],
),
child: CommonButton(
content: "确定",
width: 600,
height: 76,
fontSize: 34,
state: 1,
onPress: (){
if(selectTables.length>0){
String tid="";
for(t.Table table in selectTables){
tid+=table.id+",";
}
tid=tid.substring(0,tid.length-1);
Navigator.of(context).pop(tid);
}
},
)
)
],
),
);
}
modelToJson(t.Table table) {
Map res = {
'id': table.id,
'rid': table.rid,
'tid': table.tid,
'name': table.name,
'tablePnum': table.table_pnum,
'sellerid': null,
'qrcode': null,
'mostPnum': table.most_pnum,
'hot': null,
'orderO': table.order_o,
'status': table.status,
'enable': table.enable,
'spell': table.spell,
'cdate': null,
'rname': table.rname,
'regionName': null
};
return res;
}
}
... ...
import 'package:flutter/material.dart';
import 'package:one_key/models/table_list.dart';
class ChooseTableModel with ChangeNotifier {
List<TableList> tableList = [];
}
... ...
... ... @@ -2,6 +2,7 @@ import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/models/notebook_detail.dart';
import 'package:one_key/models/reserve_info_model.dart';
import 'package:one_key/models/seller_info.dart';
import 'package:one_key/models/table_list.dart';
import 'package:one_key/net/base_resp.dart';
... ... @@ -25,14 +26,32 @@ class NotebookDetailChangeModel with ChangeNotifier {
String ddateStr = ''; //16:30
NotebookDetail detailEntity;
List<TableList> tableList = [];
String isSetDate = '0';
clearData() {
dateList = []; //日期选择 月-日 某天
sunDateList = []; // 早市、午市、晚市
personNumList = []; // 人数
numController = TextEditingController(); //人数
phoneController = TextEditingController(); //电话
nameController = TextEditingController(); //客户姓名
customController = TextEditingController(); //客户要求
sexList = []; // 先生、女士、公司
dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟
ddateStr = ''; //16:30
tableList = [];
isSetDate = '0';
}
//构造函数,初始化
NotebookDetailChangeModel(this.detailEntity) {
// clearData();
print(detailEntity);
if (detailEntity.phone != '0') {
phoneController.text = detailEntity.phone;
}
if (detailEntity.rnameStr != '') {
nameController.text = detailEntity.rnameStr;
nameController.text = detailEntity.rname;
}
if (detailEntity.cusdem != '') {
customController.text = detailEntity.cusdem;
... ... @@ -326,15 +345,15 @@ class NotebookDetailChangeModel with ChangeNotifier {
///根据商家ID 获取桌位信息列表: 1:散座 2:包间 默认:获取所有数据
Future<List<TableListSunModel>> getNewTableList(BuildContext context) async {
// String createtime = detailEntity.ddate.toString() + '000';
// DateTime createTime =
// DateTime.fromMillisecondsSinceEpoch(int.parse(createtime));
// String rdate = DateUtil.formatDate(createTime, format: "yyyyMMdd");
String createtime = detailEntity.ddate.toString() + '000';
DateTime createTime =
DateTime.fromMillisecondsSinceEpoch(int.parse(createtime));
String rdate = DateUtil.formatDate(createTime, format: "yyyyMMdd");
UserModel userModel = Provider.of<UserModel>(context, listen: false);
Map<String, String> params = {
"sid": userModel.user.sellerid,
"rid": detailEntity.id,
"rdate": _getRdate(),
"rdate": rdate,
'ddate_solt': detailEntity.ddate_solt
};
BaseResp<dynamic> baseResp = await DioUtil()
... ... @@ -355,23 +374,35 @@ class NotebookDetailChangeModel with ChangeNotifier {
} else {
Utils.showToast(baseResp.msg ?? "");
}
tableList = [];
for (int i = 0; i < itemModelList.length; i++) {
if (itemModelList[i].name == "推荐") {
itemModelList.removeAt(i);
}
}
for (TableListSunModel item in itemModelList) {
if (item.name == "推荐") {
itemModelList.remove(item);
}
for (var item in item.list) {
for (var table in detailEntity.tables) {
if (item.id == table.id) {
item.selected = true;
tableList.add(item);
if (!tableList.contains(item)) {
tableList.add(item);
}
}
}
}
}
print(tableList);
notifyListeners();
return itemModelList;
}
}
///录入顾客订座相关信息,同时更新商家桌位状态
Future<SunSellerInfoModel> setReserveInfo(BuildContext context) async {
Future<SunReserveInfoModel> setReserveInfo(BuildContext context) async {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
String pnum = '6';
for (var item in personNumList) {
... ... @@ -385,8 +416,21 @@ class NotebookDetailChangeModel with ChangeNotifier {
sex = item['code'];
}
}
String tempDdate = _getRdate() + ' ' + ddateStr + ':00';
int ddate = DateUtil.getDateMsByTimeStr(tempDdate);
//当前选中 月 日string
String mdStr = '';
//今天 明天 其他天
for (var item in dateList) {
if (item['select'] == true) {
mdStr = item['title'];
}
}
String timeNowYear = DateUtil.formatDate(DateTime.now(), format: 'yyyy');
String ymyStr = timeNowYear + '-' + mdStr; //年月日
String timeStr = ymyStr + ' ' + ddateStr + ':00';
// int start = DateUtil.getDateMsByTimeStr(timeStr);
// String tempDdate = ymyStr + ' ' + ddateStr + ':00';
int ddate = DateUtil.getDateMsByTimeStr(timeStr);
String tableSelectInfo = '';
for (TableList item in tableList) {
if (item.selected) {
... ... @@ -399,23 +443,34 @@ class NotebookDetailChangeModel with ChangeNotifier {
}
print(tableSelectInfo);
String rdate = '';
String ddateSolt = '';
print(sunDateList);
for (var item in sunDateList) {
if (item['isSelect'] == true) {
String keys = '';
ddateSolt = '${item['ddateSolt']}';
if (item['ddateSolt'] == 1) {
//早市
List morning = dailyMap['morning'];
String start = ddateStr;
String end = morning.last;
keys = 'morning';
} else if (item['ddateSolt'] == 2) {
//午市
List noon = dailyMap['noon'];
keys = 'noon';
} else if (item['ddateSolt'] == 3) {
//晚市
List night = dailyMap['night'];
keys = 'night';
}
if (keys != '') {
String start = '${ddate}'.substring(0, 10);
List temp = dailyMap[keys];
String timeStrEnd = ymyStr + ' ' + temp.last['title'] + ':00';
int endM = DateUtil.getDateMsByTimeStr(timeStrEnd);
String end = '${endM}'.substring(0, 10);
rdate = start + '-' + end;
}
}
}
Map<String, String> params = {
'is_set_ddate': isSetDate,
"rid": detailEntity.id, //变更订单必传预定ID
"sid": userModel.user.sellerid, //商家ID
"tid": tableSelectInfo, //桌子ID: 格式 2,3,4
... ... @@ -424,38 +479,32 @@ class NotebookDetailChangeModel with ChangeNotifier {
"sex": sex, //预订人姓名:1:男 2:女
"phone": phoneController.text, //预订人电话
"cusdem": customController.text, //预订人需求:25汉字
"rdate": _getRdate(), //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time)
"ddate": '${ddate / 1000}', //到店时间
"rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time)
"ddate": '${ddate}'.substring(0, 10), //到店时间
"ddate_solt": ddateSolt
};
print(params);
// BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
// .request<Map<String, dynamic>>(context, Method.get, HttpUrl.sellerinfo,
// data: params)
// .catchError((error) {
// print(error.toString());
// });
// SunSellerInfoModel itemModel;
// if (baseResp == null) return itemModel;
// if (baseResp.code == Constant.status_success) {
// if (int.parse(baseResp.status) != Constant.status_success) {
// Utils.showToast(baseResp.msg ?? "");
// return itemModel;
// }
// if (baseResp.responseData['data'] != null) {
// itemModel = SellerInfoModel.fromJson(baseResp.responseData).data;
// } else {
// Utils.showToast(baseResp.msg ?? "");
// }
// return itemModel;
// }
}
//rdate字段值获取
_getRdate() {
String createtime = detailEntity.ddate.toString() + '000';
DateTime createTime =
DateTime.fromMillisecondsSinceEpoch(int.parse(createtime));
String rdate = DateUtil.formatDate(createTime, format: "yyyyMMdd");
return rdate;
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
.request<Map<String, dynamic>>(
context, Method.get, HttpUrl.set_reserve_info,
data: params)
.catchError((error) {
print(error.toString());
});
SunReserveInfoModel itemModel;
if (baseResp == null) return itemModel;
if (baseResp.code == Constant.status_success) {
if (int.parse(baseResp.status) != Constant.status_success) {
Utils.showToast(baseResp.msg ?? "");
return itemModel;
}
if (baseResp.responseData['data'] != null &&
baseResp.responseData['data']['row'] != null) {
itemModel = ReserveInfoModel.fromJson(baseResp.responseData).data;
} else {
Utils.showToast(baseResp.msg ?? "变更预订失败,请重试");
}
return itemModel;
}
}
}
... ...
... ... @@ -4,6 +4,7 @@ import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/models/notebook_detail.dart';
import 'package:one_key/models/table_list.dart';
import 'package:one_key/pages/detail/notebook_detail_change_page.dart';
import 'package:one_key/pages/home/home_page.dart';
import 'package:one_key/pages/invicate/invitation_page.dart';
... ... @@ -13,6 +14,7 @@ import 'package:one_key/pages/detail/notebook_detail_page.dart';
import 'package:one_key/pages/sms/sms_page.dart';
import 'package:one_key/pages/table/select_table_page.dart';
import 'package:one_key/pages/webview/webview_page.dart';
import 'package:one_key/provider/choose_table_model.dart';
import 'package:one_key/provider/notebook_detail_change_model.dart';
import 'package:one_key/utils/fluro_convert_utils.dart';
import 'package:one_key/utils/log_util.dart';
... ... @@ -55,7 +57,19 @@ var handleSelectTableHandler = new Handler(
DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(int.parse(params["dateTime"].first));
String ddate_slot = params["ddate_slot"].first;
return SelectTablePage(rid, dateTime, ddate_slot);
bool canChoose = params["canChoose"].first == "true" ? true : false;
Map object = FluroConvertUtils.string2map(params["object"].first);
List temp = object['object'];
List<TableList> res = [];
for (var item in temp) {
res.add(TableList.fromJson(item));
}
// return SelectTablePage(rid, dateTime, ddate_slot,canChoose: canChoose);
return ChangeNotifierProvider<ChooseTableModel>(
create: (_) => ChooseTableModel(),
child: SelectTablePage(rid, dateTime, ddate_slot,
canChoose: canChoose, tableList: res));
});
// 跳转到邀请函页面
... ... @@ -93,5 +107,5 @@ var handleChangeDetailHandler = new Handler(
String rid = params['rid'].first;
return ChangeNotifierProvider<NotebookDetailChangeModel>(
create: (_) => NotebookDetailChangeModel(detailEntity),
child: NoteBookChangePage(detailEntity: detailEntity,rid: rid));
child: NoteBookChangePage(detailEntity: detailEntity, rid: rid));
});
... ...
import 'dart:convert';
import 'package:one_key/models/table_list.dart';
/// fluro 参数编码解码工具类
class FluroConvertUtils {
/// fluro 传递中文参数前,先转换,fluro 不支持中文传递
... ... @@ -45,4 +47,9 @@ class FluroConvertUtils {
static Map<String, dynamic> string2map(String str) {
return json.decode(fluroCnParamsDecode(str));
}
/// string json 转为 map
static Map<String, List<TableList>> string2mapTableList(String str) {
return json.decode(fluroCnParamsDecode(str));
}
}
... ...
... ... @@ -2,6 +2,7 @@ import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/models/notebook_detail.dart';
import 'package:one_key/models/table_list.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/routes.dart';
import 'package:one_key/utils/fluro_convert_utils.dart';
... ... @@ -31,42 +32,57 @@ class NavigatorUtil {
}
/// 首页
static void goHomePage(BuildContext context,{int initialIndex=1}) {
_navigateTo(context, "${Routes.home}?initialIndex=$initialIndex", clearStack: true);
static void goHomePage(BuildContext context, {int initialIndex = 1}) {
_navigateTo(context, "${Routes.home}?initialIndex=$initialIndex",
clearStack: true);
}
/// 订单详情
static void goNotebookDetailPage(BuildContext context,String rid,{replace=false}) {
_navigateTo(context,"${Routes.reserve_detail}?rid=$rid",replace: replace);
static void goNotebookDetailPage(BuildContext context, String rid,
{replace = false}) {
_navigateTo(context, "${Routes.reserve_detail}?rid=$rid", replace: replace);
}
/// 处理在线预订
static void goHandleOnlinePage(BuildContext context,String rid,String mid,{replace=false}) {
_navigateTo(context,"${Routes.handle_online_page}?rid=$rid&mid=$mid",replace: replace);
static void goHandleOnlinePage(BuildContext context, String rid, String mid,
{replace = false}) {
_navigateTo(context, "${Routes.handle_online_page}?rid=$rid&mid=$mid",
replace: replace);
}
/// 选择桌位
static Future goSelectTablePage(BuildContext context,String rid,int dateTime,String ddate_slot) {
return _navigateTo(context,"${Routes.select_table}?rid=$rid&dateTime=$dateTime&ddate_slot=$ddate_slot");
static Future goSelectTablePage(
BuildContext context, String rid, int dateTime, String ddate_slot,
{bool canChoose = false, Map object}) {
return _navigateTo(context,
"${Routes.select_table}?rid=$rid&dateTime=$dateTime&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}");
}
/// 邀请函
static void goInvicationPage(BuildContext context,String rid,String tableInfo,String ddate,String ddateStr) {
_navigateTo(context,"${Routes.invication}?rid=$rid&tableInfo=${FluroConvertUtils.fluroCnParamsEncode(tableInfo)}&ddate=$ddate&ddateStr=${FluroConvertUtils.fluroCnParamsEncode(ddateStr)}");
static void goInvicationPage(BuildContext context, String rid,
String tableInfo, String ddate, String ddateStr,
{bool replace = false}) {
_navigateTo(context,
"${Routes.invication}?rid=$rid&tableInfo=${FluroConvertUtils.fluroCnParamsEncode(tableInfo)}&ddate=$ddate&ddateStr=${FluroConvertUtils.fluroCnParamsEncode(ddateStr)}",
replace: replace);
}
/// 发短信
static void goSmsPage(BuildContext context,String rid) {
_navigateTo(context,"${Routes.sms}?rid=$rid");
static void goSmsPage(BuildContext context, String rid) {
_navigateTo(context, "${Routes.sms}?rid=$rid");
}
/// 浏览器
static void goWebviewPage(BuildContext context) {
_navigateTo(context,"${Routes.webview}");
_navigateTo(context, "${Routes.webview}");
}
/// 变更预订
static void goNoteBookChangePage(BuildContext context,NotebookDetail detailEntity,String rid,{replace=false}) {
_navigateTo(context,"${Routes.change_detail}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid",replace: replace);
/// 变更预订
static void goNoteBookChangePage(
BuildContext context, NotebookDetail detailEntity, String rid,
{replace = false}) {
_navigateTo(context,
"${Routes.change_detail}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid",
replace: replace);
}
}
... ...
... ... @@ -5,15 +5,19 @@ import 'package:one_key/res/colors.dart';
import 'package:one_key/models/table_list.dart' as t;
import 'package:one_key/widgets/v_empty_view.dart';
class NewTableItem extends StatefulWidget{
class NewTableItem extends StatefulWidget {
final t.TableList table;
final bool canSelected;//是否能选中
final bool canSelected; //是否能选中
final ValueChanged onSelected;
final int height;//高度
final bool isRegionName;
final int height; //高度
NewTableItem(this.table,{this.onSelected,this.canSelected=false,this.height=183});
NewTableItem(this.table,
{this.onSelected,
this.canSelected = false,
this.height = 183,
this.isRegionName = false});
@override
State<StatefulWidget> createState() {
... ... @@ -22,19 +26,18 @@ class NewTableItem extends StatefulWidget{
}
}
class NewTableItemState extends State<NewTableItem>{
class NewTableItemState extends State<NewTableItem> {
@override
Widget build(BuildContext context) {
// TODO: implement build
t.TableList table=widget.table;
t.TableList table = widget.table;
return GestureDetector(
onTap: (){
if(widget.canSelected&&table.signStr.isEmpty){
onTap: () {
if (widget.canSelected && table.signStr.isEmpty) {
setState(() {
table.selected=!(table.selected??false);
table.selected = !(table.selected ?? false);
});
widget.onSelected(table);
}
... ... @@ -44,27 +47,39 @@ class NewTableItemState extends State<NewTableItem>{
Container(
width: ScreenUtil().setWidth(150),
height: ScreenUtil().setWidth(widget.height),
margin:EdgeInsets.all( ScreenUtil().setWidth(9)),
margin: EdgeInsets.all(ScreenUtil().setWidth(9)),
decoration: BoxDecoration(
color: MyColours.color_a8e2e4,
borderRadius: BorderRadius.all(Radius.circular(ScreenUtil().setWidth(8)))
),
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(8)))),
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Positioned(
left: 0,
top: 0,
child: table.tidStr==null?Container():Container(
width: ScreenUtil().setWidth(70),
height: ScreenUtil().setHeight(32),
alignment: Alignment.center,
decoration: BoxDecoration(
color: MyColours.color_63a6d1,
borderRadius: BorderRadius.only(topLeft: Radius.circular(ScreenUtil().setWidth(8)),topRight: Radius.circular(ScreenUtil().setWidth(8)),bottomRight: Radius.circular(ScreenUtil().setWidth(8)))
),
child: Text(table.tidStr,style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(24),decoration: TextDecoration.none,fontWeight: FontWeight.normal)),
),
child: table.tidStr == null
? Container()
: Container(
width: ScreenUtil().setWidth(70),
height: ScreenUtil().setHeight(32),
alignment: Alignment.center,
decoration: BoxDecoration(
color: MyColours.color_63a6d1,
borderRadius: BorderRadius.only(
topLeft:
Radius.circular(ScreenUtil().setWidth(8)),
topRight:
Radius.circular(ScreenUtil().setWidth(8)),
bottomRight: Radius.circular(
ScreenUtil().setWidth(8)))),
child: Text(table.tidStr,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(24),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal)),
),
),
Container(
alignment: Alignment.centerLeft,
... ... @@ -74,37 +89,109 @@ class NewTableItemState extends State<NewTableItem>{
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
VEmptyView(20),
Text(table.name,style: TextStyle(color: MyColours.color_131313,fontSize: ScreenUtil().setSp(30),decoration: TextDecoration.none,fontWeight: FontWeight.normal),overflow: TextOverflow.ellipsis,),
Text(
table.name,
style: TextStyle(
color: MyColours.color_131313,
fontSize: ScreenUtil().setSp(30),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
overflow: TextOverflow.ellipsis,
),
VEmptyView(5),
Text((table.reserver==null||table.reserver.isEmpty)?table.tableNum:table.reserver,style: TextStyle(color: (table.reserver==null||table.reserver.isEmpty)?MyColours.color_777777:MyColours.color_2bb5b7,fontSize: ScreenUtil().setSp(26),decoration: TextDecoration.none,fontWeight: FontWeight.normal),overflow: TextOverflow.ellipsis,),
Text(
(table.reserver == null || table.reserver.isEmpty)
? '${table.tablePnum}人'
: table.reserver,
style: TextStyle(
color: (table.reserver == null ||
table.reserver.isEmpty)
? MyColours.color_777777
: MyColours.color_2bb5b7,
fontSize: ScreenUtil().setSp(26),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
overflow: TextOverflow.ellipsis,
),
VEmptyView(5),
Text(table.lowStr,style: TextStyle(color: MyColours.color_777777,fontSize: ScreenUtil().setSp(26),decoration: TextDecoration.none,fontWeight: FontWeight.normal),overflow: TextOverflow.ellipsis,)
Text(
table.lowStr,
style: TextStyle(
color: MyColours.color_777777,
fontSize: ScreenUtil().setSp(26),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
overflow: TextOverflow.ellipsis,
)
],
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: table.signStr.isEmpty?Container():Container(
width: ScreenUtil().setWidth(150),
height: ScreenUtil().setHeight(40),
alignment: Alignment.center,
decoration: BoxDecoration(
color:MyColours.color_89c0b7,
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(ScreenUtil().setWidth(8)),bottomRight: Radius.circular(ScreenUtil().setWidth(8)))
),
child: Text(table.signStr,style: TextStyle(color:MyColours.color_ffffff,fontSize: ScreenUtil().setSp(24),decoration: TextDecoration.none,fontWeight: FontWeight.normal),),
),
),
widget.isRegionName
? Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
width: ScreenUtil().setWidth(150),
height: ScreenUtil().setHeight(40),
alignment: Alignment.center,
decoration: BoxDecoration(
color: MyColours.color_89c0b7,
borderRadius: BorderRadius.only(
bottomLeft:
Radius.circular(ScreenUtil().setWidth(8)),
bottomRight: Radius.circular(
ScreenUtil().setWidth(8)))),
child: Text(
table.regionName,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(24),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
),
),
)
: Positioned(
bottom: 0,
left: 0,
right: 0,
child: table.signStr.isEmpty
? Container()
: Container(
width: ScreenUtil().setWidth(150),
height: ScreenUtil().setHeight(40),
alignment: Alignment.center,
decoration: BoxDecoration(
color: MyColours.color_89c0b7,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(
ScreenUtil().setWidth(8)),
bottomRight: Radius.circular(
ScreenUtil().setWidth(8)))),
child: Text(
table.signStr,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(24),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
),
),
),
],
),
),
Positioned(
top: 3,
right: 5,
child: !(table.selected??false)?Container():Image.asset("assets/icon_selected.png",width: ScreenUtil().setWidth(40),height: ScreenUtil().setWidth(40),)
)
child: !(table.selected ?? false)
? Container()
: Image.asset(
"assets/icon_selected.png",
width: ScreenUtil().setWidth(40),
height: ScreenUtil().setWidth(40),
))
],
),
);
... ...
... ... @@ -5,15 +5,19 @@ import 'package:one_key/res/colors.dart';
import 'package:one_key/models/table.dart' as t;
import 'package:one_key/widgets/v_empty_view.dart';
class TableItem extends StatefulWidget{
class TableItem extends StatefulWidget {
final t.Table table;
final bool canSelected;//是否能选中
final bool canSelected; //是否能选中
final ValueChanged onSelected;
final int height;//高度
final bool canChoose;
final int height; //高度
TableItem(this.table,{this.onSelected,this.canSelected=false,this.height=183});
TableItem(this.table,
{this.onSelected,
this.canSelected = false,
this.height = 183,
this.canChoose = false});
@override
State<StatefulWidget> createState() {
... ... @@ -22,21 +26,29 @@ class TableItem extends StatefulWidget{
}
}
class TableItemState extends State<TableItem>{
class TableItemState extends State<TableItem> {
@override
Widget build(BuildContext context) {
// TODO: implement build
t.Table table=widget.table;
t.Table table = widget.table;
return GestureDetector(
onTap: (){
if(widget.canSelected&&table.signStr.isEmpty){
setState(() {
table.selected=!(table.selected??false);
});
widget.onSelected(table);
onTap: () {
if (widget.canSelected && widget.canChoose) {
if (table.sign == '5' || table.signStr.isEmpty) {
setState(() {
table.selected = !(table.selected ?? false);
});
widget.onSelected(table);
}
} else {
if (widget.canSelected && table.signStr.isEmpty) {
setState(() {
table.selected = !(table.selected ?? false);
});
widget.onSelected(table);
}
}
},
child: Stack(
... ... @@ -44,27 +56,39 @@ class TableItemState extends State<TableItem>{
Container(
width: ScreenUtil().setWidth(150),
height: ScreenUtil().setWidth(widget.height),
margin:EdgeInsets.all( ScreenUtil().setWidth(9)),
margin: EdgeInsets.all(ScreenUtil().setWidth(9)),
decoration: BoxDecoration(
color: MyColours.color_a8e2e4,
borderRadius: BorderRadius.all(Radius.circular(ScreenUtil().setWidth(8)))
),
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(8)))),
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Positioned(
left: 0,
top: 0,
child: table.tidStr==null?Container():Container(
width: ScreenUtil().setWidth(70),
height: ScreenUtil().setHeight(32),
alignment: Alignment.center,
decoration: BoxDecoration(
color: MyColours.color_63a6d1,
borderRadius: BorderRadius.only(topLeft: Radius.circular(ScreenUtil().setWidth(8)),topRight: Radius.circular(ScreenUtil().setWidth(8)),bottomRight: Radius.circular(ScreenUtil().setWidth(8)))
),
child: Text(table.tidStr,style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(24),decoration: TextDecoration.none,fontWeight: FontWeight.normal)),
),
child: table.tidStr == null
? Container()
: Container(
width: ScreenUtil().setWidth(70),
height: ScreenUtil().setHeight(32),
alignment: Alignment.center,
decoration: BoxDecoration(
color: MyColours.color_63a6d1,
borderRadius: BorderRadius.only(
topLeft:
Radius.circular(ScreenUtil().setWidth(8)),
topRight:
Radius.circular(ScreenUtil().setWidth(8)),
bottomRight: Radius.circular(
ScreenUtil().setWidth(8)))),
child: Text(table.tidStr,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(24),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal)),
),
),
Container(
alignment: Alignment.centerLeft,
... ... @@ -74,11 +98,40 @@ class TableItemState extends State<TableItem>{
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
VEmptyView(20),
Text(table.name,style: TextStyle(color: MyColours.color_131313,fontSize: ScreenUtil().setSp(30),decoration: TextDecoration.none,fontWeight: FontWeight.normal),overflow: TextOverflow.ellipsis,),
Text(
table.name,
style: TextStyle(
color: MyColours.color_131313,
fontSize: ScreenUtil().setSp(30),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
overflow: TextOverflow.ellipsis,
),
VEmptyView(5),
Text((table.reserver==null||table.reserver.isEmpty)?table.tableNum:table.reserver,style: TextStyle(color: (table.reserver==null||table.reserver.isEmpty)?MyColours.color_777777:MyColours.color_2bb5b7,fontSize: ScreenUtil().setSp(26),decoration: TextDecoration.none,fontWeight: FontWeight.normal),overflow: TextOverflow.ellipsis,),
Text(
(table.reserver == null || table.reserver.isEmpty)
? table.tableNum
: table.reserver,
style: TextStyle(
color: (table.reserver == null ||
table.reserver.isEmpty)
? MyColours.color_777777
: MyColours.color_2bb5b7,
fontSize: ScreenUtil().setSp(26),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
overflow: TextOverflow.ellipsis,
),
VEmptyView(5),
Text(table.lowStr,style: TextStyle(color: MyColours.color_777777,fontSize: ScreenUtil().setSp(26),decoration: TextDecoration.none,fontWeight: FontWeight.normal),overflow: TextOverflow.ellipsis,)
Text(
table.lowStr,
style: TextStyle(
color: MyColours.color_777777,
fontSize: ScreenUtil().setSp(26),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
overflow: TextOverflow.ellipsis,
)
],
),
),
... ... @@ -86,16 +139,28 @@ class TableItemState extends State<TableItem>{
bottom: 0,
left: 0,
right: 0,
child: table.signStr.isEmpty?Container():Container(
width: ScreenUtil().setWidth(150),
height: ScreenUtil().setHeight(40),
alignment: Alignment.center,
decoration: BoxDecoration(
color:MyColours.color_89c0b7,
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(ScreenUtil().setWidth(8)),bottomRight: Radius.circular(ScreenUtil().setWidth(8)))
),
child: Text(table.signStr,style: TextStyle(color:MyColours.color_ffffff,fontSize: ScreenUtil().setSp(24),decoration: TextDecoration.none,fontWeight: FontWeight.normal),),
),
child: table.signStr.isEmpty
? Container()
: Container(
width: ScreenUtil().setWidth(150),
height: ScreenUtil().setHeight(40),
alignment: Alignment.center,
decoration: BoxDecoration(
color: MyColours.color_89c0b7,
borderRadius: BorderRadius.only(
bottomLeft:
Radius.circular(ScreenUtil().setWidth(8)),
bottomRight: Radius.circular(
ScreenUtil().setWidth(8)))),
child: Text(
table.signStr,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(24),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
),
),
),
],
),
... ... @@ -103,8 +168,13 @@ class TableItemState extends State<TableItem>{
Positioned(
top: 3,
right: 5,
child: !(table.selected??false)?Container():Image.asset("assets/icon_selected.png",width: ScreenUtil().setWidth(40),height: ScreenUtil().setWidth(40),)
)
child: !(table.selected ?? false)
? Container()
: Image.asset(
"assets/icon_selected.png",
width: ScreenUtil().setWidth(40),
height: ScreenUtil().setWidth(40),
))
],
),
);
... ...
... ... @@ -109,44 +109,45 @@ flutter:
# To add assets to your application, add an assets section, like this:
assets:
- assets/tts_online.mp3
- assets/icon_sellercode.png
- assets/icon_account.png
- assets/icon_pwd.png
- assets/icon_pwd_show.png
- assets/icon_pwd_hide.png
- assets/icon_pwd_hide.png
- assets/message_default.png
- assets/message_selected.png
- assets/notebook_default.png
- assets/notebook_selected.png
- assets/my_default.png
- assets/my_selected.png
- assets/icon_close.png
- assets/logo.png
- assets/icon_back.png
- assets/icon_selected.png
- assets/statu_booked.png
- assets/statu_canceled.png
- assets/statu_eating.png
- assets/statu_finished.png
- assets/statu_reached.png
- assets/statu_refuse.png
- assets/status_undeal.png
- assets/icon_wechat.png
- assets/icon_sms.png
- assets/icon_phone.png
- assets/bg_invication.png
- assets/invication_line_left.png
- assets/invication_line_right.png
- assets/img_ydap.png
- assets/invication_map.png
- assets/invication_arrow_right.png
- assets/invication_back.png
- assets/icon_exist.png
- assets/my_logo.png
- assets/arr_right_gray.png
- assets/bg_error.png
- assets/
# - assets/tts_online.mp3
# - assets/icon_sellercode.png
# - assets/icon_account.png
# - assets/icon_pwd.png
# - assets/icon_pwd_show.png
# - assets/icon_pwd_hide.png
# - assets/icon_pwd_hide.png
# - assets/message_default.png
# - assets/message_selected.png
# - assets/notebook_default.png
# - assets/notebook_selected.png
# - assets/my_default.png
# - assets/my_selected.png
# - assets/icon_close.png
# - assets/logo.png
# - assets/icon_back.png
# - assets/icon_selected.png
# - assets/statu_booked.png
# - assets/statu_canceled.png
# - assets/statu_eating.png
# - assets/statu_finished.png
# - assets/statu_reached.png
# - assets/statu_refuse.png
# - assets/status_undeal.png
# - assets/icon_wechat.png
# - assets/icon_sms.png
# - assets/icon_phone.png
# - assets/bg_invication.png
# - assets/invication_line_left.png
# - assets/invication_line_right.png
# - assets/img_ydap.png
# - assets/invication_map.png
# - assets/invication_arrow_right.png
# - assets/invication_back.png
# - assets/icon_exist.png
# - assets/my_logo.png
# - assets/arr_right_gray.png
# - assets/bg_error.png
# assets:
# - images/a_dot_burr.jpeg
... ...