Commit 9d88bc8b618f13b03414a63d135e2456d96db361

Authored by wdn127929
1 parent 2f19a30f

菜单管理okok

import 'package:json_annotation/json_annotation.dart';
part 'cookbook_one_model.g.dart';
@JsonSerializable()
class CookbookOneModel extends Object {
@JsonKey(name: 'ret')
int ret;
@JsonKey(name: 'data')
Data data;
@JsonKey(name: 'msg')
String msg;
CookbookOneModel(
this.ret,
this.data,
this.msg,
);
factory CookbookOneModel.fromJson(Map<String, dynamic> srcJson) =>
_$CookbookOneModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$CookbookOneModelToJson(this);
}
@JsonSerializable()
class Data extends Object {
@JsonKey(name: 'data')
CookbookOneSunModel data;
Data(
this.data,
);
factory Data.fromJson(Map<String, dynamic> srcJson) =>
_$DataFromJson(srcJson);
Map<String, dynamic> toJson() => _$DataToJson(this);
}
@JsonSerializable()
class CookbookOneSunModel extends Object {
@JsonKey(name: 'id')
String id;
@JsonKey(name: 'sellerid')
String sellerid;
@JsonKey(name: 'cid')
String cid;
@JsonKey(name: 'unit')
String unit;
@JsonKey(name: 'name')
String name;
@JsonKey(name: 'price')
String price;
@JsonKey(name: 'first_name')
String firstName;
@JsonKey(name: 'channel')
String channel;
@JsonKey(name: 'status')
String status;
@JsonKey(name: 'give')
String give;
@JsonKey(name: 'image')
String image;
@JsonKey(name: 'order_o')
String orderO;
@JsonKey(name: 'cdate')
String cdate;
@JsonKey(name: 'class_name')
String className;
@JsonKey(name: 'class_order')
String classOrder;
@JsonKey(name: 'attr')
List<dynamic> attr;
@JsonKey(name: 'spec')
List<dynamic> spec;
@JsonKey(name: 'practice')
List<dynamic> practice;
// @JsonKey(name: 'template')
// Template template;
CookbookOneSunModel(
this.id,
this.sellerid,
this.cid,
this.unit,
this.name,
this.price,
this.firstName,
this.channel,
this.status,
this.give,
this.image,
this.orderO,
this.cdate,
this.className,
this.classOrder,
this.attr,
this.spec,
this.practice,
// this.template,
);
factory CookbookOneSunModel.fromJson(Map<String, dynamic> srcJson) =>
_$CookbookOneSunModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$CookbookOneSunModelToJson(this);
}
// @JsonSerializable()
// class Template extends Object {
// @JsonKey(name: 'templateid')
// String templateid;
// Template(
// this.templateid,
// );
// factory Template.fromJson(Map<String, dynamic> srcJson) =>
// _$TemplateFromJson(srcJson);
// Map<String, dynamic> toJson() => _$TemplateToJson(this);
// }
... ...
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'cookbook_one_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
CookbookOneModel _$CookbookOneModelFromJson(Map<String, dynamic> json) {
return CookbookOneModel(
json['ret'] as int,
json['data'] == null
? null
: Data.fromJson(json['data'] as Map<String, dynamic>),
json['msg'] as String,
);
}
Map<String, dynamic> _$CookbookOneModelToJson(CookbookOneModel instance) =>
<String, dynamic>{
'ret': instance.ret,
'data': instance.data,
'msg': instance.msg,
};
Data _$DataFromJson(Map<String, dynamic> json) {
return Data(
json['data'] == null
? null
: CookbookOneSunModel.fromJson(json['data'] as Map<String, dynamic>),
);
}
Map<String, dynamic> _$DataToJson(Data instance) => <String, dynamic>{
'data': instance.data,
};
CookbookOneSunModel _$CookbookOneSunModelFromJson(Map<String, dynamic> json) {
return CookbookOneSunModel(
json['id'] as String,
json['sellerid'] as String,
json['cid'] as String,
json['unit'] as String,
json['name'] as String,
json['price'] as String,
json['first_name'] as String,
json['channel'] as String,
json['status'] as String,
json['give'] as String,
json['image'] as String,
json['order_o'] as String,
json['cdate'] as String,
json['class_name'] as String,
json['class_order'] as String,
json['attr'] as List,
json['spec'] as List,
json['practice'] as List,
// json['template'] == null
// ? null
// : (json['template'] is Map)
// ? Template.fromJson(json['template'] as Map<String, dynamic>)
// : '',
);
}
Map<String, dynamic> _$CookbookOneSunModelToJson(
CookbookOneSunModel instance) =>
<String, dynamic>{
'id': instance.id,
'sellerid': instance.sellerid,
'cid': instance.cid,
'unit': instance.unit,
'name': instance.name,
'price': instance.price,
'first_name': instance.firstName,
'channel': instance.channel,
'status': instance.status,
'give': instance.give,
'image': instance.image,
'order_o': instance.orderO,
'cdate': instance.cdate,
'class_name': instance.className,
'class_order': instance.classOrder,
'attr': instance.attr,
'spec': instance.spec,
'practice': instance.practice,
// 'template': instance.template,
};
// Template _$TemplateFromJson(Map<String, dynamic> json) {
// return Template(
// json['templateid'] as String,
// );
// }
// Map<String, dynamic> _$TemplateToJson(Template instance) => <String, dynamic>{
// 'templateid': instance.templateid,
// };
... ...
... ... @@ -150,5 +150,7 @@ class HttpUrl {
static const String add_cookbook = "?service=App.Cookbook.AddCookbook"; //添加菜品
static const String get_spec_by_sellerid =
"?service=App.Cookbook.GetSpecBySellerid"; //获取商家计价单位
static const String get_cookbook_by_id =
"?service=App.Cookbook.GetCookbookById"; // 获取单个菜品信息
}
... ...
... ... @@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_native_image/flutter_native_image.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:image_picker/image_picker.dart';
import 'package:one_key/models/cookbook_model.dart';
import 'package:one_key/models/upload_img_model.dart';
import 'package:one_key/provider/menu_provider.dart';
import 'package:one_key/provider/upload_img_provider.dart';
... ... @@ -28,7 +29,9 @@ import 'package:provider/provider.dart';
* 添加菜品页面
*/
class MenuAddDishesPage extends StatefulWidget {
MenuAddDishesPage({Key key}) : super(key: key);
final bool isNew;
final String idstr;
MenuAddDishesPage({Key key, this.isNew, this.idstr}) : super(key: key);
@override
_MenuAddDishesPageState createState() => _MenuAddDishesPageState();
... ... @@ -60,9 +63,37 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
_getQiniuInfo();
_getCookbookBySellerId(showLoading: false);
_getSpecBySellerid();
if (!widget.isNew) {
_getCookbookById();
}
});
}
///获取单个菜品信息
_getCookbookById({bool showLoading = false}) async {
Map<String, String> params = {
"id": widget.idstr,
};
await menuManageProvider.getCookbookById(context, params,
showLoading: showLoading);
if (menuManageProvider.cookbookOneSunModel != null) {
_nameController.text = menuManageProvider.cookbookOneSunModel.name;
swichState =
menuManageProvider.cookbookOneSunModel.status == '1' ? true : false;
_priceController.text = menuManageProvider.cookbookOneSunModel.price;
categoryStr = menuManageProvider.cookbookOneSunModel.className;
specStr = menuManageProvider.cookbookOneSunModel.unit;
if (menuManageProvider.cookbookOneSunModel.image != null &&
menuManageProvider.cookbookOneSunModel.image != 'null' &&
menuManageProvider.cookbookOneSunModel.image != '') {
uploadImageProvider.dish.qiniuUrl =
menuManageProvider.cookbookOneSunModel.image;
}
setState(() {});
}
}
///计价方式
_getSpecBySellerid({bool showLoading = false}) async {
Map<String, String> params = {
... ...
... ... @@ -42,6 +42,7 @@ class _MenuCategoryPageState extends State<MenuCategoryPage> {
bool sucess = await menuManageProvider.addCookbookClass(context, params,
showLoading: showLoading);
if (sucess) {
EventBus().emit('menu_manage_page');
_getCookbookBySellerId(showLoading: false);
}
}
... ...
... ... @@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/cookbook_category_model.dart';
import 'package:one_key/models/cookbook_model.dart';
import 'package:one_key/provider/menu_provider.dart';
import 'package:one_key/provider/user_model.dart';
... ... @@ -30,14 +31,17 @@ class MenuManagePage extends StatefulWidget {
class _MenuManagePageState extends State<MenuManagePage> {
ScrollController _controller = ScrollController();
MenuManageProvider menuManageProvider;
bool isShow = false; //添加菜品按钮
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
_getCookbookByClass(showLoading: false);
_getCookbookBySellerId();
});
EventBus().on('menu_manage_page', (arg) {
_getCookbookByClass(showLoading: false);
_getCookbookBySellerId();
});
}
... ... @@ -48,6 +52,33 @@ class _MenuManagePageState extends State<MenuManagePage> {
EventBus().off('menu_manage_page');
}
///获取分类数据
_getCookbookBySellerId({bool showLoading = true}) async {
Map<String, String> params = {
"SellerId": Provider.of<UserModel>(context, listen: false).user.sellerid,
};
await menuManageProvider.getCookbookClassBySellerId(context, params,
showLoading: showLoading);
List<CookbookCategorySunModel> temp = [];
if (menuManageProvider.categorySunModel.length > 0) {
menuManageProvider.categorySunModel.forEach((element) {
if (element.className != '10道必点菜') {
temp.add(element);
}
});
}
if (temp.length == 0) {
setState(() {
isShow = false;
});
} else {
setState(() {
isShow = true;
});
}
}
_getCookbookByClass({bool showLoading = true}) async {
Map<String, String> params = {
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
... ... @@ -77,18 +108,71 @@ class _MenuManagePageState extends State<MenuManagePage> {
child: Consumer<MenuManageProvider>(
builder: (context, model, _) {
if (model.pageState != PageState.Success) {
return ExceptionPage(
pageState: model.pageState,
callback: () {
// offset = 0;
// getMessage(showLoading: true);
// _couponNetworkData();
_getCookbookByClass(showLoading: true);
},
emptyMsg: "菜品是空哒,快点击分类管理添加分类和菜品吧",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
return Column(children: [
Expanded(
child: ExceptionPage(
pageState: model.pageState,
callback: () {
// offset = 0;
// getMessage(showLoading: true);
// _couponNetworkData();
_getCookbookByClass(showLoading: true);
},
emptyMsg: "菜品是空哒,快点击分类管理添加分类和菜品吧",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
!isShow
? SizedBox()
: Padding(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
0,
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(40)),
child: RoundButton(
onPressed: () async {
await NavigatorUtil.goMenuAddDishesPage(
context);
},
text: '添加\n菜品',
fontSize: 26,
isBold: false,
height: ScreenUtil().setWidth(120),
width: ScreenUtil().setWidth(120),
radius: ScreenUtil().setWidth(60),
)),
Padding(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
0,
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(40)),
child: RoundButton(
onPressed: () async {
bool needRefresh =
await NavigatorUtil.goMenuCategoryPage(
context);
print(needRefresh);
if (needRefresh != null && needRefresh) {
//刷新页面数据
// _controller.callRefresh();
// _couponNetworkData();
}
},
text: '分类\n管理',
fontSize: 26,
isBold: false,
height: ScreenUtil().setWidth(120),
width: ScreenUtil().setWidth(120),
radius: ScreenUtil().setWidth(60),
))
],
)
]);
} else {
// double cellWidth = (MediaQuery.of(context).size.width -
// ScreenUtil().setWidth(40 * 2 + 15 * 2) / 2);
... ... @@ -160,95 +244,43 @@ class _MenuManagePageState extends State<MenuManagePage> {
ScreenUtil()
.setWidth(40 * 2 + 15 * 2)) /
2);
return model.image != null
? Stack(children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(
ScreenUtil()
.setWidth(
10))),
child: ClipRRect(
borderRadius: BorderRadius
.circular(ScreenUtil()
.setWidth(10)),
child: CachedNetworkImage(
imageUrl: model.image,
fit: BoxFit.cover,
width: cellWidth,
height: ScreenUtil()
.setWidth(210),
),
)),
VEmptyView(15),
Text(
model.name,
style: TextStyle(
color: MyColours
.color_333333,
fontSize: ScreenUtil()
.setSp(34),
fontWeight:
FontWeight.bold),
),
VEmptyView(20),
Text(
'${model.price}元/${model.unit}',
style: TextStyle(
color: MyColours
.color_333333,
fontSize: ScreenUtil()
.setSp(28),
))
],
),
Positioned(
bottom:
ScreenUtil().setWidth(14),
right:
ScreenUtil().setWidth(20),
child: model.status == '1'
? SizedBox()
: Image.asset(
Utils.getImgPath(
'stop-sell'),
width: ScreenUtil()
.setWidth(82),
height: ScreenUtil()
.setWidth(52),
)),
])
: Stack(children: [
Container(
width: cellWidth,
height:
ScreenUtil().setWidth(210),
decoration: BoxDecoration(
color: index % 2 == 0
? Color.fromRGBO(
247, 230, 230, 1)
: Color.fromRGBO(
234, 236, 252, 1),
borderRadius:
BorderRadius.circular(
ScreenUtil()
.setWidth(10))),
child: Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil()
.setWidth(20)),
child: Column(
return InkWell(
onTap: () async {
await NavigatorUtil
.goMenuAddDishesPage(context,
isNew: false,
idstr: model.id);
},
child: model.image != null
? Stack(children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(
ScreenUtil()
.setWidth(
10))),
child: ClipRRect(
borderRadius:
BorderRadius.circular(
ScreenUtil()
.setWidth(
10)),
child:
CachedNetworkImage(
imageUrl:
model.image,
fit: BoxFit.cover,
width: cellWidth,
height: ScreenUtil()
.setWidth(210),
),
)),
VEmptyView(15),
Text(
model.name,
style: TextStyle(
... ... @@ -259,7 +291,7 @@ class _MenuManagePageState extends State<MenuManagePage> {
fontWeight:
FontWeight.bold),
),
VEmptyView(40),
VEmptyView(20),
Text(
'${model.price}元/${model.unit}',
style: TextStyle(
... ... @@ -270,41 +302,113 @@ class _MenuManagePageState extends State<MenuManagePage> {
))
],
),
),
Positioned(
bottom: ScreenUtil()
.setWidth(14),
right: ScreenUtil()
.setWidth(20),
child: model.status == '1'
? SizedBox()
: Image.asset(
Utils.getImgPath(
'stop-sell'),
width: ScreenUtil()
.setWidth(82),
height: ScreenUtil()
.setWidth(52),
)),
])
: Stack(children: [
Container(
width: cellWidth,
height: ScreenUtil()
.setWidth(210),
// VEmptyView(15),
// Text(
// ' ',
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize:
// ScreenUtil().setSp(34),
// fontWeight: FontWeight.bold),
// ),
// VEmptyView(20),
// Text(' ',
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize:
// ScreenUtil().setSp(28),
// ))
),
Positioned(
bottom:
ScreenUtil().setWidth(46),
right:
ScreenUtil().setWidth(20),
child: model.status == '1'
? SizedBox()
: Image.asset(
Utils.getImgPath(
'stop-sell'),
width: ScreenUtil()
.setWidth(82),
height: ScreenUtil()
.setWidth(52),
)),
]);
decoration: BoxDecoration(
color: index % 2 == 0
? Color.fromRGBO(
247, 230, 230, 1)
: Color.fromRGBO(
234, 236, 252, 1),
borderRadius: BorderRadius
.circular(ScreenUtil()
.setWidth(10))),
child: Container(
padding:
EdgeInsets.symmetric(
horizontal:
ScreenUtil()
.setWidth(
20)),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
Text(
model.name,
style: TextStyle(
color: MyColours
.color_333333,
fontSize:
ScreenUtil()
.setSp(
34),
fontWeight:
FontWeight
.bold),
),
VEmptyView(40),
Text(
'${model.price}元/${model.unit}',
style: TextStyle(
color: MyColours
.color_333333,
fontSize:
ScreenUtil()
.setSp(
28),
))
],
),
),
// VEmptyView(15),
// Text(
// ' ',
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize:
// ScreenUtil().setSp(34),
// fontWeight: FontWeight.bold),
// ),
// VEmptyView(20),
// Text(' ',
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize:
// ScreenUtil().setSp(28),
// ))
),
Positioned(
bottom: ScreenUtil()
.setWidth(46),
right: ScreenUtil()
.setWidth(20),
child: model.status == '1'
? SizedBox()
: Image.asset(
Utils.getImgPath(
'stop-sell'),
width: ScreenUtil()
.setWidth(82),
height: ScreenUtil()
.setWidth(52),
)),
]));
},
staggeredTileBuilder: (int index) =>
new StaggeredTile.count(
... ... @@ -327,7 +431,7 @@ class _MenuManagePageState extends State<MenuManagePage> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
model.pageState == PageState.Empty
!isShow
? SizedBox()
: Padding(
padding: EdgeInsets.fromLTRB(
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/seller_table_class_entity.dart';
import 'package:one_key/provider/store_detail_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/widgets/page_exception.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
... ... @@ -50,6 +52,13 @@ class _RoomTypeManagePageState extends State<RoomTypeManagePage> {
// tables.any((element) => element.isFull == 1);
// rooms.clear();
if (tables == null) {
detailModel.pageState = PageState.ConnectivityTimeOut;
} else if (tables.length > 0) {
detailModel.pageState = PageState.Success;
} else if (tables.length == 0) {
detailModel.pageState = PageState.Empty;
}
setState(() {});
}
... ... @@ -79,114 +88,142 @@ class _RoomTypeManagePageState extends State<RoomTypeManagePage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
VEmptyView(20),
Selector<StoreDetailModel,
List<SellerTableClassEntity>>(
shouldRebuild: (pre, next) => true,
selector: (context, model) => model.tables,
builder: (context, tables, child) {
return GridView.builder(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing:
ScreenUtil().setWidth(20),
crossAxisSpacing:
ScreenUtil().setWidth(30),
childAspectRatio: 2.4),
itemBuilder: (context, index) {
return GestureDetector(
onTap: () async {
NavigatorUtil.goRoomTypeCreatePage(context,
isNew: false,
tableClassId: tables[index].id);
},
child: Stack(
children: [
Container(
height: ScreenUtil().setWidth(140),
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(30)),
decoration: BoxDecoration(
color: tables[index].status == '1'
? MyColours.color_A9E3E6
: MyColours.color_f5f5f5,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10)),
border: Border.all(
child: Consumer<StoreDetailModel>(
builder: (context, model, _) {
if (model.pageState != PageState.Success) {
return ExceptionPage(
pageState: model.pageState,
callback: () {
// offset = 0;
// getMessage(showLoading: true);
// _couponNetworkData();
// _getCookbookByClass(showLoading: true);
_getSellerTableClass();
},
emptyMsg: "包间类型是空哒,快来添加类型吧",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return SingleChildScrollView(
child: Column(
children: [
VEmptyView(20),
Selector<StoreDetailModel,
List<SellerTableClassEntity>>(
shouldRebuild: (pre, next) => true,
selector: (context, model) => model.tables,
builder: (context, tables, child) {
return GridView.builder(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing:
ScreenUtil().setWidth(20),
crossAxisSpacing:
ScreenUtil().setWidth(30),
childAspectRatio: 2.4),
itemBuilder: (context, index) {
return GestureDetector(
onTap: () async {
NavigatorUtil.goRoomTypeCreatePage(
context,
isNew: false,
tableClassId: tables[index].id);
},
child: Stack(
children: [
Container(
height: ScreenUtil().setWidth(140),
padding: EdgeInsets.only(
left:
ScreenUtil().setWidth(30)),
decoration: BoxDecoration(
color: tables[index].status == '1'
? MyColours.color_199095
: MyColours.color_E0E0E0,
width: ScreenUtil().setWidth(2)),
),
alignment: Alignment.centerLeft,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Text("${tables[index].name}",
style: TextStyle(
fontSize:
ScreenUtil().setSp(30),
color:
MyColours.color_333333,
fontWeight:
FontWeight.bold)),
VEmptyView(10),
int.parse(tables[index].max ??
"0") >
0
? Text(
"最多可坐${tables[index].max}人",
? MyColours.color_A9E3E6
: MyColours.color_f5f5f5,
borderRadius:
BorderRadius.circular(
ScreenUtil()
.setWidth(10)),
border: Border.all(
color: tables[index].status ==
'1'
? MyColours.color_199095
: MyColours.color_E0E0E0,
width:
ScreenUtil().setWidth(2)),
),
alignment: Alignment.centerLeft,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Text("${tables[index].name}",
style: TextStyle(
fontSize: ScreenUtil()
.setSp(24),
.setSp(30),
color: MyColours
.color_333333,
fontWeight:
FontWeight.normal),
)
: Container(),
int.parse(tables[index].low ??
"0") >
0
? Text(
"最低消费${tables[index].low}元",
style: TextStyle(
fontSize: ScreenUtil()
.setSp(20),
color: MyColours
.color_199095,
fontWeight:
FontWeight.normal),
)
: Container()
],
),
),
tables[index].status != '1'
? Positioned(
bottom: -ScreenUtil().setWidth(0),
right: -ScreenUtil().setWidth(10),
child: Container(
padding: EdgeInsets.only(
bottom: ScreenUtil()
.setWidth(10)),
alignment:
Alignment.bottomCenter,
width:
ScreenUtil().setWidth(100),
height:
ScreenUtil().setWidth(74),
decoration: BoxDecoration(
borderRadius:
BorderRadius.only(
FontWeight.bold)),
VEmptyView(10),
int.parse(tables[index].max ??
"0") >
0
? Text(
"最多可坐${tables[index].max}人",
style: TextStyle(
fontSize:
ScreenUtil()
.setSp(24),
color: MyColours
.color_333333,
fontWeight:
FontWeight
.normal),
)
: Container(),
int.parse(tables[index].low ??
"0") >
0
? Text(
"最低消费${tables[index].low}元",
style: TextStyle(
fontSize:
ScreenUtil()
.setSp(20),
color: MyColours
.color_199095,
fontWeight:
FontWeight
.normal),
)
: Container()
],
),
),
tables[index].status != '1'
? Positioned(
bottom:
-ScreenUtil().setWidth(0),
right: -ScreenUtil()
.setWidth(10),
child: Container(
padding: EdgeInsets.only(
bottom: ScreenUtil()
.setWidth(10)),
alignment:
Alignment.bottomCenter,
width: ScreenUtil()
.setWidth(100),
height: ScreenUtil()
.setWidth(74),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft:
Radius.circular(
ScreenUtil()
... ... @@ -197,30 +234,33 @@ class _RoomTypeManagePageState extends State<RoomTypeManagePage> {
ScreenUtil()
.setWidth(
10))),
color: MyColours.color_d8d8d8,
),
child: Text(
'已停用',
style: TextStyle(
fontSize: ScreenUtil()
.setSp(24),
color: MyColours
.color_333333),
),
))
: SizedBox()
],
),
.color_d8d8d8,
),
child: Text(
'已停用',
style: TextStyle(
fontSize: ScreenUtil()
.setSp(24),
color: MyColours
.color_333333),
),
))
: SizedBox()
],
),
);
},
itemCount: tables.length,
shrinkWrap: true,
physics: new NeverScrollableScrollPhysics(),
);
},
itemCount: tables.length,
shrinkWrap: true,
physics: new NeverScrollableScrollPhysics(),
);
},
)
],
)),
)
],
));
}
}),
),
Padding(
padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0,
... ...
... ... @@ -106,6 +106,11 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> {
// if (_chooseTableModel.pageState == PageState.Success) {
// }
if (tableOuterList.length == 0 || tableOuterList == null) {
_chooseTableModel.pageState = PageState.Empty;
_chooseTableModel.notifyListeners();
return;
}
if (needLoading) {
initData();
} else {
... ... @@ -301,8 +306,8 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> {
widget.tableList
.add(tableToTableList(table).id);
} else {
widget.tableList.removeWhere(
(t) => t == table.id);
widget.tableList
.removeWhere((t) => t == table.id);
selectNum--;
... ... @@ -389,7 +394,7 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> {
));
}
TableList tableToTableList(t.Table table) {
TableList tableToTableList(t.Table table) {
TableList _tableList = TableList(
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
_tableList.id = table.id;
... ...
... ... @@ -4,6 +4,7 @@ import 'package:one_key/constant/error.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/cookbook_category_model.dart';
import 'package:one_key/models/cookbook_model.dart';
import 'package:one_key/models/cookbook_one_model.dart';
import 'package:one_key/models/cookbook_spec_model.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
... ... @@ -16,6 +17,26 @@ class MenuManageProvider extends ChangeNotifier {
List<MenuModel> menuModel; //菜品数据
List<CookbookCategorySunModel> categorySunModel; //菜品分类数据
List<CookbookSpecSunModel> specSunModel; //计价单位
CookbookOneSunModel cookbookOneSunModel;
/// 获取单个菜品信息
getCookbookById(BuildContext context, Map<String, String> params,
{showLoading = false}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.get_cookbook_by_id,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
});
if (baseResp != null && baseResp.code == Constant.status_success) {
cookbookOneSunModel =
CookbookOneModel.fromJson(baseResp.responseData).data.data;
} else {
Utils.showToast(baseResp.msg ?? "");
}
}
/// 获取商家计价单位
getSpecBySellerid(BuildContext context, Map<String, String> params,
{showLoading = false}) async {
... ...
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/seller_table_class_entity.dart';
import 'package:one_key/models/table_class_model.dart';
import 'package:one_key/models/table_fill_up_date_model.dart';
... ... @@ -15,6 +16,8 @@ class StoreDetailModel with ChangeNotifier {
List<SellerTableClassEntity> tables = []; //商家包间类型
TableClassSunModel tableClassSunModel;
PageState pageState = PageState.Loading;
///添加/修改包间分类
Future<bool> setTableClass(BuildContext context, Map<String, String> params,
{bool showLoading = false}) async {
... ...
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:one_key/models/cookbook_model.dart';
import 'package:one_key/models/coupon_model.dart';
import 'package:one_key/models/integral_model.dart';
import 'package:one_key/models/notebook.dart';
... ... @@ -415,8 +416,9 @@ class NavigatorUtil {
/// 添加菜品页面
static Future<dynamic> goMenuAddDishesPage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.menu_add_dishes_page}",
{replace = false, bool isNew = true, String idstr}) {
return _navigateTo(
context, "${Routes.menu_add_dishes_page}?isNew=$isNew&idstr=${idstr}",
replace: replace);
}
}
... ...
... ... @@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:one_key/models/cookbook_model.dart';
import 'package:one_key/models/coupon_model.dart';
import 'package:one_key/models/integral_model.dart';
import 'package:one_key/models/notebook_detail.dart';
... ... @@ -645,10 +646,16 @@ var menuCategoryPageHandle = new Handler(
///添加菜品
var menuAddDishesPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// SmsInfoData data = SmsInfoData.fromJson(json.decode(
// FluroConvertUtils.fluroCnParamsDecode(params["smsInfoData"].first)));
bool isNew = FluroConvertUtils.string2bool(params["isNew"].first);
if (isNew) {
return ChangeNotifierProvider<MenuManageProvider>(
create: (_) => MenuManageProvider(),
child: MenuAddDishesPage(isNew: isNew));
}
String idstr = params["idstr"].first;
return ChangeNotifierProvider<MenuManageProvider>(
create: (_) => MenuManageProvider(), child: MenuAddDishesPage());
create: (_) => MenuManageProvider(),
child: MenuAddDishesPage(isNew: isNew, idstr: idstr));
// return ChangeNotifierProvider<UploadImageProvider>(
// create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage());
});
... ...