Commit 5c747542be686d4033eba348578c57154b8c0854

Authored by wdn127929
1 parent 71d1edab

意向and选台(添加桌位----不带餐页面)

class DsoltXt {
String id;
String title = '请选择';
}
... ...
... ... @@ -28,29 +28,26 @@ class GetStaffModel {
}
class GetStaffSunModel {
String id;
String sid;
String userId;
Null status;
Null cdate;
String nickName;
String account;
GetStaffSunModel({this.id, this.sid, this.userId, this.status, this.cdate});
GetStaffSunModel({this.sid, this.userId, this.nickName, this.account});
GetStaffSunModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
sid = json['sid'];
userId = json['user_id'];
status = json['status'];
cdate = json['cdate'];
nickName = json['nick_name'];
account = json['account'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['sid'] = this.sid;
data['user_id'] = this.userId;
data['status'] = this.status;
data['cdate'] = this.cdate;
data['nick_name'] = this.nickName;
data['account'] = this.account;
return data;
}
}
... ...
import 'package:one_key/models/dsolt_xt.dart';
import 'package:one_key/models/table_list.dart' as t;
class SetXuanTaiModel {
String rid;
String reserveOrder;
String ddateInterval;
String rdate;
List<Tids> tids;
List<Setmeal> setmeal;
List<Wine> wine;
List<Other> other;
String remark;
List<Images> images;
String dateTimeShowxt = '请选择'; //宴会日期显示 选台 2022-08-02(周二 七月十五)
DateTime dateTimext = DateTime.now(); //宴会日期
String cdShow = '请选择';
int cdSelIndex;
String qsDateShow = '暂未选择'; //起始时间
String startDate = '';
String endDate = '';
List<t.TableList> tableList;
SetXuanTaiModel(
{this.rid,
this.reserveOrder,
this.ddateInterval,
this.rdate,
this.tids,
this.setmeal,
this.wine,
this.other,
this.remark,
this.images});
SetXuanTaiModel.fromJson(Map<String, dynamic> json) {
rid = json['rid'];
reserveOrder = json['reserve_order'];
ddateInterval = json['ddate_interval'];
rdate = json['rdate'];
if (json['tids'] = null) {
tids = <Tids>[];
json['tids'].forEach((v) {
tids.add(new Tids.fromJson(v));
});
}
if (json['setmeal'] = null) {
setmeal = <Setmeal>[];
json['setmeal'].forEach((v) {
setmeal.add(new Setmeal.fromJson(v));
});
}
if (json['wine'] = null) {
wine = <Wine>[];
json['wine'].forEach((v) {
wine.add(new Wine.fromJson(v));
});
}
if (json['other'] = null) {
other = <Other>[];
json['other'].forEach((v) {
other.add(new Other.fromJson(v));
});
}
remark = json['remark'];
if (json['images'] = null) {
images = <Images>[];
json['images'].forEach((v) {
images.add(new Images.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['rid'] = this.rid;
data['reserve_order'] = this.reserveOrder;
data['ddate_interval'] = this.ddateInterval;
data['rdate'] = this.rdate;
if (this.tids = null) {
data['tids'] = this.tids.map((v) => v.toJson()).toList();
}
if (this.setmeal = null) {
data['setmeal'] = this.setmeal.map((v) => v.toJson()).toList();
}
if (this.wine = null) {
data['wine'] = this.wine.map((v) => v.toJson()).toList();
}
if (this.other = null) {
data['other'] = this.other.map((v) => v.toJson()).toList();
}
data['remark'] = this.remark;
if (this.images = null) {
data['images'] = this.images.map((v) => v.toJson()).toList();
}
return data;
}
}
class Tids {
String tid;
String numStr;
String name;
Tids({this.tid, this.numStr, this.name});
Tids.fromJson(Map<String, dynamic> json) {
tid = json['tid'];
numStr = json['num'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['tid'] = this.tid;
data['num'] = this.numStr;
return data;
}
}
class Setmeal {
String setmealId;
String price;
String finalPrice;
String pnum;
String min;
String spare;
Setmeal(
{this.setmealId,
this.price,
this.finalPrice,
this.pnum,
this.min,
this.spare});
Setmeal.fromJson(Map<String, dynamic> json) {
setmealId = json['setmeal_id'];
price = json['price'];
finalPrice = json['final_price'];
pnum = json['pnum'];
min = json['min'];
spare = json['spare'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['setmeal_id'] = this.setmealId;
data['price'] = this.price;
data['final_price'] = this.finalPrice;
data['pnum'] = this.pnum;
data['min'] = this.min;
data['spare'] = this.spare;
return data;
}
}
class Wine {
String wineId;
String price;
String finalPrice;
String num;
Wine({this.wineId, this.price, this.finalPrice, this.num});
Wine.fromJson(Map<String, dynamic> json) {
wineId = json['wine_id'];
price = json['price'];
finalPrice = json['final_price'];
num = json['num'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['wine_id'] = this.wineId;
data['price'] = this.price;
data['final_price'] = this.finalPrice;
data['num'] = this.num;
return data;
}
}
class Other {
String otherId;
String price;
String finalPrice;
String num;
Other({this.otherId, this.price, this.finalPrice, this.num});
Other.fromJson(Map<String, dynamic> json) {
otherId = json['other_id'];
price = json['price'];
finalPrice = json['final_price'];
num = json['num'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['other_id'] = this.otherId;
data['price'] = this.price;
data['final_price'] = this.finalPrice;
data['num'] = this.num;
return data;
}
}
class Images {
String url;
Images({this.url});
Images.fromJson(Map<String, dynamic> json) {
url = json['url'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['url'] = this.url;
return data;
}
}
... ...
... ... @@ -292,4 +292,8 @@ class HttpUrl {
static const String del_deposit = "?service=App.Banquet.DelDeposit"; // 删除宴会定金
static const String create_banquet =
"?service=App.Banquet.CreateBanquet"; //创建意向
static const String set_banquet_info =
"?service=App.Banquet.SetBanquetInfo"; //设置选台信息
}
... ...
import 'dart:convert';
import 'dart:ui';
... ... @@ -2507,3 +2509,4 @@ Widget remarkButton({GestureTapCallback onPress, content, isSelect = false}) {
),
);
}
... ...
import 'dart:convert';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/gestures.dart';
... ... @@ -10,11 +12,15 @@ import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../models/dsolt_xt.dart';
import '../../models/feast_menu_model.dart';
import '../../models/set_xuan_tai_model.dart';
import '../../models/upload_img_model.dart';
import '../../provider/feast_model.dart';
import '../../provider/upload_img_provider.dart';
import '../../provider/user_model.dart';
import '../../res/colors.dart';
import '../../utils/ConvertNumberToChineseMoneyWords.dart';
import '../../utils/dialog_util.dart';
import '../../utils/screen_util.dart';
import '../../utils/upload_image_util.dart';
... ... @@ -24,6 +30,7 @@ import '../../widgets/set_time_widget.dart';
import '../../widgets/system_app_bar.dart';
import '../online_check/img_picker_widget_f.dart';
import '../table/area_item_table.dart';
import 'package:one_key/models/table_list.dart' as t;
class FeastCreatePage extends StatefulWidget {
FeastCreatePage({Key key}) : super(key: key);
... ... @@ -60,39 +67,89 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
String selectMenu = '意向'; //当前选中的菜单名称
Set<String> menuSet = {}; //已经保存的菜单名称
String cdShow = '请选择'; //餐段显示
String qsDateShow = '请选择'; //起始时间
String startDate = '';
String endDate = '';
String dateTimeShowxt = '请选择'; //宴会日期显示 选台 2022-08-02(周二 七月十五)
DateTime dateTimext; //宴会日期
ScrollController controller = ScrollController();
String djDBR = '请选择'; //定金担保人
UploadImageProvider _uploadImageProvider;
List<SetXuanTaiModel> xuantaiData = [];
int xuantaiSelIndex = 0;
List<DsoltXt> dsoltList = [];
@override
void initState() {
// TODO: implement initState
super.initState();
dateTime = DateTime.now();
dateTimext = DateTime.now();
Utils.changeStatusColor(color: MyColours.color_438E93);
initSexList();
xuantaiData.add(initSetXuanTaiModel());
initTime(context);
WidgetsBinding.instance.addPostFrameCallback((_) {
_getSellerUserBySellerid();
_getStaff();
_getClassify();
// scrollController.jumpTo(scrollController.position.minScrollExtent);
});
}
///商家编辑页面 ----- 获取经理数据
initSetXuanTaiModel() {
SetXuanTaiModel setXuanTaiModel = SetXuanTaiModel();
setXuanTaiModel.dateTimeShowxt = '请选择';
setXuanTaiModel.cdShow = '请选择';
setXuanTaiModel.qsDateShow = '暂未选择'; //起始时间
setXuanTaiModel.images = [];
setXuanTaiModel.other = [];
setXuanTaiModel.setmeal = [];
setXuanTaiModel.tids = [];
setXuanTaiModel.wine = [];
return setXuanTaiModel;
}
dsoltModel(String id, String title) {
DsoltXt dsoltXt = DsoltXt();
dsoltXt.id = id;
dsoltXt.title = title;
return dsoltXt;
}
//初始化餐段
initTime(BuildContext context) async {
dsoltList = [];
dsoltList.add(dsoltModel('0', '不带餐'));
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;
if (morning != "00:00-00:00") {
dsoltList.add(dsoltModel('1', '早餐'));
}
if (noon != "00:00-00:00") {
dsoltList.add(dsoltModel('2', '午餐'));
}
if (night != "00:00-00:00") {
dsoltList.add(dsoltModel('3', '晚餐'));
}
}
///获取经理数据 ---- 接单人---全部员工
_getSellerUserBySellerid() async {
await feastModel.getAuthUserLists(context);
}
///跟单人---宴会员工
_getStaff() async {
await feastModel.getStaff(context);
}
// for (int i = 0; i < feastModel.sellerManageList.length; i++) {
// if (manageShow == feastModel.sellerManageList[i].title) {
// customerProvider.manageSelIndex = i;
// }
// }
///获取宴会分类
Future<bool> _getClassify({bool isShowLoading = true}) async {
await feastModel.getClassify(context, isShowLoading: isShowLoading);
}
///称谓
... ... @@ -232,7 +289,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
labelShow,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: labelShow == '请选择'
color: labelShow == '请选择' || labelShow == '暂未选择'
? MyColours.color_999999
: MyColours.color_515151,
fontSize: ScreenUtil().setSp(28),
... ... @@ -494,6 +551,70 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
return ymd;
}
Future<bool> yxSave() async {
if (dateTimeShow == '请选择') {
Utils.showToast('请选择宴会日期');
return false;
}
if (jdShow == '请选择') {
Utils.showToast('请选择接单人');
return false;
}
if (gdShow == '请选择') {
Utils.showToast('请选择跟单人');
return false;
}
if (feastTypeShow == '请选择') {
Utils.showToast('请选择宴会类型');
return false;
}
if (nameC.text.trim().length == 0) {
Utils.showToast('请输入预订人');
return false;
}
if (phoneC.text.trim().length == 0) {
Utils.showToast('请输入电话');
return false;
}
for (UploadImgModel item in _uploadImageProvider.feastRemarkImageList) {
if (item.process < 1) {
Utils.showToast('正在上传图片,请稍等');
return false;
}
}
List imageQiniuUrlList = []; //接口图片数据list
for (int i = 0; i < _uploadImageProvider.feastRemarkImageList.length; i++) {
imageQiniuUrlList
.add({"url": _uploadImageProvider.feastRemarkImageList[i].qiniuUrl});
}
String ddate = (dateTime.millisecondsSinceEpoch / 1000).floor().toString();
Map<String, String> pramas = {
'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
'ddate': ddate,
'jiedan_id': feastModel.sellerManageList[jdSelIndex].id,
'staff_id': feastModel.personnalList[gdSelIndex].id,
'classify_id': feastModel.classifyData[feastTypeSelIndex].id,
'phone': phoneC.text,
'rname': nameC.text,
'sex': sexList[sexSelectIndex]['code'],
};
if (customC.text.trim().length > 0) {
pramas['remark'] = customC.text; //备注
}
if (imageQiniuUrlList.length > 0) {
pramas['images'] = json.encode(imageQiniuUrlList); //备注图片
}
bool success = await feastModel.createBanquet(context, pramas);
if (success) {
Utils.showToast('保存成功');
return true;
} else {
return false;
}
}
///意向
Widget yxWidget() {
return Column(
... ... @@ -537,13 +658,13 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
DialogUtil.showSelectCusmanDialog(
context,
feastModel.sellerManageList.map((item) {
feastModel.personnalList.map((item) {
return item.title;
}).toList(), (value) {
if (value != null) {
setState(() {
gdSelIndex = value.first;
gdShow = feastModel.sellerManageList[gdSelIndex].title;
gdShow = feastModel.personnalList[gdSelIndex].title;
});
}
},
... ... @@ -556,14 +677,14 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
DialogUtil.showSelectCusmanDialog(
context,
feastModel.sellerManageList.map((item) {
return item.title;
feastModel.classifyData.map((item) {
return item.className;
}).toList(), (value) {
if (value != null) {
setState(() {
feastTypeSelIndex = value.first;
feastTypeShow =
feastModel.sellerManageList[feastTypeSelIndex].title;
feastModel.classifyData[feastTypeSelIndex].className;
});
}
},
... ... @@ -602,33 +723,22 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
children: [
Expanded(
child: _callButton(
onPress: () {
Map<String, String> pramas = {
'sid': Provider.of<UserModel>(context, listen: false)
.user
.sellerid,
'ddate': '',
'jiedan_id': '',
'staff_id': '',
'classify_id': '',
'rname': '',
'sex': '',
'phone': '',
'remark': '',
'images': ''
};
feastModel.createBanquet(context, pramas);
onPress: () async {
yxSave();
},
content: '仅保存',
hasLeftBorder: true,
isSelect: false)),
Expanded(
child: _callButton(
onPress: () {
onPress: () async {
// bool success = await yxSave();
// if (success) {
selectMenu = '选台';
menuSet.add('意向');
menuSet.add('选台');
setState(() {});
// }
},
content: '保存并下一步',
hasLeftBorder: true,
... ... @@ -656,12 +766,13 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
Container(
height: h(33),
child: ListView.builder(
padding: EdgeInsets.only(left: w(21)),
itemCount: 2,
padding: EdgeInsets.only(left: w(21), right: w(9)),
itemCount: xuantaiData.length + 1,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemBuilder: (BuildContext contxt, int index) {
if (index == 1) {
if (index == xuantaiData.length ||
xuantaiData.length == 0) {
return InkWell(
onTap: () async {
// //添加区域弹框
... ... @@ -685,11 +796,15 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
// }
// });
xuantaiSelIndex = index;
xuantaiData.add(initSetXuanTaiModel());
setState(() {});
},
child: DottedBorder(
dashPattern: [2, 2, 2, 2],
borderType: BorderType.RRect,
radius: Radius.circular(r(6)),
// padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
color: MyColours.color_199095,
strokeWidth: ScreenUtil().setWidth(2),
... ... @@ -718,80 +833,127 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
),
));
} else {
return Container(
height: h(33),
width: w(70),
// padding: EdgeInsets.symmetric(
// horizontal: w(8),
// ),
margin: EdgeInsets.only(right: w(8)),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(r(6)),
color: true
? MyColours.color_438E93
: MyColours.color_ffffff),
child: Text(
'第一场',
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: true
? MyColours.color_F6F6F6
: MyColours.color_999999,
fontSize: font(18),
fontWeight: FontWeight.bold),
),
);
String numStr =
ConvertNumberToChineseMoneyWords.toChinese(
index);
return InkWell(
onTap: () {
setState(() {
xuantaiSelIndex = index;
});
},
child: Container(
height: h(33),
width: w(70),
// padding: EdgeInsets.symmetric(
// horizontal: w(8),
// ),
margin: EdgeInsets.only(right: w(8)),
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(
width: w(1),
color: MyColours.color_438E93),
borderRadius:
BorderRadius.circular(r(6)),
color: xuantaiSelIndex == index
? MyColours.color_438E93
: MyColours.color_ffffff),
child: Text(
'第${numStr}场',
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: xuantaiSelIndex == index
? MyColours.color_F6F6F6
: MyColours.color_999999,
fontSize: font(18),
fontWeight: FontWeight.bold),
),
));
}
},
)),
VEmptyView(26),
_selectWidget('宴会日期', dateTimeShowxt, onTap: () {
xuantaiData.length > 1
? Center(
child: RoundButton(
margin: EdgeInsets.only(top: w(24)),
text: '删除该场次',
radius: r(5),
width: w(106),
height: h(33),
fontSize: 36,
textColor: MyColours.color_F6F6F6,
isBold: true,
gradientStart: MyColours.color_E34D59,
gradientEnd: MyColours.color_E34D59,
onPressed: () async {
xuantaiData.removeAt(xuantaiSelIndex);
xuantaiSelIndex--;
setState(() {});
}))
: SizedBox(),
VEmptyView(36),
_selectWidget(
'宴会日期', xuantaiData[xuantaiSelIndex].dateTimeShowxt,
onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
DialogUtil.showCalendarDialog(context, dateTimext)
DialogUtil.showCalendarDialog(context,
xuantaiData[xuantaiSelIndex].dateTimext)
.then((day) async {
if (day != null) {
dateTimext = day;
dateTimeShowxt = createDateText(context, day);
xuantaiData[xuantaiSelIndex].dateTimext = day;
xuantaiData[xuantaiSelIndex].dateTimeShowxt =
createDateText(context, day);
setState(() {});
}
});
}),
_selectWidget('餐段选择', cdShow, onTap: () {
_selectWidget('餐段选择', xuantaiData[xuantaiSelIndex].cdShow,
onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
DialogUtil.showSelectCusmanDialog(
context,
feastModel.sellerManageList.map((item) {
dsoltList.map((item) {
return item.title;
}).toList(), (value) {
if (value != null) {
setState(() {
jdSelIndex = value.first;
jdShow =
feastModel.sellerManageList[jdSelIndex].title;
xuantaiData[xuantaiSelIndex].cdSelIndex =
value.first;
xuantaiData[xuantaiSelIndex].cdShow = dsoltList[
xuantaiData[xuantaiSelIndex].cdSelIndex]
.title;
});
}
},
cancelText: '',
title: '选择餐段',
selecteds:
jdSelIndex == null ? [] : [jdSelIndex])
selecteds: xuantaiData[xuantaiSelIndex]
.cdSelIndex ==
null
? []
: [xuantaiData[xuantaiSelIndex].cdSelIndex])
.then((value) {});
}),
_selectWidget('起始时间', qsDateShow, need: false, onTap: () {
_selectWidget(
'起始时间', xuantaiData[xuantaiSelIndex].qsDateShow,
need: false, onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
SetTimeWidget.init.showFeastTimeSelector(
context,
SetTimeWidget.init.getFeastDateData('00:00-23:30'),
startDate,
endDate, (value) {
xuantaiData[xuantaiSelIndex].startDate,
xuantaiData[xuantaiSelIndex].endDate, (value) {
if (value != null) {
startDate =
xuantaiData[xuantaiSelIndex].startDate =
SetTimeWidget.init.getSelectTitle(value[0]);
endDate =
xuantaiData[xuantaiSelIndex].endDate =
SetTimeWidget.init.getSelectTitle(value[1]);
qsDateShow = startDate + '-' + endDate;
xuantaiData[xuantaiSelIndex].qsDateShow =
xuantaiData[xuantaiSelIndex].startDate +
'-' +
xuantaiData[xuantaiSelIndex].endDate;
setState(() {});
}
});
... ... @@ -852,7 +1014,8 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
],
)),
ListView.builder(
itemCount: 2,
itemCount:
xuantaiData[xuantaiSelIndex].tids.length,
shrinkWrap: true,
controller: controller,
itemBuilder:
... ... @@ -871,7 +1034,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
children: [
Expanded(
child: Text(
'包间$index',
xuantaiData[xuantaiSelIndex]
.tids[index]
.name,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_438E93,
... ... @@ -913,6 +1078,102 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
isBold: false,
gradientStart: MyColours.color_438E93,
gradientEnd: MyColours.color_438E93,
onPressed: () async {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
if (xuantaiData[xuantaiSelIndex].cdShow ==
'不带餐') {
Map temp = {};
if (xuantaiData[xuantaiSelIndex]
.tableList !=
null &&
xuantaiData[xuantaiSelIndex]
.tableList
.length >
0) {
temp = await NavigatorUtil
.goFeastSelectTablePage(context,
object: {
'object':
xuantaiData[xuantaiSelIndex]
.tableList
});
} else {
temp = await NavigatorUtil
.goFeastSelectTablePage(
context,
);
}
if (temp == null) {
} else if (temp['object'].length == 0) {
} else {
xuantaiData[xuantaiSelIndex].tids = [];
xuantaiData[xuantaiSelIndex].tableList =
temp['object'];
for (t.TableList item
in xuantaiData[xuantaiSelIndex]
.tableList) {
item.selected = true;
Tids tids = Tids();
tids.tid = item.tid;
tids.name = item.name;
xuantaiData[xuantaiSelIndex]
.tids
.add(tids);
}
setState(() {});
}
} else {
//带餐
}
// int ddate = xuantaiData[xuantaiSelIndex]
// .dateTimext
// .millisecondsSinceEpoch;
// String ddateSolt = _notebookDetailChangeModel
// .currTimeIndex
// .toString();
// Map temp =
// await NavigatorUtil.goSelectTableFPage(
// context, '', ddate, ddateSolt,
// canChoose: true,
// object: {
// 'object':
// _notebookDetailChangeModel.tableList
// });
// if (temp == null) {
// } else if (temp['object'].length == 0) {
// } else {
// _notebookDetailChangeModel.tableList =
// temp['object'];
// for (t.TableList item
// in _notebookDetailChangeModel
// .tableList) {
// item.selected = true;
// }
// // setState(() {});
// int dateTimeMill =
// _notebookDetailChangeModel
// .dateTime.millisecondsSinceEpoch;
// await _notebookDetailChangeModel
// .getNewTableList(
// context,
// '${dateTimeMill}',
// _notebookDetailChangeModel
// .currTimeIndex
// .toString(),
// widget.detailEntity.pnum,
// _notebookDetailChangeModel
// .tableList);
// _notebookDetailChangeModel
// .notifyListeners();
// }
},
),
VEmptyView(52),
Text(
... ... @@ -1166,7 +1427,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
children: [
Expanded(
child: _callButton(
onPress: () {},
onPress: () {
// setBanquetInfo
},
content: '仅保存',
hasLeftBorder: true,
isSelect: false)),
... ... @@ -2672,6 +2935,8 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
@override
Widget build(BuildContext context) {
feastModel = Provider.of<FeastModel>(context, listen: true);
_uploadImageProvider =
Provider.of<UploadImageProvider>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
... ...
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/utils/dialog_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/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 FeastSelectTablePage extends StatefulWidget {
final List<TableList> tableList;
final String tid;
FeastSelectTablePage({this.tableList, this.tid});
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new FeastSelectTablePageState();
}
}
class FeastSelectTablePageState extends State<FeastSelectTablePage> {
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 = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟
@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();
});
}
// /// 早市、午市、晚市对应的半个小时间隔时间段
// 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();
}
}
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.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;
}
print(currentArea);
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().screenWidth -
// ScreenUtil().setWidth(12 * 3 - 10 * 2),
// width: ScreenUtil().screenWidth -
// 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(table, canSelected: true,
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(() {});
// }
}, fromPage: '', tableMap: tableMap, 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 ? 1 : 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();
});
});
}
// }
},
)),
// InkWell(
// onTap: () {
// setState(() {
// model.swichState = !model.swichState;
// if (model.swichState) {
// model.areaTableMapShow =
// _chooseTableModel.areaTableMapCanNote;
// model.tablesShow =
// _chooseTableModel.tablesCanNote;
// } else {
// model.areaTableMapShow = model.areaTableMap;
// model.tablesShow = model.tablesAll;
// }
// });
// },
// child: Container(
// margin: EdgeInsets.only(
// top: ScreenUtil().setWidth(20),
// ),
// child: Row(
// children: [
// MyDivider(ScreenUtil().setWidth(15),
// ScreenUtil().setWidth(80),
// color: MyColours.color_F1F0F4),
// MyDivider(ScreenUtil().setWidth(2),
// ScreenUtil().setWidth(80),
// color: MyColours.color_9C9C9C),
// HEmptyView(30),
// Image.asset(
// model.swichState
// ? Utils.getImgPath('f_swich_on')
// : Utils.getImgPath('f_swich_off'),
// width: ScreenUtil().setWidth(90),
// // height: ScreenUtil().setWidth(82),
// ),
// // HEmptyView(20),
// // Text(
// // '仅看\n空座',
// // style: TextStyle(
// // fontSize: ScreenUtil().setSp(28),
// // color: MyColours.color_333333,
// // ),
// // ),
// // HEmptyView(40)
// ],
// )),
// )
],
),
),
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;
}
}
... ...
... ... @@ -228,7 +228,7 @@ class _FeastPersonalPageState extends State<FeastPersonalPage> {
return ExceptionPage(
pageState: model.pageStatePersonnalHome,
callback: () {
_getSellerUserBySellerid();
_getData();
},
emptyMsg: "暂时没有员工哦",
emptyImg: "empty_search",
... ...
... ... @@ -30,7 +30,8 @@ class FeastModel extends ChangeNotifier {
PageState pageStatePersonnalHome = PageState.Loading; //员工管理
List<String> selectPersonnalData = [];
bool checkValue = false;
List<String> getPersonnalList = []; //宴会员工
List<String> getPersonnalList = []; //宴会员工uid
List<FilterBtnModel> personnalList = []; //宴会员工数据----跟单人
PageState pageStateType = PageState.Loading; //宴会类型
List<ClassifySunModel> classifyData = [];
... ... @@ -57,15 +58,16 @@ class FeastModel extends ChangeNotifier {
PageState pageStateFollowUp = PageState.Loading; //待跟进宴会
PageState pageStateDepositData = PageState.Loading; //定金数据
String rid; //宴会id
/***
*
* 新建宴会
*/
///添加宴会员工
Future<dynamic> createBanquet(BuildContext context, Map<String, String> params,
///新建意向
Future<dynamic> createBanquet(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.create_banquet,
... ... @@ -77,6 +79,35 @@ class FeastModel extends ChangeNotifier {
});
if (baseResp.code == Constant.status_success) {
// if (baseResp.data == 1) {
rid = baseResp.data['id'];
return true;
// } else {
// return false;
// }
} else {
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
}
///设置选台信息
Future<dynamic> setBanquetInfo(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.set_banquet_info,
data: params, showLoading: isShowLoading)
.catchError((error) {
print(error.toString());
if (error is MyError) {}
return false;
});
if (baseResp.code == Constant.status_success) {
// if (baseResp.data == 1) {
// rid = baseResp.data['id'];
return true;
// } else {
// return false;
... ... @@ -88,6 +119,8 @@ class FeastModel extends ChangeNotifier {
return false;
}
}
/***
*
* 宴会员工
... ... @@ -154,6 +187,15 @@ class FeastModel extends ChangeNotifier {
return model;
}
FilterBtnModel returnModelStaff(GetStaffSunModel item) {
FilterBtnModel model = FilterBtnModel();
model.id = item.userId;
model.title = item.nickName ?? item.account;
model.account = item.account;
// model.phone = item.phone;
return model;
}
/// 获取店员列表
Future<bool> getAuthUserLists(BuildContext context,
{showLoading = false}) async {
... ... @@ -271,11 +313,14 @@ class FeastModel extends ChangeNotifier {
return false;
});
getPersonnalList = [];
personnalList = [];
GetStaffModel getStaffModel = GetStaffModel.fromJson(baseResp.responseData);
if (getStaffModel.ret == Constant.status_success) {
List<GetStaffSunModel> data = getStaffModel.data;
data.forEach((element) {
getPersonnalList.add(element.userId);
FilterBtnModel model = returnModelStaff(element);
personnalList.add(model);
});
return true;
} else {
... ...
... ... @@ -998,4 +998,15 @@ class NavigatorUtil {
return _navigateTo(context, "${Routes.feast_deposit_data_page}",
replace: replace);
}
///宴会---不待餐---- 选择桌位——方硕新修改的选择桌位页面
static Future goFeastSelectTablePage(BuildContext context,
{Map object, String tid = ''}) {
if (object != null) {
return _navigateTo(context,
"${Routes.feast_select_table_page}?tid=$tid&object=${FluroConvertUtils.object2string(object)}");
}
// object = {'object': [], "tid": ''};
return _navigateTo(context, "${Routes.feast_select_table_page}?tid=$tid");
}
}
... ...
... ... @@ -42,6 +42,7 @@ import 'package:one_key/pages/detail/edit_reserver_page.dart';
import 'package:one_key/pages/detail/notebook_detail_change_page.dart';
import 'package:one_key/pages/detail/notebook_detail_change_page_f.dart';
import 'package:one_key/pages/detail/select_tables_f_page.dart';
import 'package:one_key/pages/feast/feast_select_table_page.dart';
import 'package:one_key/pages/home/home_page.dart';
import 'package:one_key/pages/invicate/invitation_page.dart';
import 'package:one_key/pages/invicate/invitation_page_f_old.dart';
... ... @@ -1588,3 +1589,24 @@ var feastDepositDataPageHandle = new Handler(
return ChangeNotifierProvider<FeastModel>(
create: (_) => FeastModel(), child: FeastDepositDataPage());
});
///宴会---选择桌位
var feastSelectTablePageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
String tid = params['tid'].first;
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: FeastSelectTablePage(tableList: res, tid: tid));
});
... ...
... ... @@ -147,6 +147,8 @@ class Routes {
static String feast_follow_up_page = "/feast_follow_up_page"; //宴会-----待跟进
static String feast_deposit_data_page =
"/feast_deposit_data_page"; //宴会-----定金数据
static String feast_select_table_page =
"/feast_select_table_page"; //宴会-----新建宴会---选择桌位
static void configureRoutes(FluroRouter router) {
router.notFoundHandler = new Handler(
... ... @@ -296,7 +298,8 @@ class Routes {
router.define(feast_follow_up_page, handler: feastFollowUpPageHandle);
router.define(feast_deposit_data_page, handler: feastDepositDataPageHandle);
router.define(feast_deposit_data_page, handler: feastDepositDataPageHandle);
router.define(feast_select_table_page, handler: feastSelectTablePageHandle);
}
}
... ...
class ConvertNumberToChineseMoneyWords{
// 大写数字
static List<String> NUMBERS = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十",""];
static String toChinese(int index) {
if(index > 100){
return index.toString();
}
StringBuffer stringBuffer = StringBuffer();
if(index / 10 < 1){
return NUMBERS[index];
}
int tenUnit = (index / 10).toInt();
int remainder = index % 10;
if(remainder == 9){
tenUnit++;
remainder = 10;
}
if(tenUnit == 1){
stringBuffer..write("十")..write(NUMBERS[remainder]);
return stringBuffer.toString();
}
stringBuffer..write(NUMBERS[tenUnit - 1])..write("十")..write(NUMBERS[remainder]);
return stringBuffer.toString();
}
}
... ...