Commit 497bdbda0518f61cc02f7b86361ec0d5694a1846

Authored by wdn127929
1 parent 7292c82a

包间类型

@@ -264,7 +264,7 @@ SPEC CHECKSUMS: @@ -264,7 +264,7 @@ SPEC CHECKSUMS:
264 video_compress: fce97e4fb1dfd88175aa07d2ffc8a2f297f87fbe 264 video_compress: fce97e4fb1dfd88175aa07d2ffc8a2f297f87fbe
265 video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e 265 video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e
266 wakelock: 0d4a70faf8950410735e3f61fb15d517c8a6efc4 266 wakelock: 0d4a70faf8950410735e3f61fb15d517c8a6efc4
267 - webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96 267 + webview_flutter: 3603125dfd3bcbc9d8d418c3f80aeecf331c068b
268 WechatOpenSDK: 6a4d1436c15b3b5fe2a0bd383f3046010186da44 268 WechatOpenSDK: 6a4d1436c15b3b5fe2a0bd383f3046010186da44
269 269
270 PODFILE CHECKSUM: a75497545d4391e2d394c3668e20cfb1c2bbd4aa 270 PODFILE CHECKSUM: a75497545d4391e2d394c3668e20cfb1c2bbd4aa
@@ -482,7 +482,7 @@ @@ -482,7 +482,7 @@
482 CURRENT_PROJECT_VERSION = 296; 482 CURRENT_PROJECT_VERSION = 296;
483 DEVELOPMENT_TEAM = 8J59HM8B82; 483 DEVELOPMENT_TEAM = 8J59HM8B82;
484 ENABLE_BITCODE = NO; 484 ENABLE_BITCODE = NO;
485 - FLUTTER_BUILD_MODE = release; 485 + FLUTTER_BUILD_MODE = debug;
486 FRAMEWORK_SEARCH_PATHS = ( 486 FRAMEWORK_SEARCH_PATHS = (
487 "$(inherited)", 487 "$(inherited)",
488 "$(PROJECT_DIR)/Flutter", 488 "$(PROJECT_DIR)/Flutter",
@@ -627,7 +627,7 @@ @@ -627,7 +627,7 @@
627 CURRENT_PROJECT_VERSION = 296; 627 CURRENT_PROJECT_VERSION = 296;
628 DEVELOPMENT_TEAM = 8J59HM8B82; 628 DEVELOPMENT_TEAM = 8J59HM8B82;
629 ENABLE_BITCODE = NO; 629 ENABLE_BITCODE = NO;
630 - FLUTTER_BUILD_MODE = release; 630 + FLUTTER_BUILD_MODE = debug;
631 FRAMEWORK_SEARCH_PATHS = ( 631 FRAMEWORK_SEARCH_PATHS = (
632 "$(inherited)", 632 "$(inherited)",
633 "$(PROJECT_DIR)/Flutter", 633 "$(PROJECT_DIR)/Flutter",
@@ -9,8 +9,10 @@ import 'package:flutter_bugly/flutter_bugly.dart'; @@ -9,8 +9,10 @@ import 'package:flutter_bugly/flutter_bugly.dart';
9 import 'package:flutter_easyrefresh/ball_pulse_footer.dart'; 9 import 'package:flutter_easyrefresh/ball_pulse_footer.dart';
10 import 'package:flutter_easyrefresh/easy_refresh.dart'; 10 import 'package:flutter_easyrefresh/easy_refresh.dart';
11 import 'package:flutter_easyrefresh/material_header.dart'; 11 import 'package:flutter_easyrefresh/material_header.dart';
  12 +import 'package:flutter_screenutil/screenutil.dart';
12 import 'package:fluwx/fluwx.dart'; 13 import 'package:fluwx/fluwx.dart';
13 import 'package:one_key/pages/detail/handle_online_page.dart'; 14 import 'package:one_key/pages/detail/handle_online_page.dart';
  15 +import 'package:one_key/pages/home/home_page.dart';
14 import 'package:one_key/provider/base_info_provider.dart'; 16 import 'package:one_key/provider/base_info_provider.dart';
15 import 'package:one_key/provider/coupon_provider.dart'; 17 import 'package:one_key/provider/coupon_provider.dart';
16 import 'package:one_key/provider/create_store_model.dart'; 18 import 'package:one_key/provider/create_store_model.dart';
@@ -104,6 +106,7 @@ Future<void> main() async { @@ -104,6 +106,7 @@ Future<void> main() async {
104 child: MyApp(), 106 child: MyApp(),
105 )); 107 ));
106 }); 108 });
  109 + await App.initSp();
