Commit c5fc92b1d3104c1d79dff824fc9c501376e72f2a

Authored by wdn127929
1 parent c684b26a

选台readyready

class FeastMenuSetModel {
String id;
String cname;
}
... ...
import 'package:flutter/material.dart';
import 'package:one_key/models/dsolt_xt.dart';
import 'package:one_key/models/setmeal_by_id_model.dart';
import 'package:one_key/models/table_list.dart' as t;
class SetXuanTaiModel {
... ... @@ -135,22 +136,26 @@ class Setmeal {
TextEditingController pnumC;
TextEditingController minC;
TextEditingController spareC;
List<Cooklist> cooklist;
Map<String, List<CookByIdSetmeal>> dataMenu = {};
Setmeal({
this.setmealId,
this.price,
this.finalPrice,
this.pnum,
this.min,
this.spare,
this.name,
this.select,
this.bargaining,
// this.finalPriceC,
// this.pnumC,
// this.minC,
// this.spareC,
});
Setmeal(
{this.setmealId,
this.price,
this.finalPrice,
this.pnum,
this.min,
this.spare,
this.name,
this.select,
this.bargaining,
this.cooklist,
this.dataMenu
// this.finalPriceC,
// this.pnumC,
// this.minC,
// this.spareC,
});
Setmeal.fromJson(Map<String, dynamic> json) {
setmealId = json['setmeal_id'];
... ... @@ -162,6 +167,13 @@ class Setmeal {
name = json['name'];
select = json['select'];
bargaining = json['bargaining'];
if (json['cooklist'] != null) {
cooklist = <Cooklist>[];
json['cooklist'].forEach((v) {
cooklist.add(new Cooklist.fromJson(v));
});
}
// finalPriceC = json['finalPriceC'];
// pnumC = json['pnumC'];
// minC = json['minC'];
... ... @@ -183,7 +195,28 @@ class Setmeal {
// data['pnumC'] = this.pnumC;
// data['minC'] = this.minC;
// data['spareC'] = this.spareC;
if (this.cooklist != null) {
data['cooklist'] = this.cooklist.map((v) => v.toJson()).toList();
}
return data;
}
}
class Cooklist {
String id;
String cname;
Cooklist({this.cname});
Cooklist.fromJson(Map<String, dynamic> json) {
id = json['id'];
cname = json['cname'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['cname'] = this.cname;
return data;
}
}
... ... @@ -192,15 +225,22 @@ class Wine {
String wineId;
String price;
String finalPrice;
String num;
String numStr;
String name;
String bargaining;
bool select = false;
String spec;
TextEditingController finalPriceC;
TextEditingController numC;
Wine({this.wineId, this.price, this.finalPrice, this.num});
Wine({this.wineId, this.price, this.finalPrice, this.numStr});
Wine.fromJson(Map<String, dynamic> json) {
wineId = json['wine_id'];
price = json['price'];
finalPrice = json['final_price'];
num = json['num'];
numStr = json['num'];
}
Map<String, dynamic> toJson() {
... ... @@ -208,7 +248,7 @@ class Wine {
data['wine_id'] = this.wineId;
data['price'] = this.price;
data['final_price'] = this.finalPrice;
data['num'] = this.num;
data['num'] = this.numStr;
return data;
}
}
... ... @@ -217,15 +257,23 @@ class Other {
String otherId;
String price;
String finalPrice;
String num;
String numStr;
Other({this.otherId, this.price, this.finalPrice, this.num});
String name;
String bargaining;
bool select = false;
String spec;
TextEditingController finalPriceC;
TextEditingController numC;
Other({this.otherId, this.price, this.finalPrice, this.numStr});
Other.fromJson(Map<String, dynamic> json) {
otherId = json['other_id'];
price = json['price'];
finalPrice = json['final_price'];
num = json['num'];
numStr = json['num'];
}
Map<String, dynamic> toJson() {
... ... @@ -233,7 +281,7 @@ class Other {
data['other_id'] = this.otherId;
data['price'] = this.price;
data['final_price'] = this.finalPrice;
data['num'] = this.num;
data['num'] = this.numStr;
return data;
}
}
... ...
import 'package:flutter/material.dart';
class SetMeaByIdModel {
int ret;
SetMeaByIdSunModel data;
... ... @@ -24,6 +26,7 @@ class SetMeaByIdModel {
}
}
class SetMeaByIdSunModel {
String id;
String sid;
... ... @@ -128,6 +131,8 @@ class CookByIdSetmeal {
String spec;
String isTrim;
String status;
TextEditingController numC = TextEditingController(); //数量
TextEditingController nameC = TextEditingController(); //菜名
CookByIdSetmeal(
{this.id,
... ...
... ... @@ -292,8 +292,9 @@ 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 =
static const String set_banquet_info =
"?service=App.Banquet.SetBanquetInfo"; //设置选台信息
static const String set_banquet_info_cook =
"?service=App.Banquet.SetBanquetInfoCook"; //调菜
}
... ...
... ... @@ -74,6 +74,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
List<SetXuanTaiModel> xuantaiData = [];
int xuantaiSelIndex = 0;
List<DsoltXt> dsoltList = [];
UserModel userModel;
@override
void initState() {
... ... @@ -732,13 +733,13 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
Expanded(
child: _callButton(
onPress: () async {
// bool success = await yxSave();
// if (success) {
selectMenu = '选台';
menuSet.add('意向');
menuSet.add('选台');
setState(() {});
// }
bool success = await yxSave();
if (success) {
selectMenu = '选台';
menuSet.add('意向');
menuSet.add('选台');
setState(() {});
}
},
content: '保存并下一步',
hasLeftBorder: true,
... ... @@ -1333,11 +1334,42 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
fontSize: font(16)),
)),
InkWell(
onTap: () {
NavigatorUtil
.goFeastMenuPage(
context,
setmeal.setmealId);
onTap: () async {
Map temp = {};
if (setmeal.dataMenu !=
null &&
setmeal.dataMenu
.length >
0) {
temp = await NavigatorUtil
.goFeastMenuPage(
context,
setmeal.setmealId,
justSelData: {
'object':
setmeal.dataMenu
});
} else {
temp = await NavigatorUtil
.goFeastMenuPage(
context,
setmeal.setmealId,
);
}
if (temp == null) {
} else if (temp['object']
.length ==
0) {
} else {
setmeal.dataMenu =
temp['object'];
xuantaiData[xuantaiSelIndex]
.setmeal[index]
.dataMenu =
temp['object'];
}
setState(() {});
},
child: Row(
children: [
... ... @@ -1365,24 +1397,22 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
))
],
),
setmeal.finalPrice.isEmpty &&
setmeal.min.isEmpty &&
setmeal.spare.isEmpty &&
setmeal.pnum.isEmpty
? SizedBox()
: VEmptyView(32),
VEmptyView(32),
Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
setmeal.finalPrice.isNotEmpty
? Padding(
padding: EdgeInsets.only(
right: w(16)),
child: taocanText(
setmeal.finalPrice,
' 元/桌'))
: SizedBox(),
Padding(
padding: EdgeInsets.only(
right: w(16)),
child: taocanText(
setmeal.bargaining ==
'0' ||
setmeal.finalPrice
.isEmpty
? setmeal.price
: setmeal.finalPrice,
' 元/桌')),
setmeal.pnum.isNotEmpty
? Padding(
padding: EdgeInsets.only(
... ... @@ -1421,22 +1451,45 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
gradientStart: MyColours.color_438E93,
gradientEnd: MyColours.color_438E93,
onPressed: () async {
String dateData = '';
if (xuantaiData[xuantaiSelIndex]
.dateTimeShowxt !=
'暂未选择') {
DateTime day =
xuantaiData[xuantaiSelIndex].dateTimext;
String ymd = "${day.year}-" +
Utils.addZeroNumber(day.month) +
"-" +
Utils.addZeroNumber(day.day);
dateData += ymd;
}
if (dateData.length > 0) {
dateData += ' ${feastModel.reserve}';
} else {
dateData += '${feastModel.reserve}';
}
dateData += ' ${feastModel.type}';
Map temp = {};
if (xuantaiData[xuantaiSelIndex]
.setmeal
.length >
0) {
print(xuantaiData[xuantaiSelIndex].setmeal);
userModel.justSelData =
xuantaiData[xuantaiSelIndex].setmeal;
temp =
await NavigatorUtil.goFeastSetmealPage(
context,
justSelData: {
'object': xuantaiData[xuantaiSelIndex]
.setmeal
});
context, dateData, justSelData: {
'object':
xuantaiData[xuantaiSelIndex].setmeal
});
} else {
temp =
await NavigatorUtil.goFeastSetmealPage(
context,
dateData,
);
}
... ... @@ -1460,11 +1513,14 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
fontSize: ScreenUtil().setSp(28)),
),
ListView.builder(
itemCount: 2,
itemCount:
xuantaiData[xuantaiSelIndex].wine.length,
shrinkWrap: true,
controller: controller,
itemBuilder:
(BuildContext context, int index) {
Wine wine = xuantaiData[xuantaiSelIndex]
.wine[index];
return Container(
height: h(42),
decoration: BoxDecoration(
... ... @@ -1479,21 +1535,52 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
children: [
Expanded(
child: Text(
'剑南春52度500ml',
wine.name,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(16)),
)),
taocanText('1299', ' 元/份'),
HEmptyView(32),
taocanText('12', ' 份'),
taocanText(
wine.bargaining == '1' &&
wine.finalPrice.isNotEmpty
? wine.finalPrice
: wine.price,
' 元/${wine.spec}'),
wine.numStr.isEmpty
? SizedBox()
: HEmptyView(32),
wine.numStr.isEmpty
? SizedBox()
: taocanText(
wine.numStr, ' ${wine.spec}'),
HEmptyView(32),
InkWell(
onTap: () {
FocusScope.of(context)
.requestFocus(
FocusNode()); //点击空白处隐藏键盘
//弹框确认是否删除
DialogUtil.cupertinoAlertDialog(
context,
title: "",
content: "是否确定删除?",
isBoldContent: true,
contentColor: MyColours
.color_E6000000,
rTitle: "删除",
rCallback: () {
xuantaiData[xuantaiSelIndex]
.wine
.removeAt(index);
setState(() {});
});
},
child: Image.asset(
Utils.getImgPath('f_delete_red'),
width: w(20),
))
Utils.getImgPath(
'f_delete_red'),
width: w(20),
))
],
),
);
... ... @@ -1509,8 +1596,31 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
isBold: false,
gradientStart: MyColours.color_438E93,
gradientEnd: MyColours.color_438E93,
onPressed: () {
NavigatorUtil.goFeastWinePage(context);
onPressed: () async {
Map temp = {};
if (xuantaiData[xuantaiSelIndex].wine.length >
0) {
temp = await NavigatorUtil.goFeastWinePage(
context,
justSelData: {
'object':
xuantaiData[xuantaiSelIndex].wine
});
} else {
temp = await NavigatorUtil.goFeastWinePage(
context);
}
if (temp == null) {
} else if (temp['object'].length == 0) {
} else {
xuantaiData[xuantaiSelIndex].wine =
temp['object'];
print(xuantaiData[xuantaiSelIndex]
.wine
.toString());
}
setState(() {});
},
),
VEmptyView(52),
... ... @@ -1521,11 +1631,14 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
fontSize: ScreenUtil().setSp(28)),
),
ListView.builder(
itemCount: 2,
itemCount:
xuantaiData[xuantaiSelIndex].other.length,
shrinkWrap: true,
controller: controller,
itemBuilder:
(BuildContext context, int index) {
Other other = xuantaiData[xuantaiSelIndex]
.other[index];
return Container(
height: h(42),
decoration: BoxDecoration(
... ... @@ -1540,21 +1653,53 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
children: [
Expanded(
child: Text(
'LED大屏',
other.name,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(16)),
)),
taocanText('1299', ' 元/份'),
HEmptyView(32),
taocanText('12', ' 份'),
taocanText(
other.bargaining == '1' &&
other
.finalPrice.isNotEmpty
? other.finalPrice
: other.price,
' 元/${other.spec}'),
other.numStr.isEmpty
? SizedBox()
: HEmptyView(32),
other.numStr.isEmpty
? SizedBox()
: taocanText(other.numStr,
' ${other.spec}'),
HEmptyView(32),
InkWell(
onTap: () {
FocusScope.of(context)
.requestFocus(
FocusNode()); //点击空白处隐藏键盘
//弹框确认是否删除
DialogUtil.cupertinoAlertDialog(
context,
title: "",
content: "是否确定删除?",
isBoldContent: true,
contentColor: MyColours
.color_E6000000,
rTitle: "删除",
rCallback: () {
xuantaiData[xuantaiSelIndex]
.other
.removeAt(index);
setState(() {});
});
},
child: Image.asset(
Utils.getImgPath('f_delete_red'),
width: w(20),
))
Utils.getImgPath(
'f_delete_red'),
width: w(20),
))
],
),
);
... ... @@ -1570,8 +1715,31 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
isBold: false,
gradientStart: MyColours.color_438E93,
gradientEnd: MyColours.color_438E93,
onPressed: () {
NavigatorUtil.goFeastSetPage(context);
onPressed: () async {
Map temp = {};
if (xuantaiData[xuantaiSelIndex].wine.length >
0) {
temp = await NavigatorUtil.goFeastSetPage(
context,
justSelData: {
'object':
xuantaiData[xuantaiSelIndex].other
});
} else {
temp = await NavigatorUtil.goFeastSetPage(
context);
}
if (temp == null) {
} else if (temp['object'].length == 0) {
} else {
xuantaiData[xuantaiSelIndex].other =
temp['object'];
print(xuantaiData[xuantaiSelIndex]
.other
.toString());
}
setState(() {});
},
),
],
... ... @@ -3112,6 +3280,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
@override
Widget build(BuildContext context) {
feastModel = Provider.of<FeastModel>(context, listen: true);
userModel = Provider.of<UserModel>(context, listen: false);
_uploadImageProvider =
Provider.of<UploadImageProvider>(context, listen: true);
return Scaffold(
... ...
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/get_setmeal_class_by_id_model.dart';
... ... @@ -8,6 +10,7 @@ import 'package:one_key/widgets/h_empty_view.dart';
import 'package:provider/provider.dart';
import '../../constant/state.dart';
import '../../models/feast_menu_set_model.dart';
import '../../provider/feast_model.dart';
import '../../res/colors.dart';
import '../../utils/screen_util.dart';
... ... @@ -22,7 +25,8 @@ import '../../widgets/v_empty_view.dart';
*/
class FeastMenuPage extends StatefulWidget {
final String setmealId;
FeastMenuPage({Key key, this.setmealId}) : super(key: key);
final Map<String, List<CookByIdSetmeal>> justSelData;
FeastMenuPage({Key key, this.setmealId, this.justSelData}) : super(key: key);
@override
_FeastMenuPageState createState() => _FeastMenuPageState();
... ... @@ -33,6 +37,10 @@ class _FeastMenuPageState extends State<FeastMenuPage> {
FeastModel feastModel;
Map<String, List<CookByIdSetmeal>> data = {};
List<String> classNames = [];
List<Map<String, String>> setModel = [];
Map<String, List<CookByIdSetmeal>> dataNew = {};
@override
void initState() {
// TODO: implement initState
... ... @@ -50,19 +58,26 @@ class _FeastMenuPageState extends State<FeastMenuPage> {
bool success = await feastModel.getSetmealById(context, params,
isShowLoading: isShowLoading);
if (success) {
for (ClassifyById item in feastModel.setmealDetail.classify) {
// Map<String, List<CookByIdSetmeal>> map = {};
String cid = item.id;
String className = item.className;
if (widget.justSelData.length > 0) {
data = widget.justSelData;
data.forEach((key, value) {
classNames.add(key);
});
} else {
for (ClassifyById item in feastModel.setmealDetail.classify) {
// Map<String, List<CookByIdSetmeal>> map = {};
String cid = item.id;
String className = item.className;
List<CookByIdSetmeal> temp = [];
for (CookByIdSetmeal itemCook in feastModel.setmealDetail.cook) {
if (cid == itemCook.cid) {
temp.add(itemCook);
List<CookByIdSetmeal> temp = [];
for (CookByIdSetmeal itemCook in feastModel.setmealDetail.cook) {
if (cid == itemCook.cid) {
temp.add(itemCook);
}
}
classNames.add(className);
data[className] = temp;
}
classNames.add(className);
data[className] = temp;
}
feastModel.pageStateMenu = PageState.Success;
setState(() {});
... ... @@ -166,7 +181,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> {
return ListView.builder(
shrinkWrap: true,
controller: controller,
padding: EdgeInsets.only(right: w(12)),
// padding: EdgeInsets.only(right: w(12)),
itemCount: cookList.length + 1,
itemBuilder: (BuildContext context, int index) {
if (index < 1) {
... ... @@ -200,7 +215,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> {
Container(
width: h(36),
child: Text(
'10${setmeal.spec}',
'${setmeal.spec}',
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
... ... @@ -229,9 +244,11 @@ class _FeastMenuPageState extends State<FeastMenuPage> {
fontSize: ScreenUtil().setSp(32)),
),
HEmptyView(16),
Expanded(child: _textfield('菜名', null, null)),
HEmptyView(16),
_textfield('数量', null, null, width: w(56))
Expanded(
child:
_textfield('菜名', setmeal.nameC, null)),
// HEmptyView(16),
// _textfield('数量', null, null, width: w(56))
],
))
],
... ... @@ -280,7 +297,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> {
return ExceptionPage(
pageState: model.pageStateMenu,
callback: () {
// _getSellerUserBySellerid();
_getSetmealById();
},
emptyMsg: "暂时没有菜品哦",
emptyImg: "empty_search",
... ... @@ -336,7 +353,38 @@ class _FeastMenuPageState extends State<FeastMenuPage> {
isSelect: false)),
Expanded(
child: _callButton(
onPress: () {},
onPress: () async {
FocusScope.of(context).requestFocus(FocusNode());
// setModel = [];
data.forEach((key, value) {
List<CookByIdSetmeal> temp = [];
value.forEach((element) {
if (element.nameC.text.trim().length > 0) {
//已调菜
// setModel.add({
// 'id': element.id,
// 'cname': element.nameC.text
// });
element.cname = element.nameC.text;
temp.add(element);
} else {
temp.add(element);
}
});
dataNew[key] = temp;
});
// if (setModel.length > 0) {
// bool success = await feastModel
// .setBanquetInfoCook(context,
// {'data': json.encode(setModel)});
// if (success) {
Map temp = {
'object': dataNew,
};
Navigator.of(context).pop(temp);
// }
},
content: '保存并返回',
hasLeftBorder: true,
isSelect: true))
... ...
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/get_setmeal_class_by_id_model.dart';
import 'package:one_key/models/setmeal_by_id_model.dart';
import 'package:one_key/models/setmeal_model.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:provider/provider.dart';
import '../../constant/state.dart';
import '../../models/feast_menu_set_model.dart';
import '../../provider/feast_model.dart';
import '../../res/colors.dart';
import '../../utils/screen_util.dart';
import '../../utils/utils.dart';
import '../../widgets/page_exception.dart';
import '../../widgets/system_app_bar.dart';
import '../../widgets/v_empty_view.dart';
/**
*
* 菜单信息
*/
class FeastMenuShowPage extends StatefulWidget {
final String setmealId;
final String mealName;
final String dateData;
final String needtable;
final Map<String, List<CookByIdSetmeal>> justSelData;
FeastMenuShowPage(
{Key key,
this.setmealId,
this.mealName,
this.dateData,
this.needtable,
this.justSelData})
: super(key: key);
@override
_FeastMenuShowPageState createState() => _FeastMenuShowPageState();
}
class _FeastMenuShowPageState extends State<FeastMenuShowPage> {
ScrollController controller = ScrollController();
FeastModel feastModel;
Map<String, List<CookByIdSetmeal>> data = {};
List<String> classNames = [];
List<Map<String, String>> setModel = [];
Map<String, List<CookByIdSetmeal>> dataNew = {};
@override
void initState() {
// TODO: implement initState
super.initState();
Utils.changeStatusColor(color: MyColours.color_438E93);
WidgetsBinding.instance.addPostFrameCallback((_) {
_getSetmealById();
});
}
/// 根据ID获取宴会套餐
_getSetmealById({bool isShowLoading = true}) async {
Map<String, String> params = {"id": widget.setmealId};
bool success = await feastModel.getSetmealById(context, params,
isShowLoading: isShowLoading);
if (success) {
if (widget.justSelData.length > 0) {
data = widget.justSelData;
data.forEach((key, value) {
classNames.add(key);
});
} else {
for (ClassifyById item in feastModel.setmealDetail.classify) {
// Map<String, List<CookByIdSetmeal>> map = {};
String cid = item.id;
String className = item.className;
List<CookByIdSetmeal> temp = [];
for (CookByIdSetmeal itemCook in feastModel.setmealDetail.cook) {
if (cid == itemCook.cid) {
temp.add(itemCook);
}
}
classNames.add(className);
data[className] = temp;
}
}
feastModel.pageStateMenu = PageState.Success;
setState(() {});
}
}
Widget _callButton(
{GestureTapCallback onPress,
content,
hasLeftBorder = true,
isSelect = false}) {
return InkWell(
onTap: onPress,
child: Container(
height: h(48),
decoration: BoxDecoration(
color: isSelect ? MyColours.color_438E93 : MyColours.color_ffffff,
border: Border(
bottom: BorderSide(
color: MyColours.color_438E93,
width: ScreenUtil().setWidth(2)),
top: BorderSide(
color: MyColours.color_438E93,
width: ScreenUtil().setWidth(2)),
left: hasLeftBorder
? BorderSide(
color: MyColours.color_438E93,
width: ScreenUtil().setWidth(2))
: BorderSide.none,
right: BorderSide(
color: MyColours.color_438E93,
width: ScreenUtil().setWidth(2)))),
child: Align(
alignment: Alignment.center,
child: Text(
content,
style: TextStyle(
color:
isSelect ? MyColours.color_F6F6F6 : MyColours.color_438E93,
fontSize: ScreenUtil().setSp(36)),
),
),
),
);
}
// 根据index展示不同的widget
Widget buildItemWidget(BuildContext context, int index) {
return _itemBuildWidget(context, index);
}
///输入框
Widget _textfield(String hintText, TextEditingController editingController,
FocusNode focusNode,
{TextInputType inputType = TextInputType.text, double width}) {
return Container(
width: width,
padding: EdgeInsets.symmetric(horizontal: w(6)),
decoration: BoxDecoration(
border: Border.all(width: h(1), color: MyColours.color_DBDBDB)),
child: Container(
// height: ScreenUtil().setHeight(120),
height: ScreenUtil().setWidth(64),
child: TextField(
controller: editingController,
// textAlign: TextAlign.right,
// textAlignVertical: TextAlignVertical.bottom,
maxLines: 1,
inputFormatters: [],
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
),
focusNode: focusNode,
decoration: InputDecoration(
border: OutlineInputBorder(borderSide: BorderSide.none),
hintText: hintText,
hintStyle: TextStyle(
color: hintText == '菜名' || hintText == '数量'
? MyColours.color_999999
: MyColours.color_515151,
fontSize: ScreenUtil().setSp(24),
),
contentPadding: EdgeInsets.zero,
),
onChanged: (value) {},
onEditingComplete: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
keyboardType: inputType,
)),
);
}
Widget _itemBuildWidget(BuildContext context, int index1) {
List<CookByIdSetmeal> cookList = data[classNames[index1]];
return ListView.builder(
shrinkWrap: true,
controller: controller,
// padding: EdgeInsets.only(right: w(12)),
itemCount: cookList.length + 1,
itemBuilder: (BuildContext context, int index) {
if (index < 1) {
return _buildHeaderWidget(context, classNames[index1]);
} else {
int itemIndex = index - 1;
CookByIdSetmeal setmeal = cookList[itemIndex];
return Container(
margin: new EdgeInsets.only(bottom: h(12)),
color: MyColours.color_ffffff,
child: new GestureDetector(
onTap: () {
// _gotoProjectDetail(projectModelList[index]);
},
child: new Container(
color: MyColours.color_ffffff,
child: Row(
children: [
Container(
width: h(119),
child: Text(
setmeal.cname,
overflow: TextOverflow.ellipsis,
maxLines: 10,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
)),
HEmptyView(16),
Container(
width: h(36),
child: Text(
'${setmeal.spec}',
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
)),
],
)),
),
);
}
},
);
}
// // 总count数
// int _getItemListCount() {
// return data.length + 1;
// }
// header内容
Widget _buildHeaderWidget(BuildContext context, String title) {
return Padding(
padding: EdgeInsets.only(bottom: h(12)),
child: Text(
title,
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(16),
fontWeight: FontWeight.bold),
));
}
@override
Widget build(BuildContext context) {
feastModel = Provider.of(context);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'查看菜单',
needWhite: true,
bgColor: MyColours.color_438E93,
titleColor: MyColours.color_F6F6F6,
onTap: () {
Navigator.pop(context);
},
),
body: Consumer<FeastModel>(builder: (context, model, _) {
if (model.pageStateMenu != PageState.Success) {
return ExceptionPage(
pageState: model.pageStateMenu,
callback: () {
_getSetmealById();
},
emptyMsg: "暂时没有菜单信息哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return SingleChildScrollView(
controller: controller,
child: Padding(
padding: EdgeInsets.only(left: w(16)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
VEmptyView(20),
Container(
width: double.infinity,
height: h(48),
alignment: Alignment.centerLeft,
child: Text(
widget.mealName,
style: TextStyle(
color: MyColours.color_E6000000,
fontSize: font(16)),
),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: h(0.5),
color: MyColours.color_E7E7E7))),
),
VEmptyView(22),
Container(
width: double.infinity,
height: h(48),
alignment: Alignment.centerLeft,
child: Text(
widget.dateData,
style: TextStyle(
color: MyColours.color_E6000000,
fontSize: font(16)),
),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: h(0.5),
color: MyColours.color_E7E7E7))),
),
widget.needtable.isEmpty ? SizedBox() : VEmptyView(22),
widget.needtable.isEmpty
? SizedBox()
: Container(
width: double.infinity,
height: h(48),
child: Text(
widget.needtable,
style: TextStyle(
color: MyColours.color_E6000000,
fontSize: font(16)),
),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: h(0.5),
color: MyColours.color_E7E7E7))),
),
VEmptyView(36),
ListView.builder(
shrinkWrap: true,
controller: controller,
padding: EdgeInsets.only(right: w(12)),
itemCount: data.length,
itemBuilder: (BuildContext context, int index) {
return buildItemWidget(context, index);
},
)
],
)),
);
}
}));
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/otherset_model.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:provider/provider.dart';
import '../../constant/state.dart';
import '../../models/set_xuan_tai_model.dart';
import '../../provider/feast_model.dart';
import '../../res/colors.dart';
import '../../utils/screen_util.dart';
import '../../utils/utils.dart';
import '../../widgets/page_exception.dart';
import '../../widgets/round_button.dart';
import '../../widgets/system_app_bar.dart';
import '../../widgets/v_empty_view.dart';
... ... @@ -13,17 +19,60 @@ import '../../widgets/v_empty_view.dart';
* 添加配置
*/
class FeastSetPage extends StatefulWidget {
FeastSetPage({Key key}) : super(key: key);
final List<Other> justSelData;
FeastSetPage({Key key, this.justSelData}) : super(key: key);
@override
_FeastSetPageState createState() => _FeastSetPageState();
}
class _FeastSetPageState extends State<FeastSetPage> {
FeastModel feastModel;
List<Other> otherData = [];
@override
void initState() {
super.initState();
Utils.changeStatusColor(color: MyColours.color_438E93);
WidgetsBinding.instance.addPostFrameCallback((_) {
_getOthersetList();
// scrollController.jumpTo(scrollController.position.minScrollExtent);
});
}
///获取其他配置
Future<bool> _getOthersetList({bool isShowLoading = true}) async {
bool success =
await feastModel.getOthersetList(context, isShowLoading: isShowLoading);
if (success) {
List<String> otherids = widget.justSelData.map((e) {
return e.otherId;
}).toList();
for (OthersetSunModel item in feastModel.otherData) {
Other other = Other();
other.otherId = item.id;
other.name = item.otherName;
other.bargaining = item.bargaining;
other.price = item.price;
other.finalPriceC = TextEditingController();
other.numC = TextEditingController();
other.spec = item.spec;
if (otherids.contains(item.id)) {
other.select = true;
int index = widget.justSelData
.indexWhere((element) => element.otherId == item.id);
Other widgetData = widget.justSelData[index];
other.finalPriceC.text = widgetData.finalPrice;
other.numC.text = widgetData.numStr;
} else {
other.select = false;
}
other.price = item.price;
otherData.add(other);
}
setState(() {});
}
}
Widget _callButton(
... ... @@ -114,7 +163,7 @@ class _FeastSetPageState extends State<FeastSetPage> {
);
}
Widget buildListItem(BuildContext context, int index, bool select) {
Widget buildListItem(Other data) {
return Container(
padding: EdgeInsets.only(
top: h(25), bottom: h(10), left: w(12), right: w(12)),
... ... @@ -130,21 +179,21 @@ class _FeastSetPageState extends State<FeastSetPage> {
InkWell(
onTap: () {
setState(() {
select = !select;
data.select = !data.select;
});
},
child: Row(
children: [
Image.asset(
Utils.getImgPath(
select ? 'f_select' : 'f_select_not'),
data.select ? 'f_select' : 'f_select_not'),
width: w(24),
),
HEmptyView(24),
Text(
'LED大屏',
data.name,
style: TextStyle(
color: select
color: data.select
? MyColours.color_515151
: MyColours.color_999999,
fontSize: font(16),
... ... @@ -155,7 +204,7 @@ class _FeastSetPageState extends State<FeastSetPage> {
]),
Spacer(),
Text(
'原价:1100元/份',
'原价:${data.price}元/${data.spec}',
style: TextStyle(
color: MyColours.color_999999,
fontSize: font(14),
... ... @@ -163,25 +212,31 @@ class _FeastSetPageState extends State<FeastSetPage> {
),
],
),
select ? VEmptyView(42) : SizedBox(),
select
data.select ? VEmptyView(42) : SizedBox(),
data.select
? Row(
children: [
Text(
'议价:不可议价',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(14),
),
),
// _textfield('1299', null, null, width: w(103)),
// Text(
// ' 元',
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: font(14),
// ),
// ),
data.bargaining == '1'
? Row(
children: [
_textfield('', data.finalPriceC, null,
width: w(103)),
Text(
' 元',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(14),
),
),
],
)
: Text(
'议价:不可议价',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(14),
),
),
Spacer(),
Text(
'数量:',
... ... @@ -190,9 +245,9 @@ class _FeastSetPageState extends State<FeastSetPage> {
fontSize: font(14),
),
),
_textfield('1299', null, null, width: w(103)),
_textfield('', data.numC, null, width: w(103)),
Text(
' 份',
' ${data.spec}',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(14),
... ... @@ -207,10 +262,11 @@ class _FeastSetPageState extends State<FeastSetPage> {
@override
Widget build(BuildContext context) {
feastModel = Provider.of<FeastModel>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'选择酒水',
'选择配置',
needWhite: true,
bgColor: MyColours.color_438E93,
titleColor: MyColours.color_F6F6F6,
... ... @@ -218,36 +274,75 @@ class _FeastSetPageState extends State<FeastSetPage> {
Navigator.pop(context);
},
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: ListView.builder(
shrinkWrap: true,
itemCount: 10,
itemBuilder: (BuildContext context, int index) {
return buildListItem(context, index, true);
body: Consumer<FeastModel>(builder: (context, model, _) {
if (model.pageStateOther != PageState.Success) {
return ExceptionPage(
pageState: model.pageStateOther,
callback: () {
_getOthersetList();
},
)),
Row(
emptyMsg: "暂时没有配置列表哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: _callButton(
onPress: () {
Navigator.pop(context);
},
content: '返回',
hasLeftBorder: true,
isSelect: false)),
Expanded(
child: _callButton(
onPress: () {},
content: '保存并返回',
hasLeftBorder: true,
isSelect: true))
child: ListView.builder(
shrinkWrap: true,
itemCount: otherData.length,
itemBuilder: (BuildContext context, int index) {
Other data = otherData[index];
return buildListItem(data);
},
)),
Row(
children: [
Expanded(
child: _callButton(
onPress: () {
Navigator.pop(context);
},
content: '返回',
hasLeftBorder: true,
isSelect: false)),
Expanded(
child: _callButton(
onPress: () {
List<Other> selectData = [];
if (otherData.length > 0) {
String otherIds = "";
for (Other item in otherData) {
if (item.select) {
item.finalPrice = item.finalPriceC.text;
item.numStr = item.numC.text;
selectData.add(item);
otherIds += item.otherId + ",";
}
}
if (otherIds.length > 0) {
otherIds = otherIds.substring(
0, otherIds.length - 1);
}
Map temp = {
'object': selectData,
'otherIds': otherIds
};
Navigator.of(context).pop(temp);
}
},
content: '保存并返回',
hasLeftBorder: true,
isSelect: true))
],
)
],
)
],
));
);
}
}));
}
}
... ...
import 'package:contacts_service/contacts_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:provider/provider.dart';
... ... @@ -9,6 +10,7 @@ import '../../models/set_xuan_tai_model.dart';
import '../../models/setmeal_model.dart';
import '../../provider/feast_model.dart';
import '../../res/colors.dart';
import '../../route/navigator_util.dart';
import '../../utils/screen_util.dart';
import '../../utils/utils.dart';
import '../../widgets/page_exception.dart';
... ... @@ -21,7 +23,10 @@ import '../../widgets/v_empty_view.dart';
*/
class FeastSetmealPage extends StatefulWidget {
final List<Setmeal> justSelData;
FeastSetmealPage({Key key, this.justSelData}) : super(key: key);
final String dateData;
FeastSetmealPage({Key key, this.justSelData, this.dateData})
: super(key: key);
@override
_FeastSetmealPageState createState() => _FeastSetmealPageState();
... ... @@ -30,6 +35,7 @@ class FeastSetmealPage extends StatefulWidget {
class _FeastSetmealPageState extends State<FeastSetmealPage> {
List<Setmeal> setmealData = [];
FeastModel feastModel;
UserModel userModel;
@override
void initState() {
... ... @@ -47,7 +53,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> {
bool success =
await feastModel.getSetmeal(context, isShowLoading: isShowLoading);
if (success) {
List<String> setmealids = widget.justSelData.map((e) {
List<String> setmealids = userModel.justSelData.map((e) {
return e.setmealId;
}).toList();
for (SetMealSunModel item in feastModel.setmealData) {
... ... @@ -62,13 +68,14 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> {
if (setmealids.contains(item.id)) {
setmeal.select = true;
int index = widget.justSelData
int index = userModel.justSelData
.indexWhere((element) => element.setmealId == item.id);
Setmeal widgetData = widget.justSelData[index];
Setmeal widgetData = userModel.justSelData[index];
setmeal.finalPriceC.text = widgetData.finalPrice;
setmeal.minC.text = widgetData.min;
setmeal.pnumC.text = widgetData.pnum;
setmeal.spareC.text = widgetData.spare;
setmeal.dataMenu = widgetData.dataMenu;
} else {
setmeal.select = false;
}
... ... @@ -216,8 +223,30 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> {
isBold: false,
gradientStart: MyColours.color_438E93,
gradientEnd: MyColours.color_438E93,
onPressed: () {
// NavigatorUtil.goFeastSetmealPage(context);
onPressed: () async {
String tableData = '';
if (data.pnumC.text.trim().length > 0) {
tableData += '${data.pnumC.text}人/桌';
}
if (data.minC.text.trim().length > 0) {
tableData += ' 保证 ${data.minC.text} 桌';
}
if (data.spareC.text.trim().length > 0) {
tableData += ' 备用 ${data.spareC.text} 桌';
}
if (data.dataMenu != null && data.dataMenu.length > 0) {
await NavigatorUtil.goFeastMenuShowPage(context,
data.setmealId, data.name, widget.dateData, tableData,
justSelData: {'object': data.dataMenu});
} else {
await NavigatorUtil.goFeastMenuShowPage(
context,
data.setmealId,
data.name,
widget.dateData,
tableData);
}
},
),
],
... ... @@ -328,6 +357,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> {
@override
Widget build(BuildContext context) {
feastModel = Provider.of<FeastModel>(context, listen: true);
userModel = Provider.of<UserModel>(context, listen: false);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
... ... @@ -381,11 +411,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> {
String setmealIds = "";
for (Setmeal item in setmealData) {
if (item.select) {
item.finalPrice =
item.finalPriceC.text == '' ||
item.bargaining == '0'
? item.price
: item.finalPriceC.text;
item.finalPrice = item.finalPriceC.text;
item.pnum = item.pnumC.text;
item.min = item.minC.text;
item.spare = item.spareC.text;
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/wine_model.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:provider/provider.dart';
import '../../constant/state.dart';
import '../../models/set_xuan_tai_model.dart';
import '../../provider/feast_model.dart';
import '../../res/colors.dart';
import '../../utils/screen_util.dart';
import '../../utils/utils.dart';
import '../../widgets/page_exception.dart';
import '../../widgets/round_button.dart';
import '../../widgets/system_app_bar.dart';
import '../../widgets/v_empty_view.dart';
... ... @@ -13,17 +19,60 @@ import '../../widgets/v_empty_view.dart';
* 添加酒水
*/
class FeastWinePage extends StatefulWidget {
FeastWinePage({Key key}) : super(key: key);
final List<Wine> justSelData;
FeastWinePage({Key key, this.justSelData}) : super(key: key);
@override
_FeastWinePageState createState() => _FeastWinePageState();
}
class _FeastWinePageState extends State<FeastWinePage> {
FeastModel feastModel;
List<Wine> wineData = [];
@override
void initState() {
super.initState();
Utils.changeStatusColor(color: MyColours.color_438E93);
WidgetsBinding.instance.addPostFrameCallback((_) {
_getWine();
// scrollController.jumpTo(scrollController.position.minScrollExtent);
});
}
///获取酒水
Future<bool> _getWine({bool isShowLoading = true}) async {
bool success =
await feastModel.getWine(context, isShowLoading: isShowLoading);
if (success) {
List<String> wineids = widget.justSelData.map((e) {
return e.wineId;
}).toList();
for (WineSunModel item in feastModel.wineData) {
Wine wine = Wine();
wine.wineId = item.id;
wine.name = item.wineName;
wine.bargaining = item.bargaining;
wine.price = item.price;
wine.finalPriceC = TextEditingController();
wine.numC = TextEditingController();
wine.spec = item.spec;
if (wineids.contains(item.id)) {
wine.select = true;
int index = widget.justSelData
.indexWhere((element) => element.wineId == item.id);
Wine widgetData = widget.justSelData[index];
wine.finalPriceC.text = widgetData.finalPrice;
wine.numC.text = widgetData.numStr;
} else {
wine.select = false;
}
wine.price = item.price;
wineData.add(wine);
}
setState(() {});
}
}
Widget _callButton(
... ... @@ -69,7 +118,7 @@ class _FeastWinePageState extends State<FeastWinePage> {
///输入框
Widget _textfield(String hintText, TextEditingController editingController,
FocusNode focusNode,
{TextInputType inputType = TextInputType.text, double width}) {
{TextInputType inputType = TextInputType.number, double width}) {
return Container(
width: width,
padding: EdgeInsets.symmetric(horizontal: w(6)),
... ... @@ -114,7 +163,7 @@ class _FeastWinePageState extends State<FeastWinePage> {
);
}
Widget buildListItem(BuildContext context, int index, bool select) {
Widget buildListItem(Wine data) {
return Container(
padding: EdgeInsets.only(
top: h(25), bottom: h(10), left: w(12), right: w(12)),
... ... @@ -130,21 +179,21 @@ class _FeastWinePageState extends State<FeastWinePage> {
InkWell(
onTap: () {
setState(() {
select = !select;
data.select = !data.select;
});
},
child: Row(
children: [
Image.asset(
Utils.getImgPath(
select ? 'f_select' : 'f_select_not'),
data.select ? 'f_select' : 'f_select_not'),
width: w(24),
),
HEmptyView(24),
Text(
'剑南春52度500ml',
data.name,
style: TextStyle(
color: select
color: data.select
? MyColours.color_515151
: MyColours.color_999999,
fontSize: font(16),
... ... @@ -155,7 +204,7 @@ class _FeastWinePageState extends State<FeastWinePage> {
]),
Spacer(),
Text(
'原价:460元/份',
'原价:${data.price}元/${data.spec}',
style: TextStyle(
color: MyColours.color_999999,
fontSize: font(14),
... ... @@ -163,8 +212,8 @@ class _FeastWinePageState extends State<FeastWinePage> {
),
],
),
select ? VEmptyView(42) : SizedBox(),
select
data.select ? VEmptyView(42) : SizedBox(),
data.select
? Row(
children: [
Text(
... ... @@ -174,14 +223,25 @@ class _FeastWinePageState extends State<FeastWinePage> {
fontSize: font(14),
),
),
_textfield('1299', null, null, width: w(103)),
Text(
' 元',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(14),
),
),
data.bargaining == '1'
? _textfield('', data.finalPriceC, null,
width: w(103))
: Text(
'不可议价',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(14),
),
),
data.bargaining == '1'
? Text(
' 元',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(14),
),
)
: SizedBox(),
Spacer(),
Text(
'数量:',
... ... @@ -190,9 +250,9 @@ class _FeastWinePageState extends State<FeastWinePage> {
fontSize: font(14),
),
),
_textfield('1299', null, null, width: w(103)),
_textfield('', data.numC, null, width: w(103)),
Text(
' 份',
' ${data.spec}',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(14),
... ... @@ -207,6 +267,7 @@ class _FeastWinePageState extends State<FeastWinePage> {
@override
Widget build(BuildContext context) {
feastModel = Provider.of<FeastModel>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
... ... @@ -218,36 +279,75 @@ class _FeastWinePageState extends State<FeastWinePage> {
Navigator.pop(context);
},
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: ListView.builder(
shrinkWrap: true,
itemCount: 10,
itemBuilder: (BuildContext context, int index) {
return buildListItem(context, index, true);
body: Consumer<FeastModel>(builder: (context, model, _) {
if (model.pageStateWine != PageState.Success) {
return ExceptionPage(
pageState: model.pageStateWine,
callback: () {
_getWine();
},
)),
Row(
emptyMsg: "暂时没有酒水哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: _callButton(
onPress: () {
Navigator.pop(context);
},
content: '返回',
hasLeftBorder: true,
isSelect: false)),
Expanded(
child: _callButton(
onPress: () {},
content: '保存并返回',
hasLeftBorder: true,
isSelect: true))
child: ListView.builder(
shrinkWrap: true,
itemCount: wineData.length,
itemBuilder: (BuildContext context, int index) {
Wine data = wineData[index];
return buildListItem(data);
},
)),
Row(
children: [
Expanded(
child: _callButton(
onPress: () {
Navigator.pop(context);
},
content: '返回',
hasLeftBorder: true,
isSelect: false)),
Expanded(
child: _callButton(
onPress: () {
List<Wine> selectData = [];
if (wineData.length > 0) {
String wineIds = "";
for (Wine item in wineData) {
if (item.select) {
item.finalPrice = item.finalPriceC.text;
item.numStr = item.numC.text;
selectData.add(item);
wineIds += item.wineId + ",";
}
}
if (wineIds.length > 0) {
wineIds =
wineIds.substring(0, wineIds.length - 1);
}
Map temp = {
'object': selectData,
'wineIds': wineIds
};
Navigator.of(context).pop(temp);
}
},
content: '保存并返回',
hasLeftBorder: true,
isSelect: true))
],
)
],
)
],
));
);
}
}));
}
}
... ...
... ... @@ -45,8 +45,7 @@ class _FeastDishPageState extends State<FeastDishPage> {
}
///添加宴会套餐菜品分类
_setSetmealCook(String name, String numStr, String per, String trim,
{String cookid}) async {
_setSetmealCook(String name, String per, String trim, {String cookid}) async {
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
'cname': name,
... ... @@ -54,7 +53,7 @@ class _FeastDishPageState extends State<FeastDishPage> {
'cid': widget.classId,
'spec': per,
'is_trim': trim,
'num': numStr
// 'num': numStr
};
if (cookid != null) {
params['id'] = cookid;
... ... @@ -103,10 +102,10 @@ class _FeastDishPageState extends State<FeastDishPage> {
String per = map['per'];
String name = map['name'];
String can = map['can'];
String numStr = map['num'];
// String numStr = map['num'];
print(can);
_setSetmealCook(name, numStr, per, can);
_setSetmealCook(name, per, can);
});
},
text: '添加一项',
... ... @@ -164,10 +163,10 @@ class _FeastDishPageState extends State<FeastDishPage> {
can: cook.isTrim == '1' ? true : false, onTap: (Map map) {
String per = map['per'];
String name = map['name'];
String numStr = map['num'];
// String numStr = map['num'];
String can = map['can'];
print(can);
_setSetmealCook(name, numStr, per, can, cookid: cook.id);
_setSetmealCook(name, per, can, cookid: cook.id);
});
},
child: Text(
... ...
... ... @@ -50,7 +50,7 @@ class _FeastOthersetManagePageState extends State<FeastOthersetManagePage> {
super.dispose();
}
///获取宴会分类
///获取其他配置
Future<bool> _getOthersetList({bool isShowLoading = true}) async {
await feastModel.getOthersetList(context, isShowLoading: isShowLoading);
}
... ...
... ... @@ -50,7 +50,7 @@ class _FeastWineManagePageState extends State<FeastWineManagePage> {
super.dispose();
}
///获取宴会分类
///获取酒水
Future<bool> _getWine({bool isShowLoading = true}) async {
await feastModel.getWine(context, isShowLoading: isShowLoading);
}
... ...
... ... @@ -14,6 +14,7 @@ import '../models/get_setmeal_class_by_id_model.dart';
import '../models/get_staff_model.dart';
import '../models/otherset_model.dart';
import '../models/personnel_manage_model.dart';
import '../models/set_xuan_tai_model.dart';
import '../models/setmeal_by_id_model.dart';
import '../models/setmeal_model.dart';
import '../models/wine_model.dart';
... ... @@ -61,6 +62,9 @@ class FeastModel extends ChangeNotifier {
PageState pageStateMenu = PageState.Loading; //调菜
String rid; //宴会id
String reserve; //宴会预订人
String type; //宴会类型
/***
*
... ... @@ -82,6 +86,22 @@ class FeastModel extends ChangeNotifier {
if (baseResp.code == Constant.status_success) {
// if (baseResp.data == 1) {
rid = baseResp.data['id'];
reserve = baseResp.data['rname'];
dynamic sex = baseResp.data['sex'];
if (sex.toString() == '1') {
reserve += '先生';
} else if (sex.toString() == '2') {
reserve += '女士';
} else if (sex.toString() == '3') {
reserve += '公司';
}
classifyData.forEach((element) {
if (element.id == baseResp.data['classify_id'].toString()) {
type = element.className;
}
});
return true;
// } else {
// return false;
... ... @@ -122,6 +142,33 @@ class FeastModel extends ChangeNotifier {
}
}
///调菜
Future<dynamic> setBanquetInfoCook(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.set_banquet_info_cook,
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;
// }
} else {
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
}
/***
*
* 宴会员工
... ... @@ -763,7 +810,6 @@ class FeastModel extends ChangeNotifier {
if (setMeaByIdModel.ret == Constant.status_success) {
setmealDetail = setMeaByIdModel.data;
if (setmealDetail.classify != null && setmealDetail.classify.length > 0) {
} else {
pageStateMenu = PageState.Empty;
}
... ...
... ... @@ -19,6 +19,7 @@ import 'package:provider/provider.dart';
import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
import '../app.dart';
import '../models/set_xuan_tai_model.dart';
class UserModel with ChangeNotifier {
User _user;
... ... @@ -27,6 +28,8 @@ class UserModel with ChangeNotifier {
List<PullMarketingByUidSunModel> pullMarketingByUidSunModel;
// bool accountLogin = false;
List<Setmeal> justSelData = [];
User get user => _user;
set registrationId(String registrationId) => _registrationId = registrationId;
... ...
... ... @@ -866,38 +866,51 @@ class NavigatorUtil {
}
///宴会----调菜
static Future<dynamic> goFeastMenuPage(
BuildContext context,
String setmealId, {
replace = false,
bool onlyShow = false,
}) {
return _navigateTo(
context, "${Routes.feast_menu_page}?setmealId=$setmealId",
static Future<dynamic> goFeastMenuPage(BuildContext context, String setmealId,
{replace = false, bool onlyShow = false, Map justSelData}) {
if (justSelData == null) {
return _navigateTo(
context, "${Routes.feast_menu_page}?setmealId=$setmealId",
replace: replace);
}
return _navigateTo(context,
"${Routes.feast_menu_page}?setmealId=$setmealId&object=${FluroConvertUtils.object2string(justSelData)}",
replace: replace);
}
///宴会----添加套餐
static Future<dynamic> goFeastSetmealPage(BuildContext context,
static Future<dynamic> goFeastSetmealPage(
BuildContext context, String dateData,
{replace = false, bool onlyShow = false, Map justSelData}) {
if (justSelData != null) {
if (justSelData == null) {
return _navigateTo(context,
"${Routes.feast_setmeal_page}?object=${FluroConvertUtils.object2string(justSelData)}",
"${Routes.feast_setmeal_page}?dateData=${Uri.encodeComponent(dateData)}",
replace: replace);
}
return _navigateTo(context, "${Routes.feast_setmeal_page}",
return _navigateTo(context,
"${Routes.feast_setmeal_page}?object=${FluroConvertUtils.object2string(justSelData)}&dateData=${Uri.encodeComponent(dateData)}",
replace: replace);
}
///宴会----添加酒水
static Future<dynamic> goFeastWinePage(BuildContext context,
{replace = false, bool onlyShow = false}) {
{replace = false, bool onlyShow = false, Map justSelData}) {
if (justSelData != null) {
return _navigateTo(context,
"${Routes.feast_wine_page}?object=${FluroConvertUtils.object2string(justSelData)}",
replace: replace);
}
return _navigateTo(context, "${Routes.feast_wine_page}", replace: replace);
}
///宴会----添加配置
static Future<dynamic> goFeastSetPage(BuildContext context,
{replace = false, bool onlyShow = false}) {
{replace = false, bool onlyShow = false, Map justSelData}) {
if (justSelData != null) {
return _navigateTo(context,
"${Routes.feast_set_page}?object=${FluroConvertUtils.object2string(justSelData)}",
replace: replace);
}
return _navigateTo(context, "${Routes.feast_set_page}", replace: replace);
}
... ... @@ -1021,4 +1034,18 @@ class NavigatorUtil {
// object = {'object': [], "tid": ''};
return _navigateTo(context, "${Routes.feast_select_table_page}?tid=$tid");
}
///宴会----菜单信息
static Future<dynamic> goFeastMenuShowPage(BuildContext context,
String setmealId, String mealName, String dateData, String needtable,
{replace = false, bool onlyShow = false, Map justSelData}) {
if (justSelData == null) {
return _navigateTo(context,
"${Routes.feast_menu_show_page}?setmealId=$setmealId&mealName=${Uri.encodeComponent(mealName)}&dateData=${Uri.encodeComponent(dateData)}&needtable=${Uri.encodeComponent(needtable)}",
replace: replace);
}
return _navigateTo(context,
"${Routes.feast_menu_show_page}?setmealId=$setmealId&object=${FluroConvertUtils.object2string(justSelData)}&mealName=${Uri.encodeComponent(mealName)}&dateData=${Uri.encodeComponent(dateData)}&needtable=${Uri.encodeComponent(needtable)}",
replace: replace);
}
}
... ...
... ... @@ -148,6 +148,7 @@ import 'package:one_key/utils/utils.dart';
import 'package:provider/provider.dart';
import '../models/set_xuan_tai_model.dart';
import '../models/setmeal_by_id_model.dart';
import '../pages/feast/feast_board.dart';
import '../pages/feast/feast_create_page.dart';
import '../pages/feast/feast_deposit_data_page.dart';
... ... @@ -155,6 +156,7 @@ import '../pages/feast/feast_deposit_page.dart';
import '../pages/feast/feast_followup_page.dart';
import '../pages/feast/feast_invoice_page.dart';
import '../pages/feast/feast_menu_page.dart';
import '../pages/feast/feast_menu_show_page.dart';
import '../pages/feast/feast_set_page.dart';
import '../pages/feast/feast_setmeal_page.dart';
import '../pages/feast/feast_wine_page.dart';
... ... @@ -1382,14 +1384,32 @@ var feastMenuPageHandle = new Handler(
// bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first);
String setmealId = params["setmealId"].first;
Map<String, List<CookByIdSetmeal>> justSelData = {};
if (params.keys.contains('object')) {
Map object = FluroConvertUtils.string2map(params["object"].first);
Map<String, dynamic> temp = object['object'];
temp.forEach((key, value) {
List<CookByIdSetmeal> cook = [];
for (var item in value) {
cook.add(CookByIdSetmeal.fromJson(item));
}
justSelData[key] = cook;
});
}
return ChangeNotifierProvider<FeastModel>(
create: (_) => FeastModel(), child: FeastMenuPage(setmealId: setmealId));
create: (_) => FeastModel(),
child: FeastMenuPage(
setmealId: setmealId,
justSelData: justSelData,
));
});
///宴会----添加套餐
var feastSetmealPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// String uids = params["uids"].first;
String dateData = params["dateData"].first;
List<Setmeal> justSelData = [];
if (params.keys.contains('object')) {
Map object = FluroConvertUtils.string2map(params["object"].first);
... ... @@ -1402,27 +1422,43 @@ var feastSetmealPageHandle = new Handler(
// bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first);
return ChangeNotifierProvider<FeastModel>(
create: (_) => FeastModel(),
child: FeastSetmealPage(justSelData: justSelData));
child: FeastSetmealPage(justSelData: justSelData, dateData: dateData));
});
///宴会----添加酒水
var feastWinePageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// String uids = params["uids"].first;
List<Wine> justSelData = [];
if (params.keys.contains('object')) {
Map object = FluroConvertUtils.string2map(params["object"].first);
List temp = object['object'];
// bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first);
for (var item in temp) {
justSelData.add(Wine.fromJson(item));
}
}
return ChangeNotifierProvider<FeastModel>(
create: (_) => FeastModel(), child: FeastWinePage());
create: (_) => FeastModel(),
child: FeastWinePage(justSelData: justSelData));
});
///宴会----添加配置
var feastSetPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// String uids = params["uids"].first;
List<Other> justSelData = [];
if (params.keys.contains('object')) {
Map object = FluroConvertUtils.string2map(params["object"].first);
List temp = object['object'];
// bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first);
for (var item in temp) {
justSelData.add(Other.fromJson(item));
}
}
return ChangeNotifierProvider<FeastModel>(
create: (_) => FeastModel(), child: FeastSetPage());
create: (_) => FeastModel(),
child: FeastSetPage(
justSelData: justSelData,
));
});
///宴会----添加发票
... ... @@ -1621,3 +1657,38 @@ var feastSelectTablePageHandle = new Handler(
create: (_) => ChooseTableModel(),
child: FeastSelectTablePage(tableList: res, tid: tid));
});
///宴会----菜单信息
var feastMenuShowPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// String uids = params["uids"].first;
// bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first);
String setmealId = params["setmealId"].first;
String mealName = params["mealName"].first;
String dateData = params["dateData"].first;
String needtable = params["needtable"].first;
Map<String, List<CookByIdSetmeal>> justSelData = {};
if (params.keys.contains('object')) {
Map object = FluroConvertUtils.string2map(params["object"].first);
Map<String, dynamic> temp = object['object'];
temp.forEach((key, value) {
List<CookByIdSetmeal> cook = [];
for (var item in value) {
cook.add(CookByIdSetmeal.fromJson(item));
}
justSelData[key] = cook;
});
}
return ChangeNotifierProvider<FeastModel>(
create: (_) => FeastModel(),
child: FeastMenuShowPage(
setmealId: setmealId,
justSelData: justSelData,
mealName: mealName,
dateData: dateData,
needtable: needtable,
));
});
... ...
... ... @@ -149,6 +149,9 @@ class Routes {
"/feast_deposit_data_page"; //宴会-----定金数据
static String feast_select_table_page =
"/feast_select_table_page"; //宴会-----新建宴会---选择桌位
static String feast_menu_show_page =
"/feast_menu_show_page"; //宴会-----新建宴会---菜单信息
static void configureRoutes(FluroRouter router) {
router.notFoundHandler = new Handler(
... ... @@ -300,6 +303,8 @@ class Routes {
router.define(feast_deposit_data_page, handler: feastDepositDataPageHandle);
router.define(feast_select_table_page, handler: feastSelectTablePageHandle);
router.define(feast_menu_show_page, handler: feastMenuShowPageHandle);
}
}
... ...
... ... @@ -788,54 +788,54 @@ class DialogUtil {
))
])),
VEmptyView(32),
Padding(
padding: EdgeInsets.symmetric(horizontal: w(16)),
child: Row(children: [
Text(
'菜品数量',
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_000000),
),
HEmptyView(24),
Expanded(
child: Container(
height: ScreenUtil().setWidth(48 * 2),
decoration: BoxDecoration(
color: MyColours.color_f3f3f3,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(8))),
padding:
EdgeInsets.symmetric(horizontal: w(12)),
child: TextField(
controller: numC,
maxLines: 1,
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_515151),
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
bottom: ScreenUtil()
.setWidth(40)), //设置文字内容与边框距离
// Padding(
// padding: EdgeInsets.symmetric(horizontal: w(16)),
// child: Row(children: [
// Text(
// '菜品数量',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(32),
// color: MyColours.color_000000),
// ),
// HEmptyView(24),
// Expanded(
// child: Container(
// height: ScreenUtil().setWidth(48 * 2),
// decoration: BoxDecoration(
// color: MyColours.color_f3f3f3,
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(8))),
// padding:
// EdgeInsets.symmetric(horizontal: w(12)),
// child: TextField(
// controller: numC,
// maxLines: 1,
// style: TextStyle(
// fontSize: ScreenUtil().setSp(32),
// color: MyColours.color_515151),
// decoration: InputDecoration(
// contentPadding: EdgeInsets.only(
// bottom: ScreenUtil()
// .setWidth(40)), //设置文字内容与边框距离
border: OutlineInputBorder(
borderSide: BorderSide.none),
hintText: '请输入',
hintStyle: TextStyle(
color: MyColours.color_66000000,
fontSize: ScreenUtil().setSp(32),
),
),
onChanged: (value) {},
onEditingComplete: () {
FocusScope.of(context).requestFocus(
FocusNode()); //点击空白处隐藏键盘
},
keyboardType: TextInputType.text,
),
))
])),
VEmptyView(32),
// border: OutlineInputBorder(
// borderSide: BorderSide.none),
// hintText: '请输入',
// hintStyle: TextStyle(
// color: MyColours.color_66000000,
// fontSize: ScreenUtil().setSp(32),
// ),
// ),
// onChanged: (value) {},
// onEditingComplete: () {
// FocusScope.of(context).requestFocus(
// FocusNode()); //点击空白处隐藏键盘
// },
// keyboardType: TextInputType.text,
// ),
// ))
// ])),
// VEmptyView(32),
Padding(
padding: EdgeInsets.symmetric(horizontal: w(16)),
child: Row(children: [
... ... @@ -987,7 +987,7 @@ class DialogUtil {
onTap({
'name': nameC.text,
'per': perC.text,
'num':numC.text,
'num': numC.text,
'can': can ? '1' : '0'
});
Navigator.pop(context, {
... ...