Commit 3b9cdf6bbff0fc8ed51a7ea24690233ea6ab44b7

Authored by wdn127929
1 parent 01f7dad4

照片管理

... ... @@ -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 = "312"
def flutterVersionCode = "314"
if (flutterVersionCode == null) {
flutterVersionCode = '312'
flutterVersionCode = '314'
}
def flutterVersionName = "3.1.2"
def flutterVersionName = "3.1.4"
if (flutterVersionName == null) {
flutterVersionName = '3.1.2'
flutterVersionName = '3.1.4'
}
apply plugin: 'com.android.application'
... ...
... ... @@ -1038,6 +1038,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
ymd: detailEntity.ddateYMD);
if (sucess) {
bus.emit("refresh_book_list"); //刷新已预订列表
await _getReserveDetail(showCicle: false);
}
},
... ... @@ -2195,6 +2196,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
phone: detailModel.phoneController.text);
if (sucess) {
EventBus().emit("refresh_tablemanager"); //刷新桌位
bus.emit("refresh_book_list"); //刷新已预订列表
await _getReserveDetail(showCicle: true);
setState(() {
setTop = false;
... ...
... ... @@ -830,289 +830,6 @@ class SelectTableFPageState extends State<SelectTableFPage> {
},
)),
]);
return Container(
color: MyColours.color_ffffff,
child: Row(
children: <Widget>[
Container(
width: ScreenUtil().setWidth(170),
height: double.infinity,
color: MyColours.color_f1f1f1,
child: ListView.builder(
itemBuilder: (context, index) {
if (areas.isEmpty || index == areas.length) {
return InkWell(
onTap: () async {
//添加区域弹框
await DialogUtil.openCreateAreaDialog(context,
onTap: (value) async {
print(value);
//添加区域
bool success = await _chooseTableModel
.addTableAreas(context, value);
print(success);
if (success) {
Utils.showToast('添加成功!');
await getTableList(needLoading: false);
}
});
},
child: Center(
child: Image.asset(
Utils.getImgPath('add_area'),
width: ScreenUtil().setWidth(32)),
),
);
} else {
return AreaItem(areas[index], currentArea,
(area) {
setState(() {
currentArea = (area as Area).name;
});
});
}
},
itemExtent: ScreenUtil().setHeight(207),
itemCount: areas.length + 1,
),
),
Expanded(
child: Padding(
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setHeight(10),
horizontal: ScreenUtil().setWidth(9)),
child: Column(
children: [
Expanded(
child: GridView.builder(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
childAspectRatio: 8 / 9),
itemBuilder: (context, index) {
if (index ==
areaTableMap[currentArea].length ||
areaTableMap[currentArea].length == 0) {
return InkWell(
onTap: () async {
List<String> areasTemp = [];
for (int i = 0;
i < areas.length;
i++) {
areasTemp.add(areas[i].name);
}
//添加桌位弹框
await DialogUtil
.openCreateTableDialog(
context,
areasTemp,
areasTemp
.indexOf(currentArea),
personNumList, onTap:
(Map<String, String>
value) async {
print(value);
// 'areaname':
// areas[currentAreaIndex],
// 'name': controller.text,
// 'pnumMin': pnumMin,
// 'pnumMax': pnumMax
//添加桌位 接口参数带整合???
// 以下是旧的不去,明天添加桌位接口
String rid;
for (Area item in areas) {
if (item.name ==
value['areaname']) {
rid = item.rid;
}
}
Map<String, String> params = {
'rid': rid,
'name': value['name'],
};
if (value['pnumMin'] != '') {
params['pnum'] =
value['pnumMin'];
}
if (value['pnumMax'] != '') {
params['most_pnum'] =
value['pnumMax'];
}
bool success =
await _chooseTableModel
.addTable(
context, params);
print(success);
if (success) {
Utils.showToast('添加成功!');
refreshTable(context);
}
});
},
child: Container(
margin: EdgeInsets.all(
ScreenUtil().setWidth(15)),
child: DottedBorder(
dashPattern: [5, 5, 5, 5],
borderType: BorderType.RRect,
radius: Radius.circular(
ScreenUtil().setWidth(10)),
// padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
color: MyColours.color_199095,
strokeWidth:
ScreenUtil().setWidth(2),
child: ClipRRect(
borderRadius: BorderRadius
.all(Radius.circular(
ScreenUtil()
.setWidth(10))),
child: Container(
height: ScreenUtil()
.setWidth(90 * 2),
width: ScreenUtil()
.setWidth(80 * 2),
child: Column(
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
Image.asset(
Utils.getImgPath(
'add_area'),
width: ScreenUtil()
.setWidth(32)),
],
),
),
),
)));
} else {
return TableItem(
areaTableMap[currentArea][index],
onSelected: (t.Table table) {
if (widget.fromPage == 'tablePhoto') {
for (String item
in areaTableMap.keys) {
for (t.Table item
in areaTableMap[item]) {
item.selected = false;
selectNum = 0;
if (table.id == item.id) {
item.selected = true;
selectTables = [];
selectNum++;
selectTables.add(table);
}
}
}
setState(() {});
} else {
if ((table as t.Table).selected) {
selectTables.add(table);
selectNum++;
widget.tableList
.add(tableToTableList(table));
} else {
widget.tableList.removeWhere(
(t) => t.id == table.id);
selectNum--;
selectTables.removeWhere(
(t) => t.id == table.id);
}
setState(() {});
}
},
canSelected: true,
fromPage: widget.fromPage,
tableMap: tableMap,
rid: widget.rid);
}
},
itemCount: currentArea == null
? 0
: areaTableMap[currentArea].length + 1,
)),
Container(
width: double.infinity,
height: ScreenUtil().setHeight(84),
margin: EdgeInsets.only(
bottom: ScreenUtil().setWidth(50)),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(31)),
alignment: Alignment.center,
color: MyColours.color_ffffff,
child: CommonButton(
content: widget.fromPage == 'tablePhoto'
? '确定'
: "已选${selectNum}个 确定",
width: 500,
height: 84,
fontSize: 34,
state: 1,
onPress: () {
if (widget.fromPage == "tablePhoto") {
Map temp = {
'tid': selectTables.length > 0
? selectTables[0].id
: '',
'tname': selectTables.length > 0
? selectTables[0].name
: ''
};
Navigator.of(context).pop(temp);
} else {
if (widget.canChoose) {
// if (widget.tableList.length > 0) {
String tid = "";
for (TableList table
in widget.tableList) {
tid += table.id + ",";
}
if (widget.tableList.length > 0) {
tid = tid.substring(
0, tid.length - 1);
}
Map temp = {
'object': widget.tableList,
'tid': tid
};
Navigator.of(context).pop(temp);
// }
} else {
if (selectTables.length > 0) {
String tid = "";
for (t.Table table
in selectTables) {
tid += table.id + ",";
}
if (selectTables.length > 0) {
tid = tid.substring(
0, tid.length - 1);
}
Map temp = {
'object': widget.tableList,
'tid': tid
};
Navigator.of(context).pop(temp);
}
}
}
},
)),
],
)),
)
],
),
);
}
}),
),
... ...
... ... @@ -345,6 +345,38 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
),
MyItem(
title: "照片管理",
content: "",
callback: () async {
// Map temp =
await NavigatorUtil.goPhotoManagerSelectTablePage(
context, "", DateTime.now().millisecondsSinceEpoch, "1",
canChoose: true,
object: null,
fromPage: "tablePhoto",
tid: '');
// if (temp != null && temp['tid'] != '') {
// // print(temp['tid']);
// // print(temp['tname']);
// // tname = temp['tname'];
// // tid = temp['tid'];
// // _getTablePhoto(context, temp['tid'], showLoading: true);
// }
},
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
MyItem(
title: "员工管理",
content: "",
callback: () {
... ...
import 'dart:ffi';
import 'package:common_utils/common_utils.dart';
import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/constant/state.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/pages/table/area_item_table.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/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/event_bus.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/area_item.dart';
import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/f_table_item.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/page_exception.dart';
import 'package:one_key/widgets/table_item.dart';
import 'package:one_key/models/table.dart' as t;
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import 'dart:convert' as convert;
class PhotoManagerPage extends StatefulWidget {
final String rid; //预订id
final DateTime dateTime; //日期
final String ddate_slot; //时段
final bool canChoose; //变更预订可以取消原来已预订的选中状态
final List<TableList> tableList;
final String fromPage;
final String tid;
PhotoManagerPage(this.rid, this.dateTime, this.ddate_slot,
{this.canChoose = false, this.tableList, this.fromPage, this.tid});
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new PhotoManagerPageState();
}
}
class PhotoManagerPageState extends State<PhotoManagerPage> {
List<Area> areas = []; //区域列表
List<t.Table> selectTables = []; //选择的桌位
List<TableOuter> tableOuterList = []; //区域-桌位列表
Map<String, List<t.Table>> areaTableMap = {}; //区域-桌位Map
ChooseTableModel _chooseTableModel;
Map<String, Notebook> tableMap = {}; //记录已预订桌位对应的订单
String currentArea; //当前选中区域
List<String> personNumList = [];
int selectNum = 0;
bool isSelected = true; //全部按钮
int _selectNumber;
Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟
String selectTableId;
@override
void initState() {
// TODO: implement initState
super.initState();
// for (int i = 1; i < 31; i++) {
// personNumList.add(i.toString());
// }
// initDateHourMinuteList(context);
WidgetsBinding.instance.addPostFrameCallback((_) {
getTableList();
});
bus.on("refresh_photo_manager", (args) {
getTableList();
});
}
@override
void dispose() {
super.dispose();
bus.off("refresh_photo_manager");
}
/// 早市、午市、晚市对应的半个小时间隔时间段
initDateHourMinuteList(BuildContext context) async {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
String morning =
userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning;
String noon =
userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon;
String night =
userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night;
userModel.user.morning == ''
? dailyMap.putIfAbsent('morning', () => '')
: dailyMap.putIfAbsent(
'morning', () => _getHourAndMinute(userModel.user.morning, 1));
userModel.user.noon == ''
? dailyMap.putIfAbsent('noon', () => '')
: dailyMap.putIfAbsent(
'noon', () => _getHourAndMinute(userModel.user.noon, 2));
userModel.user.night == ''
? dailyMap.putIfAbsent('night', () => '')
: dailyMap.putIfAbsent(
'night', () => _getHourAndMinute(userModel.user.night, 3));
// _initSunDateList(
// userModel.user.morning, userModel.user.noon, userModel.user.night);
}
//根据获取时间 11:00-12:30 获取30分钟间隔组装的数组
_getHourAndMinute(String hourAndMinuteStr, int mnd) {
List tempDate = hourAndMinuteStr.split("-");
String beginDate = tempDate[0];
String endDate = tempDate[1];
List tempHour = beginDate.split(':');
/*获取开始小时*/
int beginHour = int.parse(tempHour[0]);
/*获取开始分钟*/
int beginMinute = int.parse(tempHour[1]);
List res = [];
bool tempLimit = true;
while (tempLimit) {
String temp = _dealTime(beginHour, beginMinute);
// bool tempSelect = false;
// Map tempMap = {'title': temp, 'select': tempSelect};
res.add(temp);
if (temp == endDate) {
tempLimit = false;
break;
}
if (beginMinute == 30) {
beginHour++;
if (beginHour >= 24) {
beginHour = 0;
}
}
beginMinute = (beginMinute + 30) % 60;
}
return res;
}
/// 根据时间和分钟组装 格式:11:00
_dealTime(int begin, int mm) {
String sb = '';
if (begin < 10) {
sb = '0$begin';
} else {
sb = '$begin';
}
sb = '$sb:';
if (mm < 10) {
sb = '${sb}0${mm}';
} else {
sb = '${sb}${mm}';
}
return sb;
}
//获取桌位列表
getTableList({needLoading = true}) async {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
Map<String, String> params = {"sellerid": userModel.user.sellerid};
tableOuterList = await _chooseTableModel.getTableList(context, params,
needLoading: needLoading);
_chooseTableModel.tablesAll = [];
for (TableOuter item in tableOuterList) {
// if (item.name == "推荐") {
// itemModelList.remove(item);
// }
for (var item1 in item.list) {
item1.selected = false;
for (var table in widget.tableList) {
if (item1.id == table.id) {
item1.selected = true;
selectNum++;
// if (!tableList.contains(item)) {
// tableList.add(item);
// }
}
}
}
_chooseTableModel.tablesAll.addAll(item.list);
}
if (tableOuterList.isEmpty) {
_chooseTableModel.pageState = PageState.Success;
_chooseTableModel.notifyListeners();
} else {
initData();
// _getReserveList(userModel.user.sellerid, needLoading: needLoading);
}
// if (_chooseTableModel.pageState == PageState.Success) {
// }
}
refreshTable(context) async {
await getTableList(needLoading: false);
// if (temp.length > 0) {
// _getReserveList(context, needLoading: false);
// } else {
// // pageState = PageState.Empty;
// _chooseTableModel.pageState = PageState.Success;
// _chooseTableModel.notifyListeners();
// }
}
//获取已预订列表
_getReserveList(String sid, {needLoading = true}) async {
NoteBookModel model = new NoteBookModel();
Map<String, String> params = {
"sid": sid,
"rdate": _getRdate(),
"ddate_solt": widget.ddate_slot,
"y": "200",
"x": "1",
"keywords": "",
"sort": "1"
};
List<Notebook> noteBooks =
await model.getReserveList(context, params, needLoading: needLoading);
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;
}
}
}
print(tableMap);
if (needLoading) {
initData();
} else {
initData(needRetain: true);
}
}
//初始桌位数据
initData({bool needRetain = false}) {
areas.clear();
areaTableMap.clear();
List<t.Table> tempTableAll = [];
tempTableAll.addAll(_chooseTableModel.tablesAll);
for (TableOuter outer in tableOuterList) {
int count = 0;
List<t.Table> tempList = [];
tempList.addAll(outer.list);
for (t.Table table in outer.list) {
// table.selected = false;
if (widget.tid != '' && table.id == widget.tid) {
table.selected = true;
currentArea = outer.name;
}
if (table.id == selectTableId) {
table.selected = true;
currentArea = outer.name;
}
// 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;
// table.pnum = notebook.actual_pnum;
// table.nickName = notebook.nick_name;
// table.noteName = notebook.note_name;
// //(不能移除自己定的桌子)
// String idNow = '';
// if (tableMap.containsKey('${table.id}')) {
// //包含,证明该桌子已经被预订了
// idNow = tableMap['${table.id}'].id;
// if (idNow != widget.rid) {
// //不是自己的当前订单
// //剔除已经预订的桌子,剩下空桌子(仅看空座)
// tempList.remove(table);
// //全部
// tempTableAll.remove(table);
// }
// }
// } else {
// table.sign = "";
// table.notebookId = "";
// if (table.enable == "1") {
// count++;
// }
// }
// } else {
// table.sign = "2";
// table.notebookId = "";
// }
}
areaTableMap["${outer.name}"] = outer.list;
_chooseTableModel.areaTableMapCanNote["${outer.name}"] = tempList;
Area area = Area();
area.name = outer.name;
area.count = outer.list.length == 0 ? -1 : count;
area.rid = outer.list.length == 0 ? outer.rid : outer.list[0].rid;
areas.add(area);
}
_chooseTableModel.tablesCanNote = tempTableAll;
// if (_chooseTableModel.swichState) {
// _chooseTableModel.areaTableMapShow =
// _chooseTableModel.areaTableMapCanNote;
// _chooseTableModel.tablesShow = _chooseTableModel.tablesCanNote;
// } else {
_chooseTableModel.areaTableMapShow = areaTableMap;
_chooseTableModel.tablesShow = _chooseTableModel.tablesAll;
// }
if (widget.tid == '') {
if (!needRetain) {
// currentArea = areaTableMap.keys.first;
currentArea = '全部';
_chooseTableModel.currentTables = _chooseTableModel.tablesAll;
}
if (areas.length == 1) {
currentArea = areaTableMap.keys.first;
}
}
_chooseTableModel.pageState = PageState.Success;
_chooseTableModel.notifyListeners();
}
//获取一天开始-结束时间字符串
String _getRdate() {
String keys = '';
if (widget.ddate_slot == '1') {
//早市
keys = 'morning';
} else if (widget.ddate_slot == '2') {
//午市
keys = 'noon';
} else if (widget.ddate_slot == '3') {
//晚市
keys = 'night';
}
String ymd =
DateUtil.formatDate(widget.dateTime, format: DateFormats.y_mo_d);
String timeStrStart = '';
String timeStrEnd = '';
//一天开始时间
double startDay;
//一天结束时间
double endDay;
if (keys != '') {
List temp = dailyMap[keys];
timeStrStart = ymd + ' ' + temp.first + ':00';
timeStrEnd = ymd + ' ' + temp.last + ':00';
} else {
timeStrStart = widget.dateTime.year.toString() +
"-" +
Utils.addZeroNumber(widget.dateTime.month) +
"-" +
Utils.addZeroNumber(widget.dateTime.day) +
" 00:00:00";
timeStrEnd = widget.dateTime.year.toString() +
"-" +
Utils.addZeroNumber(widget.dateTime.month) +
"-" +
Utils.addZeroNumber(widget.dateTime.day) +
" 23:59:59";
}
startDay = (DateTime.parse(timeStrStart).millisecondsSinceEpoch) / 1000;
endDay = (DateTime.parse(timeStrEnd).millisecondsSinceEpoch) / 1000;
return startDay.floor().toString() + "-" + endDay.floor().toString();
}
Widget item(int i) {
return GridView.builder(
// controller: _areaController,
// physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setWidth(20),
horizontal: ScreenUtil().setWidth(10)),
shrinkWrap: true,
itemCount: currentArea == '全部'
? _chooseTableModel.tablesShow.length
: _chooseTableModel.areaTableMapShow[areas[i].name].length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
childAspectRatio: 1,
mainAxisSpacing: ScreenUtil().setWidth(30),
crossAxisSpacing: ScreenUtil().setWidth(12),
),
itemBuilder: (BuildContext context, int index) {
List<t.Table> data = currentArea == '全部'
? _chooseTableModel.tablesShow
: _chooseTableModel.areaTableMapShow[areas[i].name];
// if (index == data.length || data.length == 0) {
// return InkWell(
// onTap: () async {
// List<String> areasTemp = [];
// for (int i = 0; i < areas.length; i++) {
// areasTemp.add(areas[i].name);
// }
// //添加桌位弹框
// await DialogUtil.openCreateTableDialog(
// context, areasTemp, i, personNumList,
// onTap: (Map<String, String> value) async {
// print(value);
// // 'areaname':
// // areas[currentAreaIndex],
// // 'name': controller.text,
// // 'pnumMin': pnumMin,
// // 'pnumMax': pnumMax
// //添加桌位 接口参数带整合???
// // 以下是旧的不去,明天添加桌位接口
// String rid;
// for (Area item in areas) {
// if (item.name == value['areaname']) {
// rid = item.rid;
// }
// }
// Map<String, String> params = {
// 'rid': rid,
// 'name': value['name'],
// };
// if (value['pnumMin'] != '') {
// params['pnum'] = value['pnumMin'];
// }
// if (value['pnumMax'] != '') {
// params['most_pnum'] = value['pnumMax'];
// }
// bool success =
// await _chooseTableModel.addTable(context, params);
// print(success);
// if (success) {
// Utils.showToast('添加成功!');
// // TableOuter tableOuter = TableOuter();
// // tableOuter.name = value;
// // tableOuter.list = [];
// // tableManagerModel.tableOuterList.add(tableOuter);
// // tableManagerModel.initData();
// // Timer(
// // Duration(milliseconds: 500),
// // () => _areaController.jumpTo(
// // _areaController.position.maxScrollExtent));
// // await tableManagerModel
// // .getTableList(context);
// // await tableManagerModel
// // .initData();
// refreshTable(context);
// }
// });
// },
// child: Container(
// child: DottedBorder(
// dashPattern: [5, 5, 5, 5],
// borderType: BorderType.RRect,
// radius: Radius.circular(ScreenUtil().setWidth(20)),
// // padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
// color: MyColours.color_E0E0E0,
// strokeWidth: ScreenUtil().setWidth(2),
// child: ClipRRect(
// borderRadius: BorderRadius.all(
// Radius.circular(ScreenUtil().setWidth(20))),
// child: Container(
// height: ScreenUtil.screenWidthDp -
// ScreenUtil().setWidth(12 * 3 - 10 * 2),
// width: ScreenUtil.screenWidthDp -
// ScreenUtil().setWidth(12 * 3 - 10 * 2),
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Image.asset(Utils.getImgPath('add_store'),
// width: ScreenUtil().setWidth(32)),
// ],
// ),
// ),
// ),
// )));
// } else {
return Selector<ChooseTableModel, t.Table>(
shouldRebuild: (pre, next) => true,
selector: (context, model) => data[index],
builder: (context, table, _) {
return FTableItem(data[index], canSelected: true,
onSelected: (t.Table table) {
print(areaTableMap.keys);
for (String item in areaTableMap.keys) {
for (t.Table tableItem in areaTableMap[item]) {
tableItem.selected = false;
selectNum = 0;
if (table.id == tableItem.id) {
selectTableId = table.id;
setState(() {
tableItem.selected = true;
});
// selectTables = [];
// selectNum++;
// selectTables.add(table);
// Map temp = {
// 'tid': selectTables.length > 0 ? selectTables[0].id : '',
// 'tname':
// selectTables.length > 0 ? selectTables[0].name : ''
// };
NavigatorUtil.goTablePhotoManagerPage(context,
tid: table.id, tname: table.name);
}
}
}
}, fromPage: widget.fromPage, tableMap: tableMap, rid: widget.rid);
},
);
// }
},
);
}
@override
Widget build(BuildContext context) {
_chooseTableModel = Provider.of<ChooseTableModel>(context);
return Scaffold(
body: SafeArea(
child: Column(
children: <Widget>[
MyAppBar(
"照片管理",
showBack: true,
),
Expanded(
child: Consumer<ChooseTableModel>(builder: (context, model, _) {
if (model.pageState != PageState.Success) {
return ExceptionPage(
pageState: model.pageState,
callback: () {
getTableList();
},
emptyMsg: "暂时没有桌位哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return Column(
// crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
color: MyColours.color_ffffff,
height: ScreenUtil().setWidth(92),
margin:
EdgeInsets.only(bottom: ScreenUtil().setWidth(30)),
child: Row(
children: [
HEmptyView(20),
Expanded(
child: ListView.builder(
itemCount: areas.length == 0
? 0
: areas.length + 1,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemBuilder:
(BuildContext contxt, int index) {
// if (index == areas.length + 1 ||
// areas.length == 0) {
// return InkWell(
// onTap: () async {
// //添加区域弹框
// await DialogUtil.openCreateAreaDialog(
// context, onTap: (value) async {
// print(value);
// //添加区域
// bool success = await _chooseTableModel
// .addTableAreas(context, value);
// print(success);
// if (success) {
// Utils.showToast('添加成功!');
// UserModel userModel =
// Provider.of<UserModel>(context,
// listen: false);
// Map<String, String> params = {
// "sellerid": userModel.user.sellerid
// };
// await _chooseTableModel.getTableList(
// context, params,
// needLoading: false);
// initData();
// // setState(() {
// // updateMenu();
// // });
// // _scrollToIndex(widget
// // .tableManagerModel
// // .areas
// // .length);
// }
// });
// },
// child: Column(
// children: [
// VEmptyView(20),
// DottedBorder(
// dashPattern: [5, 5, 5, 5],
// borderType: BorderType.RRect,
// radius: Radius.circular(
// ScreenUtil().setWidth(10)),
// // padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
// color: MyColours.color_199095,
// strokeWidth: ScreenUtil().setWidth(2),
// child: ClipRRect(
// borderRadius: BorderRadius.all(
// Radius.circular(
// ScreenUtil().setWidth(10))),
// child: Container(
// height:
// ScreenUtil().setWidth(25 * 2),
// width: ScreenUtil()
// .setWidth(104 * 2),
// child: Column(
// mainAxisAlignment:
// MainAxisAlignment.center,
// children: [
// Image.asset(
// Utils.getImgPath(
// 'add_area'),
// width: ScreenUtil()
// .setWidth(24)),
// ],
// ),
// ),
// ),
// )
// ],
// ),
// );
// } else {
if (index == 0) {
return InkWell(
onTap: () {
setState(() {
isSelected = true;
currentArea = '全部';
_chooseTableModel.currentTables =
_chooseTableModel
.areaTableMapShow[
currentArea];
});
},
child: 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(
'全部',
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: isSelected
? MyColours.color_ffffff
: MyColours.color_333333,
fontSize:
ScreenUtil().setSp(28),
decoration:
TextDecoration.none,
fontWeight:
FontWeight.normal),
),
),
);
} else {
return AreaItemTable(
areas[index - 1],
currentArea,
(area) {
setState(() {
isSelected = false;
_selectNumber = index - 1;
currentArea =
areas[index - 1].name;
_chooseTableModel.currentTables =
_chooseTableModel
.areaTableMapShow[
currentArea];
// _anmationMenu();
});
},
showBadge: false,
);
}
}
// },
)),
],
),
),
Expanded(
flex: 2,
child: Container(
constraints: BoxConstraints(
minHeight: ScreenUtil().setWidth(100)),
color: Color.fromRGBO(249, 249, 249, 1),
child: item(_selectNumber))),
// Container(
// width: double.infinity,
// height: ScreenUtil().setHeight(84),
// margin: EdgeInsets.only(
// bottom: ScreenUtil().setWidth(50)),
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(31)),
// alignment: Alignment.center,
// color: MyColours.color_ffffff,
// child: CommonButton(
// // content: widget.fromPage == 'tablePhoto'
// // ? '确定'
// // : "已选${selectNum}个 确定",
// content: '确定',
// width: 300,
// height: 84,
// fontSize: 34,
// state: 1,
// onPress: () {
// if (widget.fromPage == "tablePhoto") {
// Map temp = {
// 'tid': selectTables.length > 0
// ? selectTables[0].id
// : '',
// 'tname': selectTables.length > 0
// ? selectTables[0].name
// : ''
// };
// Navigator.of(context).pop(temp);
// } else {
// if (widget.canChoose) {
// // if (widget.tableList.length > 0) {
// String tid = "";
// for (TableList table in widget.tableList) {
// tid += table.id + ",";
// }
// if (widget.tableList.length > 0) {
// tid = tid.substring(0, tid.length - 1);
// }
// Map temp = {
// 'object': widget.tableList,
// 'tid': tid
// };
// Navigator.of(context).pop(temp);
// // }
// } else {
// if (selectTables.length > 0) {
// String tid = "";
// for (t.Table table in selectTables) {
// tid += table.id + ",";
// }
// if (selectTables.length > 0) {
// tid = tid.substring(0, tid.length - 1);
// }
// Map temp = {
// 'object': widget.tableList,
// 'tid': tid
// };
// Navigator.of(context).pop(temp);
// }
// }
// }
// },
// )),
]);
}
}),
),
],
),
));
}
tableToTableList(t.Table table) {
TableList _tableList = TableList(
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
_tableList.id = table.id;
_tableList.rid = table.rid;
_tableList.tid = table.tid;
_tableList.name = table.name;
_tableList.tablePnum = table.table_pnum;
_tableList.sellerid = null;
_tableList.qrcode = null;
_tableList.mostPnum = table.most_pnum;
_tableList.hot = null;
_tableList.orderO = table.order_o;
_tableList.status = table.status;
_tableList.enable = table.enable;
_tableList.spell = table.spell;
_tableList.cdate = null;
_tableList.rname = table.rname;
_tableList.regionName = table.rname;
_tableList.selected = true;
return _tableList;
}
}
... ...
... ... @@ -76,6 +76,7 @@ class _TablePhotoManagerPageState extends State<TablePhotoManagerPage> {
}
}
}
bus.emit("refresh_photo_manager");
}
print(_uploadImageProvider.tableImageList);
... ... @@ -178,25 +179,26 @@ class _TablePhotoManagerPageState extends State<TablePhotoManagerPage> {
fontWeight: FontWeight.bold)),
InkWell(
onTap: () async {
Map temp =
await NavigatorUtil.goSelectTablePage(
context,
"",
DateTime.now()
.millisecondsSinceEpoch,
"1",
canChoose: true,
object: null,
fromPage: "tablePhoto",
tid: tid);
if (temp != null && temp['tid'] != '') {
print(temp['tid']);
print(temp['tname']);
tname = temp['tname'];
tid = temp['tid'];
_getTablePhoto(context, temp['tid'],
showLoading: true);
}
Navigator.pop(context);
// Map temp = await NavigatorUtil
// .goPhotoManagerSelectTablePage(
// context,
// "",
// DateTime.now()
// .millisecondsSinceEpoch,
// "1",
// canChoose: true,
// object: null,
// fromPage: "tablePhoto",
// tid: tid);
// if (temp != null && temp['tid'] != '') {
// print(temp['tid']);
// print(temp['tname']);
// tname = temp['tname'];
// tid = temp['tid'];
// _getTablePhoto(context, temp['tid'],
// showLoading: true);
// }
},
child: Text('切换桌位',
style: TextStyle(
... ...
... ... @@ -8,8 +8,10 @@ class AreaItemTable extends StatefulWidget {
final String currentArea; //当前选中区域名称
final Area area;
final ValueChanged selectCallback;
final bool showBadge;
AreaItemTable(this.area, this.currentArea, this.selectCallback);
AreaItemTable(this.area, this.currentArea, this.selectCallback,
{this.showBadge = true});
@override
State<StatefulWidget> createState() {
... ... @@ -65,36 +67,38 @@ class AreaItemTableState extends State<AreaItemTable> {
fontWeight: FontWeight.normal),
),
),
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)))
!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)),
),
),
child: Text(area.count <= 0 ? "满座" : "${area.count}",
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(26),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal)),
),
),
],
));
}
... ...
... ... @@ -76,6 +76,22 @@ class NavigatorUtil {
"${Routes.select_table}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose");
}
/// 选择桌位-照片管理
static Future goPhotoManagerSelectTablePage(
BuildContext context, String rid, int dateTime, String ddate_slot,
{bool canChoose = false,
Map object,
String fromPage = 'change',
String tid = ''}) {
if (object != null) {
return _navigateTo(context,
"${Routes.photo_manager_page}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}");
}
// object = {'object': [], "tid": ''};
return _navigateTo(context,
"${Routes.photo_manager_page}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose");
}
/// 选择桌位——方硕新修改的选择桌位页面
static Future goSelectTableFPage(
BuildContext context, String rid, int dateTime, String ddate_slot,
... ...
... ... @@ -49,6 +49,7 @@ import 'package:one_key/pages/my/menu_type/menu_add_dishes_page.dart';
import 'package:one_key/pages/my/menu_type/menu_category_page.dart';
import 'package:one_key/pages/my/menu_type/menu_manage_page.dart';
import 'package:one_key/pages/my/my_integral_page.dart';
import 'package:one_key/pages/my/photo_type/photo_manager_page.dart';
import 'package:one_key/pages/my/receive_orders_time_set.dart';
import 'package:one_key/pages/my/remark_manager_page.dart';
import 'package:one_key/pages/my/room_type/room_type_create_page.dart';
... ... @@ -65,7 +66,7 @@ import 'package:one_key/pages/online_check/online_check_detail_page.dart';
import 'package:one_key/pages/online_check/online_check_edit_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/table/table_photo_manager_page.dart';
import 'package:one_key/pages/my/photo_type/table_photo_manager_page.dart';
import 'package:one_key/pages/webview/webview_page.dart';
import 'package:one_key/provider/base_info_provider.dart';
import 'package:one_key/provider/book_set_time_model.dart';
... ... @@ -191,6 +192,33 @@ var handleSelectTableFHandler = new Handler(
canChoose: canChoose, tableList: res, fromPage: fromPage, tid: tid));
});
// 跳转到照片管理的选择桌位_方硕新修改的页面
var photoManagerPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
String rid = params['rid'].first;
String tid = params['tid'].first;
DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(int.parse(params["dateTime"].first));
String ddate_slot = params["ddate_slot"].first;
String fromPage = params["fromPage"].first;
bool canChoose = params["canChoose"].first == "true" ? true : false;
List<TableList> res = [];
if (params.keys.contains('object')) {
Map object = FluroConvertUtils.string2map(params["object"].first);
List temp = object['object'];
for (var item in temp) {
res.add(TableList.fromJson(item));
}
}
// return SelectTablePage(rid, dateTime, ddate_slot,canChoose: canChoose);
return ChangeNotifierProvider<ChooseTableModel>(
create: (_) => ChooseTableModel(),
child: PhotoManagerPage(rid, dateTime, ddate_slot,
canChoose: canChoose, tableList: res, fromPage: fromPage, tid: tid));
});
// 跳转到邀请函页面
var handleInvicationHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
... ...
... ... @@ -65,6 +65,7 @@ class Routes {
static String personnel_password_edit_page =
"/personnel_password_edit_page"; //密码修改页
static String change_detail_f = "/change_detail_f"; //变更预订_方硕新修改页面
static String photo_manager_page = "/photo_manager_page"; //照片管理
static void configureRoutes(FluroRouter router) {
router.notFoundHandler = new Handler(
... ... @@ -77,7 +78,7 @@ class Routes {
router.define(handle_online_page, handler: handleOnlineHandler);
router.define(reserve_detail, handler: reserveDetailHandler);
router.define(select_table, handler: handleSelectTableHandler);
router.define(select_table_f, handler: handleSelectTableFHandler);
router.define(select_table_f, handler: handleSelectTableFHandler);
router.define(invication, handler: handleInvicationHandler);
router.define(sms, handler: handleSmsHandler);
router.define(webview, handler: handleWebviewHandler);
... ... @@ -138,5 +139,6 @@ class Routes {
router.define(personnel_password_edit_page,
handler: personnelPasswordEditPageHandle);
router.define(change_detail_f, handler: noteBookChangeFPageHandle);
router.define(photo_manager_page, handler: photoManagerPageHandle);
}
}
... ...