Showing
13 changed files
with
663 additions
and
40 deletions
lib/models/all_cuisine.dart
0 → 100644
| 1 | +class AllCuisineModel { | ||
| 2 | + int ret; | ||
| 3 | + List<AllCuisineSunModel> data; | ||
| 4 | + String msg; | ||
| 5 | + | ||
| 6 | + AllCuisineModel({this.ret, this.data, this.msg}); | ||
| 7 | + | ||
| 8 | + AllCuisineModel.fromJson(Map<String, dynamic> json) { | ||
| 9 | + ret = json['ret']; | ||
| 10 | + if (json['data'] != null) { | ||
| 11 | + data = new List<AllCuisineSunModel>(); | ||
| 12 | + json['data'].forEach((v) { | ||
| 13 | + data.add(new AllCuisineSunModel.fromJson(v)); | ||
| 14 | + }); | ||
| 15 | + } | ||
| 16 | + msg = json['msg']; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + Map<String, dynamic> toJson() { | ||
| 20 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 21 | + data['ret'] = this.ret; | ||
| 22 | + if (this.data != null) { | ||
| 23 | + data['data'] = this.data.map((v) => v.toJson()).toList(); | ||
| 24 | + } | ||
| 25 | + data['msg'] = this.msg; | ||
| 26 | + return data; | ||
| 27 | + } | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +class AllCuisineSunModel { | ||
| 31 | + String id; | ||
| 32 | + String name; | ||
| 33 | + String icon; | ||
| 34 | + String weight; | ||
| 35 | + bool select = false; | ||
| 36 | + | ||
| 37 | +AllCuisineSunModel({this.id, this.name, this.icon, this.weight}); | ||
| 38 | + | ||
| 39 | + AllCuisineSunModel.fromJson(Map<String, dynamic> json) { | ||
| 40 | + id = json['id']; | ||
| 41 | + name = json['name']; | ||
| 42 | + icon = json['icon']; | ||
| 43 | + weight = json['weight']; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + Map<String, dynamic> toJson() { | ||
| 47 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 48 | + data['id'] = this.id; | ||
| 49 | + data['name'] = this.name; | ||
| 50 | + data['icon'] = this.icon; | ||
| 51 | + data['weight'] = this.weight; | ||
| 52 | + return data; | ||
| 53 | + } | ||
| 54 | +} |
lib/models/seller_cuisine_model.dart
0 → 100644
| 1 | +class SellerCuisineModel { | ||
| 2 | + int ret; | ||
| 3 | + List<SellerCuisineSunModel> data; | ||
| 4 | + String msg; | ||
| 5 | + | ||
| 6 | + SellerCuisineModel({this.ret, this.data, this.msg}); | ||
| 7 | + | ||
| 8 | + SellerCuisineModel.fromJson(Map<String, dynamic> json) { | ||
| 9 | + ret = json['ret']; | ||
| 10 | + if (json['data'] != null) { | ||
| 11 | + data = new List<SellerCuisineSunModel>(); | ||
| 12 | + json['data'].forEach((v) { | ||
| 13 | + data.add(new SellerCuisineSunModel.fromJson(v)); | ||
| 14 | + }); | ||
| 15 | + } | ||
| 16 | + msg = json['msg']; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + Map<String, dynamic> toJson() { | ||
| 20 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 21 | + data['ret'] = this.ret; | ||
| 22 | + if (this.data != null) { | ||
| 23 | + data['data'] = this.data.map((v) => v.toJson()).toList(); | ||
| 24 | + } | ||
| 25 | + data['msg'] = this.msg; | ||
| 26 | + return data; | ||
| 27 | + } | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +class SellerCuisineSunModel { | ||
| 31 | + String sid; | ||
| 32 | + String cid; | ||
| 33 | + | ||
| 34 | + SellerCuisineSunModel({this.sid, this.cid}); | ||
| 35 | + | ||
| 36 | + SellerCuisineSunModel.fromJson(Map<String, dynamic> json) { | ||
| 37 | + sid = json['sid']; | ||
| 38 | + cid = json['cid']; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + Map<String, dynamic> toJson() { | ||
| 42 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 43 | + data['sid'] = this.sid; | ||
| 44 | + data['cid'] = this.cid; | ||
| 45 | + return data; | ||
| 46 | + } | ||
| 47 | +} |
| @@ -574,29 +574,32 @@ class HttpUrl { | @@ -574,29 +574,32 @@ class HttpUrl { | ||
| 574 | "?service=App.Reserve.SetStoreWineSaiYouText"; // 配置商家存酒短信可变内容 | 574 | "?service=App.Reserve.SetStoreWineSaiYouText"; // 配置商家存酒短信可变内容 |
| 575 | 575 | ||
| 576 | static const set_cookbook_order_markeclass = | 576 | static const set_cookbook_order_markeclass = |
| 577 | - "?service=App.Cookbook.SetCookbookOrderMarkeclass"; // 设置营销菜品移动 | 577 | + "?service=App.Cookbook.SetCookbookOrderMarkeclass"; // 设置营销菜品移动 |
| 578 | 578 | ||
| 579 | static const set_seller_meal_section = | 579 | static const set_seller_meal_section = |
| 580 | - "?service=App.Seller.SetSellerMealSection"; // 商家设置多时段 | 580 | + "?service=App.Seller.SetSellerMealSection"; // 商家设置多时段 |
| 581 | static const get_seller_meal_section = | 581 | static const get_seller_meal_section = |
| 582 | - "?service=App.Seller.GetSellerMealSection"; // 获取商家多时段列表 | 582 | + "?service=App.Seller.GetSellerMealSection"; // 获取商家多时段列表 |
| 583 | 583 | ||
| 584 | static const get_meal_section_by_day = | 584 | static const get_meal_section_by_day = |
| 585 | - "?service=App.Seller.getMealSectionByDay"; // 获取日期对应的时段 | 585 | + "?service=App.Seller.getMealSectionByDay"; // 获取日期对应的时段 |
| 586 | static const get_sai_you_yun_birthday_temp = | 586 | static const get_sai_you_yun_birthday_temp = |
| 587 | "?service=App.GuestManage.GetSaiYouYunBirthdayTemp"; // 获取客户生日提醒短信模板配置内容 | 587 | "?service=App.GuestManage.GetSaiYouYunBirthdayTemp"; // 获取客户生日提醒短信模板配置内容 |
| 588 | 588 | ||
| 589 | static const set_sai_you_yun_birthday = | 589 | static const set_sai_you_yun_birthday = |
| 590 | "?service=App.GuestManage.SetSaiYouYunBirthday"; // 客户生日提醒短信模板 | 590 | "?service=App.GuestManage.SetSaiYouYunBirthday"; // 客户生日提醒短信模板 |
| 591 | 591 | ||
| 592 | + static const get_all_cuisine = | ||
| 593 | + "?service=App.Seller.GetAllCuisine"; // 获取全部所属菜系 | ||
| 592 | 594 | ||
| 595 | + static const get_seller_cuisine = | ||
| 596 | + "?service=App.Seller.GetSellerCuisine"; // 获取商家所属菜系 | ||
| 593 | 597 | ||
| 598 | + static const set_seller_config_by_pc = | ||
| 599 | + "?service=App.Seller.SetSellerConfigByPC"; // PC维护商家基本信息,保存人均消费 | ||
| 600 | + static const set_seller_cuisine = | ||
| 601 | + "?service=App.Seller.SetSellerCuisine"; // 设置商家所属菜系 | ||
| 594 | 602 | ||
| 595 | - | ||
| 596 | - | ||
| 597 | - | ||
| 598 | - | ||
| 599 | - | ||
| 600 | - | 603 | + |
| 601 | 604 | ||
| 602 | } | 605 | } |
| @@ -137,11 +137,11 @@ class _BaseInfoPageState extends State<BaseInfoPage> { | @@ -137,11 +137,11 @@ class _BaseInfoPageState extends State<BaseInfoPage> { | ||
| 137 | nameStr = _baseIndoProvider.baseInfoSunModel.name; | 137 | nameStr = _baseIndoProvider.baseInfoSunModel.name; |
| 138 | _uploadImageProvider.touxiang.qiniuUrl = | 138 | _uploadImageProvider.touxiang.qiniuUrl = |
| 139 | _baseIndoProvider.baseInfoSunModel.photo; | 139 | _baseIndoProvider.baseInfoSunModel.photo; |
| 140 | - _uploadImageProvider.touxiang.process = 1; | 140 | + _uploadImageProvider.touxiang.process = 1; |
| 141 | imgAll.add(_baseIndoProvider.baseInfoSunModel.photo); | 141 | imgAll.add(_baseIndoProvider.baseInfoSunModel.photo); |
| 142 | _uploadImageProvider.erweima.qiniuUrl = | 142 | _uploadImageProvider.erweima.qiniuUrl = |
| 143 | _baseIndoProvider.baseInfoSunModel.qrcode; | 143 | _baseIndoProvider.baseInfoSunModel.qrcode; |
| 144 | - _uploadImageProvider.erweima.process = 1; | 144 | + _uploadImageProvider.erweima.process = 1; |
| 145 | _phoneController.text = _baseIndoProvider.baseInfoSunModel.phone; | 145 | _phoneController.text = _baseIndoProvider.baseInfoSunModel.phone; |
| 146 | phoneStr = _baseIndoProvider.baseInfoSunModel.phone ?? ''; | 146 | phoneStr = _baseIndoProvider.baseInfoSunModel.phone ?? ''; |
| 147 | _wechatController.text = _baseIndoProvider.baseInfoSunModel.wechat; | 147 | _wechatController.text = _baseIndoProvider.baseInfoSunModel.wechat; |
| @@ -723,11 +723,22 @@ class _BaseInfoPageState extends State<BaseInfoPage> { | @@ -723,11 +723,22 @@ class _BaseInfoPageState extends State<BaseInfoPage> { | ||
| 723 | ScreenUtil().setWidth(56)), | 723 | ScreenUtil().setWidth(56)), |
| 724 | child: RoundButton( | 724 | child: RoundButton( |
| 725 | onPressed: () { | 725 | onPressed: () { |
| 726 | - if (_uploadImageProvider.touxiang.process < 1 && | ||
| 727 | - _uploadImageProvider.touxiang.process > 0) { | ||
| 728 | - Utils.showToast('正在上传图片,请稍等!'); | ||
| 729 | - return; | 726 | + if (_uploadImageProvider.touxiang.qiniuUrl |
| 727 | + .trim() | ||
| 728 | + .length == | ||
| 729 | + 0 || | ||
| 730 | + _uploadImageProvider.touxiang.qiniuUrl == | ||
| 731 | + 'http://nosqn.colorcun.com/yd_person.png') { | ||
| 732 | + } else { | ||
| 733 | + if (_uploadImageProvider.touxiang.process < 1 && | ||
| 734 | + _uploadImageProvider.touxiang.process > 0.01 && | ||
| 735 | + _uploadImageProvider.touxiang.qiniuUrl != | ||
| 736 | + '') { | ||
| 737 | + Utils.showToast('正在上传图片,请稍等!'); | ||
| 738 | + return; | ||
| 739 | + } | ||
| 730 | } | 740 | } |
| 741 | + | ||
| 731 | if (_phoneController.text.trim().length == 0 || | 742 | if (_phoneController.text.trim().length == 0 || |
| 732 | _nameController.text.trim().length == 0) { | 743 | _nameController.text.trim().length == 0) { |
| 733 | Utils.showToast('请至少填写您的姓名和电话'); | 744 | Utils.showToast('请至少填写您的姓名和电话'); |
| @@ -1650,7 +1650,7 @@ class _BookInfoPageState extends State<BookInfoPage> { | @@ -1650,7 +1650,7 @@ class _BookInfoPageState extends State<BookInfoPage> { | ||
| 1650 | 1650 | ||
| 1651 | if (addFirstImage && | 1651 | if (addFirstImage && |
| 1652 | _uploadImageProvider.firstImage.process < 1 && | 1652 | _uploadImageProvider.firstImage.process < 1 && |
| 1653 | - _uploadImageProvider.firstImage.process > 0) { | 1653 | + _uploadImageProvider.firstImage.process > 0.01) { |
| 1654 | Utils.showToast('正在上传餐厅首图!,请稍等'); | 1654 | Utils.showToast('正在上传餐厅首图!,请稍等'); |
| 1655 | return false; | 1655 | return false; |
| 1656 | } | 1656 | } |
| @@ -787,7 +787,7 @@ class _FirstImagePageState extends State<FirstImagePage> { | @@ -787,7 +787,7 @@ class _FirstImagePageState extends State<FirstImagePage> { | ||
| 787 | } | 787 | } |
| 788 | 788 | ||
| 789 | if (_uploadImageProvider.firstImage.process < 1 && | 789 | if (_uploadImageProvider.firstImage.process < 1 && |
| 790 | - _uploadImageProvider.firstImage.process > 0) { | 790 | + _uploadImageProvider.firstImage.process > 0.01) { |
| 791 | Utils.showToast('正在上传餐厅照片!,请稍等'); | 791 | Utils.showToast('正在上传餐厅照片!,请稍等'); |
| 792 | return false; | 792 | return false; |
| 793 | } | 793 | } |
| @@ -183,7 +183,7 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | @@ -183,7 +183,7 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | ||
| 183 | _addCookbook({bool showLoading = true}) async { | 183 | _addCookbook({bool showLoading = true}) async { |
| 184 | bool canDelete = false; | 184 | bool canDelete = false; |
| 185 | if (uploadImageProvider.dish.process < 1 && | 185 | if (uploadImageProvider.dish.process < 1 && |
| 186 | - uploadImageProvider.dish.process > 0) { | 186 | + uploadImageProvider.dish.process > 0.01 && uploadImageProvider.dish.qiniuUrl != '') { |
| 187 | Utils.showToast('正在上传菜品图片,请稍等!'); | 187 | Utils.showToast('正在上传菜品图片,请稍等!'); |
| 188 | return false; | 188 | return false; |
| 189 | } | 189 | } |
| @@ -39,6 +39,8 @@ import 'package:permission_handler/permission_handler.dart'; | @@ -39,6 +39,8 @@ import 'package:permission_handler/permission_handler.dart'; | ||
| 39 | import 'package:provider/provider.dart'; | 39 | import 'package:provider/provider.dart'; |
| 40 | 40 | ||
| 41 | import '../../app.dart'; | 41 | import '../../app.dart'; |
| 42 | +import '../../utils/dialog_util.dart'; | ||
| 43 | +import '../../utils/screen_util.dart'; | ||
| 42 | 44 | ||
| 43 | class StoreBaseInfoPage extends StatefulWidget { | 45 | class StoreBaseInfoPage extends StatefulWidget { |
| 44 | StoreBaseInfoPage({Key key}) : super(key: key); | 46 | StoreBaseInfoPage({Key key}) : super(key: key); |
| @@ -88,6 +90,9 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | @@ -88,6 +90,9 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | ||
| 88 | TextEditingController _booktime1 = TextEditingController(); | 90 | TextEditingController _booktime1 = TextEditingController(); |
| 89 | TextEditingController _booktime2 = TextEditingController(); | 91 | TextEditingController _booktime2 = TextEditingController(); |
| 90 | TextEditingController _booktime3 = TextEditingController(); | 92 | TextEditingController _booktime3 = TextEditingController(); |
| 93 | + TextEditingController _averageC = TextEditingController(); | ||
| 94 | + String cuisine = ''; | ||
| 95 | + List<String> cuisineIds = []; | ||
| 91 | 96 | ||
| 92 | ///获取接单时间接口 | 97 | ///获取接单时间接口 |
| 93 | _getReceiveOrdersTime() async { | 98 | _getReceiveOrdersTime() async { |
| @@ -141,6 +146,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | @@ -141,6 +146,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | ||
| 141 | _getReceiveOrdersTime(); | 146 | _getReceiveOrdersTime(); |
| 142 | _getDailyTime(); | 147 | _getDailyTime(); |
| 143 | getSellerTemplateConf(); | 148 | getSellerTemplateConf(); |
| 149 | + _getCuisineData(); | ||
| 144 | }); | 150 | }); |
| 145 | } | 151 | } |
| 146 | 152 | ||
| @@ -151,6 +157,60 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | @@ -151,6 +157,60 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | ||
| 151 | super.dispose(); | 157 | super.dispose(); |
| 152 | } | 158 | } |
| 153 | 159 | ||
| 160 | + _getCuisineData() async { | ||
| 161 | + Future.wait<bool>([getAllCuisine(context), getSellerCuisine(context)]) | ||
| 162 | + .then((results) async { | ||
| 163 | + print(results[0]); | ||
| 164 | + if (results[0] && results[1]) { | ||
| 165 | + //成功 | ||
| 166 | + cuisineIds = []; | ||
| 167 | + _baseIndoProvider.sellerCuisineData.forEach((elements) { | ||
| 168 | + var result = _baseIndoProvider.allCuisineData | ||
| 169 | + .where((element) => element.id == elements.cid); | ||
| 170 | + if (result.length > 0) { | ||
| 171 | + cuisine += result.first.name + ' '; | ||
| 172 | + cuisineIds.add(elements.cid); | ||
| 173 | + } | ||
| 174 | + }); | ||
| 175 | + if (cuisine.endsWith(' ')) { | ||
| 176 | + cuisine = cuisine.substring(0, cuisine.length - 1); | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + setState(() {}); | ||
| 180 | + } else { | ||
| 181 | + // if (!results[0]) { | ||
| 182 | + // //没有优惠券 | ||
| 183 | + // } else {} | ||
| 184 | + // if (!results[1]) { | ||
| 185 | + // //没有营销中心数据 | ||
| 186 | + // } else {} | ||
| 187 | + setState(() {}); | ||
| 188 | + } | ||
| 189 | + }).catchError((e) { | ||
| 190 | + print(e); | ||
| 191 | + }); | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + Future<bool> getAllCuisine(BuildContext context) async { | ||
| 195 | + bool success = await _baseIndoProvider.getAllCuisine(context); | ||
| 196 | + if (success && _baseIndoProvider.allCuisineData.length > 0) { | ||
| 197 | + //有数据 | ||
| 198 | + return true; | ||
| 199 | + } else { | ||
| 200 | + return false; | ||
| 201 | + } | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + Future<bool> getSellerCuisine(BuildContext context) async { | ||
| 205 | + bool success = await _baseIndoProvider.getSellerCuisine(context); | ||
| 206 | + if (success && _baseIndoProvider.sellerCuisineData.length > 0) { | ||
| 207 | + //有数据 | ||
| 208 | + return true; | ||
| 209 | + } else { | ||
| 210 | + return false; | ||
| 211 | + } | ||
| 212 | + } | ||
| 213 | + | ||
| 154 | getSellerTemplateConf() async { | 214 | getSellerTemplateConf() async { |
| 155 | bool success = await marketingCenterProvider.getSellerTemplateConf(context); | 215 | bool success = await marketingCenterProvider.getSellerTemplateConf(context); |
| 156 | if (success && marketingCenterProvider.markDataModel.store != null) { | 216 | if (success && marketingCenterProvider.markDataModel.store != null) { |
| @@ -356,6 +416,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | @@ -356,6 +416,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | ||
| 356 | GetSellerInfoSunModel itemModel = | 416 | GetSellerInfoSunModel itemModel = |
| 357 | await _baseIndoProvider.getSellerById(context); | 417 | await _baseIndoProvider.getSellerById(context); |
| 358 | if (itemModel != null) { | 418 | if (itemModel != null) { |
| 419 | + _averageC.text = itemModel.data.average ?? '0'; | ||
| 359 | _nameController.text = itemModel.data.sellername; | 420 | _nameController.text = itemModel.data.sellername; |
| 360 | 421 | ||
| 361 | _timeController.text = itemModel.data.dailyTime; | 422 | _timeController.text = itemModel.data.dailyTime; |
| @@ -454,12 +515,35 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | @@ -454,12 +515,35 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | ||
| 454 | return; | 515 | return; |
| 455 | } | 516 | } |
| 456 | } | 517 | } |
| 457 | - | 518 | + if(cuisineIds.length == 0){ |
| 519 | + Utils.showToast('请至少选择一个菜系!'); | ||
| 520 | + return; | ||
| 521 | + } | ||
| 522 | + setSellerCuisine(); | ||
| 523 | + setAverage(); | ||
| 458 | await _setReceiveTime(); | 524 | await _setReceiveTime(); |
| 459 | _refreshMarketingInfo(); | 525 | _refreshMarketingInfo(); |
| 460 | await _setSellerInfoById(); | 526 | await _setSellerInfoById(); |
| 461 | } | 527 | } |
| 462 | 528 | ||
| 529 | + setAverage() async { | ||
| 530 | + Map<String, String> params = { | ||
| 531 | + 'sid': Provider.of<UserModel>(context,listen: false).user.sellerid, | ||
| 532 | + 'field': 'average', | ||
| 533 | + 'value': _averageC.text | ||
| 534 | + }; | ||
| 535 | + await _baseIndoProvider.setSellerConfigByPC(context, params); | ||
| 536 | + } | ||
| 537 | + | ||
| 538 | + setSellerCuisine() async { | ||
| 539 | + | ||
| 540 | + Map<String, String> params = { | ||
| 541 | + 'sellerid': Provider.of<UserModel>(context,listen: false).user.sellerid, | ||
| 542 | + 'cid':Utils.listToStringEnglish1(cuisineIds) | ||
| 543 | + }; | ||
| 544 | + await _baseIndoProvider.setSellerCuisine(context, params); | ||
| 545 | + } | ||
| 546 | + | ||
| 463 | _refreshMarketingInfo() async { | 547 | _refreshMarketingInfo() async { |
| 464 | //接口 | 548 | //接口 |
| 465 | Map storeData = { | 549 | Map storeData = { |
| @@ -1335,10 +1419,10 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | @@ -1335,10 +1419,10 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | ||
| 1335 | return InkWell( | 1419 | return InkWell( |
| 1336 | onTap: onTap, | 1420 | onTap: onTap, |
| 1337 | child: Padding( | 1421 | child: Padding( |
| 1338 | - padding: | ||
| 1339 | - EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(24)), | 1422 | + padding: EdgeInsets.symmetric( |
| 1423 | + horizontal: ScreenUtil().setWidth(24), vertical: w(5)), | ||
| 1340 | child: Container( | 1424 | child: Container( |
| 1341 | - height: ScreenUtil().setWidth(40), | 1425 | + // height: ScreenUtil().setWidth(40), |
| 1342 | child: Row( | 1426 | child: Row( |
| 1343 | crossAxisAlignment: CrossAxisAlignment.center, | 1427 | crossAxisAlignment: CrossAxisAlignment.center, |
| 1344 | mainAxisAlignment: MainAxisAlignment.spaceBetween, | 1428 | mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| @@ -1350,14 +1434,16 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | @@ -1350,14 +1434,16 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | ||
| 1350 | : MyColours.color_999999, | 1434 | : MyColours.color_999999, |
| 1351 | fontSize: ScreenUtil().setSp(28), | 1435 | fontSize: ScreenUtil().setSp(28), |
| 1352 | )), | 1436 | )), |
| 1353 | - Spacer(), | ||
| 1354 | - Text(time, | ||
| 1355 | - style: TextStyle( | ||
| 1356 | - color: highted | ||
| 1357 | - ? MyColours.color_353535 | ||
| 1358 | - : MyColours.color_438E93, | ||
| 1359 | - fontSize: ScreenUtil().setSp(28), | ||
| 1360 | - )), | 1437 | + Expanded( |
| 1438 | + child: Text(time, | ||
| 1439 | + textAlign: TextAlign.right, | ||
| 1440 | + maxLines: 10, | ||
| 1441 | + style: TextStyle( | ||
| 1442 | + color: highted | ||
| 1443 | + ? MyColours.color_353535 | ||
| 1444 | + : MyColours.color_438E93, | ||
| 1445 | + fontSize: ScreenUtil().setSp(28), | ||
| 1446 | + ))), | ||
| 1361 | HEmptyView(14), | 1447 | HEmptyView(14), |
| 1362 | Image.asset( | 1448 | Image.asset( |
| 1363 | Utils.getImgPath('arrow_right_new'), | 1449 | Utils.getImgPath('arrow_right_new'), |
| @@ -2298,6 +2384,117 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | @@ -2298,6 +2384,117 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | ||
| 2298 | // }, | 2384 | // }, |
| 2299 | keyboardType: TextInputType.multiline, | 2385 | keyboardType: TextInputType.multiline, |
| 2300 | )), | 2386 | )), |
| 2387 | + | ||
| 2388 | + VEmptyView(152), | ||
| 2389 | + Text('其他信息', | ||
| 2390 | + style: TextStyle( | ||
| 2391 | + fontWeight: FontWeight.bold, | ||
| 2392 | + fontSize: ScreenUtil().setSp(32), | ||
| 2393 | + color: MyColours.color_515151)), | ||
| 2394 | + VEmptyView(34), | ||
| 2395 | + timeWidget('经营菜系', cuisine, highted: false, | ||
| 2396 | + onTap: () { | ||
| 2397 | + FocusScope.of(context) | ||
| 2398 | + .requestFocus(FocusNode()); //隐藏键盘 | ||
| 2399 | + // 存储 | ||
| 2400 | + | ||
| 2401 | + DialogUtil.openCuisineSelectModalBottomSheet( | ||
| 2402 | + context, | ||
| 2403 | + List.from(_baseIndoProvider.allCuisineData), | ||
| 2404 | + cuisineIds, rCallback: (value) async { | ||
| 2405 | + if (value != null) { | ||
| 2406 | + cuisineIds = value; | ||
| 2407 | + cuisine = ''; | ||
| 2408 | + _baseIndoProvider.allCuisineData | ||
| 2409 | + .forEach((element) { | ||
| 2410 | + if (cuisineIds.contains(element.id)) { | ||
| 2411 | + cuisine += element.name + ' '; | ||
| 2412 | + } | ||
| 2413 | + }); | ||
| 2414 | + if (cuisine.endsWith(' ')) { | ||
| 2415 | + cuisine = cuisine.substring( | ||
| 2416 | + 0, cuisine.length - 1); | ||
| 2417 | + } | ||
| 2418 | + | ||
| 2419 | + setState(() {}); | ||
| 2420 | + } | ||
| 2421 | + }); | ||
| 2422 | + }), | ||
| 2423 | + VEmptyView(40), | ||
| 2424 | + | ||
| 2425 | + ///应收金额 | ||
| 2426 | + | ||
| 2427 | + Container( | ||
| 2428 | + // color: Colors.white, | ||
| 2429 | + padding: EdgeInsets.only( | ||
| 2430 | + left: ScreenUtil().setWidth(24), | ||
| 2431 | + right: w(10)), | ||
| 2432 | + child: Row( | ||
| 2433 | + children: [ | ||
| 2434 | + Text( | ||
| 2435 | + '人均消费', | ||
| 2436 | + style: TextStyle( | ||
| 2437 | + fontSize: ScreenUtil().setSp(28), | ||
| 2438 | + color: MyColours.color_999999), | ||
| 2439 | + ), | ||
| 2440 | + | ||
| 2441 | + // HEmptyView(40), | ||
| 2442 | + Expanded( | ||
| 2443 | + child: Container( | ||
| 2444 | + child: TextField( | ||
| 2445 | + maxLines: 1, | ||
| 2446 | + textAlign: TextAlign.right, | ||
| 2447 | + //输入文本的样式 | ||
| 2448 | + style: TextStyle( | ||
| 2449 | + fontSize: | ||
| 2450 | + ScreenUtil().setSp(28), | ||
| 2451 | + color: | ||
| 2452 | + MyColours.color_438E93), | ||
| 2453 | + controller: _averageC, | ||
| 2454 | + // focusNode: _focusNode, | ||
| 2455 | + keyboardType: TextInputType | ||
| 2456 | + .numberWithOptions( | ||
| 2457 | + decimal: true), | ||
| 2458 | + // textAlignVertical: TextAlignVertical.bottom, | ||
| 2459 | + decoration: InputDecoration( | ||
| 2460 | + isCollapsed: false, | ||
| 2461 | + hintText: "请输入", | ||
| 2462 | + hintStyle: TextStyle( | ||
| 2463 | + color: | ||
| 2464 | + MyColours.color_999999, | ||
| 2465 | + fontSize: | ||
| 2466 | + ScreenUtil().setSp(28), | ||
| 2467 | + ), | ||
| 2468 | + // contentPadding: | ||
| 2469 | + // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)), | ||
| 2470 | + contentPadding: | ||
| 2471 | + EdgeInsets.zero, | ||
| 2472 | + border: OutlineInputBorder( | ||
| 2473 | + borderSide: | ||
| 2474 | + BorderSide.none), | ||
| 2475 | + ), | ||
| 2476 | + onChanged: (value) { | ||
| 2477 | + // print(value); | ||
| 2478 | + // // currentRemark = value; | ||
| 2479 | + // // print(); | ||
| 2480 | + // setState(() { | ||
| 2481 | + // if (value != '¥' && value.trim().length > 0) { | ||
| 2482 | + // btnState = 1; | ||
| 2483 | + // } else { | ||
| 2484 | + // btnState = -1; | ||
| 2485 | + // } | ||
| 2486 | + // }); | ||
| 2487 | + }, | ||
| 2488 | + onEditingComplete: () { | ||
| 2489 | + print('fff'); | ||
| 2490 | + // _focusNode.unfocus(); | ||
| 2491 | + | ||
| 2492 | + // _editingController.text = ''; | ||
| 2493 | + // _needNode.unfocus(); | ||
| 2494 | + }))) | ||
| 2495 | + ], | ||
| 2496 | + )), | ||
| 2497 | + | ||
| 2301 | // Padding( | 2498 | // Padding( |
| 2302 | // padding: EdgeInsets.symmetric( | 2499 | // padding: EdgeInsets.symmetric( |
| 2303 | // horizontal: ScreenUtil().setWidth(40), | 2500 | // horizontal: ScreenUtil().setWidth(40), |
| @@ -848,7 +848,7 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { | @@ -848,7 +848,7 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { | ||
| 848 | innerloop: | 848 | innerloop: |
| 849 | for (UploadImgModel item | 849 | for (UploadImgModel item |
| 850 | in _uploadImageProvider.imageList) { | 850 | in _uploadImageProvider.imageList) { |
| 851 | - if (item.process > 0 && | 851 | + if (item.process > 0.01 && |
| 852 | item.process < 1) { | 852 | item.process < 1) { |
| 853 | Utils.showToast('正在上传,请稍等'); | 853 | Utils.showToast('正在上传,请稍等'); |
| 854 | // return false; | 854 | // return false; |
| @@ -137,11 +137,11 @@ class _BaseInfoPageSimState extends State<BaseInfoPageSim> { | @@ -137,11 +137,11 @@ class _BaseInfoPageSimState extends State<BaseInfoPageSim> { | ||
| 137 | nameStr = _baseIndoProvider.baseInfoSunModel.name; | 137 | nameStr = _baseIndoProvider.baseInfoSunModel.name; |
| 138 | _uploadImageProvider.touxiang.qiniuUrl = | 138 | _uploadImageProvider.touxiang.qiniuUrl = |
| 139 | _baseIndoProvider.baseInfoSunModel.photo; | 139 | _baseIndoProvider.baseInfoSunModel.photo; |
| 140 | - _uploadImageProvider.touxiang.process = 1; | 140 | + _uploadImageProvider.touxiang.process = 1; |
| 141 | imgAll.add(_baseIndoProvider.baseInfoSunModel.photo); | 141 | imgAll.add(_baseIndoProvider.baseInfoSunModel.photo); |
| 142 | _uploadImageProvider.erweima.qiniuUrl = | 142 | _uploadImageProvider.erweima.qiniuUrl = |
| 143 | _baseIndoProvider.baseInfoSunModel.qrcode; | 143 | _baseIndoProvider.baseInfoSunModel.qrcode; |
| 144 | - _uploadImageProvider.erweima.process = 1; | 144 | + _uploadImageProvider.erweima.process = 1; |
| 145 | _phoneController.text = _baseIndoProvider.baseInfoSunModel.phone; | 145 | _phoneController.text = _baseIndoProvider.baseInfoSunModel.phone; |
| 146 | phoneStr = _baseIndoProvider.baseInfoSunModel.phone ?? ''; | 146 | phoneStr = _baseIndoProvider.baseInfoSunModel.phone ?? ''; |
| 147 | _wechatController.text = _baseIndoProvider.baseInfoSunModel.wechat; | 147 | _wechatController.text = _baseIndoProvider.baseInfoSunModel.wechat; |
| @@ -725,10 +725,21 @@ class _BaseInfoPageSimState extends State<BaseInfoPageSim> { | @@ -725,10 +725,21 @@ class _BaseInfoPageSimState extends State<BaseInfoPageSim> { | ||
| 725 | ScreenUtil().setWidth(56)), | 725 | ScreenUtil().setWidth(56)), |
| 726 | child: RoundButton( | 726 | child: RoundButton( |
| 727 | onPressed: () { | 727 | onPressed: () { |
| 728 | - if (_uploadImageProvider.touxiang.process < 1 && | ||
| 729 | - _uploadImageProvider.touxiang.process > 0) { | ||
| 730 | - Utils.showToast('正在上传图片,请稍等!'); | ||
| 731 | - return; | 728 | + if (_uploadImageProvider.touxiang.qiniuUrl |
| 729 | + .trim() | ||
| 730 | + .length == | ||
| 731 | + 0 || | ||
| 732 | + _uploadImageProvider.touxiang.qiniuUrl == | ||
| 733 | + 'http://nosqn.colorcun.com/yd_person.png') { | ||
| 734 | + } else { | ||
| 735 | + if (_uploadImageProvider.touxiang.process < 1 && | ||
| 736 | + _uploadImageProvider.touxiang.process > | ||
| 737 | + 0.01 && | ||
| 738 | + _uploadImageProvider.touxiang.qiniuUrl != | ||
| 739 | + '') { | ||
| 740 | + Utils.showToast('正在上传图片,请稍等!'); | ||
| 741 | + return; | ||
| 742 | + } | ||
| 732 | } | 743 | } |
| 733 | if (_phoneController.text.trim().length == 0 || | 744 | if (_phoneController.text.trim().length == 0 || |
| 734 | _nameController.text.trim().length == 0) { | 745 | _nameController.text.trim().length == 0) { |
| @@ -1415,7 +1415,7 @@ class _BookInfoPageSimState extends State<BookInfoPageSim> { | @@ -1415,7 +1415,7 @@ class _BookInfoPageSimState extends State<BookInfoPageSim> { | ||
| 1415 | 1415 | ||
| 1416 | if (addFirstImage && | 1416 | if (addFirstImage && |
| 1417 | _uploadImageProvider.firstImage.process < 1 && | 1417 | _uploadImageProvider.firstImage.process < 1 && |
| 1418 | - _uploadImageProvider.firstImage.process > 0) { | 1418 | + _uploadImageProvider.firstImage.process > 0.01) { |
| 1419 | Utils.showToast('正在上传餐厅首图!,请稍等'); | 1419 | Utils.showToast('正在上传餐厅首图!,请稍等'); |
| 1420 | return false; | 1420 | return false; |
| 1421 | } | 1421 | } |
| @@ -17,8 +17,10 @@ import 'package:one_key/utils/utils.dart'; | @@ -17,8 +17,10 @@ import 'package:one_key/utils/utils.dart'; | ||
| 17 | import 'package:one_key/widgets/loading.dart'; | 17 | import 'package:one_key/widgets/loading.dart'; |
| 18 | import 'package:provider/provider.dart'; | 18 | import 'package:provider/provider.dart'; |
| 19 | 19 | ||
| 20 | +import '../models/all_cuisine.dart'; | ||
| 20 | import '../models/meal_day_date_model.dart'; | 21 | import '../models/meal_day_date_model.dart'; |
| 21 | import '../models/meal_list_model.dart'; | 22 | import '../models/meal_list_model.dart'; |
| 23 | +import '../models/seller_cuisine_model.dart'; | ||
| 22 | 24 | ||
| 23 | class StoreBaseIndoProvider with ChangeNotifier { | 25 | class StoreBaseIndoProvider with ChangeNotifier { |
| 24 | GetSellerInfoSunModel itemModel; | 26 | GetSellerInfoSunModel itemModel; |
| @@ -38,6 +40,10 @@ class StoreBaseIndoProvider with ChangeNotifier { | @@ -38,6 +40,10 @@ class StoreBaseIndoProvider with ChangeNotifier { | ||
| 38 | 40 | ||
| 39 | List<MealDayDateSunModel> dayDateData = []; | 41 | List<MealDayDateSunModel> dayDateData = []; |
| 40 | 42 | ||
| 43 | + List<SellerCuisineSunModel> sellerCuisineData = []; | ||
| 44 | + | ||
| 45 | + List<AllCuisineSunModel> allCuisineData = []; | ||
| 46 | + | ||
| 41 | ///根据商家ID获取商家信息 | 47 | ///根据商家ID获取商家信息 |
| 42 | Future<GetSellerInfoSunModel> getSellerById( | 48 | Future<GetSellerInfoSunModel> getSellerById( |
| 43 | BuildContext context, { | 49 | BuildContext context, { |
| @@ -71,6 +77,70 @@ class StoreBaseIndoProvider with ChangeNotifier { | @@ -71,6 +77,70 @@ class StoreBaseIndoProvider with ChangeNotifier { | ||
| 71 | } | 77 | } |
| 72 | } | 78 | } |
| 73 | 79 | ||
| 80 | + //获取所有菜系 | ||
| 81 | + Future<bool> getAllCuisine( | ||
| 82 | + BuildContext context, { | ||
| 83 | + bool showLoading = true, | ||
| 84 | + bool selfDismiss = false, | ||
| 85 | + }) async { | ||
| 86 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 87 | + .request<dynamic>(context, Method.post, HttpUrl.get_all_cuisine, | ||
| 88 | + showLoading: showLoading, selfDismiss: selfDismiss) | ||
| 89 | + .catchError((error) { | ||
| 90 | + print(error.toString()); | ||
| 91 | + }); | ||
| 92 | + | ||
| 93 | + if (baseResp == null) return false; | ||
| 94 | + if (baseResp.code == Constant.status_success) { | ||
| 95 | + if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 96 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 97 | + return false; | ||
| 98 | + } | ||
| 99 | + if (baseResp.responseData['data'] != null) { | ||
| 100 | + allCuisineData = AllCuisineModel.fromJson(baseResp.responseData).data; | ||
| 101 | + print(allCuisineData); | ||
| 102 | + return true; | ||
| 103 | + } else { | ||
| 104 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 105 | + } | ||
| 106 | + return false; | ||
| 107 | + } | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + //获取商家所属菜系 | ||
| 111 | + Future<bool> getSellerCuisine( | ||
| 112 | + BuildContext context, { | ||
| 113 | + bool showLoading = true, | ||
| 114 | + bool selfDismiss = false, | ||
| 115 | + }) async { | ||
| 116 | + Map<String, String> params = { | ||
| 117 | + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 118 | + }; | ||
| 119 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 120 | + .request<dynamic>(context, Method.post, HttpUrl.get_seller_cuisine, | ||
| 121 | + data: params, showLoading: showLoading, selfDismiss: selfDismiss) | ||
| 122 | + .catchError((error) { | ||
| 123 | + print(error.toString()); | ||
| 124 | + }); | ||
| 125 | + | ||
| 126 | + if (baseResp == null) return false; | ||
| 127 | + if (baseResp.code == Constant.status_success) { | ||
| 128 | + if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 129 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 130 | + return false; | ||
| 131 | + } | ||
| 132 | + if (baseResp.responseData['data'] != null) { | ||
| 133 | + sellerCuisineData = | ||
| 134 | + SellerCuisineModel.fromJson(baseResp.responseData).data; | ||
| 135 | + print(sellerCuisineData); | ||
| 136 | + return true; | ||
| 137 | + } else { | ||
| 138 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 139 | + } | ||
| 140 | + return false; | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + | ||
| 74 | /// decode response data. | 144 | /// decode response data. |
| 75 | Map<String, dynamic> _decodeData(Response response) { | 145 | Map<String, dynamic> _decodeData(Response response) { |
| 76 | if (response == null || | 146 | if (response == null || |
| @@ -178,6 +248,56 @@ class StoreBaseIndoProvider with ChangeNotifier { | @@ -178,6 +248,56 @@ class StoreBaseIndoProvider with ChangeNotifier { | ||
| 178 | } | 248 | } |
| 179 | } | 249 | } |
| 180 | 250 | ||
| 251 | + // 设置商家所属菜系 | ||
| 252 | + Future<bool> setSellerCuisine( | ||
| 253 | + BuildContext context, | ||
| 254 | + Map<String, String> params, { | ||
| 255 | + bool showLoading = true, | ||
| 256 | + bool selfDismiss = false, | ||
| 257 | + }) async { | ||
| 258 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 259 | + .request<dynamic>(context, Method.post, HttpUrl.set_seller_cuisine, | ||
| 260 | + data: params, showLoading: showLoading, selfDismiss: selfDismiss) | ||
| 261 | + .catchError((error) { | ||
| 262 | + print(error.toString()); | ||
| 263 | + return false; | ||
| 264 | + }); | ||
| 265 | + | ||
| 266 | + if (baseResp == null) return false; | ||
| 267 | + if (baseResp.code == Constant.status_success) { | ||
| 268 | + // Utils.showToast('保存成功'); | ||
| 269 | + return true; | ||
| 270 | + } else { | ||
| 271 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 272 | + return false; | ||
| 273 | + } | ||
| 274 | + } | ||
| 275 | + | ||
| 276 | +// PC维护商家基本信息,保存人均消费 | ||
| 277 | + Future<bool> setSellerConfigByPC( | ||
| 278 | + BuildContext context, | ||
| 279 | + Map<String, String> params, { | ||
| 280 | + bool showLoading = true, | ||
| 281 | + bool selfDismiss = false, | ||
| 282 | + }) async { | ||
| 283 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 284 | + .request<dynamic>(context, Method.post, HttpUrl.set_seller_config_by_pc, | ||
| 285 | + data: params, showLoading: showLoading, selfDismiss: selfDismiss) | ||
| 286 | + .catchError((error) { | ||
| 287 | + print(error.toString()); | ||
| 288 | + return false; | ||
| 289 | + }); | ||
| 290 | + | ||
| 291 | + if (baseResp == null) return false; | ||
| 292 | + if (baseResp.code == Constant.status_success) { | ||
| 293 | + // Utils.showToast('保存成功'); | ||
| 294 | + return true; | ||
| 295 | + } else { | ||
| 296 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 297 | + return false; | ||
| 298 | + } | ||
| 299 | + } | ||
| 300 | + | ||
| 181 | ///根据商家ID修改商家信息 | 301 | ///根据商家ID修改商家信息 |
| 182 | Future<SetSellerInfoSunModel> setSellerInfoById( | 302 | Future<SetSellerInfoSunModel> setSellerInfoById( |
| 183 | BuildContext context, FormData params) async { | 303 | BuildContext context, FormData params) async { |
| @@ -40,6 +40,7 @@ import 'package:one_key/models/table.dart' as t; | @@ -40,6 +40,7 @@ import 'package:one_key/models/table.dart' as t; | ||
| 40 | import 'package:url_launcher/url_launcher.dart'; | 40 | import 'package:url_launcher/url_launcher.dart'; |
| 41 | 41 | ||
| 42 | import '../app.dart'; | 42 | import '../app.dart'; |
| 43 | +import '../models/all_cuisine.dart'; | ||
| 43 | import '../models/cookbook_model.dart'; | 44 | import '../models/cookbook_model.dart'; |
| 44 | import '../models/customer_label_model.dart'; | 45 | import '../models/customer_label_model.dart'; |
| 45 | import '../models/get_reserve_type_field_model.dart'; | 46 | import '../models/get_reserve_type_field_model.dart'; |
| @@ -224,6 +225,84 @@ class DialogUtil { | @@ -224,6 +225,84 @@ class DialogUtil { | ||
| 224 | return temp; | 225 | return temp; |
| 225 | } | 226 | } |
| 226 | 227 | ||
| 228 | + static List<Widget> cuisineSelecctBtn(List<AllCuisineSunModel> menuSunModel, | ||
| 229 | + state, List<String> selectType, ClickkListCallbac callback) { | ||
| 230 | + List<Widget> temp = []; | ||
| 231 | + for (int i = 0; i < menuSunModel.length; i++) { | ||
| 232 | + AllCuisineSunModel practiceModel = menuSunModel[i]; | ||
| 233 | + temp.add(InkWell( | ||
| 234 | + onTap: () { | ||
| 235 | + // for (int j = 0; j < menuSunModel.length; j++) { | ||
| 236 | + // menuSunModel[j].select = false; | ||
| 237 | + // } | ||
| 238 | + practiceModel.select = !practiceModel.select; | ||
| 239 | + if (practiceModel.select) { | ||
| 240 | + selectType.add(practiceModel.id); | ||
| 241 | + } else { | ||
| 242 | + selectType.remove(practiceModel.id); | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + callback(selectType); | ||
| 246 | + state(() {}); | ||
| 247 | + }, | ||
| 248 | + child: Container( | ||
| 249 | + // height: w(34), | ||
| 250 | + padding: | ||
| 251 | + EdgeInsets.symmetric(horizontal: w(10), vertical: w(5)), | ||
| 252 | + decoration: BoxDecoration( | ||
| 253 | + border: Border.all( | ||
| 254 | + color: practiceModel.select | ||
| 255 | + ? MyColours.color_438E93 | ||
| 256 | + : MyColours.color_515151, | ||
| 257 | + width: w(1)), | ||
| 258 | + borderRadius: BorderRadius.circular(r(5)), | ||
| 259 | + color: practiceModel.select | ||
| 260 | + ? MyColours.color_438E93 | ||
| 261 | + : MyColours.color_ffffff, | ||
| 262 | + ), | ||
| 263 | + child: Text(practiceModel.name, | ||
| 264 | + style: TextStyle( | ||
| 265 | + fontSize: font(14), | ||
| 266 | + color: practiceModel.select | ||
| 267 | + ? MyColours.color_ffffff | ||
| 268 | + : MyColours.color_515151, | ||
| 269 | + )), | ||
| 270 | + )) | ||
| 271 | + | ||
| 272 | + // RoundButton( | ||
| 273 | + // text: practiceModel.name, | ||
| 274 | + // // bgColor: MyColours.color_ffffff, | ||
| 275 | + // gradientStart: practiceModel.select | ||
| 276 | + // ? MyColours.color_438E93 | ||
| 277 | + // : MyColours.color_ffffff, | ||
| 278 | + // gradientEnd: practiceModel.select | ||
| 279 | + // ? MyColours.color_438E93 | ||
| 280 | + // : MyColours.color_ffffff, | ||
| 281 | + // // width: w(80), | ||
| 282 | + // padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(5)), | ||
| 283 | + // height: w(34), | ||
| 284 | + // isBold: false, | ||
| 285 | + // radius: r(5), | ||
| 286 | + // textColor: practiceModel.select | ||
| 287 | + // ? MyColours.color_ffffff | ||
| 288 | + // : MyColours.color_515151, | ||
| 289 | + // borderColor: practiceModel.select | ||
| 290 | + // ? MyColours.color_438E93 | ||
| 291 | + // : MyColours.color_515151, | ||
| 292 | + // onPressed: () { | ||
| 293 | + // for (int j = 0; j < menuSunModel.length; j++) { | ||
| 294 | + // menuSunModel[j].select = false; | ||
| 295 | + // } | ||
| 296 | + // menuSunModel[i].select = true; | ||
| 297 | + // callback(menuSunModel[i].name); | ||
| 298 | + // state(() {}); | ||
| 299 | + // }, | ||
| 300 | + // ) | ||
| 301 | + ); | ||
| 302 | + } | ||
| 303 | + return temp; | ||
| 304 | + } | ||
| 305 | + | ||
| 227 | static List<Widget> dishSelectBtn( | 306 | static List<Widget> dishSelectBtn( |
| 228 | List<GetReserveTypeFieldsSunModel> menuSunModel, | 307 | List<GetReserveTypeFieldsSunModel> menuSunModel, |
| 229 | state, | 308 | state, |
| @@ -631,6 +710,107 @@ class DialogUtil { | @@ -631,6 +710,107 @@ class DialogUtil { | ||
| 631 | }); | 710 | }); |
| 632 | } | 711 | } |
| 633 | 712 | ||
| 713 | + ///菜系选择 | ||
| 714 | + static openCuisineSelectModalBottomSheet(context, | ||
| 715 | + List<AllCuisineSunModel> cuisineAllDatas, List<String> cuisineIds, | ||
| 716 | + {VoidCallback lCallback, ClickkListCallbac rCallback}) async { | ||
| 717 | + List<String> selectType = List.from(cuisineIds); | ||
| 718 | + | ||
| 719 | + if (cuisineIds.length > 0) { | ||
| 720 | + cuisineAllDatas.forEach((element) { | ||
| 721 | + element.select = false; | ||
| 722 | + if (cuisineIds.contains(element.id)) { | ||
| 723 | + element.select = true; | ||
| 724 | + } | ||
| 725 | + }); | ||
| 726 | + } | ||
| 727 | + final option = await showModalBottomSheet( | ||
| 728 | + context: context, | ||
| 729 | + backgroundColor: Colors.transparent, | ||
| 730 | + isDismissible: false, | ||
| 731 | + isScrollControlled: true, | ||
| 732 | + builder: (BuildContext context) { | ||
| 733 | + return StatefulBuilder(builder: (context, state) { | ||
| 734 | + return Container( | ||
| 735 | + decoration: BoxDecoration( | ||
| 736 | + color: MyColours.color_ffffff, | ||
| 737 | + borderRadius: BorderRadius.only( | ||
| 738 | + topLeft: Radius.circular(ScreenUtil().setWidth(10)), | ||
| 739 | + topRight: Radius.circular(ScreenUtil().setWidth(10)))), | ||
| 740 | + child: | ||
| 741 | + Column(mainAxisSize: MainAxisSize.min, children: <Widget>[ | ||
| 742 | + Row( | ||
| 743 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 744 | + children: [ | ||
| 745 | + GestureDetector( | ||
| 746 | + behavior: HitTestBehavior.opaque, | ||
| 747 | + onTap: () { | ||
| 748 | + cuisineAllDatas.forEach((element) { | ||
| 749 | + element.select = false; | ||
| 750 | + }); | ||
| 751 | + Navigator.of(context).pop(); | ||
| 752 | + }, | ||
| 753 | + child: Container( | ||
| 754 | + // width: double.infinity, | ||
| 755 | + alignment: Alignment.center, | ||
| 756 | + padding: EdgeInsets.symmetric( | ||
| 757 | + horizontal: w(15), | ||
| 758 | + vertical: ScreenUtil().setWidth(40)), | ||
| 759 | + child: Text( | ||
| 760 | + "取消", | ||
| 761 | + style: TextStyle( | ||
| 762 | + fontSize: ScreenUtil().setSp(32), | ||
| 763 | + color: MyColours.color_438E93), | ||
| 764 | + ), | ||
| 765 | + )), | ||
| 766 | + Container( | ||
| 767 | + // width: double.infinity, | ||
| 768 | + alignment: Alignment.center, | ||
| 769 | + padding: EdgeInsets.symmetric( | ||
| 770 | + vertical: ScreenUtil().setWidth(40)), | ||
| 771 | + child: Text( | ||
| 772 | + "选择经营菜系", | ||
| 773 | + style: TextStyle( | ||
| 774 | + fontWeight: FontWeight.bold, | ||
| 775 | + fontSize: ScreenUtil().setSp(32), | ||
| 776 | + color: MyColours.color_E6000000), | ||
| 777 | + ), | ||
| 778 | + ), | ||
| 779 | + GestureDetector( | ||
| 780 | + behavior: HitTestBehavior.opaque, | ||
| 781 | + onTap: () { | ||
| 782 | + Navigator.of(context).pop(); | ||
| 783 | + rCallback(selectType); | ||
| 784 | + }, | ||
| 785 | + child: Container( | ||
| 786 | + // width: double.infinity, | ||
| 787 | + alignment: Alignment.center, | ||
| 788 | + padding: EdgeInsets.symmetric( | ||
| 789 | + horizontal: w(15), | ||
| 790 | + vertical: ScreenUtil().setWidth(40)), | ||
| 791 | + child: Text("确定", | ||
| 792 | + style: TextStyle( | ||
| 793 | + fontSize: ScreenUtil().setSp(32), | ||
| 794 | + color: MyColours.color_438E93)), | ||
| 795 | + )), | ||
| 796 | + ]), | ||
| 797 | + VEmptyView(50), | ||
| 798 | + Wrap( | ||
| 799 | + spacing: w(12), | ||
| 800 | + runSpacing: w(12), | ||
| 801 | + children: cuisineSelecctBtn( | ||
| 802 | + cuisineAllDatas, state, selectType, (value) { | ||
| 803 | + selectType = value; | ||
| 804 | + })), | ||
| 805 | + VEmptyView(50), | ||
| 806 | + ])); | ||
| 807 | + }); | ||
| 808 | + }); | ||
| 809 | + cuisineAllDatas.forEach((element) { | ||
| 810 | + element.select = false; | ||
| 811 | + }); | ||
| 812 | + } | ||
| 813 | + | ||
| 634 | ///用餐类型 | 814 | ///用餐类型 |
| 635 | static openDishTypeSelectModalBottomSheet(context, | 815 | static openDishTypeSelectModalBottomSheet(context, |
| 636 | List<GetReserveTypeFieldsSunModel> reserveTypes, String reserveType, | 816 | List<GetReserveTypeFieldsSunModel> reserveTypes, String reserveType, |
| @@ -9009,7 +9189,7 @@ class DialogUtil { | @@ -9009,7 +9189,7 @@ class DialogUtil { | ||
| 9009 | // yearBegin: DateTime.now().year, | 9189 | // yearBegin: DateTime.now().year, |
| 9010 | // yearEnd: 2030, | 9190 | // yearEnd: 2030, |
| 9011 | minValue: DateTime(1925), | 9191 | minValue: DateTime(1925), |
| 9012 | - maxValue:DateTime.now(), | 9192 | + maxValue: DateTime.now(), |
| 9013 | value: dateTime), | 9193 | value: dateTime), |
| 9014 | height: ScreenUtil().setWidth(480), | 9194 | height: ScreenUtil().setWidth(480), |
| 9015 | hideHeader: false, | 9195 | hideHeader: false, |
-
Please register or login to post a comment