Commit 8fc69a6de75ec1ec17a87fe64f0200c41d67e9d2

Authored by wdn127929
1 parent fb5a1aaf

菜单OK

import 'dart:convert' as convert;
class GetDzSellerConfModel {
int ret;
GetDzSellerConfSunModel data;
String msg;
GetDzSellerConfModel({this.ret, this.data, this.msg});
GetDzSellerConfModel.fromJson(Map<String, dynamic> json) {
ret = json['ret'];
data = json['data'] != null
? new GetDzSellerConfSunModel.fromJson(json['data'])
: null;
msg = json['msg'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ret'] = this.ret;
if (this.data != null) {
data['data'] = this.data.toJson();
}
data['msg'] = this.msg;
return data;
}
}
class GetDzSellerConfSunModel {
String id;
String sid;
String isSms;
String templateId;
String isOpenOrder;
String isOpenWine;
String dzVersion;
String isCheckedCall;
String isCheckedApp;
String isCheckedLite;
String reserveMode;
String isDisplayDish;
String isNewTemplate;
AllCookStyle cookStyle;
String cdate;
GetDzSellerConfSunModel(
{this.id,
this.sid,
this.isSms,
this.templateId,
this.isOpenOrder,
this.isOpenWine,
this.dzVersion,
this.isCheckedCall,
this.isCheckedApp,
this.isCheckedLite,
this.reserveMode,
this.isDisplayDish,
this.isNewTemplate,
this.cookStyle,
this.cdate});
GetDzSellerConfSunModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
sid = json['sid'];
isSms = json['is_sms'];
templateId = json['template_id'];
isOpenOrder = json['is_open_order'];
isOpenWine = json['is_open_wine'];
dzVersion = json['dz_version'];
isCheckedCall = json['is_checked_call'];
isCheckedApp = json['is_checked_app'];
isCheckedLite = json['is_checked_lite'];
reserveMode = json['reserve_mode'];
isDisplayDish = json['is_display_dish'];
isNewTemplate = json['is_new_template'];
cookStyle = AllCookStyle.fromJson(convert.json.decode(json['cook_style']));
cdate = json['cdate'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['sid'] = this.sid;
data['is_sms'] = this.isSms;
data['template_id'] = this.templateId;
data['is_open_order'] = this.isOpenOrder;
data['is_open_wine'] = this.isOpenWine;
data['dz_version'] = this.dzVersion;
data['is_checked_call'] = this.isCheckedCall;
data['is_checked_app'] = this.isCheckedApp;
data['is_checked_lite'] = this.isCheckedLite;
data['reserve_mode'] = this.reserveMode;
data['is_display_dish'] = this.isDisplayDish;
data['is_new_template'] = this.isNewTemplate;
data['cook_style'] = this.cookStyle;
data['cdate'] = this.cdate;
return data;
}
}
class AllCookStyle {
String menuThemeColor;
String index;
AllCookStyle({
this.menuThemeColor,
this.index,
});
AllCookStyle.fromJson(Map<String, dynamic> json) {
menuThemeColor = json['menu_theme_color'];
index = json['index'] ?? "0";
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['menu_theme_color'] = this.menuThemeColor;
data['index'] = this.index ?? '0';
return data;
}
}
... ...
... ... @@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:one_key/models/radio_model.dart';
import 'package:one_key/utils/utils.dart';
import 'dart:convert' as convert;
///菜单
class MenuModel {
... ... @@ -115,29 +117,29 @@ class MenuSunModel {
TextEditingController amountC = TextEditingController();
int moreSum = 0; //排菜编辑页展示选中总数
String nameType = '3'; //1左侧,2右侧,3顶部分开
String imageType = '1'; //1大图,2小图
// String nameType = '3'; //1左侧,2右侧,3顶部分开
// String imageType = '1'; //1大图,2小图
int sort;
int indexNew;
String taste;
String cooks;
String cookStyle;
DishCookStyle cookStyle;
//名称样式选择数组
List<RadioModel> get nameTypeList {
RadioModel radioModel1 = RadioModel();
radioModel1.title = '菜品名称(味型/烹调)及价格在顶部左侧';
radioModel1.code = '1';
radioModel1.select = nameType == radioModel1.code ? true : false;
radioModel1.select = cookStyle.nameType == radioModel1.code ? true : false;
RadioModel radioModel2 = RadioModel();
radioModel2.title = '菜品名称(味型/烹调)及价格在顶部右侧';
radioModel2.code = '2';
radioModel2.select = nameType == radioModel2.code ? true : false;
radioModel2.select = cookStyle.nameType == radioModel2.code ? true : false;
RadioModel radioModel3 = RadioModel();
radioModel3.title = '菜品名称(味型/烹调)及价格在顶部分开';
radioModel3.code = '3';
radioModel3.select = nameType == radioModel3.code ? true : false;
radioModel3.select = cookStyle.nameType == radioModel3.code ? true : false;
return [radioModel1, radioModel2, radioModel3];
}
... ... @@ -146,11 +148,11 @@ class MenuSunModel {
RadioModel radioModel1 = RadioModel();
radioModel1.title = '大图展示菜品';
radioModel1.code = '1';
radioModel1.select = imageType == radioModel1.code ? true : false;
radioModel1.select = cookStyle.imageType == radioModel1.code ? true : false;
RadioModel radioModel2 = RadioModel();
radioModel2.title = '小图展示菜品';
radioModel2.code = '2';
radioModel2.select = imageType == radioModel2.code ? true : false;
radioModel2.select = cookStyle.imageType == radioModel2.code ? true : false;
return [radioModel1, radioModel2];
}
... ... @@ -200,8 +202,6 @@ class MenuSunModel {
this.amount = 0,
this.cookList,
this.amountC,
this.nameType,
this.imageType,
this.sort,
this.taste,
this.cooks,
... ... @@ -263,14 +263,22 @@ class MenuSunModel {
}
// imageType = Utils.randomGet(1, 3) ?? '1';
// nameType = Utils.randomGet(1, 4) ?? '3';
imageType = name == '小炒肉' || name == '水煮肉片' || name == '西湖牛肉羹' ? '2' : '1';
nameType = '1';
// imageType = name == '小炒肉' || name == '水煮肉片' || name == '西湖牛肉羹' ? '2' : '1';
// nameType = '1';
sort = json['sort'];
taste = json['taste'];
cooks = json['cooks'];
cookStyle = json['cook_style'];
json['cook_style'] != null && json['cook_style'] != ''
? cookStyle = DishCookStyle.fromJson(json['cook_style'] is Map
? json['cook_style']
: convert.json.decode(json['cook_style']))
: cookStyle = DishCookStyle.fromJson({
// 'image_type': image != null && image != '' ? '1' : '2',
'image_type': '1',
'name_type': '3'
});
}
MenuSunModel.fromJson3(Map<String, dynamic> json) {
... ... @@ -328,7 +336,15 @@ class MenuSunModel {
}
taste = json['taste'];
cooks = json['cooks'];
cookStyle = json['cook_style'];
json['cook_style'] != null && json['cook_style'] != ''
? cookStyle = DishCookStyle.fromJson(json['cook_style'] is Map
? json['cook_style']
: convert.json.decode(json['cook_style']))
: cookStyle = DishCookStyle.fromJson({
// 'image_type': image != null && image != '' ? '1' : '2',
'image_type': '1',
'name_type': '3'
});
}
MenuSunModel.fromJson2(Map<String, dynamic> json) {
... ... @@ -386,7 +402,15 @@ class MenuSunModel {
}
taste = json['taste'];
cooks = json['cooks'];
cookStyle = json['cook_style'];
json['cook_style'] != null && json['cook_style'] != ''
? cookStyle = DishCookStyle.fromJson(json['cook_style'] is Map
? json['cook_style']
: convert.json.decode(json['cook_style']))
: cookStyle = DishCookStyle.fromJson({
// 'image_type': image != null && image != '' ? '1' : '2',
'image_type': '1',
'name_type': '3'
});
}
Map<String, dynamic> toJson() {
... ... @@ -511,3 +535,22 @@ class PracticeModel {
return data;
}
}
class DishCookStyle {
String imageType; //1大图,2小图
String nameType; //1左侧,2右侧,3顶部分开
DishCookStyle({this.imageType, this.nameType});
DishCookStyle.fromJson(Map<String, dynamic> json) {
imageType = json['image_type'];
nameType = json['name_type'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['image_type'] = this.imageType;
data['name_type'] = this.nameType;
return data;
}
}
... ...
import 'package:json_annotation/json_annotation.dart';
import 'package:one_key/models/cookbook_model.dart';
import 'dart:convert' as convert;
part 'cookbook_one_model.g.dart';
... ... @@ -107,36 +108,36 @@ class CookbookOneSunModel extends Object {
String cooks;
@JsonKey(name: 'cook_style')
String cookStyle;
DishCookStyle cookStyle;
@JsonKey(name: 'desc')
String desc;
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.taste,
this.cooks,
this.cookStyle,
this.desc
// this.template,
);
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.taste,
this.cooks,
this.cookStyle,
this.desc
// this.template,
);
factory CookbookOneSunModel.fromJson(Map<String, dynamic> srcJson) =>
_$CookbookOneSunModelFromJson(srcJson);
... ...
... ... @@ -64,7 +64,7 @@ CookbookOneSunModel _$CookbookOneSunModelFromJson(Map<String, dynamic> json) {
?.toList(),
json['taste'] as String,
json['cooks'] as String,
json['cook_style'] as String,
DishCookStyle.fromJson(convert.json.decode(json['cook_style'])),
json['desc'] as String,
);
}
... ...
... ... @@ -424,18 +424,13 @@ class HttpUrl {
static const String add_practice =
"?service=Android.Seller.AddPractice"; // 商家添加做法
static const String add_unit_value =
"?service=App.Seller.AddUnitValue"; // 添加商家计价单位
static const String del_unit_value =
"?service=App.Seller.DelUnitValue"; // 删除商家计价单位
static const String get_dz_seller_conf =
"?service=App.Seller.GetDzSellerConf"; // 获取商家订座配置
}
... ...
... ... @@ -740,16 +740,16 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> {
// onPressed: () {},
// )),
// VEmptyView(18),
Container(
height: w(28),
alignment: Alignment.center,
child: Text(
Provider.of<UserModel>(context, listen: false).user.sellername,
style:
TextStyle(fontSize: font(14), color: MyColours.color_515151),
),
),
VEmptyView(20)
// Container(
// height: w(28),
// alignment: Alignment.center,
// child: Text(
// Provider.of<UserModel>(context, listen: false).user.sellername,
// style:
// TextStyle(fontSize: font(14), color: MyColours.color_515151),
// ),
// ),
// VEmptyView(20)
]));
}
... ...
... ... @@ -1425,15 +1425,15 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> {
))
: SizedBox(),
VEmptyView(18),
Container(
height: w(28),
alignment: Alignment.center,
child: Text(
Provider.of<UserModel>(context, listen: false).user.sellername,
style: TextStyle(fontSize: font(14), color: MyColours.color_515151),
),
),
VEmptyView(20)
// Container(
// height: w(28),
// alignment: Alignment.center,
// child: Text(
// Provider.of<UserModel>(context, listen: false).user.sellername,
// style: TextStyle(fontSize: font(14), color: MyColours.color_515151),
// ),
// ),
// VEmptyView(20)
],
);
}
... ...
... ... @@ -47,11 +47,17 @@ class _MenuManagePageState extends State<MenuManagePage> {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
_getCookbookByClass(showLoading: false);
_getCookbookBySellerId();
_getDzSellerConf();
});
EventBus().on('menu_manage_page', (arg) {
_getCookbookByClass(showLoading: false);
_getCookbookBySellerId();
});
EventBus().on('menu_theme_color', (arg) {
print(arg);
themeColerModel1 = themeColorData[arg];
setState(() {});
});
}
@override
... ... @@ -59,6 +65,7 @@ class _MenuManagePageState extends State<MenuManagePage> {
// TODO: implement dispose
super.dispose();
EventBus().off('menu_manage_page');
EventBus().off('menu_theme_color');
}
///初始化主题颜色
... ... @@ -99,7 +106,15 @@ class _MenuManagePageState extends State<MenuManagePage> {
colorModel4.name = '国风绿';
colorModel4.color = MyColours.color_3E6F51;
themeColorData.add(colorModel4);
themeColerModel1 = themeColorData[4];
themeColerModel1 = themeColorData[0];
}
_getDzSellerConf() async {
bool success = await menuManageProvider.getDzSellerConf(context);
if (success) {
themeColerModel1 = themeColorData[
int.parse(menuManageProvider.dzSellerConfModel.cookStyle.index)];
}
}
///获取分类数据
... ... @@ -175,7 +190,7 @@ class _MenuManagePageState extends State<MenuManagePage> {
j++) {
MenuSunModel menuSunModel =
menuManageProvider.menuModel[i].cookbooklist[j];
if (menuSunModel.imageType == '1') {
if (menuSunModel.cookStyle.imageType == '1') {
//大图
menuSunModel.indexNew = j;
listSub.add(menuSunModel);
... ... @@ -184,7 +199,7 @@ class _MenuManagePageState extends State<MenuManagePage> {
//判断下一个是大图还是小图
if (menuManageProvider.menuModel[i].cookbooklist.length - 1 > j) {
if (menuManageProvider
.menuModel[i].cookbooklist[j + 1].imageType ==
.menuModel[i].cookbooklist[j + 1].cookStyle.imageType ==
'1') {
//下一个是大图
menuSunModel.indexNew = j;
... ... @@ -645,15 +660,15 @@ class _MenuManagePageState extends State<MenuManagePage> {
if (object['name_type'] != null) {
//有一个选中
model.nameType = object['name_type'];
model.cookStyle.nameType = object['name_type'];
} else {
//全部不选择
model.nameType = null;
model.cookStyle.nameType = null;
}
if (object['image_type'] != null) {
model.imageType = object['image_type'];
model.cookStyle.imageType = object['image_type'];
} else {
model.imageType = null;
model.cookStyle.imageType = null;
}
if (object['move'] != null) {
if (object['move'] == '1' && model.indexNew != 0) {
... ... @@ -685,8 +700,7 @@ class _MenuManagePageState extends State<MenuManagePage> {
Map cookStyle = {
'name_type': object['name_type'],
'image_type': '',
'sort': ''
'image_type': object['image_type'],
};
_setCookbookById(model.id, cookStyle);
}
... ... @@ -887,7 +901,7 @@ class _MenuManagePageState extends State<MenuManagePage> {
.menuModel[indexOut]
.cookbooklistShow[index];
if (model.imageType == '2') {
if (model.cookStyle.imageType == '2') {
//小图
return GestureDetector(
onTap: () async {
... ... @@ -947,13 +961,18 @@ class _MenuManagePageState extends State<MenuManagePage> {
bottom: (w(2))),
child: Column(
crossAxisAlignment: model
.cookStyle
.imageType !=
'2' &&
model.nameType == '1'
model.cookStyle
.nameType ==
'1'
? CrossAxisAlignment.start
: model.imageType !=
: model.cookStyle
.imageType !=
'2' &&
model.nameType ==
model.cookStyle
.nameType ==
'2'
? CrossAxisAlignment
.end
... ... @@ -967,20 +986,23 @@ class _MenuManagePageState extends State<MenuManagePage> {
left: w(20),
right: w(20),
bottom: w(15)),
child: model.imageType !=
child: model.cookStyle
.imageType !=
'2' &&
model.nameType ==
model.cookStyle
.nameType ==
'3'
? _topBetween(model)
: model.imageType !=
: model.cookStyle.imageType !=
'2' &&
model.nameType ==
model.cookStyle
.nameType ==
'2'
? _topRight(
model)
: model.imageType !=
: model.cookStyle.imageType !=
'2' &&
model.nameType ==
model.cookStyle.nameType ==
'1'
? _topLeft(
model)
... ...
... ... @@ -28,6 +28,7 @@ import '../../../../widgets/MyDivider.dart';
import '../../../../widgets/round_button.dart';
import '../../../constant/state.dart';
import '../../../models/cookbook_model.dart';
import '../../../utils/event_bus.dart';
import '../../../widgets/h_empty_view.dart';
import '../../../widgets/page_exception.dart';
import '../../online_check/photo_view_wiget.dart';
... ... @@ -60,6 +61,8 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
List<MenuModel> menuModelTemp = [];
MenuManageProvider menuManageProvider;
@override
void initState() {
super.initState();
... ... @@ -243,7 +246,7 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
// }
for (int j = 0; j < widget.menuModel[i].cookbooklist.length; j++) {
MenuSunModel menuSunModel = widget.menuModel[i].cookbooklist[j];
if (menuSunModel.imageType == '1') {
if (menuSunModel.cookStyle.imageType == '1') {
//大图
menuSunModel.indexNew = j;
listSub.add(menuSunModel);
... ... @@ -251,7 +254,8 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
//小图
//判断下一个是大图还是小图
if (widget.menuModel[i].cookbooklist.length - 1 > j) {
if (widget.menuModel[i].cookbooklist[j + 1].imageType == '1') {
if (widget.menuModel[i].cookbooklist[j + 1].cookStyle.imageType ==
'1') {
//下一个是大图
menuSunModel.indexNew = j;
listSub.add(menuSunModel);
... ... @@ -301,40 +305,111 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
spreadRadius: w(20))
]),
),
if ((model.taste != null &&
model.taste != '' &&
model.cooks != null &&
model.cooks != '') ||
(model.taste != null && model.taste != '') ||
(model.cooks != null && model.cooks != ''))
VEmptyView(20),
if ((model.taste != null &&
model.taste != '' &&
model.cooks != null &&
model.cooks != '') ||
(model.taste != null && model.taste != '') ||
(model.cooks != null && model.cooks != ''))
VEmptyView(20),
if ((model.taste != null &&
model.taste != '' &&
model.cooks != null &&
model.cooks != '') ||
(model.taste != null && model.taste != '') ||
(model.cooks != null && model.cooks != ''))
VEmptyView(20),
if ((model.taste != null &&
model.taste != '' &&
model.cooks != null &&
model.cooks != '') ||
(model.taste != null && model.taste != '') ||
(model.cooks != null && model.cooks != ''))
Text(
model.taste != null &&
model.taste != '' &&
model.cooks != null &&
model.cooks != ''
? '味型:${model.taste} 烹调:${model.cooks}'
: model.taste != null && model.taste != ''
? '味型:${model.taste}'
: model.cooks != null && model.cooks != ''
? '味型:${model.taste} 烹调:${model.cooks}'
: '',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(12),
color: MyColours.color_515151,
shadows: [
BoxShadow(
color: MyColours.color_FBF6F1,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
])),
VEmptyView(20),
Text('味型:咸鲜 烹调:熬煮',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(12),
color: MyColours.color_515151,
shadows: [
BoxShadow(
color: MyColours.color_FBF6F1,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
])),
VEmptyView(20),
Text(
'¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',
textAlign: TextAlign.right,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(14),
color: MyColours.color_515151,
shadows: [
BoxShadow(
color: MyColours.color_FBF6F1,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
),
model.price == null
? Column(children: _priceWidget(model))
: Text(
'¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',
textAlign: TextAlign.right,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(14),
color: MyColours.color_515151,
shadows: [
BoxShadow(
color: MyColours.color_FBF6F1,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
),
],
),
);
}
List<Widget> _priceWidget(MenuSunModel model) {
List<SpecModel> tempPrice = [];
if (model.price == null) {
//新添加菜品
model.spec.forEach((element) {
if (element.status == '1') {
//规格启用状态
tempPrice.add(element);
}
});
}
List<Widget> textWidgetList = [];
tempPrice.forEach((element) {
textWidgetList.add(
Text(
'¥${element.price}/${element.specs} 会员 ¥${element.memberPrice ?? ''}/${element.specs} ',
textAlign: TextAlign.right,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(14),
color: MyColours.color_515151,
shadows: [
BoxShadow(
color: MyColours.color_FBF6F1,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
),
);
});
return textWidgetList;
}
//右边
Widget _topRight(MenuSunModel model) {
... ... @@ -356,35 +431,59 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
spreadRadius: w(20))
]),
),
if ((model.taste != null &&
model.taste != '' &&
model.cooks != null &&
model.cooks != '') ||
(model.taste != null && model.taste != '') ||
(model.cooks != null && model.cooks != ''))
VEmptyView(20),
if ((model.taste != null &&
model.taste != '' &&
model.cooks != null &&
model.cooks != '') ||
(model.taste != null && model.taste != '') ||
(model.cooks != null && model.cooks != ''))
Text(
model.taste != null &&
model.taste != '' &&
model.cooks != null &&
model.cooks != ''
? '味型:${model.taste} 烹调:${model.cooks}'
: model.taste != null && model.taste != ''
? '味型:${model.taste}'
: model.cooks != null && model.cooks != ''
? '味型:${model.taste} 烹调:${model.cooks}'
: '',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(12),
color: MyColours.color_515151,
shadows: [
BoxShadow(
color: MyColours.color_FBF6F1,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
])),
VEmptyView(20),
Text('味型:咸鲜 烹调:熬煮',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(12),
color: MyColours.color_515151,
shadows: [
BoxShadow(
color: MyColours.color_FBF6F1,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
])),
VEmptyView(20),
Text(
'¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',
textAlign: TextAlign.right,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(14),
color: MyColours.color_515151,
shadows: [
BoxShadow(
color: MyColours.color_FBF6F1,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
),
model.price == null
? Column(children: _priceWidget(model))
: Text(
'¥${model.price}/${model.unit} 会员 ¥${model.member_price ?? ''}/${model.unit} ',
textAlign: TextAlign.right,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(14),
color: MyColours.color_515151,
shadows: [
BoxShadow(
color: MyColours.color_FBF6F1,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
),
],
),
);
... ... @@ -415,38 +514,76 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
spreadRadius: w(20))
]),
),
VEmptyView(20),
Text('味型:咸鲜 烹调:熬煮',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(12),
color: MyColours.color_515151,
shadows: [
BoxShadow(
color: MyColours.color_FBF6F1,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]))
if ((model.taste != null &&
model.taste != '' &&
model.cooks != null &&
model.cooks != '') ||
(model.taste != null && model.taste != '') ||
(model.cooks != null && model.cooks != ''))
VEmptyView(20),
if ((model.taste != null &&
model.taste != '' &&
model.cooks != null &&
model.cooks != '') ||
(model.taste != null && model.taste != '') ||
(model.cooks != null && model.cooks != ''))
VEmptyView(20),
if ((model.taste != null &&
model.taste != '' &&
model.cooks != null &&
model.cooks != '') ||
(model.taste != null && model.taste != '') ||
(model.cooks != null && model.cooks != ''))
VEmptyView(20),
if ((model.taste != null &&
model.taste != '' &&
model.cooks != null &&
model.cooks != '') ||
(model.taste != null && model.taste != '') ||
(model.cooks != null && model.cooks != ''))
Text(
model.taste != null &&
model.taste != '' &&
model.cooks != null &&
model.cooks != ''
? '味型:${model.taste} 烹调:${model.cooks}'
: model.taste != null && model.taste != ''
? '味型:${model.taste}'
: model.cooks != null && model.cooks != ''
? '味型:${model.taste} 烹调:${model.cooks}'
: '',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(12),
color: MyColours.color_515151,
shadows: [
BoxShadow(
color: MyColours.color_FBF6F1,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]))
],
),
),
HEmptyView(10),
Text(
'¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',
textAlign: TextAlign.right,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(14),
color: MyColours.color_515151,
shadows: [
BoxShadow(
color: MyColours.color_FBF6F1,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
),
model.price == null
? Column(children: _priceWidget(model))
: Text(
'¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',
textAlign: TextAlign.right,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(14),
color: MyColours.color_515151,
shadows: [
BoxShadow(
color: MyColours.color_FBF6F1,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
),
],
);
}
... ... @@ -475,41 +612,64 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
spreadRadius: w(20))
]),
)),
if ((model.taste != null &&
model.taste != '' &&
model.cooks != null &&
model.cooks != '') ||
(model.taste != null && model.taste != '') ||
(model.cooks != null && model.cooks != ''))
VEmptyView(20),
if ((model.taste != null &&
model.taste != '' &&
model.cooks != null &&
model.cooks != '') ||
(model.taste != null && model.taste != '') ||
(model.cooks != null && model.cooks != ''))
Padding(
padding: EdgeInsets.symmetric(horizontal: w(10)),
child: Text(
model.taste != null &&
model.taste != '' &&
model.cooks != null &&
model.cooks != ''
? '味型:${model.taste} 烹调:${model.cooks}'
: model.taste != null && model.taste != ''
? '味型:${model.taste}'
: model.cooks != null && model.cooks != ''
? '味型:${model.taste} 烹调:${model.cooks}'
: '',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(12),
color: MyColours.color_515151,
shadows: [
BoxShadow(
color: MyColours.color_FBF6F1,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
)),
VEmptyView(20),
Padding(
padding: EdgeInsets.symmetric(horizontal: w(10)),
child: Text(
'味型:咸鲜 烹调:熬煮',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(12),
color: MyColours.color_515151,
shadows: [
BoxShadow(
color: MyColours.color_FBF6F1,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
)),
VEmptyView(20),
Padding(
padding: EdgeInsets.symmetric(horizontal: w(10)),
child: Text(
'¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',
textAlign: TextAlign.right,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(14),
color: MyColours.color_515151,
shadows: [
BoxShadow(
color: MyColours.color_FBF6F1,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
)),
child: model.price == null
? Column(children: _priceWidget(model))
: Text(
'¥${model.price}/${model.unit} 会员 ¥${model.member_price}/${model.unit} ',
textAlign: TextAlign.right,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(14),
color: MyColours.color_515151,
shadows: [
BoxShadow(
color: MyColours.color_FBF6F1,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
)),
VEmptyView(30),
if (model.image != null)
CachedNetworkImage(
... ... @@ -518,11 +678,11 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
width: ScreenUtil().screenWidth / 2,
height: w(125),
),
if (true)
if (model.desc != null && model.desc != '')
Padding(
padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(10)),
child: Text(
'江南传统名菜,口味咸鲜,汤白汁浓,肉质酥肥,笋清香脆嫩,鲜味浓厚。',
model.desc ?? "",
style: TextStyle(
color: themeColerModel.name == '珍珠白'
? MyColours.color_515151
... ... @@ -549,7 +709,7 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
Widget build(BuildContext context) {
ThemeColorModel themeColerModel = themeColorData[themeColorIndex];
// menuManageProvider = Provider.of<MenuManageProvider>(context, listen: true);
menuManageProvider = Provider.of<MenuManageProvider>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
... ... @@ -674,7 +834,7 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
menuModelTemp[indexOut]
.cookbooklistShow[index];
if (model.imageType == '2') {
if (model.cookStyle.imageType == '2') {
//小图
return Padding(
padding:
... ... @@ -707,13 +867,17 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
margin:
EdgeInsets.only(bottom: (w(2))),
child: Column(
crossAxisAlignment: model
crossAxisAlignment: model.cookStyle
.imageType !=
'2' &&
model.nameType == '1'
model.cookStyle.nameType ==
'1'
? CrossAxisAlignment.start
: model.imageType != '2' &&
model.nameType == '2'
: model.cookStyle.imageType !=
'2' &&
model.cookStyle
.nameType ==
'2'
? CrossAxisAlignment.end
: CrossAxisAlignment.center,
children: [
... ... @@ -723,18 +887,25 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
left: w(20),
right: w(20),
bottom: w(15)),
child: model.imageType !=
child: model.cookStyle
.imageType !=
'2' &&
model.nameType == '3'
model.cookStyle
.nameType ==
'3'
? _topBetween(model)
: model.imageType !=
: model.cookStyle
.imageType !=
'2' &&
model.nameType ==
model.cookStyle
.nameType ==
'2'
? _topRight(model)
: model.imageType !=
: model.cookStyle
.imageType !=
'2' &&
model.nameType ==
model.cookStyle
.nameType ==
'1'
? _topLeft(model)
: _topLeft(
... ... @@ -746,13 +917,14 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
width: double.infinity,
height: w(250),
),
if (true)
if (model.desc != null &&
model.desc != '')
Padding(
padding: EdgeInsets.symmetric(
horizontal: w(16),
vertical: w(10)),
child: Text(
'江南传统名菜,口味咸鲜,汤白汁浓,肉质酥肥,笋清香脆嫩,鲜味浓厚。',
model.desc,
style: TextStyle(
color: themeColerModel
.name ==
... ... @@ -883,27 +1055,31 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
// App.sp.setInt(
// "themeColor", themeColorData[themeColorIndex].color.value);
//接口
Map homeData = {
'theme_color':
Map menuThemeData = {
'menu_theme_color':
themeColorData[themeColorIndex].color.value.toString(),
'red': themeColorData[themeColorIndex].color.red,
'green': themeColorData[themeColorIndex].color.green,
'blue': themeColorData[themeColorIndex].color.blue,
'alpha': themeColorData[themeColorIndex].color.opacity,
'index': themeColorIndex.toString()
};
//调用接口
Map<String, String> params = {
'sid': Provider.of<UserModel>(context, listen: false)
.user
.sellerid,
'home': json.encode(homeData)
'key': 'cook_style',
'value': json.encode(menuThemeData)
};
// bool success = await menuManageProvider
// .setSellerTemplateConf(context, params, showLoading: true);
// if (success) {
// Utils.showToast('保存成功');
// Navigator.pop(context);
// }
bool success =
await menuManageProvider.setConfing(context, params);
if (success) {
Utils.showToast('设置成功!');
bus.emit('menu_theme_color', themeColorIndex);
}
},
),
)
... ...
... ... @@ -9,8 +9,11 @@ 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';
import 'package:one_key/net/http_url.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/utils/utils.dart';
import 'package:provider/provider.dart';
import '../models/GetDzSellerConfModel.dart';
import '../models/cookbook_practice_model.dart';
class MenuManageProvider extends ChangeNotifier {
... ... @@ -26,6 +29,8 @@ class MenuManageProvider extends ChangeNotifier {
PageState pageStatePractice = PageState.Loading;
List<CookbookPracticeSunModel> dataPractice; //做法数据
GetDzSellerConfSunModel dzSellerConfModel; //商家配置
/// 获取单个菜品信息
getCookbookById(BuildContext context, Map<String, String> params,
{showLoading = false}) async {
... ... @@ -164,6 +169,54 @@ class MenuManageProvider extends ChangeNotifier {
notifyListeners();
}
// 设置订座商家配置信息
Future<bool> setConfing(BuildContext context, Map<String, String> params,
{bool showLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.set_confing,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
Utils.showToast('设置失败,请重试');
return false;
});
if (baseResp.code == Constant.status_success) {
if (baseResp.data == 0 || baseResp.data == 1) {
Utils.showToast('设置成功');
return true;
} else {
Utils.showToast('设置失败,请重试');
}
} else {
Utils.showToast(baseResp.msg ?? '设置失败,请重试');
}
return false;
}
// 获取商家订座配置
Future<bool> getDzSellerConf(BuildContext context,
{bool showLoading = true}) async {
Map<String, String> params = {
'sid': Provider.of<UserModel>(context, listen: false).user.sellerid
};
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.get_dz_seller_conf,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
Utils.showToast('请求失败,请重试');
return false;
});
if (baseResp.code == Constant.status_success) {
dzSellerConfModel =
GetDzSellerConfModel.fromJson(baseResp.responseData).data;
return true;
} else {
Utils.showToast(baseResp.msg ?? '设置失败,请重试');
}
return false;
}
///分类下所有菜品列表(1.传orderid顾客端获取带订单信息的 否则不传
getCookbookByClass(BuildContext context, Map<String, String> params,
... ...