Showing
12 changed files
with
723 additions
and
266 deletions
lib/models/cookbook_one_model.dart
0 → 100644
| 1 | +import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | + | ||
| 3 | +part 'cookbook_one_model.g.dart'; | ||
| 4 | + | ||
| 5 | +@JsonSerializable() | ||
| 6 | +class CookbookOneModel extends Object { | ||
| 7 | + @JsonKey(name: 'ret') | ||
| 8 | + int ret; | ||
| 9 | + | ||
| 10 | + @JsonKey(name: 'data') | ||
| 11 | + Data data; | ||
| 12 | + | ||
| 13 | + @JsonKey(name: 'msg') | ||
| 14 | + String msg; | ||
| 15 | + | ||
| 16 | + CookbookOneModel( | ||
| 17 | + this.ret, | ||
| 18 | + this.data, | ||
| 19 | + this.msg, | ||
| 20 | + ); | ||
| 21 | + | ||
| 22 | + factory CookbookOneModel.fromJson(Map<String, dynamic> srcJson) => | ||
| 23 | + _$CookbookOneModelFromJson(srcJson); | ||
| 24 | + | ||
| 25 | + Map<String, dynamic> toJson() => _$CookbookOneModelToJson(this); | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +@JsonSerializable() | ||
| 29 | +class Data extends Object { | ||
| 30 | + @JsonKey(name: 'data') | ||
| 31 | + CookbookOneSunModel data; | ||
| 32 | + | ||
| 33 | + Data( | ||
| 34 | + this.data, | ||
| 35 | + ); | ||
| 36 | + | ||
| 37 | + factory Data.fromJson(Map<String, dynamic> srcJson) => | ||
| 38 | + _$DataFromJson(srcJson); | ||
| 39 | + | ||
| 40 | + Map<String, dynamic> toJson() => _$DataToJson(this); | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +@JsonSerializable() | ||
| 44 | +class CookbookOneSunModel extends Object { | ||
| 45 | + @JsonKey(name: 'id') | ||
| 46 | + String id; | ||
| 47 | + | ||
| 48 | + @JsonKey(name: 'sellerid') | ||
| 49 | + String sellerid; | ||
| 50 | + | ||
| 51 | + @JsonKey(name: 'cid') | ||
| 52 | + String cid; | ||
| 53 | + | ||
| 54 | + @JsonKey(name: 'unit') | ||
| 55 | + String unit; | ||
| 56 | + | ||
| 57 | + @JsonKey(name: 'name') | ||
| 58 | + String name; | ||
| 59 | + | ||
| 60 | + @JsonKey(name: 'price') | ||
| 61 | + String price; | ||
| 62 | + | ||
| 63 | + @JsonKey(name: 'first_name') | ||
| 64 | + String firstName; | ||
| 65 | + | ||
| 66 | + @JsonKey(name: 'channel') | ||
| 67 | + String channel; | ||
| 68 | + | ||
| 69 | + @JsonKey(name: 'status') | ||
| 70 | + String status; | ||
| 71 | + | ||
| 72 | + @JsonKey(name: 'give') | ||
| 73 | + String give; | ||
| 74 | + | ||
| 75 | + @JsonKey(name: 'image') | ||
| 76 | + String image; | ||
| 77 | + | ||
| 78 | + @JsonKey(name: 'order_o') | ||
| 79 | + String orderO; | ||
| 80 | + | ||
| 81 | + @JsonKey(name: 'cdate') | ||
| 82 | + String cdate; | ||
| 83 | + | ||
| 84 | + @JsonKey(name: 'class_name') | ||
| 85 | + String className; | ||
| 86 | + | ||
| 87 | + @JsonKey(name: 'class_order') | ||
| 88 | + String classOrder; | ||
| 89 | + | ||
| 90 | + @JsonKey(name: 'attr') | ||
| 91 | + List<dynamic> attr; | ||
| 92 | + | ||
| 93 | + @JsonKey(name: 'spec') | ||
| 94 | + List<dynamic> spec; | ||
| 95 | + | ||
| 96 | + @JsonKey(name: 'practice') | ||
| 97 | + List<dynamic> practice; | ||
| 98 | + | ||
| 99 | + // @JsonKey(name: 'template') | ||
| 100 | + // Template template; | ||
| 101 | + | ||
| 102 | + CookbookOneSunModel( | ||
| 103 | + this.id, | ||
| 104 | + this.sellerid, | ||
| 105 | + this.cid, | ||
| 106 | + this.unit, | ||
| 107 | + this.name, | ||
| 108 | + this.price, | ||
| 109 | + this.firstName, | ||
| 110 | + this.channel, | ||
| 111 | + this.status, | ||
| 112 | + this.give, | ||
| 113 | + this.image, | ||
| 114 | + this.orderO, | ||
| 115 | + this.cdate, | ||
| 116 | + this.className, | ||
| 117 | + this.classOrder, | ||
| 118 | + this.attr, | ||
| 119 | + this.spec, | ||
| 120 | + this.practice, | ||
| 121 | + // this.template, | ||
| 122 | + ); | ||
| 123 | + | ||
| 124 | + factory CookbookOneSunModel.fromJson(Map<String, dynamic> srcJson) => | ||
| 125 | + _$CookbookOneSunModelFromJson(srcJson); | ||
| 126 | + | ||
| 127 | + Map<String, dynamic> toJson() => _$CookbookOneSunModelToJson(this); | ||
| 128 | +} | ||
| 129 | + | ||
| 130 | +// @JsonSerializable() | ||
| 131 | +// class Template extends Object { | ||
| 132 | +// @JsonKey(name: 'templateid') | ||
| 133 | +// String templateid; | ||
| 134 | + | ||
| 135 | +// Template( | ||
| 136 | +// this.templateid, | ||
| 137 | +// ); | ||
| 138 | + | ||
| 139 | +// factory Template.fromJson(Map<String, dynamic> srcJson) => | ||
| 140 | +// _$TemplateFromJson(srcJson); | ||
| 141 | + | ||
| 142 | +// Map<String, dynamic> toJson() => _$TemplateToJson(this); | ||
| 143 | +// } |
lib/models/cookbook_one_model.g.dart
0 → 100644
| 1 | +// GENERATED CODE - DO NOT MODIFY BY HAND | ||
| 2 | + | ||
| 3 | +part of 'cookbook_one_model.dart'; | ||
| 4 | + | ||
| 5 | +// ************************************************************************** | ||
| 6 | +// JsonSerializableGenerator | ||
| 7 | +// ************************************************************************** | ||
| 8 | + | ||
| 9 | +CookbookOneModel _$CookbookOneModelFromJson(Map<String, dynamic> json) { | ||
| 10 | + return CookbookOneModel( | ||
| 11 | + json['ret'] as int, | ||
| 12 | + json['data'] == null | ||
| 13 | + ? null | ||
| 14 | + : Data.fromJson(json['data'] as Map<String, dynamic>), | ||
| 15 | + json['msg'] as String, | ||
| 16 | + ); | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +Map<String, dynamic> _$CookbookOneModelToJson(CookbookOneModel instance) => | ||
| 20 | + <String, dynamic>{ | ||
| 21 | + 'ret': instance.ret, | ||
| 22 | + 'data': instance.data, | ||
| 23 | + 'msg': instance.msg, | ||
| 24 | + }; | ||
| 25 | + | ||
| 26 | +Data _$DataFromJson(Map<String, dynamic> json) { | ||
| 27 | + return Data( | ||
| 28 | + json['data'] == null | ||
| 29 | + ? null | ||
| 30 | + : CookbookOneSunModel.fromJson(json['data'] as Map<String, dynamic>), | ||
| 31 | + ); | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +Map<String, dynamic> _$DataToJson(Data instance) => <String, dynamic>{ | ||
| 35 | + 'data': instance.data, | ||
| 36 | + }; | ||
| 37 | + | ||
| 38 | +CookbookOneSunModel _$CookbookOneSunModelFromJson(Map<String, dynamic> json) { | ||
| 39 | + return CookbookOneSunModel( | ||
| 40 | + json['id'] as String, | ||
| 41 | + json['sellerid'] as String, | ||
| 42 | + json['cid'] as String, | ||
| 43 | + json['unit'] as String, | ||
| 44 | + json['name'] as String, | ||
| 45 | + json['price'] as String, | ||
| 46 | + json['first_name'] as String, | ||
| 47 | + json['channel'] as String, | ||
| 48 | + json['status'] as String, | ||
| 49 | + json['give'] as String, | ||
| 50 | + json['image'] as String, | ||
| 51 | + json['order_o'] as String, | ||
| 52 | + json['cdate'] as String, | ||
| 53 | + json['class_name'] as String, | ||
| 54 | + json['class_order'] as String, | ||
| 55 | + json['attr'] as List, | ||
| 56 | + json['spec'] as List, | ||
| 57 | + json['practice'] as List, | ||
| 58 | + // json['template'] == null | ||
| 59 | + // ? null | ||
| 60 | + // : (json['template'] is Map) | ||
| 61 | + // ? Template.fromJson(json['template'] as Map<String, dynamic>) | ||
| 62 | + // : '', | ||
| 63 | + ); | ||
| 64 | +} | ||
| 65 | + | ||
| 66 | +Map<String, dynamic> _$CookbookOneSunModelToJson( | ||
| 67 | + CookbookOneSunModel instance) => | ||
| 68 | + <String, dynamic>{ | ||
| 69 | + 'id': instance.id, | ||
| 70 | + 'sellerid': instance.sellerid, | ||
| 71 | + 'cid': instance.cid, | ||
| 72 | + 'unit': instance.unit, | ||
| 73 | + 'name': instance.name, | ||
| 74 | + 'price': instance.price, | ||
| 75 | + 'first_name': instance.firstName, | ||
| 76 | + 'channel': instance.channel, | ||
| 77 | + 'status': instance.status, | ||
| 78 | + 'give': instance.give, | ||
| 79 | + 'image': instance.image, | ||
| 80 | + 'order_o': instance.orderO, | ||
| 81 | + 'cdate': instance.cdate, | ||
| 82 | + 'class_name': instance.className, | ||
| 83 | + 'class_order': instance.classOrder, | ||
| 84 | + 'attr': instance.attr, | ||
| 85 | + 'spec': instance.spec, | ||
| 86 | + 'practice': instance.practice, | ||
| 87 | + // 'template': instance.template, | ||
| 88 | + }; | ||
| 89 | + | ||
| 90 | +// Template _$TemplateFromJson(Map<String, dynamic> json) { | ||
| 91 | +// return Template( | ||
| 92 | +// json['templateid'] as String, | ||
| 93 | +// ); | ||
| 94 | +// } | ||
| 95 | + | ||
| 96 | +// Map<String, dynamic> _$TemplateToJson(Template instance) => <String, dynamic>{ | ||
| 97 | +// 'templateid': instance.templateid, | ||
| 98 | +// }; |
| @@ -150,5 +150,7 @@ class HttpUrl { | @@ -150,5 +150,7 @@ class HttpUrl { | ||
| 150 | static const String add_cookbook = "?service=App.Cookbook.AddCookbook"; //添加菜品 | 150 | static const String add_cookbook = "?service=App.Cookbook.AddCookbook"; //添加菜品 |
| 151 | static const String get_spec_by_sellerid = | 151 | static const String get_spec_by_sellerid = |
| 152 | "?service=App.Cookbook.GetSpecBySellerid"; //获取商家计价单位 | 152 | "?service=App.Cookbook.GetSpecBySellerid"; //获取商家计价单位 |
| 153 | + static const String get_cookbook_by_id = | ||
| 154 | + "?service=App.Cookbook.GetCookbookById"; // 获取单个菜品信息 | ||
| 153 | 155 | ||
| 154 | } | 156 | } |
| @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; | @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; | ||
| 6 | import 'package:flutter_native_image/flutter_native_image.dart'; | 6 | import 'package:flutter_native_image/flutter_native_image.dart'; |
| 7 | import 'package:flutter_screenutil/screenutil.dart'; | 7 | import 'package:flutter_screenutil/screenutil.dart'; |
| 8 | import 'package:image_picker/image_picker.dart'; | 8 | import 'package:image_picker/image_picker.dart'; |
| 9 | +import 'package:one_key/models/cookbook_model.dart'; | ||
| 9 | import 'package:one_key/models/upload_img_model.dart'; | 10 | import 'package:one_key/models/upload_img_model.dart'; |
| 10 | import 'package:one_key/provider/menu_provider.dart'; | 11 | import 'package:one_key/provider/menu_provider.dart'; |
| 11 | import 'package:one_key/provider/upload_img_provider.dart'; | 12 | import 'package:one_key/provider/upload_img_provider.dart'; |
| @@ -28,7 +29,9 @@ import 'package:provider/provider.dart'; | @@ -28,7 +29,9 @@ import 'package:provider/provider.dart'; | ||
| 28 | * 添加菜品页面 | 29 | * 添加菜品页面 |
| 29 | */ | 30 | */ |
| 30 | class MenuAddDishesPage extends StatefulWidget { | 31 | class MenuAddDishesPage extends StatefulWidget { |
| 31 | - MenuAddDishesPage({Key key}) : super(key: key); | 32 | + final bool isNew; |
| 33 | + final String idstr; | ||
| 34 | + MenuAddDishesPage({Key key, this.isNew, this.idstr}) : super(key: key); | ||
| 32 | 35 | ||
| 33 | @override | 36 | @override |
| 34 | _MenuAddDishesPageState createState() => _MenuAddDishesPageState(); | 37 | _MenuAddDishesPageState createState() => _MenuAddDishesPageState(); |
| @@ -60,9 +63,37 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | @@ -60,9 +63,37 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | ||
| 60 | _getQiniuInfo(); | 63 | _getQiniuInfo(); |
| 61 | _getCookbookBySellerId(showLoading: false); | 64 | _getCookbookBySellerId(showLoading: false); |
| 62 | _getSpecBySellerid(); | 65 | _getSpecBySellerid(); |
| 66 | + if (!widget.isNew) { | ||
| 67 | + _getCookbookById(); | ||
| 68 | + } | ||
| 63 | }); | 69 | }); |
| 64 | } | 70 | } |
| 65 | 71 | ||
| 72 | + ///获取单个菜品信息 | ||
| 73 | + _getCookbookById({bool showLoading = false}) async { | ||
| 74 | + Map<String, String> params = { | ||
| 75 | + "id": widget.idstr, | ||
| 76 | + }; | ||
| 77 | + await menuManageProvider.getCookbookById(context, params, | ||
| 78 | + showLoading: showLoading); | ||
| 79 | + if (menuManageProvider.cookbookOneSunModel != null) { | ||
| 80 | + _nameController.text = menuManageProvider.cookbookOneSunModel.name; | ||
| 81 | + swichState = | ||
| 82 | + menuManageProvider.cookbookOneSunModel.status == '1' ? true : false; | ||
| 83 | + _priceController.text = menuManageProvider.cookbookOneSunModel.price; | ||
| 84 | + categoryStr = menuManageProvider.cookbookOneSunModel.className; | ||
| 85 | + specStr = menuManageProvider.cookbookOneSunModel.unit; | ||
| 86 | + if (menuManageProvider.cookbookOneSunModel.image != null && | ||
| 87 | + menuManageProvider.cookbookOneSunModel.image != 'null' && | ||
| 88 | + menuManageProvider.cookbookOneSunModel.image != '') { | ||
| 89 | + uploadImageProvider.dish.qiniuUrl = | ||
| 90 | + menuManageProvider.cookbookOneSunModel.image; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + setState(() {}); | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + | ||
| 66 | ///计价方式 | 97 | ///计价方式 |
| 67 | _getSpecBySellerid({bool showLoading = false}) async { | 98 | _getSpecBySellerid({bool showLoading = false}) async { |
| 68 | Map<String, String> params = { | 99 | Map<String, String> params = { |
| @@ -42,6 +42,7 @@ class _MenuCategoryPageState extends State<MenuCategoryPage> { | @@ -42,6 +42,7 @@ class _MenuCategoryPageState extends State<MenuCategoryPage> { | ||
| 42 | bool sucess = await menuManageProvider.addCookbookClass(context, params, | 42 | bool sucess = await menuManageProvider.addCookbookClass(context, params, |
| 43 | showLoading: showLoading); | 43 | showLoading: showLoading); |
| 44 | if (sucess) { | 44 | if (sucess) { |
| 45 | + EventBus().emit('menu_manage_page'); | ||
| 45 | _getCookbookBySellerId(showLoading: false); | 46 | _getCookbookBySellerId(showLoading: false); |
| 46 | } | 47 | } |
| 47 | } | 48 | } |
| @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; | @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; | ||
| 4 | import 'package:flutter_easyrefresh/easy_refresh.dart'; | 4 | import 'package:flutter_easyrefresh/easy_refresh.dart'; |
| 5 | import 'package:flutter_screenutil/screenutil.dart'; | 5 | import 'package:flutter_screenutil/screenutil.dart'; |
| 6 | import 'package:one_key/constant/state.dart'; | 6 | import 'package:one_key/constant/state.dart'; |
| 7 | +import 'package:one_key/models/cookbook_category_model.dart'; | ||
| 7 | import 'package:one_key/models/cookbook_model.dart'; | 8 | import 'package:one_key/models/cookbook_model.dart'; |
| 8 | import 'package:one_key/provider/menu_provider.dart'; | 9 | import 'package:one_key/provider/menu_provider.dart'; |
| 9 | import 'package:one_key/provider/user_model.dart'; | 10 | import 'package:one_key/provider/user_model.dart'; |
| @@ -30,14 +31,17 @@ class MenuManagePage extends StatefulWidget { | @@ -30,14 +31,17 @@ class MenuManagePage extends StatefulWidget { | ||
| 30 | class _MenuManagePageState extends State<MenuManagePage> { | 31 | class _MenuManagePageState extends State<MenuManagePage> { |
| 31 | ScrollController _controller = ScrollController(); | 32 | ScrollController _controller = ScrollController(); |
| 32 | MenuManageProvider menuManageProvider; | 33 | MenuManageProvider menuManageProvider; |
| 34 | + bool isShow = false; //添加菜品按钮 | ||
| 33 | @override | 35 | @override |
| 34 | void initState() { | 36 | void initState() { |
| 35 | super.initState(); | 37 | super.initState(); |
| 36 | WidgetsBinding.instance.addPostFrameCallback((timeStamp) { | 38 | WidgetsBinding.instance.addPostFrameCallback((timeStamp) { |
| 37 | _getCookbookByClass(showLoading: false); | 39 | _getCookbookByClass(showLoading: false); |
| 40 | + _getCookbookBySellerId(); | ||
| 38 | }); | 41 | }); |
| 39 | EventBus().on('menu_manage_page', (arg) { | 42 | EventBus().on('menu_manage_page', (arg) { |
| 40 | _getCookbookByClass(showLoading: false); | 43 | _getCookbookByClass(showLoading: false); |
| 44 | + _getCookbookBySellerId(); | ||
| 41 | }); | 45 | }); |
| 42 | } | 46 | } |
| 43 | 47 | ||
| @@ -48,6 +52,33 @@ class _MenuManagePageState extends State<MenuManagePage> { | @@ -48,6 +52,33 @@ class _MenuManagePageState extends State<MenuManagePage> { | ||
| 48 | EventBus().off('menu_manage_page'); | 52 | EventBus().off('menu_manage_page'); |
| 49 | } | 53 | } |
| 50 | 54 | ||
| 55 | + ///获取分类数据 | ||
| 56 | + _getCookbookBySellerId({bool showLoading = true}) async { | ||
| 57 | + Map<String, String> params = { | ||
| 58 | + "SellerId": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 59 | + }; | ||
| 60 | + | ||
| 61 | + await menuManageProvider.getCookbookClassBySellerId(context, params, | ||
| 62 | + showLoading: showLoading); | ||
| 63 | + List<CookbookCategorySunModel> temp = []; | ||
| 64 | + if (menuManageProvider.categorySunModel.length > 0) { | ||
| 65 | + menuManageProvider.categorySunModel.forEach((element) { | ||
| 66 | + if (element.className != '10道必点菜') { | ||
| 67 | + temp.add(element); | ||
| 68 | + } | ||
| 69 | + }); | ||
| 70 | + } | ||
| 71 | + if (temp.length == 0) { | ||
| 72 | + setState(() { | ||
| 73 | + isShow = false; | ||
| 74 | + }); | ||
| 75 | + } else { | ||
| 76 | + setState(() { | ||
| 77 | + isShow = true; | ||
| 78 | + }); | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + | ||
| 51 | _getCookbookByClass({bool showLoading = true}) async { | 82 | _getCookbookByClass({bool showLoading = true}) async { |
| 52 | Map<String, String> params = { | 83 | Map<String, String> params = { |
| 53 | "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | 84 | "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, |
| @@ -77,18 +108,71 @@ class _MenuManagePageState extends State<MenuManagePage> { | @@ -77,18 +108,71 @@ class _MenuManagePageState extends State<MenuManagePage> { | ||
| 77 | child: Consumer<MenuManageProvider>( | 108 | child: Consumer<MenuManageProvider>( |
| 78 | builder: (context, model, _) { | 109 | builder: (context, model, _) { |
| 79 | if (model.pageState != PageState.Success) { | 110 | if (model.pageState != PageState.Success) { |
| 80 | - return ExceptionPage( | ||
| 81 | - pageState: model.pageState, | ||
| 82 | - callback: () { | ||
| 83 | - // offset = 0; | ||
| 84 | - // getMessage(showLoading: true); | ||
| 85 | - // _couponNetworkData(); | ||
| 86 | - _getCookbookByClass(showLoading: true); | ||
| 87 | - }, | ||
| 88 | - emptyMsg: "菜品是空哒,快点击分类管理添加分类和菜品吧", | ||
| 89 | - emptyImg: "empty_search", | ||
| 90 | - showMsg: "加载中,请稍后...", | ||
| 91 | - ); | 111 | + return Column(children: [ |
| 112 | + Expanded( | ||
| 113 | + child: ExceptionPage( | ||
| 114 | + pageState: model.pageState, | ||
| 115 | + callback: () { | ||
| 116 | + // offset = 0; | ||
| 117 | + // getMessage(showLoading: true); | ||
| 118 | + // _couponNetworkData(); | ||
| 119 | + _getCookbookByClass(showLoading: true); | ||
| 120 | + }, | ||
| 121 | + emptyMsg: "菜品是空哒,快点击分类管理添加分类和菜品吧", | ||
| 122 | + emptyImg: "empty_search", | ||
| 123 | + showMsg: "加载中,请稍后...", | ||
| 124 | + )), | ||
| 125 | + Row( | ||
| 126 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 127 | + children: [ | ||
| 128 | + !isShow | ||
| 129 | + ? SizedBox() | ||
| 130 | + : Padding( | ||
| 131 | + padding: EdgeInsets.fromLTRB( | ||
| 132 | + ScreenUtil().setWidth(40), | ||
| 133 | + 0, | ||
| 134 | + ScreenUtil().setWidth(40), | ||
| 135 | + ScreenUtil().setWidth(40)), | ||
| 136 | + child: RoundButton( | ||
| 137 | + onPressed: () async { | ||
| 138 | + await NavigatorUtil.goMenuAddDishesPage( | ||
| 139 | + context); | ||
| 140 | + }, | ||
| 141 | + text: '添加\n菜品', | ||
| 142 | + fontSize: 26, | ||
| 143 | + isBold: false, | ||
| 144 | + height: ScreenUtil().setWidth(120), | ||
| 145 | + width: ScreenUtil().setWidth(120), | ||
| 146 | + radius: ScreenUtil().setWidth(60), | ||
| 147 | + )), | ||
| 148 | + Padding( | ||
| 149 | + padding: EdgeInsets.fromLTRB( | ||
| 150 | + ScreenUtil().setWidth(40), | ||
| 151 | + 0, | ||
| 152 | + ScreenUtil().setWidth(40), | ||
| 153 | + ScreenUtil().setWidth(40)), | ||
| 154 | + child: RoundButton( | ||
| 155 | + onPressed: () async { | ||
| 156 | + bool needRefresh = | ||
| 157 | + await NavigatorUtil.goMenuCategoryPage( | ||
| 158 | + context); | ||
| 159 | + print(needRefresh); | ||
| 160 | + if (needRefresh != null && needRefresh) { | ||
| 161 | + //刷新页面数据 | ||
| 162 | + // _controller.callRefresh(); | ||
| 163 | + // _couponNetworkData(); | ||
| 164 | + } | ||
| 165 | + }, | ||
| 166 | + text: '分类\n管理', | ||
| 167 | + fontSize: 26, | ||
| 168 | + isBold: false, | ||
| 169 | + height: ScreenUtil().setWidth(120), | ||
| 170 | + width: ScreenUtil().setWidth(120), | ||
| 171 | + radius: ScreenUtil().setWidth(60), | ||
| 172 | + )) | ||
| 173 | + ], | ||
| 174 | + ) | ||
| 175 | + ]); | ||
| 92 | } else { | 176 | } else { |
| 93 | // double cellWidth = (MediaQuery.of(context).size.width - | 177 | // double cellWidth = (MediaQuery.of(context).size.width - |
| 94 | // ScreenUtil().setWidth(40 * 2 + 15 * 2) / 2); | 178 | // ScreenUtil().setWidth(40 * 2 + 15 * 2) / 2); |
| @@ -160,95 +244,43 @@ class _MenuManagePageState extends State<MenuManagePage> { | @@ -160,95 +244,43 @@ class _MenuManagePageState extends State<MenuManagePage> { | ||
| 160 | ScreenUtil() | 244 | ScreenUtil() |
| 161 | .setWidth(40 * 2 + 15 * 2)) / | 245 | .setWidth(40 * 2 + 15 * 2)) / |
| 162 | 2); | 246 | 2); |
| 163 | - return model.image != null | ||
| 164 | - ? Stack(children: [ | ||
| 165 | - Column( | ||
| 166 | - crossAxisAlignment: | ||
| 167 | - CrossAxisAlignment.start, | ||
| 168 | - children: [ | ||
| 169 | - Container( | ||
| 170 | - decoration: BoxDecoration( | ||
| 171 | - borderRadius: | ||
| 172 | - BorderRadius.circular( | ||
| 173 | - ScreenUtil() | ||
| 174 | - .setWidth( | ||
| 175 | - 10))), | ||
| 176 | - child: ClipRRect( | ||
| 177 | - borderRadius: BorderRadius | ||
| 178 | - .circular(ScreenUtil() | ||
| 179 | - .setWidth(10)), | ||
| 180 | - child: CachedNetworkImage( | ||
| 181 | - imageUrl: model.image, | ||
| 182 | - fit: BoxFit.cover, | ||
| 183 | - width: cellWidth, | ||
| 184 | - height: ScreenUtil() | ||
| 185 | - .setWidth(210), | ||
| 186 | - ), | ||
| 187 | - )), | ||
| 188 | - VEmptyView(15), | ||
| 189 | - Text( | ||
| 190 | - model.name, | ||
| 191 | - style: TextStyle( | ||
| 192 | - color: MyColours | ||
| 193 | - .color_333333, | ||
| 194 | - fontSize: ScreenUtil() | ||
| 195 | - .setSp(34), | ||
| 196 | - fontWeight: | ||
| 197 | - FontWeight.bold), | ||
| 198 | - ), | ||
| 199 | - VEmptyView(20), | ||
| 200 | - Text( | ||
| 201 | - '${model.price}元/${model.unit}', | ||
| 202 | - style: TextStyle( | ||
| 203 | - color: MyColours | ||
| 204 | - .color_333333, | ||
| 205 | - fontSize: ScreenUtil() | ||
| 206 | - .setSp(28), | ||
| 207 | - )) | ||
| 208 | - ], | ||
| 209 | - ), | ||
| 210 | - Positioned( | ||
| 211 | - bottom: | ||
| 212 | - ScreenUtil().setWidth(14), | ||
| 213 | - right: | ||
| 214 | - ScreenUtil().setWidth(20), | ||
| 215 | - child: model.status == '1' | ||
| 216 | - ? SizedBox() | ||
| 217 | - : Image.asset( | ||
| 218 | - Utils.getImgPath( | ||
| 219 | - 'stop-sell'), | ||
| 220 | - width: ScreenUtil() | ||
| 221 | - .setWidth(82), | ||
| 222 | - height: ScreenUtil() | ||
| 223 | - .setWidth(52), | ||
| 224 | - )), | ||
| 225 | - ]) | ||
| 226 | - : Stack(children: [ | ||
| 227 | - Container( | ||
| 228 | - width: cellWidth, | ||
| 229 | - height: | ||
| 230 | - ScreenUtil().setWidth(210), | ||
| 231 | - | ||
| 232 | - decoration: BoxDecoration( | ||
| 233 | - color: index % 2 == 0 | ||
| 234 | - ? Color.fromRGBO( | ||
| 235 | - 247, 230, 230, 1) | ||
| 236 | - : Color.fromRGBO( | ||
| 237 | - 234, 236, 252, 1), | ||
| 238 | - borderRadius: | ||
| 239 | - BorderRadius.circular( | ||
| 240 | - ScreenUtil() | ||
| 241 | - .setWidth(10))), | ||
| 242 | - child: Container( | ||
| 243 | - padding: EdgeInsets.symmetric( | ||
| 244 | - horizontal: ScreenUtil() | ||
| 245 | - .setWidth(20)), | ||
| 246 | - child: Column( | 247 | + return InkWell( |
| 248 | + onTap: () async { | ||
| 249 | + await NavigatorUtil | ||
| 250 | + .goMenuAddDishesPage(context, | ||
| 251 | + isNew: false, | ||
| 252 | + idstr: model.id); | ||
| 253 | + }, | ||
| 254 | + child: model.image != null | ||
| 255 | + ? Stack(children: [ | ||
| 256 | + Column( | ||
| 247 | crossAxisAlignment: | 257 | crossAxisAlignment: |
| 248 | CrossAxisAlignment.start, | 258 | CrossAxisAlignment.start, |
| 249 | - mainAxisAlignment: | ||
| 250 | - MainAxisAlignment.center, | ||
| 251 | children: [ | 259 | children: [ |
| 260 | + Container( | ||
| 261 | + decoration: BoxDecoration( | ||
| 262 | + borderRadius: | ||
| 263 | + BorderRadius.circular( | ||
| 264 | + ScreenUtil() | ||
| 265 | + .setWidth( | ||
| 266 | + 10))), | ||
| 267 | + child: ClipRRect( | ||
| 268 | + borderRadius: | ||
| 269 | + BorderRadius.circular( | ||
| 270 | + ScreenUtil() | ||
| 271 | + .setWidth( | ||
| 272 | + 10)), | ||
| 273 | + child: | ||
| 274 | + CachedNetworkImage( | ||
| 275 | + imageUrl: | ||
| 276 | + model.image, | ||
| 277 | + fit: BoxFit.cover, | ||
| 278 | + width: cellWidth, | ||
| 279 | + height: ScreenUtil() | ||
| 280 | + .setWidth(210), | ||
| 281 | + ), | ||
| 282 | + )), | ||
| 283 | + VEmptyView(15), | ||
| 252 | Text( | 284 | Text( |
| 253 | model.name, | 285 | model.name, |
| 254 | style: TextStyle( | 286 | style: TextStyle( |
| @@ -259,7 +291,7 @@ class _MenuManagePageState extends State<MenuManagePage> { | @@ -259,7 +291,7 @@ class _MenuManagePageState extends State<MenuManagePage> { | ||
| 259 | fontWeight: | 291 | fontWeight: |
| 260 | FontWeight.bold), | 292 | FontWeight.bold), |
| 261 | ), | 293 | ), |
| 262 | - VEmptyView(40), | 294 | + VEmptyView(20), |
| 263 | Text( | 295 | Text( |
| 264 | '${model.price}元/${model.unit}', | 296 | '${model.price}元/${model.unit}', |
| 265 | style: TextStyle( | 297 | style: TextStyle( |
| @@ -270,41 +302,113 @@ class _MenuManagePageState extends State<MenuManagePage> { | @@ -270,41 +302,113 @@ class _MenuManagePageState extends State<MenuManagePage> { | ||
| 270 | )) | 302 | )) |
| 271 | ], | 303 | ], |
| 272 | ), | 304 | ), |
| 273 | - ), | 305 | + Positioned( |
| 306 | + bottom: ScreenUtil() | ||
| 307 | + .setWidth(14), | ||
| 308 | + right: ScreenUtil() | ||
| 309 | + .setWidth(20), | ||
| 310 | + child: model.status == '1' | ||
| 311 | + ? SizedBox() | ||
| 312 | + : Image.asset( | ||
| 313 | + Utils.getImgPath( | ||
| 314 | + 'stop-sell'), | ||
| 315 | + width: ScreenUtil() | ||
| 316 | + .setWidth(82), | ||
| 317 | + height: ScreenUtil() | ||
| 318 | + .setWidth(52), | ||
| 319 | + )), | ||
| 320 | + ]) | ||
| 321 | + : Stack(children: [ | ||
| 322 | + Container( | ||
| 323 | + width: cellWidth, | ||
| 324 | + height: ScreenUtil() | ||
| 325 | + .setWidth(210), | ||
| 274 | 326 | ||
| 275 | - // VEmptyView(15), | ||
| 276 | - // Text( | ||
| 277 | - // ' ', | ||
| 278 | - // style: TextStyle( | ||
| 279 | - // color: MyColours.color_333333, | ||
| 280 | - // fontSize: | ||
| 281 | - // ScreenUtil().setSp(34), | ||
| 282 | - // fontWeight: FontWeight.bold), | ||
| 283 | - // ), | ||
| 284 | - // VEmptyView(20), | ||
| 285 | - // Text(' ', | ||
| 286 | - // style: TextStyle( | ||
| 287 | - // color: MyColours.color_333333, | ||
| 288 | - // fontSize: | ||
| 289 | - // ScreenUtil().setSp(28), | ||
| 290 | - // )) | ||
| 291 | - ), | ||
| 292 | - Positioned( | ||
| 293 | - bottom: | ||
| 294 | - ScreenUtil().setWidth(46), | ||
| 295 | - right: | ||
| 296 | - ScreenUtil().setWidth(20), | ||
| 297 | - child: model.status == '1' | ||
| 298 | - ? SizedBox() | ||
| 299 | - : Image.asset( | ||
| 300 | - Utils.getImgPath( | ||
| 301 | - 'stop-sell'), | ||
| 302 | - width: ScreenUtil() | ||
| 303 | - .setWidth(82), | ||
| 304 | - height: ScreenUtil() | ||
| 305 | - .setWidth(52), | ||
| 306 | - )), | ||
| 307 | - ]); | 327 | + decoration: BoxDecoration( |
| 328 | + color: index % 2 == 0 | ||
| 329 | + ? Color.fromRGBO( | ||
| 330 | + 247, 230, 230, 1) | ||
| 331 | + : Color.fromRGBO( | ||
| 332 | + 234, 236, 252, 1), | ||
| 333 | + borderRadius: BorderRadius | ||
| 334 | + .circular(ScreenUtil() | ||
| 335 | + .setWidth(10))), | ||
| 336 | + child: Container( | ||
| 337 | + padding: | ||
| 338 | + EdgeInsets.symmetric( | ||
| 339 | + horizontal: | ||
| 340 | + ScreenUtil() | ||
| 341 | + .setWidth( | ||
| 342 | + 20)), | ||
| 343 | + child: Column( | ||
| 344 | + crossAxisAlignment: | ||
| 345 | + CrossAxisAlignment | ||
| 346 | + .start, | ||
| 347 | + mainAxisAlignment: | ||
| 348 | + MainAxisAlignment | ||
| 349 | + .center, | ||
| 350 | + children: [ | ||
| 351 | + Text( | ||
| 352 | + model.name, | ||
| 353 | + style: TextStyle( | ||
| 354 | + color: MyColours | ||
| 355 | + .color_333333, | ||
| 356 | + fontSize: | ||
| 357 | + ScreenUtil() | ||
| 358 | + .setSp( | ||
| 359 | + 34), | ||
| 360 | + fontWeight: | ||
| 361 | + FontWeight | ||
| 362 | + .bold), | ||
| 363 | + ), | ||
| 364 | + VEmptyView(40), | ||
| 365 | + Text( | ||
| 366 | + '${model.price}元/${model.unit}', | ||
| 367 | + style: TextStyle( | ||
| 368 | + color: MyColours | ||
| 369 | + .color_333333, | ||
| 370 | + fontSize: | ||
| 371 | + ScreenUtil() | ||
| 372 | + .setSp( | ||
| 373 | + 28), | ||
| 374 | + )) | ||
| 375 | + ], | ||
| 376 | + ), | ||
| 377 | + ), | ||
| 378 | + | ||
| 379 | + // VEmptyView(15), | ||
| 380 | + // Text( | ||
| 381 | + // ' ', | ||
| 382 | + // style: TextStyle( | ||
| 383 | + // color: MyColours.color_333333, | ||
| 384 | + // fontSize: | ||
| 385 | + // ScreenUtil().setSp(34), | ||
| 386 | + // fontWeight: FontWeight.bold), | ||
| 387 | + // ), | ||
| 388 | + // VEmptyView(20), | ||
| 389 | + // Text(' ', | ||
| 390 | + // style: TextStyle( | ||
| 391 | + // color: MyColours.color_333333, | ||
| 392 | + // fontSize: | ||
| 393 | + // ScreenUtil().setSp(28), | ||
| 394 | + // )) | ||
| 395 | + ), | ||
| 396 | + Positioned( | ||
| 397 | + bottom: ScreenUtil() | ||
| 398 | + .setWidth(46), | ||
| 399 | + right: ScreenUtil() | ||
| 400 | + .setWidth(20), | ||
| 401 | + child: model.status == '1' | ||
| 402 | + ? SizedBox() | ||
| 403 | + : Image.asset( | ||
| 404 | + Utils.getImgPath( | ||
| 405 | + 'stop-sell'), | ||
| 406 | + width: ScreenUtil() | ||
| 407 | + .setWidth(82), | ||
| 408 | + height: ScreenUtil() | ||
| 409 | + .setWidth(52), | ||
| 410 | + )), | ||
| 411 | + ])); | ||
| 308 | }, | 412 | }, |
| 309 | staggeredTileBuilder: (int index) => | 413 | staggeredTileBuilder: (int index) => |
| 310 | new StaggeredTile.count( | 414 | new StaggeredTile.count( |
| @@ -327,7 +431,7 @@ class _MenuManagePageState extends State<MenuManagePage> { | @@ -327,7 +431,7 @@ class _MenuManagePageState extends State<MenuManagePage> { | ||
| 327 | Row( | 431 | Row( |
| 328 | mainAxisAlignment: MainAxisAlignment.spaceBetween, | 432 | mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 329 | children: [ | 433 | children: [ |
| 330 | - model.pageState == PageState.Empty | 434 | + !isShow |
| 331 | ? SizedBox() | 435 | ? SizedBox() |
| 332 | : Padding( | 436 | : Padding( |
| 333 | padding: EdgeInsets.fromLTRB( | 437 | padding: EdgeInsets.fromLTRB( |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_screenutil/screenutil.dart'; | 2 | import 'package:flutter_screenutil/screenutil.dart'; |
| 3 | +import 'package:one_key/constant/state.dart'; | ||
| 3 | import 'package:one_key/models/seller_table_class_entity.dart'; | 4 | import 'package:one_key/models/seller_table_class_entity.dart'; |
| 4 | import 'package:one_key/provider/store_detail_model.dart'; | 5 | import 'package:one_key/provider/store_detail_model.dart'; |
| 5 | import 'package:one_key/provider/user_model.dart'; | 6 | import 'package:one_key/provider/user_model.dart'; |
| 6 | import 'package:one_key/res/colors.dart'; | 7 | import 'package:one_key/res/colors.dart'; |
| 7 | import 'package:one_key/route/navigator_util.dart'; | 8 | import 'package:one_key/route/navigator_util.dart'; |
| 8 | import 'package:one_key/utils/event_bus.dart'; | 9 | import 'package:one_key/utils/event_bus.dart'; |
| 10 | +import 'package:one_key/widgets/page_exception.dart'; | ||
| 9 | import 'package:one_key/widgets/round_button.dart'; | 11 | import 'package:one_key/widgets/round_button.dart'; |
| 10 | import 'package:one_key/widgets/system_app_bar.dart'; | 12 | import 'package:one_key/widgets/system_app_bar.dart'; |
| 11 | import 'package:one_key/widgets/v_empty_view.dart'; | 13 | import 'package:one_key/widgets/v_empty_view.dart'; |
| @@ -50,6 +52,13 @@ class _RoomTypeManagePageState extends State<RoomTypeManagePage> { | @@ -50,6 +52,13 @@ class _RoomTypeManagePageState extends State<RoomTypeManagePage> { | ||
| 50 | 52 | ||
| 51 | // tables.any((element) => element.isFull == 1); | 53 | // tables.any((element) => element.isFull == 1); |
| 52 | // rooms.clear(); | 54 | // rooms.clear(); |
| 55 | + if (tables == null) { | ||
| 56 | + detailModel.pageState = PageState.ConnectivityTimeOut; | ||
| 57 | + } else if (tables.length > 0) { | ||
| 58 | + detailModel.pageState = PageState.Success; | ||
| 59 | + } else if (tables.length == 0) { | ||
| 60 | + detailModel.pageState = PageState.Empty; | ||
| 61 | + } | ||
| 53 | setState(() {}); | 62 | setState(() {}); |
| 54 | } | 63 | } |
| 55 | 64 | ||
| @@ -79,114 +88,142 @@ class _RoomTypeManagePageState extends State<RoomTypeManagePage> { | @@ -79,114 +88,142 @@ class _RoomTypeManagePageState extends State<RoomTypeManagePage> { | ||
| 79 | crossAxisAlignment: CrossAxisAlignment.start, | 88 | crossAxisAlignment: CrossAxisAlignment.start, |
| 80 | children: <Widget>[ | 89 | children: <Widget>[ |
| 81 | Expanded( | 90 | Expanded( |
| 82 | - child: SingleChildScrollView( | ||
| 83 | - child: Column( | ||
| 84 | - children: [ | ||
| 85 | - VEmptyView(20), | ||
| 86 | - Selector<StoreDetailModel, | ||
| 87 | - List<SellerTableClassEntity>>( | ||
| 88 | - shouldRebuild: (pre, next) => true, | ||
| 89 | - selector: (context, model) => model.tables, | ||
| 90 | - builder: (context, tables, child) { | ||
| 91 | - return GridView.builder( | ||
| 92 | - gridDelegate: | ||
| 93 | - SliverGridDelegateWithFixedCrossAxisCount( | ||
| 94 | - crossAxisCount: 2, | ||
| 95 | - mainAxisSpacing: | ||
| 96 | - ScreenUtil().setWidth(20), | ||
| 97 | - crossAxisSpacing: | ||
| 98 | - ScreenUtil().setWidth(30), | ||
| 99 | - childAspectRatio: 2.4), | ||
| 100 | - itemBuilder: (context, index) { | ||
| 101 | - return GestureDetector( | ||
| 102 | - onTap: () async { | ||
| 103 | - NavigatorUtil.goRoomTypeCreatePage(context, | ||
| 104 | - isNew: false, | ||
| 105 | - tableClassId: tables[index].id); | ||
| 106 | - }, | ||
| 107 | - child: Stack( | ||
| 108 | - children: [ | ||
| 109 | - Container( | ||
| 110 | - height: ScreenUtil().setWidth(140), | ||
| 111 | - padding: EdgeInsets.only( | ||
| 112 | - left: ScreenUtil().setWidth(30)), | ||
| 113 | - decoration: BoxDecoration( | ||
| 114 | - color: tables[index].status == '1' | ||
| 115 | - ? MyColours.color_A9E3E6 | ||
| 116 | - : MyColours.color_f5f5f5, | ||
| 117 | - borderRadius: BorderRadius.circular( | ||
| 118 | - ScreenUtil().setWidth(10)), | ||
| 119 | - border: Border.all( | 91 | + child: Consumer<StoreDetailModel>( |
| 92 | + builder: (context, model, _) { | ||
| 93 | + if (model.pageState != PageState.Success) { | ||
| 94 | + return ExceptionPage( | ||
| 95 | + pageState: model.pageState, | ||
| 96 | + callback: () { | ||
| 97 | + // offset = 0; | ||
| 98 | + // getMessage(showLoading: true); | ||
| 99 | + // _couponNetworkData(); | ||
| 100 | + // _getCookbookByClass(showLoading: true); | ||
| 101 | + _getSellerTableClass(); | ||
| 102 | + }, | ||
| 103 | + emptyMsg: "包间类型是空哒,快来添加类型吧", | ||
| 104 | + emptyImg: "empty_search", | ||
| 105 | + showMsg: "加载中,请稍后...", | ||
| 106 | + ); | ||
| 107 | + } else { | ||
| 108 | + return SingleChildScrollView( | ||
| 109 | + child: Column( | ||
| 110 | + children: [ | ||
| 111 | + VEmptyView(20), | ||
| 112 | + Selector<StoreDetailModel, | ||
| 113 | + List<SellerTableClassEntity>>( | ||
| 114 | + shouldRebuild: (pre, next) => true, | ||
| 115 | + selector: (context, model) => model.tables, | ||
| 116 | + builder: (context, tables, child) { | ||
| 117 | + return GridView.builder( | ||
| 118 | + gridDelegate: | ||
| 119 | + SliverGridDelegateWithFixedCrossAxisCount( | ||
| 120 | + crossAxisCount: 2, | ||
| 121 | + mainAxisSpacing: | ||
| 122 | + ScreenUtil().setWidth(20), | ||
| 123 | + crossAxisSpacing: | ||
| 124 | + ScreenUtil().setWidth(30), | ||
| 125 | + childAspectRatio: 2.4), | ||
| 126 | + itemBuilder: (context, index) { | ||
| 127 | + return GestureDetector( | ||
| 128 | + onTap: () async { | ||
| 129 | + NavigatorUtil.goRoomTypeCreatePage( | ||
| 130 | + context, | ||
| 131 | + isNew: false, | ||
| 132 | + tableClassId: tables[index].id); | ||
| 133 | + }, | ||
| 134 | + child: Stack( | ||
| 135 | + children: [ | ||
| 136 | + Container( | ||
| 137 | + height: ScreenUtil().setWidth(140), | ||
| 138 | + padding: EdgeInsets.only( | ||
| 139 | + left: | ||
| 140 | + ScreenUtil().setWidth(30)), | ||
| 141 | + decoration: BoxDecoration( | ||
| 120 | color: tables[index].status == '1' | 142 | color: tables[index].status == '1' |
| 121 | - ? MyColours.color_199095 | ||
| 122 | - : MyColours.color_E0E0E0, | ||
| 123 | - width: ScreenUtil().setWidth(2)), | ||
| 124 | - ), | ||
| 125 | - alignment: Alignment.centerLeft, | ||
| 126 | - child: Column( | ||
| 127 | - mainAxisSize: MainAxisSize.min, | ||
| 128 | - mainAxisAlignment: | ||
| 129 | - MainAxisAlignment.center, | ||
| 130 | - crossAxisAlignment: | ||
| 131 | - CrossAxisAlignment.start, | ||
| 132 | - children: <Widget>[ | ||
| 133 | - Text("${tables[index].name}", | ||
| 134 | - style: TextStyle( | ||
| 135 | - fontSize: | ||
| 136 | - ScreenUtil().setSp(30), | ||
| 137 | - color: | ||
| 138 | - MyColours.color_333333, | ||
| 139 | - fontWeight: | ||
| 140 | - FontWeight.bold)), | ||
| 141 | - VEmptyView(10), | ||
| 142 | - int.parse(tables[index].max ?? | ||
| 143 | - "0") > | ||
| 144 | - 0 | ||
| 145 | - ? Text( | ||
| 146 | - "最多可坐${tables[index].max}人", | 143 | + ? MyColours.color_A9E3E6 |
| 144 | + : MyColours.color_f5f5f5, | ||
| 145 | + borderRadius: | ||
| 146 | + BorderRadius.circular( | ||
| 147 | + ScreenUtil() | ||
| 148 | + .setWidth(10)), | ||
| 149 | + border: Border.all( | ||
| 150 | + color: tables[index].status == | ||
| 151 | + '1' | ||
| 152 | + ? MyColours.color_199095 | ||
| 153 | + : MyColours.color_E0E0E0, | ||
| 154 | + width: | ||
| 155 | + ScreenUtil().setWidth(2)), | ||
| 156 | + ), | ||
| 157 | + alignment: Alignment.centerLeft, | ||
| 158 | + child: Column( | ||
| 159 | + mainAxisSize: MainAxisSize.min, | ||
| 160 | + mainAxisAlignment: | ||
| 161 | + MainAxisAlignment.center, | ||
| 162 | + crossAxisAlignment: | ||
| 163 | + CrossAxisAlignment.start, | ||
| 164 | + children: <Widget>[ | ||
| 165 | + Text("${tables[index].name}", | ||
| 147 | style: TextStyle( | 166 | style: TextStyle( |
| 148 | fontSize: ScreenUtil() | 167 | fontSize: ScreenUtil() |
| 149 | - .setSp(24), | 168 | + .setSp(30), |
| 150 | color: MyColours | 169 | color: MyColours |
| 151 | .color_333333, | 170 | .color_333333, |
| 152 | fontWeight: | 171 | fontWeight: |
| 153 | - FontWeight.normal), | ||
| 154 | - ) | ||
| 155 | - : Container(), | ||
| 156 | - int.parse(tables[index].low ?? | ||
| 157 | - "0") > | ||
| 158 | - 0 | ||
| 159 | - ? Text( | ||
| 160 | - "最低消费${tables[index].low}元", | ||
| 161 | - style: TextStyle( | ||
| 162 | - fontSize: ScreenUtil() | ||
| 163 | - .setSp(20), | ||
| 164 | - color: MyColours | ||
| 165 | - .color_199095, | ||
| 166 | - fontWeight: | ||
| 167 | - FontWeight.normal), | ||
| 168 | - ) | ||
| 169 | - : Container() | ||
| 170 | - ], | ||
| 171 | - ), | ||
| 172 | - ), | ||
| 173 | - tables[index].status != '1' | ||
| 174 | - ? Positioned( | ||
| 175 | - bottom: -ScreenUtil().setWidth(0), | ||
| 176 | - right: -ScreenUtil().setWidth(10), | ||
| 177 | - child: Container( | ||
| 178 | - padding: EdgeInsets.only( | ||
| 179 | - bottom: ScreenUtil() | ||
| 180 | - .setWidth(10)), | ||
| 181 | - alignment: | ||
| 182 | - Alignment.bottomCenter, | ||
| 183 | - width: | ||
| 184 | - ScreenUtil().setWidth(100), | ||
| 185 | - height: | ||
| 186 | - ScreenUtil().setWidth(74), | ||
| 187 | - decoration: BoxDecoration( | ||
| 188 | - borderRadius: | ||
| 189 | - BorderRadius.only( | 172 | + FontWeight.bold)), |
| 173 | + VEmptyView(10), | ||
| 174 | + int.parse(tables[index].max ?? | ||
| 175 | + "0") > | ||
| 176 | + 0 | ||
| 177 | + ? Text( | ||
| 178 | + "最多可坐${tables[index].max}人", | ||
| 179 | + style: TextStyle( | ||
| 180 | + fontSize: | ||
| 181 | + ScreenUtil() | ||
| 182 | + .setSp(24), | ||
| 183 | + color: MyColours | ||
| 184 | + .color_333333, | ||
| 185 | + fontWeight: | ||
| 186 | + FontWeight | ||
| 187 | + .normal), | ||
| 188 | + ) | ||
| 189 | + : Container(), | ||
| 190 | + int.parse(tables[index].low ?? | ||
| 191 | + "0") > | ||
| 192 | + 0 | ||
| 193 | + ? Text( | ||
| 194 | + "最低消费${tables[index].low}元", | ||
| 195 | + style: TextStyle( | ||
| 196 | + fontSize: | ||
| 197 | + ScreenUtil() | ||
| 198 | + .setSp(20), | ||
| 199 | + color: MyColours | ||
| 200 | + .color_199095, | ||
| 201 | + fontWeight: | ||
| 202 | + FontWeight | ||
| 203 | + .normal), | ||
| 204 | + ) | ||
| 205 | + : Container() | ||
| 206 | + ], | ||
| 207 | + ), | ||
| 208 | + ), | ||
| 209 | + tables[index].status != '1' | ||
| 210 | + ? Positioned( | ||
| 211 | + bottom: | ||
| 212 | + -ScreenUtil().setWidth(0), | ||
| 213 | + right: -ScreenUtil() | ||
| 214 | + .setWidth(10), | ||
| 215 | + child: Container( | ||
| 216 | + padding: EdgeInsets.only( | ||
| 217 | + bottom: ScreenUtil() | ||
| 218 | + .setWidth(10)), | ||
| 219 | + alignment: | ||
| 220 | + Alignment.bottomCenter, | ||
| 221 | + width: ScreenUtil() | ||
| 222 | + .setWidth(100), | ||
| 223 | + height: ScreenUtil() | ||
| 224 | + .setWidth(74), | ||
| 225 | + decoration: BoxDecoration( | ||
| 226 | + borderRadius: BorderRadius.only( | ||
| 190 | topLeft: | 227 | topLeft: |
| 191 | Radius.circular( | 228 | Radius.circular( |
| 192 | ScreenUtil() | 229 | ScreenUtil() |
| @@ -197,30 +234,33 @@ class _RoomTypeManagePageState extends State<RoomTypeManagePage> { | @@ -197,30 +234,33 @@ class _RoomTypeManagePageState extends State<RoomTypeManagePage> { | ||
| 197 | ScreenUtil() | 234 | ScreenUtil() |
| 198 | .setWidth( | 235 | .setWidth( |
| 199 | 10))), | 236 | 10))), |
| 200 | - color: MyColours.color_d8d8d8, | ||
| 201 | - ), | ||
| 202 | - child: Text( | ||
| 203 | - '已停用', | ||
| 204 | - style: TextStyle( | ||
| 205 | - fontSize: ScreenUtil() | ||
| 206 | - .setSp(24), | ||
| 207 | color: MyColours | 237 | color: MyColours |
| 208 | - .color_333333), | ||
| 209 | - ), | ||
| 210 | - )) | ||
| 211 | - : SizedBox() | ||
| 212 | - ], | ||
| 213 | - ), | 238 | + .color_d8d8d8, |
| 239 | + ), | ||
| 240 | + child: Text( | ||
| 241 | + '已停用', | ||
| 242 | + style: TextStyle( | ||
| 243 | + fontSize: ScreenUtil() | ||
| 244 | + .setSp(24), | ||
| 245 | + color: MyColours | ||
| 246 | + .color_333333), | ||
| 247 | + ), | ||
| 248 | + )) | ||
| 249 | + : SizedBox() | ||
| 250 | + ], | ||
| 251 | + ), | ||
| 252 | + ); | ||
| 253 | + }, | ||
| 254 | + itemCount: tables.length, | ||
| 255 | + shrinkWrap: true, | ||
| 256 | + physics: new NeverScrollableScrollPhysics(), | ||
| 214 | ); | 257 | ); |
| 215 | }, | 258 | }, |
| 216 | - itemCount: tables.length, | ||
| 217 | - shrinkWrap: true, | ||
| 218 | - physics: new NeverScrollableScrollPhysics(), | ||
| 219 | - ); | ||
| 220 | - }, | ||
| 221 | - ) | ||
| 222 | - ], | ||
| 223 | - )), | 259 | + ) |
| 260 | + ], | ||
| 261 | + )); | ||
| 262 | + } | ||
| 263 | + }), | ||
| 224 | ), | 264 | ), |
| 225 | Padding( | 265 | Padding( |
| 226 | padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0, | 266 | padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0, |
| @@ -106,6 +106,11 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { | @@ -106,6 +106,11 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { | ||
| 106 | // if (_chooseTableModel.pageState == PageState.Success) { | 106 | // if (_chooseTableModel.pageState == PageState.Success) { |
| 107 | 107 | ||
| 108 | // } | 108 | // } |
| 109 | + if (tableOuterList.length == 0 || tableOuterList == null) { | ||
| 110 | + _chooseTableModel.pageState = PageState.Empty; | ||
| 111 | + _chooseTableModel.notifyListeners(); | ||
| 112 | + return; | ||
| 113 | + } | ||
| 109 | if (needLoading) { | 114 | if (needLoading) { |
| 110 | initData(); | 115 | initData(); |
| 111 | } else { | 116 | } else { |
| @@ -301,8 +306,8 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { | @@ -301,8 +306,8 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { | ||
| 301 | widget.tableList | 306 | widget.tableList |
| 302 | .add(tableToTableList(table).id); | 307 | .add(tableToTableList(table).id); |
| 303 | } else { | 308 | } else { |
| 304 | - widget.tableList.removeWhere( | ||
| 305 | - (t) => t == table.id); | 309 | + widget.tableList |
| 310 | + .removeWhere((t) => t == table.id); | ||
| 306 | 311 | ||
| 307 | selectNum--; | 312 | selectNum--; |
| 308 | 313 | ||
| @@ -389,7 +394,7 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { | @@ -389,7 +394,7 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { | ||
| 389 | )); | 394 | )); |
| 390 | } | 395 | } |
| 391 | 396 | ||
| 392 | - TableList tableToTableList(t.Table table) { | 397 | + TableList tableToTableList(t.Table table) { |
| 393 | TableList _tableList = TableList( | 398 | TableList _tableList = TableList( |
| 394 | '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); | 399 | '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); |
| 395 | _tableList.id = table.id; | 400 | _tableList.id = table.id; |
| @@ -4,6 +4,7 @@ import 'package:one_key/constant/error.dart'; | @@ -4,6 +4,7 @@ import 'package:one_key/constant/error.dart'; | ||
| 4 | import 'package:one_key/constant/state.dart'; | 4 | import 'package:one_key/constant/state.dart'; |
| 5 | import 'package:one_key/models/cookbook_category_model.dart'; | 5 | import 'package:one_key/models/cookbook_category_model.dart'; |
| 6 | import 'package:one_key/models/cookbook_model.dart'; | 6 | import 'package:one_key/models/cookbook_model.dart'; |
| 7 | +import 'package:one_key/models/cookbook_one_model.dart'; | ||
| 7 | import 'package:one_key/models/cookbook_spec_model.dart'; | 8 | import 'package:one_key/models/cookbook_spec_model.dart'; |
| 8 | import 'package:one_key/net/base_resp.dart'; | 9 | import 'package:one_key/net/base_resp.dart'; |
| 9 | import 'package:one_key/net/dio_util.dart'; | 10 | import 'package:one_key/net/dio_util.dart'; |
| @@ -16,6 +17,26 @@ class MenuManageProvider extends ChangeNotifier { | @@ -16,6 +17,26 @@ class MenuManageProvider extends ChangeNotifier { | ||
| 16 | List<MenuModel> menuModel; //菜品数据 | 17 | List<MenuModel> menuModel; //菜品数据 |
| 17 | List<CookbookCategorySunModel> categorySunModel; //菜品分类数据 | 18 | List<CookbookCategorySunModel> categorySunModel; //菜品分类数据 |
| 18 | List<CookbookSpecSunModel> specSunModel; //计价单位 | 19 | List<CookbookSpecSunModel> specSunModel; //计价单位 |
| 20 | + | ||
| 21 | + CookbookOneSunModel cookbookOneSunModel; | ||
| 22 | + | ||
| 23 | + /// 获取单个菜品信息 | ||
| 24 | + getCookbookById(BuildContext context, Map<String, String> params, | ||
| 25 | + {showLoading = false}) async { | ||
| 26 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 27 | + .request<dynamic>(context, Method.get, HttpUrl.get_cookbook_by_id, | ||
| 28 | + data: params, showLoading: showLoading) | ||
| 29 | + .catchError((error) { | ||
| 30 | + print(error.toString()); | ||
| 31 | + }); | ||
| 32 | + if (baseResp != null && baseResp.code == Constant.status_success) { | ||
| 33 | + cookbookOneSunModel = | ||
| 34 | + CookbookOneModel.fromJson(baseResp.responseData).data.data; | ||
| 35 | + } else { | ||
| 36 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | + | ||
| 19 | /// 获取商家计价单位 | 40 | /// 获取商家计价单位 |
| 20 | getSpecBySellerid(BuildContext context, Map<String, String> params, | 41 | getSpecBySellerid(BuildContext context, Map<String, String> params, |
| 21 | {showLoading = false}) async { | 42 | {showLoading = false}) async { |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:one_key/constant/constant.dart'; | 2 | import 'package:one_key/constant/constant.dart'; |
| 3 | +import 'package:one_key/constant/state.dart'; | ||
| 3 | import 'package:one_key/models/seller_table_class_entity.dart'; | 4 | import 'package:one_key/models/seller_table_class_entity.dart'; |
| 4 | import 'package:one_key/models/table_class_model.dart'; | 5 | import 'package:one_key/models/table_class_model.dart'; |
| 5 | import 'package:one_key/models/table_fill_up_date_model.dart'; | 6 | import 'package:one_key/models/table_fill_up_date_model.dart'; |
| @@ -15,6 +16,8 @@ class StoreDetailModel with ChangeNotifier { | @@ -15,6 +16,8 @@ class StoreDetailModel with ChangeNotifier { | ||
| 15 | List<SellerTableClassEntity> tables = []; //商家包间类型 | 16 | List<SellerTableClassEntity> tables = []; //商家包间类型 |
| 16 | TableClassSunModel tableClassSunModel; | 17 | TableClassSunModel tableClassSunModel; |
| 17 | 18 | ||
| 19 | + PageState pageState = PageState.Loading; | ||
| 20 | + | ||
| 18 | ///添加/修改包间分类 | 21 | ///添加/修改包间分类 |
| 19 | Future<bool> setTableClass(BuildContext context, Map<String, String> params, | 22 | Future<bool> setTableClass(BuildContext context, Map<String, String> params, |
| 20 | {bool showLoading = false}) async { | 23 | {bool showLoading = false}) async { |
| 1 | import 'package:fluro/fluro.dart'; | 1 | import 'package:fluro/fluro.dart'; |
| 2 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
| 3 | +import 'package:one_key/models/cookbook_model.dart'; | ||
| 3 | import 'package:one_key/models/coupon_model.dart'; | 4 | import 'package:one_key/models/coupon_model.dart'; |
| 4 | import 'package:one_key/models/integral_model.dart'; | 5 | import 'package:one_key/models/integral_model.dart'; |
| 5 | import 'package:one_key/models/notebook.dart'; | 6 | import 'package:one_key/models/notebook.dart'; |
| @@ -415,8 +416,9 @@ class NavigatorUtil { | @@ -415,8 +416,9 @@ class NavigatorUtil { | ||
| 415 | 416 | ||
| 416 | /// 添加菜品页面 | 417 | /// 添加菜品页面 |
| 417 | static Future<dynamic> goMenuAddDishesPage(BuildContext context, | 418 | static Future<dynamic> goMenuAddDishesPage(BuildContext context, |
| 418 | - {replace = false}) { | ||
| 419 | - return _navigateTo(context, "${Routes.menu_add_dishes_page}", | 419 | + {replace = false, bool isNew = true, String idstr}) { |
| 420 | + return _navigateTo( | ||
| 421 | + context, "${Routes.menu_add_dishes_page}?isNew=$isNew&idstr=${idstr}", | ||
| 420 | replace: replace); | 422 | replace: replace); |
| 421 | } | 423 | } |
| 422 | } | 424 | } |
| @@ -2,6 +2,7 @@ import 'dart:convert'; | @@ -2,6 +2,7 @@ import 'dart:convert'; | ||
| 2 | 2 | ||
| 3 | import 'package:fluro/fluro.dart'; | 3 | import 'package:fluro/fluro.dart'; |
| 4 | import 'package:flutter/material.dart'; | 4 | import 'package:flutter/material.dart'; |
| 5 | +import 'package:one_key/models/cookbook_model.dart'; | ||
| 5 | import 'package:one_key/models/coupon_model.dart'; | 6 | import 'package:one_key/models/coupon_model.dart'; |
| 6 | import 'package:one_key/models/integral_model.dart'; | 7 | import 'package:one_key/models/integral_model.dart'; |
| 7 | import 'package:one_key/models/notebook_detail.dart'; | 8 | import 'package:one_key/models/notebook_detail.dart'; |
| @@ -645,10 +646,16 @@ var menuCategoryPageHandle = new Handler( | @@ -645,10 +646,16 @@ var menuCategoryPageHandle = new Handler( | ||
| 645 | ///添加菜品 | 646 | ///添加菜品 |
| 646 | var menuAddDishesPageHandle = new Handler( | 647 | var menuAddDishesPageHandle = new Handler( |
| 647 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | 648 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { |
| 648 | - // SmsInfoData data = SmsInfoData.fromJson(json.decode( | ||
| 649 | - // FluroConvertUtils.fluroCnParamsDecode(params["smsInfoData"].first))); | 649 | + bool isNew = FluroConvertUtils.string2bool(params["isNew"].first); |
| 650 | + if (isNew) { | ||
| 651 | + return ChangeNotifierProvider<MenuManageProvider>( | ||
| 652 | + create: (_) => MenuManageProvider(), | ||
| 653 | + child: MenuAddDishesPage(isNew: isNew)); | ||
| 654 | + } | ||
| 655 | + String idstr = params["idstr"].first; | ||
| 650 | return ChangeNotifierProvider<MenuManageProvider>( | 656 | return ChangeNotifierProvider<MenuManageProvider>( |
| 651 | - create: (_) => MenuManageProvider(), child: MenuAddDishesPage()); | 657 | + create: (_) => MenuManageProvider(), |
| 658 | + child: MenuAddDishesPage(isNew: isNew, idstr: idstr)); | ||
| 652 | // return ChangeNotifierProvider<UploadImageProvider>( | 659 | // return ChangeNotifierProvider<UploadImageProvider>( |
| 653 | // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage()); | 660 | // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage()); |
| 654 | }); | 661 | }); |
-
Please register or login to post a comment