Commit d0f73e32d7eea3366c6d7eb36b1a748e79c77606

Authored by wdn127929
1 parent f15fe5d8

切换桌位等

... ... @@ -114,5 +114,7 @@ class HttpUrl {
"?service=App.Tables.SetTablePhoto"; // App设置桌位关联图片
static const String get_table_photo =
"?service=App.Tables.GetTablePhoto"; // App获取桌位关联图片
static const String del_table_photo =
"?service=App.Tables.DelTablePhoto"; // Apps删除桌位关联图片
}
... ...
... ... @@ -1178,6 +1178,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
ddate_solt,
_model.row.phone,
_model.row.ddateSolt,
tid:t.TableList.fromJson(tableinfo[0]).id,
replace: true);
EventBus().emit("refresh_tablemanager"); //刷新桌位
} else {
... ...
... ... @@ -1067,7 +1067,9 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
detailEntity.ddateStr,
detailEntity.phone,
detailEntity
.ddate_solt);
.ddate_solt,
tid: detailEntity
.tables[0].id);
break;
case 2: //短信
if (detailEntity.phone ==
... ... @@ -1412,14 +1414,14 @@ class _TitleAndTextfieldState extends State<TitleAndTextfield> {
super.initState();
// if (Platform.isIOS) {
numberFocusNode.addListener(() {
if (numberFocusNode.hasFocus) {
showOverlay(context);
} else {
_updateMoney();
removeOverlay();
}
});
numberFocusNode.addListener(() {
if (numberFocusNode.hasFocus) {
showOverlay(context);
} else {
_updateMoney();
removeOverlay();
}
});
// }
}
... ...
... ... @@ -786,6 +786,7 @@ class _EnterPageState extends State<EnterPage> {
ddate_solt,
_model.row.phone,
_model.row.ddateSolt,
tid:t.TableList.fromJson(tableinfo[0]).id,
replace: true);
} else {
Utils.showToast("录入预订订单失败,请重试!");
... ...
... ... @@ -1357,6 +1357,7 @@ class _HomeEnterPageState extends State<HomeEnterPage> {
List<dynamic> tableinfo =
convert.jsonDecode(_model.row.tableinfo);
print(tableinfo);
String _nameStr = t.TableList.fromJson(tableinfo[0]).name;
if (tableinfo.length > 1) {
_nameStr = t.TableList.fromJson(tableinfo[0]).name +
... ... @@ -1371,6 +1372,7 @@ class _HomeEnterPageState extends State<HomeEnterPage> {
ddate_solt,
_model.row.phone,
_model.row.ddateSolt,
tid: t.TableList.fromJson(tableinfo[0]).id,
replace: false);
//今天 明天 其他天
String tempTime = _homeEnterModel.ddateStr;
... ...
... ... @@ -33,9 +33,10 @@ class InvicationPage extends StatefulWidget {
final String ddateStr;
final String phone;
final String dateSolt;
final String tid;
InvicationPage(this.rid, this.tableInfo, this.ddate, this.ddateStr,
this.phone, this.dateSolt);
this.phone, this.dateSolt, this.tid);
@override
State<StatefulWidget> createState() {
... ... @@ -67,7 +68,7 @@ class InvicationPageState extends State<InvicationPage> {
couponProvider.sendSMS = false;
_getActivityByRid();
_getCustomerActivityBaseinfo();
_getSellerPhotoById();
_getTablePhoto();
});
bus.on("refresh_coupon_invitation", (args) {
_couponNetworkData(isShowLoading: false);
... ... @@ -89,12 +90,12 @@ class InvicationPageState extends State<InvicationPage> {
super.dispose();
}
_getSellerPhotoById() async {
_getTablePhoto() async {
Map<String, String> params = {
'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid,
"type": '2',
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
"tableid": widget.tid,
};
bool success = await _baseIndoProvider.getSellerPhotoById(context, params);
bool success = await _baseIndoProvider.getTablePhoto(context, params);
}
//客户经理添加/修改基本信息
... ... @@ -290,14 +291,14 @@ class InvicationPageState extends State<InvicationPage> {
}
_seePhoto() {
List<String> temp = [];
// List<String> temp = [];
if (_baseIndoProvider.photoList.length > 0) {
for (int i = 0; i < _baseIndoProvider.photoList.length; i++) {
temp.add(_baseIndoProvider.photoList[i].image);
}
// for (int i = 0; i < _baseIndoProvider.photoList.length; i++) {
// temp.add(_baseIndoProvider.photoList[i].image);
// }
///没有上传完成的不可以点击
_showPhotoView(context, 0, temp);
_showPhotoView(context, 0, _baseIndoProvider.photoList);
}
}
... ... @@ -730,37 +731,44 @@ class InvicationPageState extends State<InvicationPage> {
),
),
Positioned(
key: key,
bottom: 0,
child: _baseIndoProvider
.photoList
.length >
0
? RoundButton(
onPressed: () {
_seePhoto();
},
text: '浏览照片',
width: ScreenUtil()
.setWidth(
68 * 2),
height:
ScreenUtil()
.setWidth(
24 *
2),
fontSize: 26,
textColor: MyColours
.color_ffffff,
isBold: false,
gradientStart:
MyColours
.color_199095,
gradientEnd: MyColours
.color_199095,
)
: Container(),
)
key: key,
bottom: 0,
child: RoundButton(
onPressed: () {
_seePhoto();
},
text: '浏览照片',
width: ScreenUtil()
.setWidth(68 * 2),
height: ScreenUtil()
.setWidth(24 * 2),
fontSize: 26,
textColor: _baseIndoProvider
.photoList
.length >
0
? MyColours
.color_ffffff
: MyColours
.color_999999,
isBold: false,
gradientStart: _baseIndoProvider
.photoList
.length >
0
? MyColours
.color_199095
: MyColours
.color_E0E0E0,
gradientEnd: _baseIndoProvider
.photoList
.length >
0
? MyColours
.color_199095
: MyColours
.color_E0E0E0,
))
],
))),
],
... ...
... ... @@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/v_empty_view.dart';
... ... @@ -29,7 +30,8 @@ class NotebookItemState extends State<NoteBookItem> {
widget.notebook.ddate,
widget.notebook.ddateStr,
widget.notebook.phone,
widget.notebook.ddate_solt);
widget.notebook.ddate_solt,
tid: widget.notebook.tid.split(',')[0]);
}
}
... ...
... ... @@ -30,6 +30,7 @@ import 'package:photo_manager/photo_manager.dart';
typedef void OnPickImageCallback(
double maxWidth, double maxHeight, int quality);
typedef void DeleteCallback(int index);
class ImgPickerWidget extends StatefulWidget {
final ScrollController scrollController;
... ... @@ -38,7 +39,7 @@ class ImgPickerWidget extends StatefulWidget {
final int maxImageNumber;
final UploadImageProvider model;
final UploadType uploadType;
final VoidCallback callbackDelete;
final DeleteCallback deleteCallback;
ImgPickerWidget(
{Key key,
this.scrollController,
... ... @@ -47,7 +48,7 @@ class ImgPickerWidget extends StatefulWidget {
this.maxImageNumber = 5,
this.model,
this.uploadType,
this.callbackDelete})
this.deleteCallback})
: super(key: key);
@override
... ... @@ -368,7 +369,7 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> {
}
//查看大图
_showPhotoView(BuildContext context, int index, List imgs,
_showPhotoView(BuildContext context, int index, List<String> imgs,
{isShow = false, List dashName}) async {
// if (imgs.length == 1 &&
// imgs[0] ==
... ... @@ -538,29 +539,13 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> {
print("取消");
}, rCallback: () {
print("确定");
widget.callbackDelete();
setState(() {
temp.removeWhere((element) =>
element == temp[index]);
widget.model.imageQiniuUrlList
.removeWhere((element) =>
element ==
widget.model
.imageQiniuUrlList[
index]);
});
widget.deleteCallback(index);
});
} else {
//直接删除
setState(() {
temp.removeWhere((element) =>
element == temp[index]);
widget.model.imageQiniuUrlList
.removeWhere((element) =>
element ==
widget.model
.imageQiniuUrlList[
index]);
});
}
} else {
... ...
... ... @@ -31,9 +31,11 @@ class SelectTablePage extends StatefulWidget {
final String ddate_slot; //时段
final bool canChoose; //变更预订可以取消原来已预订的选中状态
final List<TableList> tableList;
final String fromPage;
final String tid;
SelectTablePage(this.rid, this.dateTime, this.ddate_slot,
{this.canChoose = false, this.tableList});
{this.canChoose = false, this.tableList, this.fromPage, this.tid});
@override
State<StatefulWidget> createState() {
... ... @@ -153,6 +155,10 @@ class SelectTablePageState extends State<SelectTablePage> {
for (TableOuter outer in tableOuterList) {
int count = 0;
for (t.Table table in outer.list) {
if (widget.tid != '' && table.id == widget.tid) {
table.selected = true;
currentArea = outer.name;
}
if (table.tablestatus == "0") {
//没有用餐中
if (tableMap["${table.id}"] != null) {
... ... @@ -179,11 +185,13 @@ class SelectTablePageState extends State<SelectTablePage> {
area.rid = outer.list.length == 0 ? outer.rid : outer.list[0].rid;
areas.add(area);
}
if (!needRetain) {
currentArea = areaTableMap.keys.first;
}
if (areas.length == 1) {
currentArea = areaTableMap.keys.first;
if (widget.tid == '') {
if (!needRetain) {
currentArea = areaTableMap.keys.first;
}
if (areas.length == 1) {
currentArea = areaTableMap.keys.first;
}
}
_chooseTableModel.pageState = PageState.Success;
... ... @@ -398,20 +406,36 @@ class SelectTablePageState extends State<SelectTablePage> {
} else {
return TableItem(
areaTableMap[currentArea][index],
onSelected: (table) {
if ((table as t.Table).selected) {
selectTables.add(table);
widget.tableList
.add(tableToTableList(table));
onSelected: (t.Table table) {
if (widget.fromPage == 'tablePhoto') {
for (String item
in areaTableMap.keys) {
for (t.Table item
in areaTableMap[item]) {
item.selected = false;
if (table.id == item.id) {
item.selected = true;
selectTables = [];
selectTables.add(table);
}
}
}
setState(() {});
} else {
widget.tableList.removeWhere(
(t) => t.id == table.id);
selectTables.removeWhere(
(t) => t.id == table.id);
if ((table as t.Table).selected) {
selectTables.add(table);
widget.tableList
.add(tableToTableList(table));
} else {
widget.tableList.removeWhere(
(t) => t.id == table.id);
selectTables.removeWhere(
(t) => t.id == table.id);
}
}
},
canSelected: true,
fromPage: 'change',
fromPage: widget.fromPage,
tableMap: tableMap,
rid: widget.rid);
}
... ... @@ -436,32 +460,25 @@ class SelectTablePageState extends State<SelectTablePage> {
fontSize: 34,
state: 1,
onPress: () {
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);
}
if (widget.fromPage == "tablePhoto") {
Map temp = {
'object': widget.tableList,
'tid': tid
'tid': selectTables.length > 0
? selectTables[0].id
: '',
'tname': selectTables.length > 0
? selectTables[0].name
: ''
};
Navigator.of(context).pop(temp);
// }
} else {
if (selectTables.length > 0) {
if (widget.canChoose) {
// if (widget.tableList.length > 0) {
String tid = "";
for (t.Table table
in selectTables) {
for (TableList table
in widget.tableList) {
tid += table.id + ",";
}
if (selectTables.length > 0) {
if (widget.tableList.length > 0) {
tid = tid.substring(
0, tid.length - 1);
}
... ... @@ -471,6 +488,25 @@ class SelectTablePageState extends State<SelectTablePage> {
'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);
}
}
}
},
... ...
... ... @@ -71,9 +71,24 @@ class TableManagerPageState extends State<TableManagerPage> {
tableManagerModel.getReserveList(context);
print(tableManagerModel);
});
EventBus().on("refresh_tablePhoto", (arg) {
//订座-完成预订 刷新管理桌位
_refreshTablePhoto();
});
});
}
///刷新图片显示
_refreshTablePhoto() async {
List temp =
await tableManagerModel.getTableList(context, needLoading: false);
if (temp.length > 0) {
tableManagerModel.getReserveList(context,
needLoading: false, needKeep: true);
tableManagerModel.notifyListeners();
}
}
Widget list(List data) => ScrollablePositionedList.builder(
itemCount: data.length,
itemBuilder: (context, index) => item(index),
... ... @@ -598,5 +613,6 @@ class TableManagerPageState extends State<TableManagerPage> {
// TODO: implement dispose
super.dispose();
EventBus().off("refresh_tablemanager");
EventBus().off("refresh_tablePhoto");
}
}
... ...
... ... @@ -5,11 +5,12 @@ import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/models/table_photo_model.dart';
import 'package:one_key/models/upload_img_model.dart';
import 'package:one_key/pages/online_check/img_picker_widget.dart';
import 'package:one_key/provider/table_photo_anager_provider.dart';
import 'package:one_key/provider/table_photo_manager_provider.dart';
import 'package:one_key/provider/upload_img_provider.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/event_bus.dart';
import 'package:one_key/utils/upload_image_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/round_button.dart';
... ... @@ -30,13 +31,19 @@ class _TablePhotoManagerPageState extends State<TablePhotoManagerPage> {
ScrollController _controller = ScrollController();
UploadImageProvider _uploadImageProvider;
TablePhotoManagerModel _tablePhotoManagerModel;
String tname;
String tid;
@override
void initState() {
super.initState();
tid = widget.tid;
tname = widget.tname;
WidgetsBinding.instance.addPostFrameCallback((_) {
_getTablePhoto(context);
_getQiniuInfo();
Future.delayed(const Duration(milliseconds: 200), () {
_getTablePhoto(context, widget.tid);
});
});
}
... ... @@ -51,7 +58,7 @@ class _TablePhotoManagerPageState extends State<TablePhotoManagerPage> {
_setTablePhoto(BuildContext context, List tablePhoto) async {
Map<String, String> params = {
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
"tableid": widget.tid,
"tableid": tid,
"photoList": jsonEncode(tablePhoto)
};
print(_uploadImageProvider.tableImageList);
... ... @@ -76,13 +83,15 @@ class _TablePhotoManagerPageState extends State<TablePhotoManagerPage> {
}
///获取桌位图片
_getTablePhoto(BuildContext context) async {
_getTablePhoto(BuildContext context, String tid,
{bool showLoading = false}) async {
Map<String, String> params = {
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
"tableid": widget.tid,
"tableid": tid,
};
List<TablePhotoSunModel> tablePhotoList =
await _tablePhotoManagerModel.getTablePhoto(context, params);
_uploadImageProvider.tableImageList = [];
List<TablePhotoSunModel> tablePhotoList = await _tablePhotoManagerModel
.getTablePhoto(context, params, isShowLoading: showLoading);
if (tablePhotoList.length > 0) {
print(_uploadImageProvider.tableImageList);
for (int i = 0; i < tablePhotoList.length; i++) {
... ... @@ -93,6 +102,25 @@ class _TablePhotoManagerPageState extends State<TablePhotoManagerPage> {
model.process = 1;
_uploadImageProvider.tableImageList.add(model);
}
}
_uploadImageProvider.notifyListeners();
}
///删除桌子图片
///
_delTablePhoto(BuildContext context, String photoIds, int index) async {
Map<String, String> params = {
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
"photoIds": photoIds
};
print(_uploadImageProvider.tableImageList);
bool success = await _tablePhotoManagerModel.delTablePhoto(context, params,
isShowLoading: true);
if (success) {
print('删除成功');
//调用删除桌子图片接口
_uploadImageProvider.tableImageList.removeWhere(
(element) => element == _uploadImageProvider.tableImageList[index]);
_uploadImageProvider.notifyListeners();
}
}
... ... @@ -115,92 +143,126 @@ class _TablePhotoManagerPageState extends State<TablePhotoManagerPage> {
appBar: SystemAppBar(
'照片管理',
onTap: () {
bus.emit('refresh_tablePhoto');
Navigator.pop(context);
},
),
body: InkWell(
onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
body: WillPopScope(
onWillPop: () {
bus.emit('refresh_tablePhoto');
Navigator.of(context).pop();
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: Column(children: [
Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color: MyColours.color_f5f5f5))),
height: ScreenUtil().setWidth(100),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('当前桌位:${widget.tname}',
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(32),
fontWeight: FontWeight.bold)),
Text('切换桌位',
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(32))),
],
)),
Expanded(
child: SingleChildScrollView(
controller: _controller,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
VEmptyView(60),
Consumer<UploadImageProvider>(
builder: (context, model, _) {
return ImgPickerWidget(
scrollController: _controller,
model: model,
maxImageNumber: 5,
uploadType: UploadType.TableManagerType,
callbackDelete: () {
//调用删除桌子图片接口
},
);
}),
]))),
RoundButton(
text: '确定上传',
gradientStart: MyColours.color_199095,
gradientEnd: MyColours.color_199095,
// borderColor: MyColours.color_999999,
radius: ScreenUtil().setWidth(10),
fontSize: 34,
height: ScreenUtil().setWidth(80),
isBold: false,
onPressed: () {
for (UploadImgModel item
in _uploadImageProvider.tableImageList) {
if (item.process < 1) {
Utils.showToast('正在上传图片,请稍等');
return;
}
}
//接口,和桌子绑定
List imageQiniuUrlList = [];
for (int i = 0;
i < _uploadImageProvider.tableImageList.length;
i++) {
if (!_uploadImageProvider.tableImageList[i].isUpload) {
imageQiniuUrlList.add({
"url":
_uploadImageProvider.tableImageList[i].qiniuUrl
});
}
}
_setTablePhoto(context, imageQiniuUrlList);
},
)
]))));
child: InkWell(
onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: Column(children: [
Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color: MyColours.color_f5f5f5))),
height: ScreenUtil().setWidth(100),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('当前桌位:${tname}',
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(32),
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);
}
},
child: Text('切换桌位',
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(32)))),
],
)),
Expanded(
child: SingleChildScrollView(
controller: _controller,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
VEmptyView(60),
Consumer<UploadImageProvider>(
builder: (context, model, _) {
return ImgPickerWidget(
scrollController: _controller,
model: model,
maxImageNumber: 5,
uploadType: UploadType.TableManagerType,
deleteCallback: (int index) {
_delTablePhoto(
context,
_uploadImageProvider
.tableImageList[index]
.photoID,
index);
},
);
}),
]))),
RoundButton(
text: '确定上传',
gradientStart: MyColours.color_199095,
gradientEnd: MyColours.color_199095,
// borderColor: MyColours.color_999999,
radius: ScreenUtil().setWidth(10),
fontSize: 34,
height: ScreenUtil().setWidth(80),
isBold: false,
onPressed: () {
for (UploadImgModel item
in _uploadImageProvider.tableImageList) {
if (item.process < 1) {
Utils.showToast('正在上传图片,请稍等');
return;
}
}
//接口,和桌子绑定
List imageQiniuUrlList = [];
for (int i = 0;
i < _uploadImageProvider.tableImageList.length;
i++) {
if (!_uploadImageProvider
.tableImageList[i].isUpload) {
imageQiniuUrlList.add({
"url": _uploadImageProvider
.tableImageList[i].qiniuUrl
});
}
}
_setTablePhoto(context, imageQiniuUrlList);
},
)
])))));
}
}
... ...
... ... @@ -3,6 +3,7 @@ import 'package:one_key/constant/constant.dart';
import 'package:one_key/constant/error.dart';
import 'package:one_key/models/base_info_model.dart';
import 'package:one_key/models/seller_phone_model.dart';
import 'package:one_key/models/table_photo_model.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
... ... @@ -12,7 +13,7 @@ import 'package:provider/provider.dart';
class BaseIndoProvider with ChangeNotifier {
BaseInfoSunModel baseInfoSunModel; //客户经理基础信息
List<SellerPhoneSunModel> photoList = []; //商家图片信息
List<String> photoList = []; //商家图片信息
///客户经理添加/修改基本信息
Future<dynamic> setCustomerActivityBaseinfo(
... ... @@ -83,35 +84,64 @@ class BaseIndoProvider with ChangeNotifier {
}
}
///根据商家ID获取对应类型图片
Future<bool> getSellerPhotoById(
// ///根据商家ID获取对应类型图片
// Future<bool> getSellerPhotoById(
// BuildContext context, Map<String, String> params,
// {isShowLoading = true}) async {
// BaseResp<dynamic> baseResp = await DioUtil()
// .request<dynamic>(context, Method.get, HttpUrl.get_seller_photo_by_id,
// data: params, showLoading: isShowLoading)
// .catchError((error) {
// print(error.toString());
// if (error is MyError) {}
// });
// if (baseResp.code == Constant.status_success) {
// if (baseResp.data == null || baseResp.data == false) {
// return false;
// } else {
// photoList = SellerPhoneModel.fromJson(baseResp.responseData).data;
// // for (int i = 0; i < couponListSelect.length; i++) {
// // coupons.add(couponListSelect[i].id);
// // // couponsShow.add(couponTemp[i].id);
// // }
// // hasModify = true;
// notifyListeners();
// return true;
// }
// } else {
// if (baseResp != null) {
// Utils.showToast(baseResp.msg ?? "");
// }
// return false;
// }
// }
///App获取桌位关联图片
Future<dynamic> getTablePhoto(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.get_seller_photo_by_id,
.request<dynamic>(context, Method.get, HttpUrl.get_table_photo,
data: params, showLoading: isShowLoading)
.catchError((error) {
print(error.toString());
if (error is MyError) {}
});
if (baseResp.code == Constant.status_success) {
if (baseResp.data == null || baseResp.data == false) {
return false;
if (baseResp.data == null) {
} else {
photoList = SellerPhoneModel.fromJson(baseResp.responseData).data;
// for (int i = 0; i < couponListSelect.length; i++) {
// coupons.add(couponListSelect[i].id);
// // couponsShow.add(couponTemp[i].id);
// }
// hasModify = true;
List<TablePhotoSunModel> tablePhotoList =
TablePhotoModel.fromJson(baseResp.responseData).data;
for (int i = 0; i < tablePhotoList.length; i++) {
photoList.add(tablePhotoList[i].url);
}
notifyListeners();
return true;
}
} else {
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
return false;
return [];
}
}
}
... ...
... ... @@ -313,7 +313,8 @@ class TableManagerModel with ChangeNotifier {
}
//获取已预订列表
getReserveList(BuildContext context, {bool needLoading = true}) async {
getReserveList(BuildContext context,
{bool needLoading = true, bool needKeep = false}) async {
tableMap.clear();
NoteBookModel model = new NoteBookModel();
Map<String, String> params = {
... ... @@ -325,7 +326,7 @@ class TableManagerModel with ChangeNotifier {
"keywords": "",
"sort": "1"
};
if (needLoading) {
if ( needLoading) {
pageState = PageState.Loading;
notifyListeners();
}
... ... @@ -344,7 +345,7 @@ class TableManagerModel with ChangeNotifier {
}
}
print(tableMap);
initData();
initData(needKeep: needKeep);
}
//获取已预订订单
... ... @@ -405,7 +406,7 @@ class TableManagerModel with ChangeNotifier {
}
//初始桌位数据
initData() {
initData({bool needKeep = false}) {
areas.clear();
areaTableMap.clear();
for (TableOuter outer in tableOuterList) {
... ... @@ -442,9 +443,11 @@ class TableManagerModel with ChangeNotifier {
areas.add(area);
}
if (areaTableMap.isNotEmpty) {
currentArea = areaTableMap.keys.first;
currentTables = areaTableMap[currentArea];
pageState = PageState.Success;
if (!needKeep) {
currentArea = areaTableMap.keys.first;
currentTables = areaTableMap[currentArea];
pageState = PageState.Success;
}
} else {
// pageState = PageState.Empty;
pageState = PageState.Success;
... ...
... ... @@ -60,4 +60,32 @@ class TablePhotoManagerModel with ChangeNotifier {
return [];
}
}
///App删除桌位关联图片
Future<dynamic> delTablePhoto(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.del_table_photo,
data: params, showLoading: isShowLoading)
.catchError((error) {
print(error.toString());
if (error is MyError) {}
return false;
});
if (baseResp.code == Constant.status_success) {
if (baseResp.data != null) {
Utils.showToast("删除桌位图片成功!");
return true;
} else {
Utils.showToast(baseResp.msg ?? "删除失败");
return false;
}
} else {
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "删除失败");
}
return false;
}
}
}
... ...
... ... @@ -13,7 +13,7 @@ import 'package:one_key/utils/utils.dart';
class UploadImageProvider extends ChangeNotifier {
List<UploadImgModel> imageList = []; //图片信息列表
List<dynamic> imageQiniuUrlList = []; //七牛云地址列表
List<String> imageQiniuUrlList = []; //七牛云地址列表
QiniuInfoSunModel qiniuInfoSunModel;
UploadImgModel touxiang = UploadImgModel(); //头像
UploadImgModel erweima = UploadImgModel(); //二维码
... ...
... ... @@ -59,14 +59,17 @@ class NavigatorUtil {
/// 选择桌位
static Future goSelectTablePage(
BuildContext context, String rid, int dateTime, String ddate_slot,
{bool canChoose = false, Map object}) {
{bool canChoose = false,
Map object,
String fromPage = 'change',
String tid = ''}) {
if (object != null) {
return _navigateTo(context,
"${Routes.select_table}?rid=$rid&dateTime=$dateTime&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}");
"${Routes.select_table}?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.select_table}?rid=$rid&dateTime=$dateTime&ddate_slot=$ddate_slot&canChoose=$canChoose");
"${Routes.select_table}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose");
}
/// 邀请函
... ... @@ -78,9 +81,10 @@ class NavigatorUtil {
String ddateStr,
String phone,
String ddate_solt,
{bool replace = false}) {
{bool replace = false,
String tid}) {
_navigateTo(context,
"${Routes.invication}?rid=$rid&tableInfo=${FluroConvertUtils.fluroCnParamsEncode(tableInfo)}&ddate=$ddate&ddateStr=${FluroConvertUtils.fluroCnParamsEncode(ddateStr)}&phone=$phone&ddate_solt=$ddate_solt",
"${Routes.invication}?rid=$rid&tid=$tid&tableInfo=${FluroConvertUtils.fluroCnParamsEncode(tableInfo)}&ddate=$ddate&ddateStr=${FluroConvertUtils.fluroCnParamsEncode(ddateStr)}&phone=$phone&ddate_solt=$ddate_solt",
replace: replace);
}
... ...
... ... @@ -56,7 +56,7 @@ import 'package:one_key/provider/notebook_detail_model.dart';
import 'package:one_key/provider/order_food_provider.dart';
import 'package:one_key/provider/other_login_provider.dart';
import 'package:one_key/provider/remark_manager_model.dart';
import 'package:one_key/provider/table_photo_anager_provider.dart';
import 'package:one_key/provider/table_photo_manager_provider.dart';
import 'package:one_key/provider/upload_img_provider.dart';
import 'package:one_key/utils/fluro_convert_utils.dart';
import 'package:provider/provider.dart';
... ... @@ -110,9 +110,11 @@ var handleOnlineHandler = new Handler(
var handleSelectTableHandler = 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')) {
... ... @@ -128,7 +130,7 @@ var handleSelectTableHandler = new Handler(
return ChangeNotifierProvider<ChooseTableModel>(
create: (_) => ChooseTableModel(),
child: SelectTablePage(rid, dateTime, ddate_slot,
canChoose: canChoose, tableList: res));
canChoose: canChoose, tableList: res, fromPage: fromPage, tid: tid));
});
// 跳转到邀请函页面
... ... @@ -142,10 +144,11 @@ var handleInvicationHandler = new Handler(
FluroConvertUtils.fluroCnParamsDecode(params["ddateStr"].first);
String phone = params["phone"].first;
String ddate_solt = params["ddate_solt"].first;
String tid = params["tid"].first;
return ChangeNotifierProvider<BaseIndoProvider>(
create: (_) => BaseIndoProvider(),
child:
InvicationPage(rid, tableInfo, ddate, ddateStr, phone, ddate_solt));
InvicationPage(rid, tableInfo, ddate, ddateStr, phone, ddate_solt,tid));
});
// 发短信
... ...
... ... @@ -9,7 +9,7 @@ import 'package:one_key/widgets/v_empty_view.dart';
class TableItem extends StatefulWidget {
final t.Table table;
final bool canSelected; //是否能选中
final ValueChanged onSelected;
final ValueChanged<t.Table> onSelected;
final String fromPage; // 变更、新建、桌位管理三个页面
final String rid;
final Map<String, Notebook> tableMap; //记录已预订桌位对应的订单
... ... @@ -82,6 +82,12 @@ class TableItemState extends State<TableItem> {
} else if (widget.fromPage == 'table_manage') {
table.selected = !(table.selected ?? false);
widget.onSelected(table);
} else if (widget.fromPage == 'tablePhoto') {
// setState(() {
// table.selected = true;
// });
widget.onSelected(table);
}
},
child: Stack(
... ...