107 await AmapService.instance.init( 110 await AmapService.instance.init(
108 iosKey: 'e373581528f8fd901c01dfbda236159e', 111 iosKey: 'e373581528f8fd901c01dfbda236159e',
109 androidKey: 'dbced781d0acd36184d5b4b54da7188d'); 112 androidKey: 'dbced781d0acd36184d5b4b54da7188d');
@@ -124,6 +127,7 @@ class MyApp extends StatefulWidget { @@ -124,6 +127,7 @@ class MyApp extends StatefulWidget {
124 127
125 class MyAppState extends State<MyApp> { 128 class MyAppState extends State<MyApp> {
126 int xgCount = 1; //注册信鸽次数,最多5次 129 int xgCount = 1; //注册信鸽次数,最多5次
  130 + bool isLogin = false;
127 131
128 @override 132 @override
129 void initState() { 133 void initState() {
@@ -131,6 +135,7 @@ class MyAppState extends State<MyApp> { @@ -131,6 +135,7 @@ class MyAppState extends State<MyApp> {
131 super.initState(); 135 super.initState();
132 initDio(); 136 initDio();
133 _initFluwx(); 137 _initFluwx();
  138 + _isLogin();
134 Utils.changeStatusColor(); 139 Utils.changeStatusColor();
135 // 设置EasyRefresh的默认样式 140 // 设置EasyRefresh的默认样式
136 EasyRefresh.defaultHeader = MaterialHeader(); 141 EasyRefresh.defaultHeader = MaterialHeader();
@@ -163,8 +168,16 @@ class MyAppState extends State<MyApp> { @@ -163,8 +168,16 @@ class MyAppState extends State<MyApp> {
163 DioUtil().setConfig(config); 168 DioUtil().setConfig(config);
164 } 169 }
165 170
  171 + //判断是否登录
  172 + bool _isLogin() {
  173 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  174 + userModel.initUser();
  175 + isLogin = App.sp.getBool("isLogin") ?? false;
  176 + }
  177 +
166 @override 178 @override
167 Widget build(BuildContext context) { 179 Widget build(BuildContext context) {
  180 +
168 // TODO: implement build 181 // TODO: implement build
169 return MaterialApp( 182 return MaterialApp(
170 debugShowCheckedModeBanner: false, 183 debugShowCheckedModeBanner: false,
@@ -177,8 +190,10 @@ class MyAppState extends State<MyApp> { @@ -177,8 +190,10 @@ class MyAppState extends State<MyApp> {
177 textTheme: 190 textTheme:
178 TextTheme(overline: TextStyle(decoration: TextDecoration.none)), 191 TextTheme(overline: TextStyle(decoration: TextDecoration.none)),
179 tooltipTheme: TooltipThemeData(verticalOffset: -100000)), 192 tooltipTheme: TooltipThemeData(verticalOffset: -100000)),
180 - home: ChangeNotifierProvider<OtherLoginProvider>(  
181 - create: (_) => OtherLoginProvider(), child: LoginPage()), 193 + home: isLogin
  194 + ? HomePage(initialIndex: 2)
  195 + : ChangeNotifierProvider<OtherLoginProvider>(
  196 + create: (_) => OtherLoginProvider(), child: LoginPage()),
182 onGenerateRoute: App.router.generator, 197 onGenerateRoute: App.router.generator,
183 ); 198 );
184 } 199 }
@@ -159,47 +159,50 @@ class Data extends Object { @@ -159,47 +159,50 @@ class Data extends Object {
159 @JsonKey(name: 'seller_code') 159 @JsonKey(name: 'seller_code')
160 String sellerCode; 160 String sellerCode;
161 161
  162 + @JsonKey(name: 'real_address')
  163 + String realAddress;
  164 +
162 Data( 165 Data(
163 - this.id,  
164 - this.pid,  
165 - this.openid,  
166 - this.sellername,  
167 - this.selleralias,  
168 - this.slogan,  
169 - this.sellerdesc,  
170 - this.sellerLogo,  
171 - this.sellerImage,  
172 - this.sellerTel,  
173 - this.phone,  
174 - this.mapAddress,  
175 - this.long,  
176 - this.lat,  
177 - this.discountType,  
178 - this.lastNum,  
179 - this.ispass,  
180 - this.disIspass,  
181 - this.accountMoney,  
182 - this.isopenDc,  
183 - this.isopenMd,  
184 - this.dcAdduserCode,  
185 - this.average,  
186 - this.isOnlineReserve,  
187 - this.isTele,  
188 - this.daily,  
189 - this.dailyTime,  
190 - this.scale,  
191 - this.score,  
192 - this.isAuth,  
193 - this.isCallTel,  
194 - this.recStime,  
195 - this.recEtime,  
196 - this.status,  
197 - this.cdate,  
198 - this.proCode,  
199 - this.cityCode,  
200 - this.disCode,  
201 - this.sellerCode,  
202 - ); 166 + this.id,
  167 + this.pid,
  168 + this.openid,
  169 + this.sellername,
  170 + this.selleralias,
  171 + this.slogan,
  172 + this.sellerdesc,
  173 + this.sellerLogo,
  174 + this.sellerImage,
  175 + this.sellerTel,
  176 + this.phone,
  177 + this.mapAddress,
  178 + this.long,
  179 + this.lat,
  180 + this.discountType,
  181 + this.lastNum,
  182 + this.ispass,
  183 + this.disIspass,
  184 + this.accountMoney,
  185 + this.isopenDc,
  186 + this.isopenMd,
  187 + this.dcAdduserCode,
  188 + this.average,
  189 + this.isOnlineReserve,
  190 + this.isTele,
  191 + this.daily,
  192 + this.dailyTime,
  193 + this.scale,
  194 + this.score,
  195 + this.isAuth,
  196 + this.isCallTel,
  197 + this.recStime,
  198 + this.recEtime,
  199 + this.status,
  200 + this.cdate,
  201 + this.proCode,
  202 + this.cityCode,
  203 + this.disCode,
  204 + this.sellerCode,
  205 + this.realAddress);
203 206
204 factory Data.fromJson(Map<String, dynamic> srcJson) => 207 factory Data.fromJson(Map<String, dynamic> srcJson) =>
205 _$DataFromJson(srcJson); 208 _$DataFromJson(srcJson);
@@ -36,45 +36,47 @@ Map<String, dynamic> _$GetSellerInfoSunModelToJson( @@ -36,45 +36,47 @@ Map<String, dynamic> _$GetSellerInfoSunModelToJson(
36 36
37 Data _$DataFromJson(Map<String, dynamic> json) { 37 Data _$DataFromJson(Map<String, dynamic> json) {
38 return Data( 38 return Data(
39 - json['id'] as String,  
40 - json['pid'] as String,  
41 - json['openid'] as String,  
42 - json['sellername'] as String,  
43 - json['selleralias'] as String,  
44 - json['slogan'] as String,  
45 - json['sellerdesc'] as String,  
46 - json['seller_logo'] as String,  
47 - json['seller_image'] as String,  
48 - json['seller_tel'] as String,  
49 - json['phone'] as String,  
50 - json['map_address'] as String,  
51 - json['long'] as String,  
52 - json['lat'] as String,  
53 - json['discount_type'] as String,  
54 - json['last_num'] as String,  
55 - json['ispass'] as String,  
56 - json['dis_ispass'] as String,  
57 - json['account_money'] as String,  
58 - json['isopen_dc'] as String,  
59 - json['isopen_md'] as String,  
60 - json['dc_adduser_code'] as String,  
61 - json['average'] as String,  
62 - json['is_online_reserve'] as String,  
63 - json['is_tele'] as String,  
64 - json['daily'] as String,  
65 - json['daily_time'] as String,  
66 - json['scale'] as String,  
67 - json['score'] as String,  
68 - json['is_auth'] as String,  
69 - json['is_call_tel'] as String,  
70 - json['rec_stime'] as String,  
71 - json['rec_etime'] as String,  
72 - json['status'] as String,  
73 - json['cdate'] as String,  
74 - json['pro_code'] as String,  
75 - json['city_code'] as String,  
76 - json['dis_code'] as String,  
77 - json['seller_code'] as String); 39 + json['id'] as String,
  40 + json['pid'] as String,
  41 + json['openid'] as String,
  42 + json['sellername'] as String,
  43 + json['selleralias'] as String,
  44 + json['slogan'] as String,
  45 + json['sellerdesc'] as String,
  46 + json['seller_logo'] as String,
  47 + json['seller_image'] as String,
  48 + json['seller_tel'] as String,
  49 + json['phone'] as String,
  50 + json['map_address'] as String,
  51 + json['long'] as String,
  52 + json['lat'] as String,
  53 + json['discount_type'] as String,
  54 + json['last_num'] as String,
  55 + json['ispass'] as String,
  56 + json['dis_ispass'] as String,
  57 + json['account_money'] as String,
  58 + json['isopen_dc'] as String,
  59 + json['isopen_md'] as String,
  60 + json['dc_adduser_code'] as String,
  61 + json['average'] as String,
  62 + json['is_online_reserve'] as String,
  63 + json['is_tele'] as String,
  64 + json['daily'] as String,
  65 + json['daily_time'] as String,
  66 + json['scale'] as String,
  67 + json['score'] as String,
  68 + json['is_auth'] as String,
  69 + json['is_call_tel'] as String,
  70 + json['rec_stime'] as String,
  71 + json['rec_etime'] as String,
  72 + json['status'] as String,
  73 + json['cdate'] as String,
  74 + json['pro_code'] as String,
  75 + json['city_code'] as String,
  76 + json['dis_code'] as String,
  77 + json['seller_code'] as String,
  78 + json['real_address'] as String,
  79 + );
78 } 80 }
79 81
80 Map<String, dynamic> _$DataToJson(Data instance) => <String, dynamic>{ 82 Map<String, dynamic> _$DataToJson(Data instance) => <String, dynamic>{
@@ -116,5 +118,6 @@ Map<String, dynamic> _$DataToJson(Data instance) => <String, dynamic>{ @@ -116,5 +118,6 @@ Map<String, dynamic> _$DataToJson(Data instance) => <String, dynamic>{
116 'pro_code': instance.proCode, 118 'pro_code': instance.proCode,
117 'city_code': instance.cityCode, 119 'city_code': instance.cityCode,
118 'dis_code': instance.disCode, 120 'dis_code': instance.disCode,
119 - 'seller_code': instance.sellerCode 121 + 'seller_code': instance.sellerCode,
  122 + 'real_address': instance.realAddress
120 }; 123 };
  1 +import 'package:json_annotation/json_annotation.dart';
  2 +
  3 +part 'table_class_model.g.dart';
  4 +
  5 +@JsonSerializable()
  6 +class TableClassModel extends Object {
  7 + @JsonKey(name: 'ret')
  8 + int ret;
  9 +
  10 + @JsonKey(name: 'data')
  11 + TableClassSunModel data;
  12 +
  13 + @JsonKey(name: 'msg')
  14 + String msg;
  15 +
  16 + TableClassModel(
  17 + this.ret,
  18 + this.data,
  19 + this.msg,
  20 + );
  21 +
  22 + factory TableClassModel.fromJson(Map<String, dynamic> srcJson) =>
  23 + _$TableClassModelFromJson(srcJson);
  24 +
  25 + Map<String, dynamic> toJson() => _$TableClassModelToJson(this);
  26 +}
  27 +
  28 +@JsonSerializable()
  29 +class TableClassSunModel extends Object {
  30 + @JsonKey(name: 'id')
  31 + String id;
  32 +
  33 + @JsonKey(name: 'sellerid')
  34 + String sellerid;
  35 +
  36 + @JsonKey(name: 'tableid')
  37 + String tableid;
  38 +
  39 + @JsonKey(name: 'name')
  40 + String name;
  41 +
  42 + @JsonKey(name: 'max')
  43 + String max;
  44 +
  45 + @JsonKey(name: 'low')
  46 + String low;
  47 +
  48 + @JsonKey(name: 'standard')
  49 + String standard;
  50 +
  51 + @JsonKey(name: 'status')
  52 + String status;
  53 +
  54 + @JsonKey(name: 'cdate')
  55 + String cdate;
  56 +
  57 + TableClassSunModel(
  58 + this.id,
  59 + this.sellerid,
  60 + this.tableid,
  61 + this.name,
  62 + this.max,
  63 + this.low,
  64 + this.standard,
  65 + this.status,
  66 + this.cdate,
  67 + );
  68 +
  69 + factory TableClassSunModel.fromJson(Map<String, dynamic> srcJson) =>
  70 + _$TableClassSunModelFromJson(srcJson);
  71 +
  72 + Map<String, dynamic> toJson() => _$TableClassSunModelToJson(this);
  73 +}
  1 +// GENERATED CODE - DO NOT MODIFY BY HAND
  2 +
  3 +part of 'table_class_model.dart';
  4 +
  5 +// **************************************************************************
  6 +// JsonSerializableGenerator
  7 +// **************************************************************************
  8 +
  9 +TableClassModel _$TableClassModelFromJson(Map<String, dynamic> json) {
  10 + return TableClassModel(
  11 + json['ret'] as int,
  12 + json['data'] == null
  13 + ? null
  14 + : TableClassSunModel.fromJson(json['data'] as Map<String, dynamic>),
  15 + json['msg'] as String,
  16 + );
  17 +}
  18 +
  19 +Map<String, dynamic> _$TableClassModelToJson(TableClassModel instance) =>
  20 + <String, dynamic>{
  21 + 'ret': instance.ret,
  22 + 'data': instance.data,
  23 + 'msg': instance.msg,
  24 + };
  25 +
  26 +TableClassSunModel _$TableClassSunModelFromJson(Map<String, dynamic> json) {
  27 + return TableClassSunModel(
  28 + json['id'] as String,
  29 + json['sellerid'] as String,
  30 + json['tableid'] as String,
  31 + json['name'] as String,
  32 + json['max'] as String,
  33 + json['low'] as String,
  34 + json['standard'] as String,
  35 + json['status'] as String,
  36 + json['cdate'] as String,
  37 + );
  38 +}
  39 +
  40 +Map<String, dynamic> _$TableClassSunModelToJson(TableClassSunModel instance) =>
  41 + <String, dynamic>{
  42 + 'id': instance.id,
  43 + 'sellerid': instance.sellerid,
  44 + 'tableid': instance.tableid,
  45 + 'name': instance.name,
  46 + 'max': instance.max,
  47 + 'low': instance.low,
  48 + 'standard': instance.standard,
  49 + 'status': instance.status,
  50 + 'cdate': instance.cdate,
  51 + };
@@ -11,6 +11,7 @@ class UploadImgModel { @@ -11,6 +11,7 @@ class UploadImgModel {
11 String duration; //视频时长 11 String duration; //视频时长
12 bool isUpload; //桌面图片管理 ----- 图片是否上传到后台服务器 12 bool isUpload; //桌面图片管理 ----- 图片是否上传到后台服务器
13 String photoID; //桌面图片管理 ID 13 String photoID; //桌面图片管理 ID
  14 + String path;
14 } 15 }
15 16
16 enum FileType { 17 enum FileType {
@@ -135,4 +135,9 @@ class HttpUrl { @@ -135,4 +135,9 @@ class HttpUrl {
135 static const String app_pay_sub = 135 static const String app_pay_sub =
136 "?service=App.Pay.AppPaySub"; // 根据指定日期,返回当前商家包间类型置满情况的日期 136 "?service=App.Pay.AppPaySub"; // 根据指定日期,返回当前商家包间类型置满情况的日期
137 137
  138 + static const String get_table_class_by_id =
  139 + "?service=App.Seller.GetTableClassById"; // 获取包间分类
  140 + static const String set_table_class =
  141 + "?service=App.Seller.SetTableClass"; // 添加/修改包间分类
  142 +
138 } 143 }
@@ -7,6 +7,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -7,6 +7,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
7 import 'package:one_key/utils/dialog_util.dart'; 7 import 'package:one_key/utils/dialog_util.dart';
8 import 'package:one_key/utils/misc.dart'; 8 import 'package:one_key/utils/misc.dart';
9 import 'package:one_key/route/navigator_util.dart'; 9 import 'package:one_key/route/navigator_util.dart';
  10 +import 'package:one_key/utils/utils.dart';
10 import 'package:one_key/widgets/system_app_bar.dart'; 11 import 'package:one_key/widgets/system_app_bar.dart';
11 import 'package:permission_handler/permission_handler.dart'; 12 import 'package:permission_handler/permission_handler.dart';
12 // import 'package:demo/resources/custom_text_style.dart'; 13 // import 'package:demo/resources/custom_text_style.dart';
@@ -37,30 +38,59 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { @@ -37,30 +38,59 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> {
37 super.initState(); 38 super.initState();
38 39
39 WidgetsBinding.instance.addPostFrameCallback((_) async { 40 WidgetsBinding.instance.addPostFrameCallback((_) async {
40 - _requestLocationPermission(); 41 + _getLocationPermission();
41 }); 42 });
42 } 43 }
43 44
  45 + Future<bool> checkLocationPermission() async {
  46 + PermissionStatus permissionStatus = await Permission.location.status;
  47 + if (permissionStatus == PermissionStatus.granted) {
  48 + return true;
  49 + } else {
  50 + return false;
  51 + }
  52 + }
  53 +
  54 + /// 检查权限并定
  55 + _getLocationPermission() async {
  56 + if (!(await checkPermission(Permission.location))) {
  57 + //没有定位权限
  58 +
  59 + //申请定位权限
  60 + _requestLocationPermission();
  61 + } else {
  62 + //去定位
  63 + _requestLocationPermission();
  64 + }
  65 + }
  66 +
44 /// 获取定位权限 67 /// 获取定位权限
45 _requestLocationPermission() async { 68 _requestLocationPermission() async {
46 - Location location = await AmapLocation.instance.fetchLocation(  
47 - // needAddress: true,  
48 - // mode: LocationAccuracy.High,  
49 - // timeout: Duration(seconds: 10)  
50 - ); 69 + bool canLocation = await requestPermission(Permission.location);
  70 + // 单次定位
  71 + if (canLocation) {
  72 + Future.delayed(Duration(milliseconds: 200), () async {
  73 + final location = await AmapLocation.instance.fetchLocation(
  74 + // needAddress: true,
  75 + // mode: LocationAccuracy.High,
  76 + // timeout: Duration(seconds: 10)
  77 + );
51 78
52 - if (location.city == null || location.city == '') //网络不好,定位失败  
53 - {  
54 - // App.sp.setString("lat", "39.684670899");  
55 - // App.sp.setString("lng", "118.17630045");  
56 - // App.sp.setString("city", "唐山市"); 79 + if (location.city == null || location.city == '') //网络不好,定位失败
  80 + {
  81 + // App.sp.setString("lat", "39.684670899");
  82 + // App.sp.setString("lng", "118.17630045");
57 83
  84 + } else {
  85 + latitude = location.latLng.latitude;
  86 + longitude = location.latLng.longitude;
  87 + _controller.setCenterCoordinate(
  88 + LatLng(location.latLng.latitude, location.latLng.longitude));
  89 + setState(() {});
  90 + }
  91 + });
58 } else { 92 } else {
59 - _controller.setCenterCoordinate(  
60 - LatLng(location.latLng.latitude, location.latLng.longitude));  
61 -  
62 - // App.sp.setString("city", location.city);  
63 - // App.sp.setString("address", location.address); 93 + //无权限
64 94
65 } 95 }
66 } 96 }
@@ -251,8 +281,8 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { @@ -251,8 +281,8 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> {
251 // zoomLevel: 16); 281 // zoomLevel: 16);
252 Navigator.pop(context, { 282 Navigator.pop(context, {
253 'address': item.address, 283 'address': item.address,
254 - 'lat': item.latLng.latitude,  
255 - 'lng': item.latLng.longitude 284 + 'lat': item.latLng.latitude.toString(),
  285 + 'lng': item.latLng.longitude.toString()
256 }); 286 });
257 }, 287 },
258 ); 288 );
@@ -487,7 +487,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -487,7 +487,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
487 @override 487 @override
488 Widget build(BuildContext context) { 488 Widget build(BuildContext context) {
489 // TODO: implement build 489 // TODO: implement build
490 - 490 + ScreenUtil.init(context, width: 750, height: 1334);
491 return new WillPopScope( 491 return new WillPopScope(
492 child: Scaffold( 492 child: Scaffold(
493 bottomNavigationBar: BottomNavigationBar( 493 bottomNavigationBar: BottomNavigationBar(
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:flutter/services.dart'; 2 import 'package:flutter/services.dart';
3 import 'package:flutter_screenutil/screenutil.dart'; 3 import 'package:flutter_screenutil/screenutil.dart';
  4 +import 'package:one_key/models/table_class_model.dart';
4 import 'package:one_key/models/table_list.dart'; 5 import 'package:one_key/models/table_list.dart';
  6 +import 'package:one_key/provider/store_detail_model.dart';
  7 +import 'package:one_key/provider/user_model.dart';
5 import 'package:one_key/res/colors.dart'; 8 import 'package:one_key/res/colors.dart';
6 import 'package:one_key/route/navigator_util.dart'; 9 import 'package:one_key/route/navigator_util.dart';
  10 +import 'package:one_key/utils/event_bus.dart';
7 import 'package:one_key/utils/utils.dart'; 11 import 'package:one_key/utils/utils.dart';
8 import 'package:one_key/widgets/h_empty_view.dart'; 12 import 'package:one_key/widgets/h_empty_view.dart';
9 import 'package:one_key/widgets/round_button.dart'; 13 import 'package:one_key/widgets/round_button.dart';
10 import 'package:one_key/widgets/system_app_bar.dart'; 14 import 'package:one_key/widgets/system_app_bar.dart';
11 import 'package:one_key/widgets/v_empty_view.dart'; 15 import 'package:one_key/widgets/v_empty_view.dart';
  16 +import 'package:provider/provider.dart';
12 17
13 class RoomTypeCreatePage extends StatefulWidget { 18 class RoomTypeCreatePage extends StatefulWidget {
14 - RoomTypeCreatePage({Key key}) : super(key: key); 19 + final bool isNew;
  20 + final String tableClassId;
  21 + RoomTypeCreatePage({Key key, this.isNew = true, this.tableClassId})
  22 + : super(key: key);
15 23
16 @override 24 @override
17 _RoomTypeCreatePageState createState() => _RoomTypeCreatePageState(); 25 _RoomTypeCreatePageState createState() => _RoomTypeCreatePageState();
@@ -28,12 +36,69 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { @@ -28,12 +36,69 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
28 FocusNode _norNumFocusNode = FocusNode(); 36 FocusNode _norNumFocusNode = FocusNode();
29 FocusNode _maxNumFocusNode = FocusNode(); 37 FocusNode _maxNumFocusNode = FocusNode();
30 FocusNode _minMoneyFocusNode = FocusNode(); 38 FocusNode _minMoneyFocusNode = FocusNode();
31 - List<TableList> tableListSel = []; 39 + String tableListSel = '';
  40 +
  41 + bool swichState = true;
  42 + StoreDetailModel detailModel;
32 43
33 @override 44 @override
34 void initState() { 45 void initState() {
35 super.initState(); 46 super.initState();
36 - tableListSel = []; 47 + tableListSel = '';
  48 + WidgetsBinding.instance.addPostFrameCallback((_) {
  49 + if (!widget.isNew) {
  50 + _getTableClassById();
  51 + }
  52 + });
  53 + }
  54 +
  55 + ///获取包间类型通过id
  56 + _getTableClassById() async {
  57 + Map<String, String> params = {
  58 + "id": widget.tableClassId,
  59 + };
  60 + TableClassSunModel sunModel =
  61 + await detailModel.getTableClassById(context, params);
  62 + if (sunModel != null) {
  63 + _nameController.text = sunModel.name;
  64 + _norNumController.text = sunModel.standard;
  65 + _maxNumController.text = sunModel.max;
  66 + _minMoneyController.text = sunModel.low;
  67 + setState(() {
  68 + sunModel.status == '1' ? swichState = true : swichState = false;
  69 + tableListSel = sunModel.tableid != null ? sunModel.tableid : '';
  70 + });
  71 + }
  72 + }
  73 +
  74 + ///设置包间类型
  75 + _setTableClass() async {
  76 + if (_nameController.text.trim().length == 0) {
  77 + Utils.showToast('请填写类型名称');
  78 + return;
  79 + }
  80 + if (_norNumController.text.trim().length == 0) {
  81 + Utils.showToast('请填写标准可坐人数');
  82 + return;
  83 + }
  84 + Map<String, String> params = {
  85 + 'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid,
  86 + 'name': _nameController.text,
  87 + 'max': _maxNumController.text,
  88 + 'low': _minMoneyController.text,
  89 + 'standard': _norNumController.text,
  90 + 'status': swichState ? '1' : '0',
  91 + 'tableid': tableListSel
  92 + };
  93 + if (widget.tableClassId != 'null') {
  94 + params['id'] = widget.tableClassId;
  95 + }
  96 + bool success =
  97 + await detailModel.setTableClass(context, params, showLoading: true);
  98 + if (success) {
  99 + EventBus().emit('table_manage_page');
  100 + Navigator.of(context).pop();
  101 + }
37 } 102 }
38 103
39 ///输入框 104 ///输入框
@@ -140,14 +205,15 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { @@ -140,14 +205,15 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
140 DateTime.now().millisecondsSinceEpoch, 205 DateTime.now().millisecondsSinceEpoch,
141 "1", 206 "1",
142 canChoose: true, 207 canChoose: true,
143 - object: {'object': tableListSel}, 208 + fromPage: 'room_manage',
  209 + object: tableListSel,
144 ); 210 );
145 - if (temp != null && temp['tid'] != '') { 211 + if (temp != null) {
146 print(temp['tid']); 212 print(temp['tid']);
147 print(temp['tname']); 213 print(temp['tname']);
148 String tname = temp['tname']; 214 String tname = temp['tname'];
149 String tid = temp['tid']; 215 String tid = temp['tid'];
150 - tableListSel = temp['object']; 216 + tableListSel = temp['tid'];
151 setState(() {}); 217 setState(() {});
152 // _getTablePhoto(context, temp['tid'], showLoading: true); 218 // _getTablePhoto(context, temp['tid'], showLoading: true);
153 } 219 }
@@ -191,6 +257,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { @@ -191,6 +257,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
191 257
192 @override 258 @override
193 Widget build(BuildContext context) { 259 Widget build(BuildContext context) {
  260 + detailModel = Provider.of<StoreDetailModel>(context, listen: true);
194 return Material( 261 return Material(
195 child: InkWell( 262 child: InkWell(
196 onTap: () { 263 onTap: () {
@@ -199,7 +266,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { @@ -199,7 +266,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
199 child: Scaffold( 266 child: Scaffold(
200 backgroundColor: MyColours.color_fefefe, 267 backgroundColor: MyColours.color_fefefe,
201 appBar: SystemAppBar( 268 appBar: SystemAppBar(
202 - '创建包间类型', 269 + widget.isNew ? "创建包间类型" : '修改包间类型',
203 onTap: () { 270 onTap: () {
204 Navigator.of(context).pop(); 271 Navigator.of(context).pop();
205 }, 272 },
@@ -211,6 +278,72 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { @@ -211,6 +278,72 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
211 physics: BouncingScrollPhysics(), 278 physics: BouncingScrollPhysics(),
212 child: Column( 279 child: Column(
213 children: [ 280 children: [
  281 + !widget.isNew
  282 + ? InkWell(
  283 + onTap: () {
  284 + setState(() {
  285 + swichState = !swichState;
  286 + });
  287 + },
  288 + child: Padding(
  289 + padding: EdgeInsets.symmetric(
  290 + horizontal: ScreenUtil().setWidth(40),
  291 + vertical: ScreenUtil().setWidth(40),
  292 + ),
  293 + child: Row(
  294 + mainAxisAlignment:
  295 + MainAxisAlignment.spaceBetween,
  296 + children: [
  297 + Column(
  298 + crossAxisAlignment:
  299 + CrossAxisAlignment.start,
  300 + children: [
  301 + Container(
  302 + child: Text(
  303 + swichState ? '启用' : '停用',
  304 + style: TextStyle(
  305 + color: MyColours
  306 + .color_333333,
  307 + fontWeight:
  308 + FontWeight.bold,
  309 + fontSize: ScreenUtil()
  310 + .setSp(34)),
  311 + ),
  312 + ),
  313 + VEmptyView(40),
  314 + Container(
  315 + child: Text(
  316 + swichState
  317 + ? '已启用在线预订,可以看到该包间类型'
  318 + : '已停用在线预订,看不到该包间类型',
  319 + style: TextStyle(
  320 + color: MyColours
  321 + .color_666666,
  322 + fontSize: ScreenUtil()
  323 + .setSp(24)),
  324 + ),
  325 + ),
  326 + ],
  327 + ),
  328 + Image.asset(
  329 + swichState
  330 + ? Utils.getImgPath('swich_on')
  331 + : Utils.getImgPath(
  332 + 'swich_off'),
  333 + width: ScreenUtil().setWidth(122),
  334 + height: ScreenUtil().setWidth(82),
  335 + )
  336 + ],
  337 + )),
  338 + )
  339 + : SizedBox(),
  340 + Container(
  341 + height: ScreenUtil().setWidth(2),
  342 + color: MyColours.color_efefef,
  343 + margin: EdgeInsets.only(
  344 + left: ScreenUtil().setWidth(40),
  345 + right: ScreenUtil().setWidth(40)),
  346 + ),
214 Padding( 347 Padding(
215 padding: EdgeInsets.symmetric( 348 padding: EdgeInsets.symmetric(
216 horizontal: ScreenUtil().setWidth(40), 349 horizontal: ScreenUtil().setWidth(40),
@@ -306,8 +439,10 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { @@ -306,8 +439,10 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
306 ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)), 439 ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)),
307 child: RoundButton( 440 child: RoundButton(
308 onPressed: () { 441 onPressed: () {
  442 + FocusScope.of(context)
  443 + .requestFocus(FocusNode()); //点击空白处隐藏键盘
309 //接口 444 //接口
310 - // _setStoreBaseinfo(); 445 + _setTableClass();
311 }, 446 },
312 text: '保存', 447 text: '保存',
313 fontSize: 34, 448 fontSize: 34,
@@ -27,6 +27,16 @@ class _RoomTypeManagePageState extends State<RoomTypeManagePage> { @@ -27,6 +27,16 @@ class _RoomTypeManagePageState extends State<RoomTypeManagePage> {
27 WidgetsBinding.instance.addPostFrameCallback((timeStamp) { 27 WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
28 _getSellerTableClass(); 28 _getSellerTableClass();
29 }); 29 });
  30 + EventBus().on('table_manage_page', (arg) {
  31 + _getSellerTableClass();
  32 + });
  33 + }
  34 +
  35 + @override
  36 + void dispose() {
  37 + // TODO: implement dispose
  38 + super.dispose();
  39 + EventBus().off('table_manage_page');
30 } 40 }
31 41
32 //获取商家包间类型 42 //获取商家包间类型
@@ -89,60 +99,117 @@ class _RoomTypeManagePageState extends State<RoomTypeManagePage> { @@ -89,60 +99,117 @@ class _RoomTypeManagePageState extends State<RoomTypeManagePage> {
89 childAspectRatio: 2.4), 99 childAspectRatio: 2.4),
90 itemBuilder: (context, index) { 100 itemBuilder: (context, index) {
91 return GestureDetector( 101 return GestureDetector(
92 - onTap: () async {},  
93 - child: Container(  
94 - height: ScreenUtil().setWidth(140),  
95 - padding: EdgeInsets.only(  
96 - left: ScreenUtil().setWidth(30)),  
97 - decoration: BoxDecoration(  
98 - color: MyColours.color_A9E3E6,  
99 - borderRadius: BorderRadius.circular(  
100 - ScreenUtil().setWidth(10)),  
101 - border: Border.all(  
102 - color: MyColours.color_2AB5B7,  
103 - width: ScreenUtil().setWidth(2)),  
104 - ),  
105 - alignment: Alignment.centerLeft,  
106 - child: Column(  
107 - mainAxisSize: MainAxisSize.min,  
108 - mainAxisAlignment:  
109 - MainAxisAlignment.center,  
110 - crossAxisAlignment:  
111 - CrossAxisAlignment.start,  
112 - children: <Widget>[  
113 - Text("${tables[index].name}",  
114 - style: TextStyle(  
115 - fontSize:  
116 - ScreenUtil().setSp(30),  
117 - color: MyColours.color_333333,  
118 - fontWeight: FontWeight.bold)),  
119 - VEmptyView(10),  
120 - int.parse(tables[index].max ?? "0") > 0  
121 - ? Text(  
122 - "最多可坐${tables[index].max}人", 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(
  120 + 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}",
123 style: TextStyle( 134 style: TextStyle(
124 fontSize: 135 fontSize:
125 - ScreenUtil().setSp(24), 136 + ScreenUtil().setSp(30),
126 color: 137 color:
127 MyColours.color_333333, 138 MyColours.color_333333,
128 fontWeight: 139 fontWeight:
129 - FontWeight.normal),  
130 - )  
131 - : Container(),  
132 - int.parse(tables[index].low ?? "0") > 0  
133 - ? Text(  
134 - "最低消费${tables[index].low}元",  
135 - style: TextStyle(  
136 - fontSize:  
137 - ScreenUtil().setSp(20),  
138 - color:  
139 - MyColours.color_199095,  
140 - fontWeight:  
141 - FontWeight.normal),  
142 - )  
143 - : Container()  
144 - ],  
145 - ), 140 + FontWeight.bold)),
  141 + VEmptyView(10),
  142 + int.parse(tables[index].max ??
  143 + "0") >
  144 + 0
  145 + ? Text(
  146 + "最多可坐${tables[index].max}人",
  147 + style: TextStyle(
  148 + fontSize: ScreenUtil()
  149 + .setSp(24),
  150 + color: MyColours
  151 + .color_333333,
  152 + 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(
  190 + topLeft:
  191 + Radius.circular(
  192 + ScreenUtil()
  193 + .setWidth(
  194 + 90)),
  195 + bottomRight:
  196 + Radius.circular(
  197 + ScreenUtil()
  198 + .setWidth(
  199 + 10))),
  200 + color: MyColours.color_d8d8d8,
  201 + ),
  202 + child: Text(
  203 + '已停用',
  204 + style: TextStyle(
  205 + fontSize: ScreenUtil()
  206 + .setSp(24),
  207 + color: MyColours
  208 + .color_333333),
  209 + ),
  210 + ))
  211 + : SizedBox()
  212 + ],
146 ), 213 ),
147 ); 214 );
148 }, 215 },
@@ -30,7 +30,7 @@ class RoomTypeSelectTablePage extends StatefulWidget { @@ -30,7 +30,7 @@ class RoomTypeSelectTablePage extends StatefulWidget {
30 final DateTime dateTime; //日期 30 final DateTime dateTime; //日期
31 final String ddate_slot; //时段 31 final String ddate_slot; //时段
32 final bool canChoose; //变更预订可以取消原来已预订的选中状态 32 final bool canChoose; //变更预订可以取消原来已预订的选中状态
33 - final List<TableList> tableList; 33 + final List<String> tableList;
34 final String fromPage; 34 final String fromPage;
35 final String tid; 35 final String tid;
36 36
@@ -84,8 +84,8 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { @@ -84,8 +84,8 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> {
84 // itemModelList.remove(item); 84 // itemModelList.remove(item);
85 // } 85 // }
86 for (var item in item.list) { 86 for (var item in item.list) {
87 - for (var table in widget.tableList) {  
88 - if (item.id == table.id) { 87 + for (var tid in widget.tableList) {
  88 + if (item.id == tid) {
89 item.selected = true; 89 item.selected = true;
90 selectNum++; 90 selectNum++;
91 // if (!tableList.contains(item)) { 91 // if (!tableList.contains(item)) {
@@ -293,40 +293,23 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { @@ -293,40 +293,23 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> {
293 areaTableMap[currentArea][index], 293 areaTableMap[currentArea][index],
294 need: false, 294 need: false,
295 onSelected: (t.Table table) { 295 onSelected: (t.Table table) {
296 - if (widget.fromPage == 'tablePhoto') {  
297 - for (String item in areaTableMap.keys) {  
298 - for (t.Table item  
299 - in areaTableMap[item]) {  
300 - item.selected = false;  
301 - selectNum = 0;  
302 - if (table.id == item.id) {  
303 - item.selected = true;  
304 - selectTables = [];  
305 - selectNum++;  
306 - selectTables.add(table);  
307 - }  
308 - }  
309 - }  
310 - setState(() {});  
311 - } else {  
312 - if ((table as t.Table).selected) {  
313 - selectTables.add(table); 296 + if ((table as t.Table).selected) {
  297 + selectTables.add(table);
314 298
315 - selectNum++; 299 + selectNum++;
316 300
317 - widget.tableList  
318 - .add(tableToTableList(table));  
319 - } else {  
320 - widget.tableList.removeWhere(  
321 - (t) => t.id == table.id); 301 + widget.tableList
  302 + .add(tableToTableList(table).id);
  303 + } else {
  304 + widget.tableList.removeWhere(
  305 + (t) => t == table.id);
322 306
323 - selectNum--; 307 + selectNum--;
324 308
325 - selectTables.removeWhere(  
326 - (t) => t.id == table.id);  
327 - }  
328 - setState(() {}); 309 + selectTables.removeWhere(
  310 + (t) => t.id == table.id);
329 } 311 }
  312 + setState(() {});
330 }, 313 },
331 canSelected: true, 314 canSelected: true,
332 fromPage: widget.fromPage, 315 fromPage: widget.fromPage,
@@ -347,33 +330,38 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { @@ -347,33 +330,38 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> {
347 alignment: Alignment.center, 330 alignment: Alignment.center,
348 color: MyColours.color_ffffff, 331 color: MyColours.color_ffffff,
349 child: CommonButton( 332 child: CommonButton(
350 - content: widget.fromPage == 'tablePhoto'  
351 - ? '确定'  
352 - : "已选${selectNum}个 确定", 333 + content: "已选${selectNum}个 确定",
353 width: 500, 334 width: 500,
354 height: 84, 335 height: 84,
355 fontSize: 34, 336 fontSize: 34,
356 state: 1, 337 state: 1,
357 onPress: () { 338 onPress: () {
358 - if (widget.fromPage == "tablePhoto") { 339 + if (widget.canChoose) {
  340 + // if (widget.tableList.length > 0) {
  341 + String tid = "";
  342 + for (String tableid
  343 + in widget.tableList) {
  344 + tid += tableid + ",";
  345 + }
  346 + if (widget.tableList.length > 0) {
  347 + tid = tid.substring(
  348 + 0, tid.length - 1);
  349 + }
  350 +
359 Map temp = { 351 Map temp = {
360 - 'tid': selectTables.length > 0  
361 - ? selectTables[0].id  
362 - : '',  
363 - 'tname': selectTables.length > 0  
364 - ? selectTables[0].name  
365 - : '' 352 + 'object': widget.tableList,
  353 + 'tid': tid
366 }; 354 };
367 Navigator.of(context).pop(temp); 355 Navigator.of(context).pop(temp);
  356 + // }
368 } else { 357 } else {
369 - if (widget.canChoose) {  
370 - // if (widget.tableList.length > 0) { 358 + if (selectTables.length > 0) {
371 String tid = ""; 359 String tid = "";
372 - for (TableList table  
373 - in widget.tableList) { 360 + for (t.Table table
  361 + in selectTables) {
374 tid += table.id + ","; 362 tid += table.id + ",";
375 } 363 }
376 - if (widget.tableList.length > 0) { 364 + if (selectTables.length > 0) {
377 tid = tid.substring( 365 tid = tid.substring(
378 0, tid.length - 1); 366 0, tid.length - 1);
379 } 367 }
@@ -383,25 +371,6 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { @@ -383,25 +371,6 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> {
383 'tid': tid 371 'tid': tid
384 }; 372 };
385 Navigator.of(context).pop(temp); 373 Navigator.of(context).pop(temp);
386 - // }  
387 - } else {  
388 - if (selectTables.length > 0) {  
389 - String tid = "";  
390 - for (t.Table table  
391 - in selectTables) {  
392 - tid += table.id + ",";  
393 - }  
394 - if (selectTables.length > 0) {  
395 - tid = tid.substring(  
396 - 0, tid.length - 1);  
397 - }  
398 -  
399 - Map temp = {  
400 - 'object': widget.tableList,  
401 - 'tid': tid  
402 - };  
403 - Navigator.of(context).pop(temp);  
404 - }  
405 } 374 }
406 } 375 }
407 }, 376 },
@@ -420,7 +389,7 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { @@ -420,7 +389,7 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> {
420 )); 389 ));
421 } 390 }
422 391
423 - tableToTableList(t.Table table) { 392 + TableList tableToTableList(t.Table table) {
424 TableList _tableList = TableList( 393 TableList _tableList = TableList(
425 '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); 394 '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
426 _tableList.id = table.id; 395 _tableList.id = table.id;
1 import 'dart:io'; 1 import 'dart:io';
2 2
3 import 'package:cached_network_image/cached_network_image.dart'; 3 import 'package:cached_network_image/cached_network_image.dart';
  4 +import 'package:dio/dio.dart';
4 import 'package:flutter/material.dart'; 5 import 'package:flutter/material.dart';
5 import 'package:flutter/services.dart'; 6 import 'package:flutter/services.dart';
6 import 'package:flutter_screenutil/screenutil.dart'; 7 import 'package:flutter_screenutil/screenutil.dart';
  8 +import 'package:one_key/models/get_seller_info_model.dart';
  9 +import 'package:one_key/models/set_seller_info_model.dart';
7 import 'package:one_key/models/upload_img_model.dart'; 10 import 'package:one_key/models/upload_img_model.dart';
8 import 'package:one_key/models/user.dart'; 11 import 'package:one_key/models/user.dart';
9 import 'package:one_key/pages/online_check/photo_view_wiget.dart'; 12 import 'package:one_key/pages/online_check/photo_view_wiget.dart';
10 import 'package:one_key/pages/online_check/progress.dart'; 13 import 'package:one_key/pages/online_check/progress.dart';
11 import 'package:one_key/provider/base_info_provider.dart'; 14 import 'package:one_key/provider/base_info_provider.dart';
  15 +import 'package:one_key/provider/store_base_info_provider.dart';
12 import 'package:one_key/provider/upload_img_provider.dart'; 16 import 'package:one_key/provider/upload_img_provider.dart';
13 import 'package:one_key/provider/user_model.dart'; 17 import 'package:one_key/provider/user_model.dart';
14 import 'package:one_key/res/colors.dart'; 18 import 'package:one_key/res/colors.dart';
@@ -43,16 +47,22 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { @@ -43,16 +47,22 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
43 FocusNode _timeFocusNode = FocusNode(); 47 FocusNode _timeFocusNode = FocusNode();
44 FocusNode _addressFocusNode = FocusNode(); 48 FocusNode _addressFocusNode = FocusNode();
45 FocusNode _introductionFocusNode = FocusNode(); 49 FocusNode _introductionFocusNode = FocusNode();
46 - String storeAddress; 50 +
  51 + Map<String, dynamic> mapAddress;
47 52
48 final picker = ImagePicker(); 53 final picker = ImagePicker();
49 // OnlineCheckEditProvider _onlineCheckEditProvider; 54 // OnlineCheckEditProvider _onlineCheckEditProvider;
50 UploadImageProvider _uploadImageProvider; 55 UploadImageProvider _uploadImageProvider;
51 - BaseIndoProvider _baseIndoProvider; 56 + StoreBaseIndoProvider _baseIndoProvider;
52 57
53 @override 58 @override
54 void initState() { 59 void initState() {
55 super.initState(); 60 super.initState();
  61 + mapAddress = {
  62 + "address": '点击选择',
  63 + 'lat': '',
  64 + 'lng': '',
  65 + };
56 _scrollController = ScrollController(); 66 _scrollController = ScrollController();
57 WidgetsBinding.instance.addPostFrameCallback((_) { 67 WidgetsBinding.instance.addPostFrameCallback((_) {
58 _uploadImageProvider.mentou.process = 0.01; 68 _uploadImageProvider.mentou.process = 0.01;
@@ -65,23 +75,22 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { @@ -65,23 +75,22 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
65 75
66 ///获取店铺信息 76 ///获取店铺信息
67 _getStoreBaseinfo() async { 77 _getStoreBaseinfo() async {
68 - Map<String, String> params = {  
69 - 'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid,  
70 - "uid": Provider.of<UserModel>(context, listen: false).user.openid,  
71 - };  
72 - bool success =  
73 - await _baseIndoProvider.getCustomerActivityBaseinfo(context, params);  
74 - if (success) {  
75 - _nameController.text = _baseIndoProvider.baseInfoSunModel.name;  
76 - _uploadImageProvider.touxiang.qiniuUrl =  
77 - _baseIndoProvider.baseInfoSunModel.photo;  
78 - _uploadImageProvider.erweima.qiniuUrl =  
79 - _baseIndoProvider.baseInfoSunModel.qrcode;  
80 - _phoneController.text = _baseIndoProvider.baseInfoSunModel.phone;  
81 - // _positionController.text = _baseIndoProvider.baseInfoSunModel.position;  
82 - _uploadImageProvider.imgSizeErweima = 64;  
83 - // setState(() {});  
84 - _uploadImageProvider.notifyListeners(); 78 + GetSellerInfoSunModel itemModel =
  79 + await _baseIndoProvider.getSellerById(context);
  80 + if (itemModel != null) {
  81 + _nameController.text = itemModel.data.sellername;
  82 + _phoneController.text = itemModel.data.sellerTel;
  83 + _timeController.text = itemModel.data.dailyTime;
  84 + _addressController.text = itemModel.data.realAddress;
  85 + _introductionController.text = itemModel.data.sellerdesc;
  86 + _uploadImageProvider.mentou.qiniuUrl = itemModel.data.sellerImage;
  87 + // _uploadImageProvider.notifyListeners();
  88 + mapAddress = {
  89 + "address": itemModel.data.mapAddress,
  90 + 'lat': itemModel.data.lat,
  91 + 'lng': itemModel.data.long,
  92 + };
  93 + setState(() {});
85 } 94 }
86 } 95 }
87 96
@@ -92,48 +101,51 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { @@ -92,48 +101,51 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
92 } 101 }
93 102
94 /// 修改店铺基本信息 103 /// 修改店铺基本信息
95 - _setStoreBaseinfo() async { 104 + _setSellerInfoById() async {
96 FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 105 FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
97 106
98 User user = Provider.of<UserModel>(context, listen: false).user; 107 User user = Provider.of<UserModel>(context, listen: false).user;
99 - Map<String, String> params = {  
100 - 'sellerid': user.sellerid,  
101 - "uid": user.openid,  
102 - "name": _nameController.text.trim().length == 0  
103 - ? user.sellername  
104 - : _nameController.text.trim(),  
105 - "photo": _uploadImageProvider.touxiang.qiniuUrl.trim().length == 0  
106 - ? 'http://nosqn.colorcun.com/yd_person.png'  
107 - : _uploadImageProvider.touxiang.qiniuUrl,  
108 - // "position": _positionController.text.trim().length == 0  
109 - // ? '经理'  
110 - // : _positionController.text, 108 + Map<String, dynamic> params = {
  109 + 'id': user.sellerid,
111 }; 110 };
112 - if (_phoneController.text.trim().length == 0) {  
113 - if (user.userphone != null) {  
114 - params['phone'] = user.userphone;  
115 - }  
116 - } else {  
117 - params['phone'] = _phoneController.text.trim(); 111 +
  112 + params['name'] = _nameController.text;
  113 +
  114 + if (_uploadImageProvider.mentou.file != null &&
  115 + _uploadImageProvider.mentou.file != '') {
  116 + params['image'] =
  117 + await MultipartFile.fromFile(_uploadImageProvider.mentou.path);
  118 + }
  119 +
  120 + params['phone'] = _phoneController.text;
  121 +
  122 + if (mapAddress != null && mapAddress['address'] != '') {
  123 + params['map_address'] = mapAddress['address'];
118 } 124 }
119 - if (_uploadImageProvider.erweima.qiniuUrl != null &&  
120 - _uploadImageProvider.erweima.qiniuUrl != '') {  
121 - params['qrcode'] = _uploadImageProvider.erweima.qiniuUrl; 125 + if (mapAddress != null && mapAddress['lng'] != '') {
  126 + params['long'] = mapAddress['lng'];
122 } 127 }
123 - if (_baseIndoProvider.baseInfoSunModel != null) {  
124 - params['id'] = _baseIndoProvider.baseInfoSunModel.id; 128 + if (mapAddress != null && mapAddress['lat'] != '') {
  129 + params['lat'] = mapAddress['lat'];
125 } 130 }
126 - bool isSuccess =  
127 - await _baseIndoProvider.setCustomerActivityBaseinfo(context, params);  
128 - // _baseIndoProvider.baseInfoSunModel = null;  
129 - if (isSuccess) {  
130 - _uploadImageProvider.touxiang.file = null;  
131 - _uploadImageProvider.erweima.file = null;  
132 - //成功之后跳回前一个页面  
133 - // bus.emit('refresh_coupon_list'); 131 +
  132 + params['real_address'] = _addressController.text;
  133 +
  134 + params['sellerdesc'] = _introductionController.text;
  135 +
  136 + params['daily_time'] = _timeController.text;
  137 +
  138 + FormData formData = FormData.fromMap(params);
  139 +
  140 + SetSellerInfoSunModel sunModel =
  141 + await _baseIndoProvider.setSellerInfoById(context, formData);
  142 + if (sunModel != null) {
  143 + //修改成功
134 Utils.showToast('保存成功'); 144 Utils.showToast('保存成功');
135 EventBus().emit('changeStatusColor'); 145 EventBus().emit('changeStatusColor');
136 - Navigator.pop(context, true); 146 + Navigator.pop(context);
  147 + } else {
  148 + // Utils.showToast('保存失败');
137 } 149 }
138 } 150 }
139 151
@@ -191,7 +203,11 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { @@ -191,7 +203,11 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
191 borderSide: BorderSide.none, 203 borderSide: BorderSide.none,
192 ), 204 ),
193 ), 205 ),
194 - onChanged: (value) {}, 206 + onChanged: (value) {
  207 + // if (editingController == _nameController) {
  208 + // _nameController.text = value;
  209 + // }
  210 + },
195 onEditingComplete: () { 211 onEditingComplete: () {
196 FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 212 FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
197 }, 213 },
@@ -224,10 +240,12 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { @@ -224,10 +240,12 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
224 Widget child = Stack( 240 Widget child = Stack(
225 children: <Widget>[ 241 children: <Widget>[
226 PhotoPreview( 242 PhotoPreview(
227 - initialIndex: index,  
228 - photoList: imgs,  
229 - isShow: isShow,  
230 - dashName: dashName) 243 + initialIndex: index,
  244 + photoList: imgs,
  245 + isShow: isShow,
  246 + dashName: dashName,
  247 + needMask: false,
  248 + )
231 ], 249 ],
232 ); 250 );
233 return child; 251 return child;
@@ -248,15 +266,12 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { @@ -248,15 +266,12 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
248 } 266 }
249 }); 267 });
250 if (pickedFile != null) { 268 if (pickedFile != null) {
251 - if (title == '头像') {  
252 - _uploadImageProvider.imgSizeTouxiang = 64;  
253 - _uploadImageProvider.touxiang.qiniuUrl = null;  
254 - } else {  
255 - _uploadImageProvider.imgSizeErweima = 64;  
256 - _uploadImageProvider.erweima.qiniuUrl = null;  
257 - }  
258 - UploadImageUtil().startUploadOnly(context, File(pickedFile.path),  
259 - title == '头像' ? 0 : 1, true, _uploadImageProvider); 269 + _uploadImageProvider.imgSizeMenTou = 64;
  270 + _uploadImageProvider.mentou.qiniuUrl = null;
  271 + _uploadImageProvider.mentou.file = File(pickedFile.path);
  272 + _uploadImageProvider.mentou.path = pickedFile.path;
  273 + // UploadImageUtil().startUploadOnly(
  274 + // context, File(pickedFile.path), 2, true, _uploadImageProvider);
260 } 275 }
261 } 276 }
262 277
@@ -372,13 +387,13 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { @@ -372,13 +387,13 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
372 return InkWell( 387 return InkWell(
373 onTap: () { 388 onTap: () {
374 Utils.getPickPermission(context, () async { 389 Utils.getPickPermission(context, () async {
375 - Map address = await NavigatorUtil.goMapChoicePointPage(context);  
376 - if (address != null) { 390 + mapAddress = await NavigatorUtil.goMapChoicePointPage(context);
  391 + if (mapAddress != null) {
377 setState(() { 392 setState(() {
378 - storeAddress = address['address'];  
379 - // createStoreModel.storeInfo?.address = storeAddress;  
380 - // createStoreModel.storeInfo?.lat = address['lat'];  
381 - // createStoreModel.storeInfo?.lng = address['lng']; 393 + // storeMapAddress = address['address'];
  394 + // // createStoreModel.storeInfo?.address = storeAddress;
  395 + // // createStoreModel.storeInfo?.lat = address['lat'];
  396 + // // createStoreModel.storeInfo?.lng = address['lng'];
382 }); 397 });
383 } 398 }
384 }, Permission.location); 399 }, Permission.location);
@@ -397,15 +412,16 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { @@ -397,15 +412,16 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
397 fontSize: ScreenUtil().setSp(34)), 412 fontSize: ScreenUtil().setSp(34)),
398 ), 413 ),
399 ), 414 ),
400 - HEmptyView(20),  
401 - Spacer(),  
402 - Text(hintText,  
403 - style: TextStyle(  
404 - color: hintText == '点击选择'  
405 - ? MyColours.color_999999  
406 - : MyColours.color_333333,  
407 - fontSize: ScreenUtil().setSp(32),  
408 - )), 415 + HEmptyView(40),
  416 + Expanded(
  417 + child: Text(hintText,
  418 + textAlign: TextAlign.right,
  419 + style: TextStyle(
  420 + color: hintText == '点击选择'
  421 + ? MyColours.color_999999
  422 + : MyColours.color_333333,
  423 + fontSize: ScreenUtil().setSp(32),
  424 + ))),
409 HEmptyView(20), 425 HEmptyView(20),
410 Image.asset( 426 Image.asset(
411 Utils.getImgPath('arr_right_gray'), 427 Utils.getImgPath('arr_right_gray'),
@@ -422,7 +438,8 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { @@ -422,7 +438,8 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
422 Widget build(BuildContext context) { 438 Widget build(BuildContext context) {
423 _uploadImageProvider = 439 _uploadImageProvider =
424 Provider.of<UploadImageProvider>(context, listen: true); 440 Provider.of<UploadImageProvider>(context, listen: true);
425 - _baseIndoProvider = Provider.of<BaseIndoProvider>(context, listen: true); 441 + _baseIndoProvider =
  442 + Provider.of<StoreBaseIndoProvider>(context, listen: true);
426 return Scaffold( 443 return Scaffold(
427 backgroundColor: MyColours.color_fefefe, 444 backgroundColor: MyColours.color_fefefe,
428 appBar: SystemAppBar( 445 appBar: SystemAppBar(
@@ -504,7 +521,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { @@ -504,7 +521,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
504 horizontal: ScreenUtil().setWidth(40), 521 horizontal: ScreenUtil().setWidth(40),
505 vertical: ScreenUtil().setWidth(40), 522 vertical: ScreenUtil().setWidth(40),
506 ), 523 ),
507 - child: _select('地图地址', '点击选择')), 524 + child: _select('地图地址', mapAddress['address'])),
508 VEmptyView(10), 525 VEmptyView(10),
509 Container( 526 Container(
510 height: ScreenUtil().setWidth(2), 527 height: ScreenUtil().setWidth(2),
@@ -549,7 +566,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { @@ -549,7 +566,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
549 child: RoundButton( 566 child: RoundButton(
550 onPressed: () { 567 onPressed: () {
551 //接口 568 //接口
552 - _setStoreBaseinfo(); 569 + _setSellerInfoById();
553 }, 570 },
554 text: '保存', 571 text: '保存',
555 fontSize: 34, 572 fontSize: 34,
@@ -15,8 +15,14 @@ class PhotoPreview extends StatefulWidget { @@ -15,8 +15,14 @@ class PhotoPreview extends StatefulWidget {
15 final PageController pageController; 15 final PageController pageController;
16 final bool isShow; 16 final bool isShow;
17 final List dashName; 17 final List dashName;
18 -  
19 - PhotoPreview({this.initialIndex, this.photoList, this.isShow, this.dashName}) 18 + final bool needMask;
  19 +
  20 + PhotoPreview(
  21 + {this.initialIndex,
  22 + this.photoList,
  23 + this.isShow,
  24 + this.dashName,
  25 + this.needMask = true})
20 : pageController = PageController(initialPage: initialIndex); 26 : pageController = PageController(initialPage: initialIndex);
21 27
22 @override 28 @override
@@ -25,6 +31,7 @@ class PhotoPreview extends StatefulWidget { @@ -25,6 +31,7 @@ class PhotoPreview extends StatefulWidget {
25 31
26 class _PhotoPreviewState extends State<PhotoPreview> { 32 class _PhotoPreviewState extends State<PhotoPreview> {
27 int currentIndex; 33 int currentIndex;
  34 +
28 final _controller = new PageController(); 35 final _controller = new PageController();
29 36
30 static const _kDuration = const Duration(milliseconds: 300); 37 static const _kDuration = const Duration(milliseconds: 300);
@@ -38,10 +45,14 @@ class _PhotoPreviewState extends State<PhotoPreview> { @@ -38,10 +45,14 @@ class _PhotoPreviewState extends State<PhotoPreview> {
38 @override 45 @override
39 void initState() { 46 void initState() {
40 currentIndex = widget.initialIndex; 47 currentIndex = widget.initialIndex;
41 -  
42 - for (var item in widget.photoList) {  
43 - tempImgList.add('$item-zdmask'); 48 + if (widget.needMask) {
  49 + for (var item in widget.photoList) {
  50 + tempImgList.add('$item-zdmask');
  51 + }
  52 + } else {
  53 + tempImgList = widget.photoList;
44 } 54 }
  55 +
45 print(tempImgList); 56 print(tempImgList);
46 // tempImgList = widget.photoList; 57 // tempImgList = widget.photoList;
47 super.initState(); 58 super.initState();
  1 +import 'dart:convert';
  2 +import 'dart:io';
  3 +
  4 +import 'package:dio/dio.dart';
  5 +import 'package:dio/dio.dart';
  6 +import 'package:flutter/material.dart';
  7 +import 'package:one_key/constant/constant.dart';
  8 +import 'package:one_key/constant/error.dart';
  9 +import 'package:one_key/models/get_seller_info_model.dart';
  10 +import 'package:one_key/models/set_seller_info_model.dart';
  11 +import 'package:one_key/net/base_resp.dart';
  12 +import 'package:one_key/net/dio_util.dart';
  13 +import 'package:one_key/net/http_url.dart';
  14 +import 'package:one_key/provider/user_model.dart';
  15 +import 'package:one_key/utils/utils.dart';
  16 +import 'package:one_key/widgets/loading.dart';
  17 +import 'package:provider/provider.dart';
  18 +
  19 +class StoreBaseIndoProvider with ChangeNotifier {
  20 + GetSellerInfoSunModel itemModel;
  21 + String _statusKey = "status";
  22 +
  23 + /// BaseResp [int code]字段 key, 默认:errorCode.
  24 + String _codeKey = "errorCode";
  25 +
  26 + /// BaseResp [String msg]字段 key, 默认:errorMsg.
  27 + String _msgKey = "errorMsg";
  28 +
  29 + /// BaseResp [T data]字段 key, 默认:data.
  30 + String _dataKey = "data";
  31 +
  32 + ///根据商家ID获取商家信息
  33 + Future<GetSellerInfoSunModel> getSellerById(BuildContext context) async {
  34 + Map<String, String> params = {
  35 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  36 + };
  37 + BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
  38 + .request<Map<String, dynamic>>(
  39 + context, Method.get, HttpUrl.get_seller_info,
  40 + data: params)
  41 + .catchError((error) {
  42 + print(error.toString());
  43 + });
  44 +
  45 + if (baseResp == null) return itemModel;
  46 + if (baseResp.code == Constant.status_success) {
  47 + if (int.parse(baseResp.status) != Constant.status_success) {
  48 + Utils.showToast(baseResp.msg ?? "");
  49 + return itemModel;
  50 + }
  51 + if (baseResp.responseData['data'] != null) {
  52 + itemModel = GetSellerInfoModel.fromJson(baseResp.responseData).data;
  53 + print(itemModel);
  54 + } else {
  55 + Utils.showToast(baseResp.msg ?? "");
  56 + }
  57 + return itemModel;
  58 + }
  59 + }
  60 +
  61 + /// decode response data.
  62 + Map<String, dynamic> _decodeData(Response response) {
  63 + if (response == null ||
  64 + response.data == null ||
  65 + response.data.toString().isEmpty) {
  66 + return new Map();
  67 + }
  68 + return json.decode(response.data.toString());
  69 + }
  70 +
  71 + ///根据商家ID修改商家信息
  72 + Future<SetSellerInfoSunModel> setSellerInfoById(
  73 + BuildContext context, FormData params) async {
  74 + Loading.showLoading(context);
  75 + var dio = new Dio();
  76 + Response response = await dio.post(
  77 + "https://xt04.colorcun.com/?service=App.Seller.SetSellerById",
  78 + data: params);
  79 + print(response);
  80 +
  81 + Map _responseData;
  82 + if (response.statusCode == HttpStatus.ok ||
  83 + response.statusCode == HttpStatus.created) {
  84 + try {
  85 + if (response.data is Map) {
  86 + _responseData = response.data;
  87 + } else {
  88 + Map<String, dynamic> _dataMap = _decodeData(response);
  89 +
  90 + _responseData = _dataMap;
  91 + }
  92 +
  93 + Loading.hideLoading(context);
  94 + SetSellerInfoSunModel itemModel;
  95 +
  96 + if (_responseData['ret'] == Constant.status_success) {
  97 + if (_responseData['data'] != null) {
  98 + itemModel = SetSellerInfoModel.fromJson(_responseData).data;
  99 + } else {
  100 + Utils.showToast(_responseData['msg'] ?? "");
  101 + }
  102 + return itemModel;
  103 + }
  104 + } catch (e) {
  105 + Loading.hideLoading(context);
  106 + return new Future.error(new DioError(
  107 + // requestOptions: response.requestOptions,
  108 + response: response,
  109 + error: "data parsing exception...",
  110 + type: DioErrorType.RESPONSE,
  111 + ));
  112 + }
  113 + }
  114 + }
  115 +}
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/models/seller_table_class_entity.dart'; 3 import 'package:one_key/models/seller_table_class_entity.dart';
  4 +import 'package:one_key/models/table_class_model.dart';
4 import 'package:one_key/models/table_fill_up_date_model.dart'; 5 import 'package:one_key/models/table_fill_up_date_model.dart';
5 import 'package:one_key/net/base_resp.dart'; 6 import 'package:one_key/net/base_resp.dart';
6 import 'package:one_key/net/dio_util.dart'; 7 import 'package:one_key/net/dio_util.dart';
@@ -12,6 +13,44 @@ import 'package:one_key/utils/utils.dart'; @@ -12,6 +13,44 @@ import 'package:one_key/utils/utils.dart';
12 */ 13 */
13 class StoreDetailModel with ChangeNotifier { 14 class StoreDetailModel with ChangeNotifier {
14 List<SellerTableClassEntity> tables = []; //商家包间类型 15 List<SellerTableClassEntity> tables = []; //商家包间类型
  16 + TableClassSunModel tableClassSunModel;
  17 +
  18 + ///添加/修改包间分类
  19 + Future<bool> setTableClass(BuildContext context, Map<String, String> params,
  20 + {bool showLoading = false}) async {
  21 + BaseResp<dynamic> baseResp = await DioUtil()
  22 + .request<dynamic>(context, Method.get, HttpUrl.set_table_class,
  23 + data: params, showLoading: showLoading)
  24 + .catchError((error) {
  25 + print(error.toString());
  26 + });
  27 + if (baseResp != null && baseResp.code == Constant.status_success) {
  28 + if (baseResp.data != null) {
  29 + return true;
  30 + }
  31 + } else {
  32 + Utils.showToast(baseResp.msg ?? "");
  33 + }
  34 + return false;
  35 + }
  36 +
  37 + //获取包间分类
  38 + Future<TableClassSunModel> getTableClassById(
  39 + BuildContext context, Map<String, String> params) async {
  40 + BaseResp<dynamic> baseResp = await DioUtil()
  41 + .request<dynamic>(context, Method.get, HttpUrl.get_table_class_by_id,
  42 + data: params, showLoading: false)
  43 + .catchError((error) {
  44 + print(error.toString());
  45 + });
  46 + if (baseResp != null && baseResp.code == Constant.status_success) {
  47 + tableClassSunModel = TableClassModel.fromJson(baseResp.responseData).data;
  48 + } else {
  49 + Utils.showToast(baseResp.msg ?? "");
  50 + }
  51 + notifyListeners();
  52 + return tableClassSunModel;
  53 + }
15 54
16 //获取商家包间类型 55 //获取商家包间类型
17 Future<List<SellerTableClassEntity>> getSellerTableClass( 56 Future<List<SellerTableClassEntity>> getSellerTableClass(
@@ -375,8 +375,12 @@ class NavigatorUtil { @@ -375,8 +375,12 @@ class NavigatorUtil {
375 375
376 /// 包间类型创建 376 /// 包间类型创建
377 static Future<dynamic> goRoomTypeCreatePage(BuildContext context, 377 static Future<dynamic> goRoomTypeCreatePage(BuildContext context,
378 - {replace = false, SmsInfoData smsInfoData}) {  
379 - return _navigateTo(context, "${Routes.room_type_create_page}", 378 + {replace = false,
  379 + SmsInfoData smsInfoData,
  380 + bool isNew = true,
  381 + String tableClassId}) {
  382 + return _navigateTo(
  383 + context, "${Routes.room_type_create_page}?isnew=${isNew}&tableClassId=${tableClassId}",
380 replace: replace); 384 replace: replace);
381 } 385 }
382 386
@@ -384,12 +388,12 @@ class NavigatorUtil { @@ -384,12 +388,12 @@ class NavigatorUtil {
384 static Future goRoomTypeSelectTablePage( 388 static Future goRoomTypeSelectTablePage(
385 BuildContext context, String rid, int dateTime, String ddate_slot, 389 BuildContext context, String rid, int dateTime, String ddate_slot,
386 {bool canChoose = false, 390 {bool canChoose = false,
387 - Map object, 391 + String object,
388 String fromPage = 'change', 392 String fromPage = 'change',
389 String tid = ''}) { 393 String tid = ''}) {
390 if (object != null) { 394 if (object != null) {
391 return _navigateTo(context, 395 return _navigateTo(context,
392 - "${Routes.room_type_select_table_page}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}"); 396 + "${Routes.room_type_select_table_page}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${object}");
393 } 397 }
394 // object = {'object': [], "tid": ''}; 398 // object = {'object': [], "tid": ''};
395 return _navigateTo(context, 399 return _navigateTo(context,
@@ -69,10 +69,12 @@ import 'package:one_key/provider/other_login_provider.dart'; @@ -69,10 +69,12 @@ import 'package:one_key/provider/other_login_provider.dart';
69 import 'package:one_key/provider/remark_manager_model.dart'; 69 import 'package:one_key/provider/remark_manager_model.dart';
70 import 'package:one_key/provider/sms_recharge_provider.dart'; 70 import 'package:one_key/provider/sms_recharge_provider.dart';
71 import 'package:one_key/provider/statistics_provider.dart'; 71 import 'package:one_key/provider/statistics_provider.dart';
  72 +import 'package:one_key/provider/store_base_info_provider.dart';
72 import 'package:one_key/provider/store_detail_model.dart'; 73 import 'package:one_key/provider/store_detail_model.dart';
73 import 'package:one_key/provider/table_photo_manager_provider.dart'; 74 import 'package:one_key/provider/table_photo_manager_provider.dart';
74 import 'package:one_key/provider/upload_img_provider.dart'; 75 import 'package:one_key/provider/upload_img_provider.dart';
75 import 'package:one_key/utils/fluro_convert_utils.dart'; 76 import 'package:one_key/utils/fluro_convert_utils.dart';
  77 +import 'package:one_key/utils/utils.dart';
76 import 'package:provider/provider.dart'; 78 import 'package:provider/provider.dart';
77 79
78 // 登录页 80 // 登录页
@@ -560,8 +562,8 @@ var storeBaseInfoPageHandler = new Handler( @@ -560,8 +562,8 @@ var storeBaseInfoPageHandler = new Handler(
560 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { 562 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
561 // SmsInfoData data = SmsInfoData.fromJson(json.decode( 563 // SmsInfoData data = SmsInfoData.fromJson(json.decode(
562 // FluroConvertUtils.fluroCnParamsDecode(params["smsInfoData"].first))); 564 // FluroConvertUtils.fluroCnParamsDecode(params["smsInfoData"].first)));
563 - return ChangeNotifierProvider<BaseIndoProvider>(  
564 - create: (_) => BaseIndoProvider(), child: StoreBaseInfoPage()); 565 + return ChangeNotifierProvider<StoreBaseIndoProvider>(
  566 + create: (_) => StoreBaseIndoProvider(), child: StoreBaseInfoPage());
565 // return ChangeNotifierProvider<UploadImageProvider>( 567 // return ChangeNotifierProvider<UploadImageProvider>(
566 // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage()); 568 // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage());
567 }); 569 });
@@ -582,8 +584,11 @@ var roomTypeCreatePageHandler = new Handler( @@ -582,8 +584,11 @@ var roomTypeCreatePageHandler = new Handler(
582 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { 584 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
583 // SmsInfoData data = SmsInfoData.fromJson(json.decode( 585 // SmsInfoData data = SmsInfoData.fromJson(json.decode(
584 // FluroConvertUtils.fluroCnParamsDecode(params["smsInfoData"].first))); 586 // FluroConvertUtils.fluroCnParamsDecode(params["smsInfoData"].first)));
  587 + bool isnew = FluroConvertUtils.string2bool(params["isnew"].first);
  588 + String tableClassId = params["tableClassId"].first;
585 return ChangeNotifierProvider<StoreDetailModel>( 589 return ChangeNotifierProvider<StoreDetailModel>(
586 - create: (_) => StoreDetailModel(), child: RoomTypeCreatePage()); 590 + create: (_) => StoreDetailModel(),
  591 + child: RoomTypeCreatePage(isNew: isnew, tableClassId: tableClassId));
587 // return ChangeNotifierProvider<UploadImageProvider>( 592 // return ChangeNotifierProvider<UploadImageProvider>(
588 // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage()); 593 // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage());
589 }); 594 });
@@ -598,19 +603,15 @@ var roomTypeSelectTablePageHandler = new Handler( @@ -598,19 +603,15 @@ var roomTypeSelectTablePageHandler = new Handler(
598 String ddate_slot = params["ddate_slot"].first; 603 String ddate_slot = params["ddate_slot"].first;
599 String fromPage = params["fromPage"].first; 604 String fromPage = params["fromPage"].first;
600 bool canChoose = params["canChoose"].first == "true" ? true : false; 605 bool canChoose = params["canChoose"].first == "true" ? true : false;
601 - List<TableList> res = [];  
602 - if (params.keys.contains('object')) {  
603 - Map object = FluroConvertUtils.string2map(params["object"].first);  
604 - List temp = object['object'];  
605 -  
606 - for (var item in temp) {  
607 - res.add(TableList.fromJson(item));  
608 - }  
609 - } 606 + String temp = params["object"].first;
  607 + List<String> tidSelList = temp.length > 0 ? temp.split(',') : [];
610 608
611 // return SelectTablePage(rid, dateTime, ddate_slot,canChoose: canChoose); 609 // return SelectTablePage(rid, dateTime, ddate_slot,canChoose: canChoose);
612 return ChangeNotifierProvider<ChooseTableModel>( 610 return ChangeNotifierProvider<ChooseTableModel>(
613 create: (_) => ChooseTableModel(), 611 create: (_) => ChooseTableModel(),
614 child: RoomTypeSelectTablePage(rid, dateTime, ddate_slot, 612 child: RoomTypeSelectTablePage(rid, dateTime, ddate_slot,
615 - canChoose: canChoose, tableList: res, fromPage: fromPage, tid: tid)); 613 + canChoose: canChoose,
  614 + tableList: tidSelList,
  615 + fromPage: fromPage,
  616 + tid: tid));
616 }); 617 });
@@ -178,8 +178,13 @@ class UploadImageUtil { @@ -178,8 +178,13 @@ class UploadImageUtil {
178 putController.addProgressListener((percent) { 178 putController.addProgressListener((percent) {
179 print('${index}任务进度变化:进度:${percent.toStringAsFixed(4)}'); 179 print('${index}任务进度变化:进度:${percent.toStringAsFixed(4)}');
180 if (index == 0) { 180 if (index == 0) {
  181 + //0 头像
181 uploadImageProvider.touxiang.process = percent; 182 uploadImageProvider.touxiang.process = percent;
  183 + } else if (index == 2) {
  184 + //2 门头
  185 + uploadImageProvider.mentou.process = percent;
182 } else { 186 } else {
  187 + //1 二维码
183 uploadImageProvider.erweima.process = percent; 188 uploadImageProvider.erweima.process = percent;
184 } 189 }
185 uploadImageProvider.notifyListeners(); 190 uploadImageProvider.notifyListeners();
@@ -227,6 +232,11 @@ class UploadImageUtil { @@ -227,6 +232,11 @@ class UploadImageUtil {
227 uploadImageProvider.erweima.qiniuUrl = imgUrl; 232 uploadImageProvider.erweima.qiniuUrl = imgUrl;
228 uploadImageProvider.erweima.file = null; 233 uploadImageProvider.erweima.file = null;
229 uploadImageProvider.notifyListeners(); 234 uploadImageProvider.notifyListeners();
  235 + }else if (index == 2) {
  236 + uploadImageProvider.mentou.process = 1;
  237 + uploadImageProvider.mentou.qiniuUrl = imgUrl;
  238 + uploadImageProvider.mentou.file = null;
  239 + uploadImageProvider.notifyListeners();
230 } 240 }
231 }) 241 })
232 ..catchError((dynamic error) { 242 ..catchError((dynamic error) {
@@ -81,7 +81,8 @@ class TableItemState extends State<TableItem> { @@ -81,7 +81,8 @@ class TableItemState extends State<TableItem> {
81 table.selected = !(table.selected ?? false); 81 table.selected = !(table.selected ?? false);
82 }); 82 });
83 widget.onSelected(table); 83 widget.onSelected(table);
84 - } else if (widget.fromPage == 'table_manage') { 84 + } else if (widget.fromPage == 'table_manage' ||
  85 + widget.fromPage == 'room_manage') {
85 table.selected = !(table.selected ?? false); 86 table.selected = !(table.selected ?? false);
86 widget.onSelected(table); 87 widget.onSelected(table);
87 } else if (widget.fromPage == 'tablePhoto') { 88 } else if (widget.fromPage == 'tablePhoto') {
@@ -99,7 +100,7 @@ class TableItemState extends State<TableItem> { @@ -99,7 +100,7 @@ class TableItemState extends State<TableItem> {
99 height: ScreenUtil().setWidth(widget.height), 100 height: ScreenUtil().setWidth(widget.height),
100 margin: EdgeInsets.all(ScreenUtil().setWidth(9)), 101 margin: EdgeInsets.all(ScreenUtil().setWidth(9)),
101 decoration: BoxDecoration( 102 decoration: BoxDecoration(
102 - color: table.enable == '0' 103 + color: widget.need && table.enable == '0'
103 ? MyColours.color_E0E0E0 104 ? MyColours.color_E0E0E0
104 : MyColours.color_A9E3E6, 105 : MyColours.color_A9E3E6,
105 borderRadius: BorderRadius.all( 106 borderRadius: BorderRadius.all(
@@ -153,7 +154,7 @@ class TableItemState extends State<TableItem> { @@ -153,7 +154,7 @@ class TableItemState extends State<TableItem> {
153 table.name, 154 table.name,
154 maxLines: 2, 155 maxLines: 2,
155 style: TextStyle( 156 style: TextStyle(
156 - color: table.enable == '0' 157 + color: widget.need && table.enable == '0'
157 ? MyColours.color_999999 158 ? MyColours.color_999999
158 : MyColours.color_353535, 159 : MyColours.color_353535,
159 fontSize: ScreenUtil().setSp(28), 160 fontSize: ScreenUtil().setSp(28),
@@ -187,12 +188,12 @@ class TableItemState extends State<TableItem> { @@ -187,12 +188,12 @@ class TableItemState extends State<TableItem> {
187 ? table.tableNum 188 ? table.tableNum
188 : table.reserver, 189 : table.reserver,
189 style: TextStyle( 190 style: TextStyle(
190 - color: signStr == '已停用'  
191 - ? MyColours.color_999999  
192 - : (table.reserver == null ||  
193 - table.reserver.isEmpty)  
194 - ? MyColours.color_353535  
195 - : MyColours.color_2bb5b7, 191 + color: signStr == '已停用'
  192 + ? MyColours.color_999999
  193 + : (table.reserver == null ||
  194 + table.reserver.isEmpty)
  195 + ? MyColours.color_353535
  196 + : MyColours.color_2bb5b7,
196 fontSize: ScreenUtil().setSp(26), 197 fontSize: ScreenUtil().setSp(26),
197 decoration: TextDecoration.none, 198 decoration: TextDecoration.none,
198 fontWeight: FontWeight.normal), 199 fontWeight: FontWeight.normal),