Commit 930371ca8b504605e28595b11b2a655923ccdd83

Authored by wdn127929
1 parent 8cac09fe

设置菜系,人均消费

class AllCuisineModel {
int ret;
List<AllCuisineSunModel> data;
String msg;
AllCuisineModel({this.ret, this.data, this.msg});
AllCuisineModel.fromJson(Map<String, dynamic> json) {
ret = json['ret'];
if (json['data'] != null) {
data = new List<AllCuisineSunModel>();
json['data'].forEach((v) {
data.add(new AllCuisineSunModel.fromJson(v));
});
}
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.map((v) => v.toJson()).toList();
}
data['msg'] = this.msg;
return data;
}
}
class AllCuisineSunModel {
String id;
String name;
String icon;
String weight;
bool select = false;
AllCuisineSunModel({this.id, this.name, this.icon, this.weight});
AllCuisineSunModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
icon = json['icon'];
weight = json['weight'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['icon'] = this.icon;
data['weight'] = this.weight;
return data;
}
}
\ No newline at end of file
... ...
class SellerCuisineModel {
int ret;
List<SellerCuisineSunModel> data;
String msg;
SellerCuisineModel({this.ret, this.data, this.msg});
SellerCuisineModel.fromJson(Map<String, dynamic> json) {
ret = json['ret'];
if (json['data'] != null) {
data = new List<SellerCuisineSunModel>();
json['data'].forEach((v) {
data.add(new SellerCuisineSunModel.fromJson(v));
});
}
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.map((v) => v.toJson()).toList();
}
data['msg'] = this.msg;
return data;
}
}
class SellerCuisineSunModel {
String sid;
String cid;
SellerCuisineSunModel({this.sid, this.cid});
SellerCuisineSunModel.fromJson(Map<String, dynamic> json) {
sid = json['sid'];
cid = json['cid'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['sid'] = this.sid;
data['cid'] = this.cid;
return data;
}
}
\ No newline at end of file
... ...
... ... @@ -574,29 +574,32 @@ class HttpUrl {
"?service=App.Reserve.SetStoreWineSaiYouText"; // 配置商家存酒短信可变内容
static const set_cookbook_order_markeclass =
"?service=App.Cookbook.SetCookbookOrderMarkeclass"; // 设置营销菜品移动
"?service=App.Cookbook.SetCookbookOrderMarkeclass"; // 设置营销菜品移动
static const set_seller_meal_section =
"?service=App.Seller.SetSellerMealSection"; // 商家设置多时段
"?service=App.Seller.SetSellerMealSection"; // 商家设置多时段
static const get_seller_meal_section =
"?service=App.Seller.GetSellerMealSection"; // 获取商家多时段列表
"?service=App.Seller.GetSellerMealSection"; // 获取商家多时段列表
static const get_meal_section_by_day =
"?service=App.Seller.getMealSectionByDay"; // 获取日期对应的时段
"?service=App.Seller.getMealSectionByDay"; // 获取日期对应的时段
static const get_sai_you_yun_birthday_temp =
"?service=App.GuestManage.GetSaiYouYunBirthdayTemp"; // 获取客户生日提醒短信模板配置内容
static const set_sai_you_yun_birthday =
"?service=App.GuestManage.SetSaiYouYunBirthday"; // 客户生日提醒短信模板
static const get_all_cuisine =
"?service=App.Seller.GetAllCuisine"; // 获取全部所属菜系
static const get_seller_cuisine =
"?service=App.Seller.GetSellerCuisine"; // 获取商家所属菜系
static const set_seller_config_by_pc =
"?service=App.Seller.SetSellerConfigByPC"; // PC维护商家基本信息,保存人均消费
static const set_seller_cuisine =
"?service=App.Seller.SetSellerCuisine"; // 设置商家所属菜系
}
... ...
... ... @@ -137,11 +137,11 @@ class _BaseInfoPageState extends State<BaseInfoPage> {
nameStr = _baseIndoProvider.baseInfoSunModel.name;
_uploadImageProvider.touxiang.qiniuUrl =
_baseIndoProvider.baseInfoSunModel.photo;
_uploadImageProvider.touxiang.process = 1;
_uploadImageProvider.touxiang.process = 1;
imgAll.add(_baseIndoProvider.baseInfoSunModel.photo);
_uploadImageProvider.erweima.qiniuUrl =
_baseIndoProvider.baseInfoSunModel.qrcode;
_uploadImageProvider.erweima.process = 1;
_uploadImageProvider.erweima.process = 1;
_phoneController.text = _baseIndoProvider.baseInfoSunModel.phone;
phoneStr = _baseIndoProvider.baseInfoSunModel.phone ?? '';
_wechatController.text = _baseIndoProvider.baseInfoSunModel.wechat;
... ... @@ -723,11 +723,22 @@ class _BaseInfoPageState extends State<BaseInfoPage> {
ScreenUtil().setWidth(56)),
child: RoundButton(
onPressed: () {
if (_uploadImageProvider.touxiang.process < 1 &&
_uploadImageProvider.touxiang.process > 0) {
Utils.showToast('正在上传图片,请稍等!');
return;
if (_uploadImageProvider.touxiang.qiniuUrl
.trim()
.length ==
0 ||
_uploadImageProvider.touxiang.qiniuUrl ==
'http://nosqn.colorcun.com/yd_person.png') {
} else {
if (_uploadImageProvider.touxiang.process < 1 &&
_uploadImageProvider.touxiang.process > 0.01 &&
_uploadImageProvider.touxiang.qiniuUrl !=
'') {
Utils.showToast('正在上传图片,请稍等!');
return;
}
}
if (_phoneController.text.trim().length == 0 ||
_nameController.text.trim().length == 0) {
Utils.showToast('请至少填写您的姓名和电话');
... ...
... ... @@ -1650,7 +1650,7 @@ class _BookInfoPageState extends State<BookInfoPage> {
if (addFirstImage &&
_uploadImageProvider.firstImage.process < 1 &&
_uploadImageProvider.firstImage.process > 0) {
_uploadImageProvider.firstImage.process > 0.01) {
Utils.showToast('正在上传餐厅首图!,请稍等');
return false;
}
... ...
... ... @@ -787,7 +787,7 @@ class _FirstImagePageState extends State<FirstImagePage> {
}
if (_uploadImageProvider.firstImage.process < 1 &&
_uploadImageProvider.firstImage.process > 0) {
_uploadImageProvider.firstImage.process > 0.01) {
Utils.showToast('正在上传餐厅照片!,请稍等');
return false;
}
... ...
... ... @@ -183,7 +183,7 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
_addCookbook({bool showLoading = true}) async {
bool canDelete = false;
if (uploadImageProvider.dish.process < 1 &&
uploadImageProvider.dish.process > 0) {
uploadImageProvider.dish.process > 0.01 && uploadImageProvider.dish.qiniuUrl != '') {
Utils.showToast('正在上传菜品图片,请稍等!');
return false;
}
... ...
... ... @@ -39,6 +39,8 @@ import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
import '../../app.dart';
import '../../utils/dialog_util.dart';
import '../../utils/screen_util.dart';
class StoreBaseInfoPage extends StatefulWidget {
StoreBaseInfoPage({Key key}) : super(key: key);
... ... @@ -88,6 +90,9 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
TextEditingController _booktime1 = TextEditingController();
TextEditingController _booktime2 = TextEditingController();
TextEditingController _booktime3 = TextEditingController();
TextEditingController _averageC = TextEditingController();
String cuisine = '';
List<String> cuisineIds = [];
///获取接单时间接口
_getReceiveOrdersTime() async {
... ... @@ -141,6 +146,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
_getReceiveOrdersTime();
_getDailyTime();
getSellerTemplateConf();
_getCuisineData();
});
}
... ... @@ -151,6 +157,60 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
super.dispose();
}
_getCuisineData() async {
Future.wait<bool>([getAllCuisine(context), getSellerCuisine(context)])
.then((results) async {
print(results[0]);
if (results[0] && results[1]) {
//成功
cuisineIds = [];
_baseIndoProvider.sellerCuisineData.forEach((elements) {
var result = _baseIndoProvider.allCuisineData
.where((element) => element.id == elements.cid);
if (result.length > 0) {
cuisine += result.first.name + ' ';
cuisineIds.add(elements.cid);
}
});
if (cuisine.endsWith(' ')) {
cuisine = cuisine.substring(0, cuisine.length - 1);
}
setState(() {});
} else {
// if (!results[0]) {
// //没有优惠券
// } else {}
// if (!results[1]) {
// //没有营销中心数据
// } else {}
setState(() {});
}
}).catchError((e) {
print(e);
});
}
Future<bool> getAllCuisine(BuildContext context) async {
bool success = await _baseIndoProvider.getAllCuisine(context);
if (success && _baseIndoProvider.allCuisineData.length > 0) {
//有数据
return true;
} else {
return false;
}
}
Future<bool> getSellerCuisine(BuildContext context) async {
bool success = await _baseIndoProvider.getSellerCuisine(context);
if (success && _baseIndoProvider.sellerCuisineData.length > 0) {
//有数据
return true;
} else {
return false;
}
}
getSellerTemplateConf() async {
bool success = await marketingCenterProvider.getSellerTemplateConf(context);
if (success && marketingCenterProvider.markDataModel.store != null) {
... ... @@ -356,6 +416,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
GetSellerInfoSunModel itemModel =
await _baseIndoProvider.getSellerById(context);
if (itemModel != null) {
_averageC.text = itemModel.data.average ?? '0';
_nameController.text = itemModel.data.sellername;
_timeController.text = itemModel.data.dailyTime;
... ... @@ -454,12 +515,35 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
return;
}
}
if(cuisineIds.length == 0){
Utils.showToast('请至少选择一个菜系!');
return;
}
setSellerCuisine();
setAverage();
await _setReceiveTime();
_refreshMarketingInfo();
await _setSellerInfoById();
}
setAverage() async {
Map<String, String> params = {
'sid': Provider.of<UserModel>(context,listen: false).user.sellerid,
'field': 'average',
'value': _averageC.text
};
await _baseIndoProvider.setSellerConfigByPC(context, params);
}
setSellerCuisine() async {
Map<String, String> params = {
'sellerid': Provider.of<UserModel>(context,listen: false).user.sellerid,
'cid':Utils.listToStringEnglish1(cuisineIds)
};
await _baseIndoProvider.setSellerCuisine(context, params);
}
_refreshMarketingInfo() async {
//接口
Map storeData = {
... ... @@ -1335,10 +1419,10 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
return InkWell(
onTap: onTap,
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(24)),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(24), vertical: w(5)),
child: Container(
height: ScreenUtil().setWidth(40),
// height: ScreenUtil().setWidth(40),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
... ... @@ -1350,14 +1434,16 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
: MyColours.color_999999,
fontSize: ScreenUtil().setSp(28),
)),
Spacer(),
Text(time,
style: TextStyle(
color: highted
? MyColours.color_353535
: MyColours.color_438E93,
fontSize: ScreenUtil().setSp(28),
)),
Expanded(
child: Text(time,
textAlign: TextAlign.right,
maxLines: 10,
style: TextStyle(
color: highted
? MyColours.color_353535
: MyColours.color_438E93,
fontSize: ScreenUtil().setSp(28),
))),
HEmptyView(14),
Image.asset(
Utils.getImgPath('arrow_right_new'),
... ... @@ -2298,6 +2384,117 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
// },
keyboardType: TextInputType.multiline,
)),
VEmptyView(152),
Text('其他信息',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_515151)),
VEmptyView(34),
timeWidget('经营菜系', cuisine, highted: false,
onTap: () {
FocusScope.of(context)
.requestFocus(FocusNode()); //隐藏键盘
// 存储
DialogUtil.openCuisineSelectModalBottomSheet(
context,
List.from(_baseIndoProvider.allCuisineData),
cuisineIds, rCallback: (value) async {
if (value != null) {
cuisineIds = value;
cuisine = '';
_baseIndoProvider.allCuisineData
.forEach((element) {
if (cuisineIds.contains(element.id)) {
cuisine += element.name + ' ';
}
});
if (cuisine.endsWith(' ')) {
cuisine = cuisine.substring(
0, cuisine.length - 1);
}
setState(() {});
}
});
}),
VEmptyView(40),
///应收金额
Container(
// color: Colors.white,
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(24),
right: w(10)),
child: Row(
children: [
Text(
'人均消费',
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_999999),
),
// HEmptyView(40),
Expanded(
child: Container(
child: TextField(
maxLines: 1,
textAlign: TextAlign.right,
//输入文本的样式
style: TextStyle(
fontSize:
ScreenUtil().setSp(28),
color:
MyColours.color_438E93),
controller: _averageC,
// focusNode: _focusNode,
keyboardType: TextInputType
.numberWithOptions(
decimal: true),
// textAlignVertical: TextAlignVertical.bottom,
decoration: InputDecoration(
isCollapsed: false,
hintText: "请输入",
hintStyle: TextStyle(
color:
MyColours.color_999999,
fontSize:
ScreenUtil().setSp(28),
),
// contentPadding:
// EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
contentPadding:
EdgeInsets.zero,
border: OutlineInputBorder(
borderSide:
BorderSide.none),
),
onChanged: (value) {
// print(value);
// // currentRemark = value;
// // print();
// setState(() {
// if (value != '¥' && value.trim().length > 0) {
// btnState = 1;
// } else {
// btnState = -1;
// }
// });
},
onEditingComplete: () {
print('fff');
// _focusNode.unfocus();
// _editingController.text = '';
// _needNode.unfocus();
})))
],
)),
// Padding(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(40),
... ...
... ... @@ -848,7 +848,7 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> {
innerloop:
for (UploadImgModel item
in _uploadImageProvider.imageList) {
if (item.process > 0 &&
if (item.process > 0.01 &&
item.process < 1) {
Utils.showToast('正在上传,请稍等');
// return false;
... ...
... ... @@ -137,11 +137,11 @@ class _BaseInfoPageSimState extends State<BaseInfoPageSim> {
nameStr = _baseIndoProvider.baseInfoSunModel.name;
_uploadImageProvider.touxiang.qiniuUrl =
_baseIndoProvider.baseInfoSunModel.photo;
_uploadImageProvider.touxiang.process = 1;
_uploadImageProvider.touxiang.process = 1;
imgAll.add(_baseIndoProvider.baseInfoSunModel.photo);
_uploadImageProvider.erweima.qiniuUrl =
_baseIndoProvider.baseInfoSunModel.qrcode;
_uploadImageProvider.erweima.process = 1;
_uploadImageProvider.erweima.process = 1;
_phoneController.text = _baseIndoProvider.baseInfoSunModel.phone;
phoneStr = _baseIndoProvider.baseInfoSunModel.phone ?? '';
_wechatController.text = _baseIndoProvider.baseInfoSunModel.wechat;
... ... @@ -725,10 +725,21 @@ class _BaseInfoPageSimState extends State<BaseInfoPageSim> {
ScreenUtil().setWidth(56)),
child: RoundButton(
onPressed: () {
if (_uploadImageProvider.touxiang.process < 1 &&
_uploadImageProvider.touxiang.process > 0) {
Utils.showToast('正在上传图片,请稍等!');
return;
if (_uploadImageProvider.touxiang.qiniuUrl
.trim()
.length ==
0 ||
_uploadImageProvider.touxiang.qiniuUrl ==
'http://nosqn.colorcun.com/yd_person.png') {
} else {
if (_uploadImageProvider.touxiang.process < 1 &&
_uploadImageProvider.touxiang.process >
0.01 &&
_uploadImageProvider.touxiang.qiniuUrl !=
'') {
Utils.showToast('正在上传图片,请稍等!');
return;
}
}
if (_phoneController.text.trim().length == 0 ||
_nameController.text.trim().length == 0) {
... ...
... ... @@ -1415,7 +1415,7 @@ class _BookInfoPageSimState extends State<BookInfoPageSim> {
if (addFirstImage &&
_uploadImageProvider.firstImage.process < 1 &&
_uploadImageProvider.firstImage.process > 0) {
_uploadImageProvider.firstImage.process > 0.01) {
Utils.showToast('正在上传餐厅首图!,请稍等');
return false;
}
... ...
... ... @@ -17,8 +17,10 @@ import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/loading.dart';
import 'package:provider/provider.dart';
import '../models/all_cuisine.dart';
import '../models/meal_day_date_model.dart';
import '../models/meal_list_model.dart';
import '../models/seller_cuisine_model.dart';
class StoreBaseIndoProvider with ChangeNotifier {
GetSellerInfoSunModel itemModel;
... ... @@ -38,6 +40,10 @@ class StoreBaseIndoProvider with ChangeNotifier {
List<MealDayDateSunModel> dayDateData = [];
List<SellerCuisineSunModel> sellerCuisineData = [];
List<AllCuisineSunModel> allCuisineData = [];
///根据商家ID获取商家信息
Future<GetSellerInfoSunModel> getSellerById(
BuildContext context, {
... ... @@ -71,6 +77,70 @@ class StoreBaseIndoProvider with ChangeNotifier {
}
}
//获取所有菜系
Future<bool> getAllCuisine(
BuildContext context, {
bool showLoading = true,
bool selfDismiss = false,
}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.post, HttpUrl.get_all_cuisine,
showLoading: showLoading, selfDismiss: selfDismiss)
.catchError((error) {
print(error.toString());
});
if (baseResp == null) return false;
if (baseResp.code == Constant.status_success) {
if (int.parse(baseResp.status) != Constant.status_success) {
Utils.showToast(baseResp.msg ?? "");
return false;
}
if (baseResp.responseData['data'] != null) {
allCuisineData = AllCuisineModel.fromJson(baseResp.responseData).data;
print(allCuisineData);
return true;
} else {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
}
//获取商家所属菜系
Future<bool> getSellerCuisine(
BuildContext context, {
bool showLoading = true,
bool selfDismiss = false,
}) async {
Map<String, String> params = {
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
};
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.post, HttpUrl.get_seller_cuisine,
data: params, showLoading: showLoading, selfDismiss: selfDismiss)
.catchError((error) {
print(error.toString());
});
if (baseResp == null) return false;
if (baseResp.code == Constant.status_success) {
if (int.parse(baseResp.status) != Constant.status_success) {
Utils.showToast(baseResp.msg ?? "");
return false;
}
if (baseResp.responseData['data'] != null) {
sellerCuisineData =
SellerCuisineModel.fromJson(baseResp.responseData).data;
print(sellerCuisineData);
return true;
} else {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
}
/// decode response data.
Map<String, dynamic> _decodeData(Response response) {
if (response == null ||
... ... @@ -178,6 +248,56 @@ class StoreBaseIndoProvider with ChangeNotifier {
}
}
// 设置商家所属菜系
Future<bool> setSellerCuisine(
BuildContext context,
Map<String, String> params, {
bool showLoading = true,
bool selfDismiss = false,
}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.post, HttpUrl.set_seller_cuisine,
data: params, showLoading: showLoading, selfDismiss: selfDismiss)
.catchError((error) {
print(error.toString());
return false;
});
if (baseResp == null) return false;
if (baseResp.code == Constant.status_success) {
// Utils.showToast('保存成功');
return true;
} else {
Utils.showToast(baseResp.msg ?? "");
return false;
}
}
// PC维护商家基本信息,保存人均消费
Future<bool> setSellerConfigByPC(
BuildContext context,
Map<String, String> params, {
bool showLoading = true,
bool selfDismiss = false,
}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.post, HttpUrl.set_seller_config_by_pc,
data: params, showLoading: showLoading, selfDismiss: selfDismiss)
.catchError((error) {
print(error.toString());
return false;
});
if (baseResp == null) return false;
if (baseResp.code == Constant.status_success) {
// Utils.showToast('保存成功');
return true;
} else {
Utils.showToast(baseResp.msg ?? "");
return false;
}
}
///根据商家ID修改商家信息
Future<SetSellerInfoSunModel> setSellerInfoById(
BuildContext context, FormData params) async {
... ...
... ... @@ -40,6 +40,7 @@ import 'package:one_key/models/table.dart' as t;
import 'package:url_launcher/url_launcher.dart';
import '../app.dart';
import '../models/all_cuisine.dart';
import '../models/cookbook_model.dart';
import '../models/customer_label_model.dart';
import '../models/get_reserve_type_field_model.dart';
... ... @@ -224,6 +225,84 @@ class DialogUtil {
return temp;
}
static List<Widget> cuisineSelecctBtn(List<AllCuisineSunModel> menuSunModel,
state, List<String> selectType, ClickkListCallbac callback) {
List<Widget> temp = [];
for (int i = 0; i < menuSunModel.length; i++) {
AllCuisineSunModel practiceModel = menuSunModel[i];
temp.add(InkWell(
onTap: () {
// for (int j = 0; j < menuSunModel.length; j++) {
// menuSunModel[j].select = false;
// }
practiceModel.select = !practiceModel.select;
if (practiceModel.select) {
selectType.add(practiceModel.id);
} else {
selectType.remove(practiceModel.id);
}
callback(selectType);
state(() {});
},
child: Container(
// height: w(34),
padding:
EdgeInsets.symmetric(horizontal: w(10), vertical: w(5)),
decoration: BoxDecoration(
border: Border.all(
color: practiceModel.select
? MyColours.color_438E93
: MyColours.color_515151,
width: w(1)),
borderRadius: BorderRadius.circular(r(5)),
color: practiceModel.select
? MyColours.color_438E93
: MyColours.color_ffffff,
),
child: Text(practiceModel.name,
style: TextStyle(
fontSize: font(14),
color: practiceModel.select
? MyColours.color_ffffff
: MyColours.color_515151,
)),
))
// RoundButton(
// text: practiceModel.name,
// // bgColor: MyColours.color_ffffff,
// gradientStart: practiceModel.select
// ? MyColours.color_438E93
// : MyColours.color_ffffff,
// gradientEnd: practiceModel.select
// ? MyColours.color_438E93
// : MyColours.color_ffffff,
// // width: w(80),
// padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(5)),
// height: w(34),
// isBold: false,
// radius: r(5),
// textColor: practiceModel.select
// ? MyColours.color_ffffff
// : MyColours.color_515151,
// borderColor: practiceModel.select
// ? MyColours.color_438E93
// : MyColours.color_515151,
// onPressed: () {
// for (int j = 0; j < menuSunModel.length; j++) {
// menuSunModel[j].select = false;
// }
// menuSunModel[i].select = true;
// callback(menuSunModel[i].name);
// state(() {});
// },
// )
);
}
return temp;
}
static List<Widget> dishSelectBtn(
List<GetReserveTypeFieldsSunModel> menuSunModel,
state,
... ... @@ -631,6 +710,107 @@ class DialogUtil {
});
}
///菜系选择
static openCuisineSelectModalBottomSheet(context,
List<AllCuisineSunModel> cuisineAllDatas, List<String> cuisineIds,
{VoidCallback lCallback, ClickkListCallbac rCallback}) async {
List<String> selectType = List.from(cuisineIds);
if (cuisineIds.length > 0) {
cuisineAllDatas.forEach((element) {
element.select = false;
if (cuisineIds.contains(element.id)) {
element.select = true;
}
});
}
final option = await showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
isDismissible: false,
isScrollControlled: true,
builder: (BuildContext context) {
return StatefulBuilder(builder: (context, state) {
return Container(
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ScreenUtil().setWidth(10)),
topRight: Radius.circular(ScreenUtil().setWidth(10)))),
child:
Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
cuisineAllDatas.forEach((element) {
element.select = false;
});
Navigator.of(context).pop();
},
child: Container(
// width: double.infinity,
alignment: Alignment.center,
padding: EdgeInsets.symmetric(
horizontal: w(15),
vertical: ScreenUtil().setWidth(40)),
child: Text(
"取消",
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_438E93),
),
)),
Container(
// width: double.infinity,
alignment: Alignment.center,
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setWidth(40)),
child: Text(
"选择经营菜系",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_E6000000),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pop();
rCallback(selectType);
},
child: Container(
// width: double.infinity,
alignment: Alignment.center,
padding: EdgeInsets.symmetric(
horizontal: w(15),
vertical: ScreenUtil().setWidth(40)),
child: Text("确定",
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_438E93)),
)),
]),
VEmptyView(50),
Wrap(
spacing: w(12),
runSpacing: w(12),
children: cuisineSelecctBtn(
cuisineAllDatas, state, selectType, (value) {
selectType = value;
})),
VEmptyView(50),
]));
});
});
cuisineAllDatas.forEach((element) {
element.select = false;
});
}
///用餐类型
static openDishTypeSelectModalBottomSheet(context,
List<GetReserveTypeFieldsSunModel> reserveTypes, String reserveType,
... ... @@ -9009,7 +9189,7 @@ class DialogUtil {
// yearBegin: DateTime.now().year,
// yearEnd: 2030,
minValue: DateTime(1925),
maxValue:DateTime.now(),
maxValue: DateTime.now(),
value: dateTime),
height: ScreenUtil().setWidth(480),
hideHeader: false,
... ...