Commit 8ee29d21c5ee19ae999555c8fcb47c25cad1e671
1 parent
180f64ff
预订使用最新接口可预订时段,默认8:00,12:00,18:00改为当前时段第一个时间
Showing
10 changed files
with
249 additions
and
37 deletions
| @@ -229,8 +229,8 @@ class MyAppState extends State<MyApp> { | @@ -229,8 +229,8 @@ class MyAppState extends State<MyApp> { | ||
| 229 | 229 | ||
| 230 | //判断是否登录 | 230 | //判断是否登录 |
| 231 | _isLogin() { | 231 | _isLogin() { |
| 232 | - UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 233 | - userModel.initUser(); | 232 | + // UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 233 | + // userModel.initUser(); | ||
| 234 | isLogin = App.sp.getBool("isLogin") ?? false; | 234 | isLogin = App.sp.getBool("isLogin") ?? false; |
| 235 | } | 235 | } |
| 236 | 236 |
| 1 | import 'package:json_annotation/json_annotation.dart'; | 1 | import 'package:json_annotation/json_annotation.dart'; |
| 2 | +import 'dart:convert' as convert; | ||
| 2 | 3 | ||
| 3 | part 'get_seller_info_model.g.dart'; | 4 | part 'get_seller_info_model.g.dart'; |
| 4 | 5 | ||
| @@ -165,6 +166,9 @@ class Data extends Object { | @@ -165,6 +166,9 @@ class Data extends Object { | ||
| 165 | @JsonKey(name: 'edate') | 166 | @JsonKey(name: 'edate') |
| 166 | String edate; | 167 | String edate; |
| 167 | 168 | ||
| 169 | + @JsonKey(name: 'daily') | ||
| 170 | + Daily dailyShow; | ||
| 171 | + | ||
| 168 | Data( | 172 | Data( |
| 169 | this.id, | 173 | this.id, |
| 170 | this.pid, | 174 | this.pid, |
| @@ -206,7 +210,8 @@ class Data extends Object { | @@ -206,7 +210,8 @@ class Data extends Object { | ||
| 206 | this.disCode, | 210 | this.disCode, |
| 207 | this.sellerCode, | 211 | this.sellerCode, |
| 208 | this.realAddress, | 212 | this.realAddress, |
| 209 | - this.edate | 213 | + this.edate, |
| 214 | + this.dailyShow | ||
| 210 | ); | 215 | ); |
| 211 | 216 | ||
| 212 | factory Data.fromJson(Map<String, dynamic> srcJson) => | 217 | factory Data.fromJson(Map<String, dynamic> srcJson) => |
| @@ -214,3 +219,34 @@ class Data extends Object { | @@ -214,3 +219,34 @@ class Data extends Object { | ||
| 214 | 219 | ||
| 215 | Map<String, dynamic> toJson() => _$DataToJson(this); | 220 | Map<String, dynamic> toJson() => _$DataToJson(this); |
| 216 | } | 221 | } |
| 222 | + | ||
| 223 | +@JsonSerializable() | ||
| 224 | +class Daily extends Object { | ||
| 225 | + @JsonKey(name: 'morning') | ||
| 226 | + String morning; | ||
| 227 | + | ||
| 228 | + @JsonKey(name: 'noon') | ||
| 229 | + String noon; | ||
| 230 | + | ||
| 231 | + @JsonKey(name: 'night') | ||
| 232 | + String night; | ||
| 233 | + | ||
| 234 | + Daily( | ||
| 235 | + this.morning, | ||
| 236 | + this.noon, | ||
| 237 | + this.night, | ||
| 238 | + ); | ||
| 239 | + | ||
| 240 | + factory Daily.fromJson(Map<String, dynamic> srcJson) => | ||
| 241 | + _$DailyFromJson(srcJson); | ||
| 242 | + | ||
| 243 | + Map<String, dynamic> toJson() => _$DailyToJson(this); | ||
| 244 | + | ||
| 245 | + @override | ||
| 246 | + String toString() { | ||
| 247 | + return 'Daily{morning: $morning, noon: $noon, night: $night}'; | ||
| 248 | + } | ||
| 249 | + | ||
| 250 | + | ||
| 251 | +} | ||
| 252 | + |
| @@ -77,6 +77,10 @@ Data _$DataFromJson(Map<String, dynamic> json) { | @@ -77,6 +77,10 @@ Data _$DataFromJson(Map<String, dynamic> json) { | ||
| 77 | json['seller_code'] as String, | 77 | json['seller_code'] as String, |
| 78 | json['real_address'] as String, | 78 | json['real_address'] as String, |
| 79 | json['edate'] as String, | 79 | json['edate'] as String, |
| 80 | + json['daily'] == null | ||
| 81 | + ? null | ||
| 82 | + : Daily.fromJson( | ||
| 83 | + convert.jsonDecode(json['daily']) as Map<String, dynamic>), | ||
| 80 | ); | 84 | ); |
| 81 | } | 85 | } |
| 82 | 86 | ||
| @@ -121,5 +125,15 @@ Map<String, dynamic> _$DataToJson(Data instance) => <String, dynamic>{ | @@ -121,5 +125,15 @@ Map<String, dynamic> _$DataToJson(Data instance) => <String, dynamic>{ | ||
| 121 | 'dis_code': instance.disCode, | 125 | 'dis_code': instance.disCode, |
| 122 | 'seller_code': instance.sellerCode, | 126 | 'seller_code': instance.sellerCode, |
| 123 | 'real_address': instance.realAddress, | 127 | 'real_address': instance.realAddress, |
| 124 | - 'edate': instance.edate | 128 | + 'edate': instance.edate, |
| 129 | + }; | ||
| 130 | +Daily _$DailyFromJson(Map<String, dynamic> json) { | ||
| 131 | + return Daily(json['morning'] as String, json['noon'] as String, | ||
| 132 | + json['night'] as String); | ||
| 133 | +} | ||
| 134 | + | ||
| 135 | +Map<String, dynamic> _$DailyToJson(Daily instance) => <String, dynamic>{ | ||
| 136 | + 'morning': instance.morning, | ||
| 137 | + 'noon': instance.noon, | ||
| 138 | + 'night': instance.night | ||
| 125 | }; | 139 | }; |
| @@ -255,19 +255,44 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -255,19 +255,44 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 255 | tempSelect = true; | 255 | tempSelect = true; |
| 256 | } | 256 | } |
| 257 | } else { | 257 | } else { |
| 258 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 259 | + String beginDate = ''; | ||
| 258 | if (mnd == 1) { | 260 | if (mnd == 1) { |
| 259 | - if (temp == '08:00') { | ||
| 260 | - tempSelect = true; | 261 | + beginDate = '08:00'; |
| 262 | + if (userModel.user.morning != '' && userModel.user.morning != null) { | ||
| 263 | + List tempDate = userModel.user.morning.split("-"); | ||
| 264 | + beginDate = tempDate[0]; | ||
| 261 | } | 265 | } |
| 262 | } else if (mnd == 2) { | 266 | } else if (mnd == 2) { |
| 263 | - if (temp == '12:00') { | ||
| 264 | - tempSelect = true; | 267 | + beginDate = '12:00'; |
| 268 | + if (userModel.user.noon != '' && userModel.user.noon != null) { | ||
| 269 | + List tempDate = userModel.user.noon.split("-"); | ||
| 270 | + beginDate = tempDate[0]; | ||
| 265 | } | 271 | } |
| 266 | } else if (mnd == 3) { | 272 | } else if (mnd == 3) { |
| 267 | - if (temp == '18:00') { | ||
| 268 | - tempSelect = true; | 273 | + beginDate = '18:00'; |
| 274 | + if (userModel.user.night != '' && userModel.user.night != null) { | ||
| 275 | + List tempDate = userModel.user.night.split("-"); | ||
| 276 | + beginDate = tempDate[0]; | ||
| 269 | } | 277 | } |
| 270 | } | 278 | } |
| 279 | + if (temp == beginDate) { | ||
| 280 | + tempSelect = true; | ||
| 281 | + } | ||
| 282 | + | ||
| 283 | + // if (mnd == 1) { | ||
| 284 | + // if (temp == '08:00') { | ||
| 285 | + // tempSelect = true; | ||
| 286 | + // } | ||
| 287 | + // } else if (mnd == 2) { | ||
| 288 | + // if (temp == '12:00') { | ||
| 289 | + // tempSelect = true; | ||
| 290 | + // } | ||
| 291 | + // } else if (mnd == 3) { | ||
| 292 | + // if (temp == '18:00') { | ||
| 293 | + // tempSelect = true; | ||
| 294 | + // } | ||
| 295 | + // } | ||
| 271 | } | 296 | } |
| 272 | Map tempMap = {'title': temp, 'select': tempSelect}; | 297 | Map tempMap = {'title': temp, 'select': tempSelect}; |
| 273 | res.add(tempMap); | 298 | res.add(tempMap); |
| @@ -1416,7 +1441,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -1416,7 +1441,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 1416 | content: ddateHm, | 1441 | content: ddateHm, |
| 1417 | list: personNumList, | 1442 | list: personNumList, |
| 1418 | detailModel: model, | 1443 | detailModel: model, |
| 1419 | - uid:widget.uid, | 1444 | + uid: widget.uid, |
| 1420 | callback: () { | 1445 | callback: () { |
| 1421 | //时间弹窗 | 1446 | //时间弹窗 |
| 1422 | FocusScope.of(context) | 1447 | FocusScope.of(context) |
| @@ -1490,7 +1515,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -1490,7 +1515,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 1490 | isPrice: false, | 1515 | isPrice: false, |
| 1491 | controller: pnumC, | 1516 | controller: pnumC, |
| 1492 | focusNode: pnumF, | 1517 | focusNode: pnumF, |
| 1493 | - uid:widget.uid, | 1518 | + uid: widget.uid, |
| 1494 | callback: () async { | 1519 | callback: () async { |
| 1495 | bool sucess = | 1520 | bool sucess = |
| 1496 | await detailModel | 1521 | await detailModel |
| @@ -1565,7 +1590,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -1565,7 +1590,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 1565 | detailModel: detailModel, | 1590 | detailModel: detailModel, |
| 1566 | rid: widget.rid, | 1591 | rid: widget.rid, |
| 1567 | isPrice: true, | 1592 | isPrice: true, |
| 1568 | - uid:widget.uid, | 1593 | + uid: widget.uid, |
| 1569 | controller: | 1594 | controller: |
| 1570 | detailModel.numController, | 1595 | detailModel.numController, |
| 1571 | focusNode: priceF, | 1596 | focusNode: priceF, |
| @@ -44,6 +44,7 @@ import '../../models/customer_by_seller_model.dart'; | @@ -44,6 +44,7 @@ import '../../models/customer_by_seller_model.dart'; | ||
| 44 | import '../../app.dart'; | 44 | import '../../app.dart'; |
| 45 | 45 | ||
| 46 | import '../../models/get_seller_info_model.dart'; | 46 | import '../../models/get_seller_info_model.dart'; |
| 47 | +import '../../models/user.dart'; | ||
| 47 | import '../../provider/feast_model.dart'; | 48 | import '../../provider/feast_model.dart'; |
| 48 | import '../../provider/remark_manager_model.dart'; | 49 | import '../../provider/remark_manager_model.dart'; |
| 49 | import '../../provider/store_base_info_provider.dart'; | 50 | import '../../provider/store_base_info_provider.dart'; |
| @@ -169,7 +170,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -169,7 +170,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 169 | create: (_) => TableManagerModel(), | 170 | create: (_) => TableManagerModel(), |
| 170 | child: ChangeNotifierProvider<RemarkManagerModel>( | 171 | child: ChangeNotifierProvider<RemarkManagerModel>( |
| 171 | create: (_) => RemarkManagerModel(), | 172 | create: (_) => RemarkManagerModel(), |
| 172 | - child: TableManagerPage())), | 173 | + child: ChangeNotifierProvider<StoreBaseIndoProvider>( |
| 174 | + create: (_) => StoreBaseIndoProvider(), | ||
| 175 | + child: TableManagerPage()))), | ||
| 173 | ))) | 176 | ))) |
| 174 | ..add( | 177 | ..add( |
| 175 | ChangeNotifierProvider<FeastModel>( | 178 | ChangeNotifierProvider<FeastModel>( |
| @@ -307,6 +310,19 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -307,6 +310,19 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 307 | _edateShow(); | 310 | _edateShow(); |
| 308 | }); | 311 | }); |
| 309 | } | 312 | } |
| 313 | + | ||
| 314 | + if (App.sp.containsKey('user')) { | ||
| 315 | + String s = App.sp.getString('user'); | ||
| 316 | + User _user = User.fromJson(json.decode(s)); | ||
| 317 | + _user.sellerimage = sellerInfoSunModel.data.sellerImage; | ||
| 318 | + _user.sellerphone = sellerInfoSunModel.data.sellerTel; | ||
| 319 | + _user.sellername = sellerInfoSunModel.data.sellername; | ||
| 320 | + _user.morning = sellerInfoSunModel.data.dailyShow.morning; | ||
| 321 | + _user.noon = sellerInfoSunModel.data.dailyShow.noon; | ||
| 322 | + _user.night = sellerInfoSunModel.data.dailyShow.night; | ||
| 323 | + _user.sellerAddr = sellerInfoSunModel.data.realAddress; | ||
| 324 | + await UserModel().saveUserInfo(_user); | ||
| 325 | + } | ||
| 310 | } | 326 | } |
| 311 | } | 327 | } |
| 312 | 328 |
| @@ -136,8 +136,8 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver { | @@ -136,8 +136,8 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver { | ||
| 136 | 136 | ||
| 137 | //判断是否登录 | 137 | //判断是否登录 |
| 138 | void isLogin() async { | 138 | void isLogin() async { |
| 139 | - UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 140 | - userModel.initUser(); | 139 | + // UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 140 | + // userModel.initUser(); | ||
| 141 | if (App.sp.getBool("isLogin") ?? false) { | 141 | if (App.sp.getBool("isLogin") ?? false) { |
| 142 | Future.delayed(Duration(milliseconds: 200), () { | 142 | Future.delayed(Duration(milliseconds: 200), () { |
| 143 | NavigatorUtil.goHomePage(context); | 143 | NavigatorUtil.goHomePage(context); |
| 1 | import 'dart:async'; | 1 | import 'dart:async'; |
| 2 | +import 'dart:convert'; | ||
| 2 | 3 | ||
| 3 | import 'package:common_utils/common_utils.dart'; | 4 | import 'package:common_utils/common_utils.dart'; |
| 4 | import 'package:dotted_border/dotted_border.dart'; | 5 | import 'package:dotted_border/dotted_border.dart'; |
| @@ -46,8 +47,11 @@ import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; | @@ -46,8 +47,11 @@ import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; | ||
| 46 | import 'package:one_key/models/table_list.dart' as table; | 47 | import 'package:one_key/models/table_list.dart' as table; |
| 47 | 48 | ||
| 48 | import '../../app.dart'; | 49 | import '../../app.dart'; |
| 50 | +import '../../models/get_seller_info_model.dart'; | ||
| 49 | import '../../models/remark.dart'; | 51 | import '../../models/remark.dart'; |
| 52 | +import '../../models/user.dart'; | ||
| 50 | import '../../provider/remark_manager_model.dart'; | 53 | import '../../provider/remark_manager_model.dart'; |
| 54 | +import '../../provider/store_base_info_provider.dart'; | ||
| 51 | import '../../utils/screen_util.dart'; | 55 | import '../../utils/screen_util.dart'; |
| 52 | import '../../widgets/loading.dart'; | 56 | import '../../widgets/loading.dart'; |
| 53 | import '../../widgets/special_text/my_extended_text_selection_controls.dart'; | 57 | import '../../widgets/special_text/my_extended_text_selection_controls.dart'; |
| @@ -156,8 +160,8 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -156,8 +160,8 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 156 | affinity: TextAffinity.downstream, | 160 | affinity: TextAffinity.downstream, |
| 157 | offset: value.toString().length))); | 161 | offset: value.toString().length))); |
| 158 | }); | 162 | }); |
| 163 | + _getSellerById(); | ||
| 159 | 164 | ||
| 160 | - tableManagerModel.initTime(context); | ||
| 161 | _couponNetworkData(selfDismiss: true); | 165 | _couponNetworkData(selfDismiss: true); |
| 162 | _getSmsInfo(context); | 166 | _getSmsInfo(context); |
| 163 | _getRemark(); | 167 | _getRemark(); |
| @@ -188,6 +192,29 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -188,6 +192,29 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 188 | EventBus().off("refresh_table_m_coupon"); | 192 | EventBus().off("refresh_table_m_coupon"); |
| 189 | } | 193 | } |
| 190 | 194 | ||
| 195 | + ///获取店铺基础信息 | ||
| 196 | + _getSellerById() async { | ||
| 197 | + StoreBaseIndoProvider storeBaseIndoProvider = | ||
| 198 | + Provider.of<StoreBaseIndoProvider>(context, listen: false); | ||
| 199 | + GetSellerInfoSunModel sellerInfoSunModel = | ||
| 200 | + await storeBaseIndoProvider.getSellerById(context); | ||
| 201 | + if (sellerInfoSunModel != null) { | ||
| 202 | + if (App.sp.containsKey('user')) { | ||
| 203 | + String s = App.sp.getString('user'); | ||
| 204 | + User _user = User.fromJson(json.decode(s)); | ||
| 205 | + _user.sellerimage = sellerInfoSunModel.data.sellerImage; | ||
| 206 | + _user.sellerphone = sellerInfoSunModel.data.sellerTel; | ||
| 207 | + _user.sellername = sellerInfoSunModel.data.sellername; | ||
| 208 | + _user.morning = sellerInfoSunModel.data.dailyShow.morning; | ||
| 209 | + _user.noon = sellerInfoSunModel.data.dailyShow.noon; | ||
| 210 | + _user.night = sellerInfoSunModel.data.dailyShow.night; | ||
| 211 | + _user.sellerAddr = sellerInfoSunModel.data.realAddress; | ||
| 212 | + await UserModel().saveUserInfo(_user); | ||
| 213 | + } | ||
| 214 | + } | ||
| 215 | + tableManagerModel.initTime(context); | ||
| 216 | + } | ||
| 217 | + | ||
| 191 | ///获取备注信息 | 218 | ///获取备注信息 |
| 192 | _getRemark() async { | 219 | _getRemark() async { |
| 193 | Map<String, String> params = { | 220 | Map<String, String> params = { |
| @@ -198,22 +198,22 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -198,22 +198,22 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 198 | night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night; | 198 | night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night; |
| 199 | userModel.user.morning == '' | 199 | userModel.user.morning == '' |
| 200 | ? dailyMap.putIfAbsent('morning', () => '') | 200 | ? dailyMap.putIfAbsent('morning', () => '') |
| 201 | - : dailyMap.putIfAbsent( | ||
| 202 | - 'morning', () => _getHourAndMinute(userModel.user.morning, 1)); | 201 | + : dailyMap.putIfAbsent('morning', |
| 202 | + () => _getHourAndMinute(context, userModel.user.morning, 1)); | ||
| 203 | userModel.user.noon == '' | 203 | userModel.user.noon == '' |
| 204 | ? dailyMap.putIfAbsent('noon', () => '') | 204 | ? dailyMap.putIfAbsent('noon', () => '') |
| 205 | : dailyMap.putIfAbsent( | 205 | : dailyMap.putIfAbsent( |
| 206 | - 'noon', () => _getHourAndMinute(userModel.user.noon, 2)); | 206 | + 'noon', () => _getHourAndMinute(context, userModel.user.noon, 2)); |
| 207 | userModel.user.night == '' | 207 | userModel.user.night == '' |
| 208 | ? dailyMap.putIfAbsent('night', () => '') | 208 | ? dailyMap.putIfAbsent('night', () => '') |
| 209 | : dailyMap.putIfAbsent( | 209 | : dailyMap.putIfAbsent( |
| 210 | - 'night', () => _getHourAndMinute(userModel.user.night, 3)); | 210 | + 'night', () => _getHourAndMinute(context, userModel.user.night, 3)); |
| 211 | // _initSunDateList( | 211 | // _initSunDateList( |
| 212 | // userModel.user.morning, userModel.user.noon, userModel.user.night); | 212 | // userModel.user.morning, userModel.user.noon, userModel.user.night); |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | //根据获取时间 11:00-12:30 获取30分钟间隔组装的数组 | 215 | //根据获取时间 11:00-12:30 获取30分钟间隔组装的数组 |
| 216 | - _getHourAndMinute(String hourAndMinuteStr, int mnd) { | 216 | + _getHourAndMinute(BuildContext context, String hourAndMinuteStr, int mnd) { |
| 217 | List tempDate = hourAndMinuteStr.split("-"); | 217 | List tempDate = hourAndMinuteStr.split("-"); |
| 218 | String beginDate = tempDate[0]; | 218 | String beginDate = tempDate[0]; |
| 219 | String endDate = tempDate[1]; | 219 | String endDate = tempDate[1]; |
| @@ -261,19 +261,43 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -261,19 +261,43 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 261 | tempSelect = true; | 261 | tempSelect = true; |
| 262 | } | 262 | } |
| 263 | } else { | 263 | } else { |
| 264 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 265 | + String beginDate = ''; | ||
| 264 | if (mnd == 1) { | 266 | if (mnd == 1) { |
| 265 | - if (temp == '08:00') { | ||
| 266 | - tempSelect = true; | 267 | + beginDate = '08:00'; |
| 268 | + if (userModel.user.morning != '' && userModel.user.morning != null) { | ||
| 269 | + List tempDate = userModel.user.morning.split("-"); | ||
| 270 | + beginDate = tempDate[0]; | ||
| 267 | } | 271 | } |
| 268 | } else if (mnd == 2) { | 272 | } else if (mnd == 2) { |
| 269 | - if (temp == '12:00') { | ||
| 270 | - tempSelect = true; | 273 | + beginDate = '12:00'; |
| 274 | + if (userModel.user.noon != '' && userModel.user.noon != null) { | ||
| 275 | + List tempDate = userModel.user.noon.split("-"); | ||
| 276 | + beginDate = tempDate[0]; | ||
| 271 | } | 277 | } |
| 272 | } else if (mnd == 3) { | 278 | } else if (mnd == 3) { |
| 273 | - if (temp == '18:00') { | ||
| 274 | - tempSelect = true; | 279 | + beginDate = '18:00'; |
| 280 | + if (userModel.user.night != '' && userModel.user.night != null) { | ||
| 281 | + List tempDate = userModel.user.night.split("-"); | ||
| 282 | + beginDate = tempDate[0]; | ||
| 275 | } | 283 | } |
| 276 | } | 284 | } |
| 285 | + if (temp == beginDate) { | ||
| 286 | + tempSelect = true; | ||
| 287 | + } | ||
| 288 | + // if (mnd == 1) { | ||
| 289 | + // if (temp == '08:00') { | ||
| 290 | + // tempSelect = true; | ||
| 291 | + // } | ||
| 292 | + // } else if (mnd == 2) { | ||
| 293 | + // if (temp == '12:00') { | ||
| 294 | + // tempSelect = true; | ||
| 295 | + // } | ||
| 296 | + // } else if (mnd == 3) { | ||
| 297 | + // if (temp == '18:00') { | ||
| 298 | + // tempSelect = true; | ||
| 299 | + // } | ||
| 300 | + // } | ||
| 277 | } | 301 | } |
| 278 | Map tempMap = {'title': temp, 'select': tempSelect}; | 302 | Map tempMap = {'title': temp, 'select': tempSelect}; |
| 279 | res.add(tempMap); | 303 | res.add(tempMap); |
| @@ -573,12 +597,32 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -573,12 +597,32 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 573 | String tempTime = ddateHm; //默认上个页面到店时间半小时值 | 597 | String tempTime = ddateHm; //默认上个页面到店时间半小时值 |
| 574 | if (ddateSolt != currTimeIndex.toString()) { | 598 | if (ddateSolt != currTimeIndex.toString()) { |
| 575 | //餐段发生改变,则重新默认到店时间半小时值 | 599 | //餐段发生改变,则重新默认到店时间半小时值 |
| 600 | + // if (currTimeIndex == 1) { | ||
| 601 | + // tempTime = '08:00'; | ||
| 602 | + // } else if (currTimeIndex == 2) { | ||
| 603 | + // tempTime = '12:00'; | ||
| 604 | + // } else if (currTimeIndex == 3) { | ||
| 605 | + // tempTime = '18:00'; | ||
| 606 | + // } | ||
| 607 | + | ||
| 576 | if (currTimeIndex == 1) { | 608 | if (currTimeIndex == 1) { |
| 577 | tempTime = '08:00'; | 609 | tempTime = '08:00'; |
| 610 | + if (userModel.user.morning != '' && userModel.user.morning != null) { | ||
| 611 | + List tempDate = userModel.user.morning.split("-"); | ||
| 612 | + tempTime = tempDate[0]; | ||
| 613 | + } | ||
| 578 | } else if (currTimeIndex == 2) { | 614 | } else if (currTimeIndex == 2) { |
| 579 | tempTime = '12:00'; | 615 | tempTime = '12:00'; |
| 616 | + if (userModel.user.noon != '' && userModel.user.noon != null) { | ||
| 617 | + List tempDate = userModel.user.noon.split("-"); | ||
| 618 | + tempTime = tempDate[0]; | ||
| 619 | + } | ||
| 580 | } else if (currTimeIndex == 3) { | 620 | } else if (currTimeIndex == 3) { |
| 581 | tempTime = '18:00'; | 621 | tempTime = '18:00'; |
| 622 | + if (userModel.user.night != '' && userModel.user.night != null) { | ||
| 623 | + List tempDate = userModel.user.night.split("-"); | ||
| 624 | + tempTime = tempDate[0]; | ||
| 625 | + } | ||
| 582 | } | 626 | } |
| 583 | } | 627 | } |
| 584 | 628 | ||
| @@ -779,15 +823,37 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -779,15 +823,37 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 779 | 823 | ||
| 780 | if (ddateSolt != currTimeIndex.toString() || tempTime == '') { | 824 | if (ddateSolt != currTimeIndex.toString() || tempTime == '') { |
| 781 | //餐段发生改变,则重新默认到店时间半小时值 | 825 | //餐段发生改变,则重新默认到店时间半小时值 |
| 826 | + // if (currTimeIndex == 1) { | ||
| 827 | + // tempTime = '08:00'; | ||
| 828 | + // ddateSolt = '1'; | ||
| 829 | + // } else if (currTimeIndex == 2) { | ||
| 830 | + // tempTime = '12:00'; | ||
| 831 | + // ddateSolt = '2'; | ||
| 832 | + // } else if (currTimeIndex == 3) { | ||
| 833 | + // tempTime = '18:00'; | ||
| 834 | + // ddateSolt = '3'; | ||
| 835 | + // } | ||
| 782 | if (currTimeIndex == 1) { | 836 | if (currTimeIndex == 1) { |
| 783 | tempTime = '08:00'; | 837 | tempTime = '08:00'; |
| 784 | ddateSolt = '1'; | 838 | ddateSolt = '1'; |
| 839 | + if (userModel.user.morning != '' && userModel.user.morning != null) { | ||
| 840 | + List tempDate = userModel.user.morning.split("-"); | ||
| 841 | + tempTime = tempDate[0]; | ||
| 842 | + } | ||
| 785 | } else if (currTimeIndex == 2) { | 843 | } else if (currTimeIndex == 2) { |
| 786 | tempTime = '12:00'; | 844 | tempTime = '12:00'; |
| 787 | ddateSolt = '2'; | 845 | ddateSolt = '2'; |
| 846 | + if (userModel.user.noon != '' && userModel.user.noon != null) { | ||
| 847 | + List tempDate = userModel.user.noon.split("-"); | ||
| 848 | + tempTime = tempDate[0]; | ||
| 849 | + } | ||
| 788 | } else if (currTimeIndex == 3) { | 850 | } else if (currTimeIndex == 3) { |
| 789 | tempTime = '18:00'; | 851 | tempTime = '18:00'; |
| 790 | ddateSolt = '3'; | 852 | ddateSolt = '3'; |
| 853 | + if (userModel.user.night != '' && userModel.user.night != null) { | ||
| 854 | + List tempDate = userModel.user.night.split("-"); | ||
| 855 | + tempTime = tempDate[0]; | ||
| 856 | + } | ||
| 791 | } | 857 | } |
| 792 | } | 858 | } |
| 793 | 859 |
| @@ -17,6 +17,7 @@ import 'package:one_key/net/base_resp.dart'; | @@ -17,6 +17,7 @@ import 'package:one_key/net/base_resp.dart'; | ||
| 17 | import 'package:one_key/net/dio_util.dart'; | 17 | import 'package:one_key/net/dio_util.dart'; |
| 18 | import 'package:one_key/net/http_url.dart'; | 18 | import 'package:one_key/net/http_url.dart'; |
| 19 | import 'package:one_key/models/table.dart' as t; | 19 | import 'package:one_key/models/table.dart' as t; |
| 20 | +import 'package:one_key/provider/store_base_info_provider.dart'; | ||
| 20 | import 'package:one_key/provider/user_model.dart'; | 21 | import 'package:one_key/provider/user_model.dart'; |
| 21 | import 'package:one_key/route/navigator_util.dart'; | 22 | import 'package:one_key/route/navigator_util.dart'; |
| 22 | import 'package:one_key/utils/lunar_calendar.dart'; | 23 | import 'package:one_key/utils/lunar_calendar.dart'; |
| @@ -434,12 +435,31 @@ class TableManagerModel with ChangeNotifier { | @@ -434,12 +435,31 @@ class TableManagerModel with ChangeNotifier { | ||
| 434 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 435 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 435 | // | 436 | // |
| 436 | if (tempTime == null) { | 437 | if (tempTime == null) { |
| 438 | + // if (currTimeIndex == 1) { | ||
| 439 | + // tempTime = '08:00'; | ||
| 440 | + // } else if (currTimeIndex == 2) { | ||
| 441 | + // tempTime = '12:00'; | ||
| 442 | + // } else if (currTimeIndex == 3) { | ||
| 443 | + // tempTime = '18:00'; | ||
| 444 | + // } | ||
| 437 | if (currTimeIndex == 1) { | 445 | if (currTimeIndex == 1) { |
| 438 | tempTime = '08:00'; | 446 | tempTime = '08:00'; |
| 447 | + if (userModel.user.morning != '' && userModel.user.morning != null) { | ||
| 448 | + List tempDate = userModel.user.morning.split("-"); | ||
| 449 | + tempTime = tempDate[0]; | ||
| 450 | + } | ||
| 439 | } else if (currTimeIndex == 2) { | 451 | } else if (currTimeIndex == 2) { |
| 440 | tempTime = '12:00'; | 452 | tempTime = '12:00'; |
| 453 | + if (userModel.user.noon != '' && userModel.user.noon != null) { | ||
| 454 | + List tempDate = userModel.user.noon.split("-"); | ||
| 455 | + tempTime = tempDate[0]; | ||
| 456 | + } | ||
| 441 | } else if (currTimeIndex == 3) { | 457 | } else if (currTimeIndex == 3) { |
| 442 | tempTime = '18:00'; | 458 | tempTime = '18:00'; |
| 459 | + if (userModel.user.night != '' && userModel.user.night != null) { | ||
| 460 | + List tempDate = userModel.user.night.split("-"); | ||
| 461 | + tempTime = tempDate[0]; | ||
| 462 | + } | ||
| 443 | } | 463 | } |
| 444 | } | 464 | } |
| 445 | 465 |
| @@ -23,7 +23,6 @@ import '../app.dart'; | @@ -23,7 +23,6 @@ import '../app.dart'; | ||
| 23 | import '../models/set_xuan_tai_model.dart'; | 23 | import '../models/set_xuan_tai_model.dart'; |
| 24 | 24 | ||
| 25 | class UserModel with ChangeNotifier { | 25 | class UserModel with ChangeNotifier { |
| 26 | - User _user; | ||
| 27 | String _registrationId; //极光推送registrationId | 26 | String _registrationId; //极光推送registrationId |
| 28 | String _token; //信鸽推送token | 27 | String _token; //信鸽推送token |
| 29 | List<PullMarketingByUidSunModel> pullMarketingByUidSunModel; | 28 | List<PullMarketingByUidSunModel> pullMarketingByUidSunModel; |
| @@ -31,7 +30,15 @@ class UserModel with ChangeNotifier { | @@ -31,7 +30,15 @@ class UserModel with ChangeNotifier { | ||
| 31 | 30 | ||
| 32 | List<Setmeal> justSelData = []; | 31 | List<Setmeal> justSelData = []; |
| 33 | 32 | ||
| 34 | - User get user => _user; | 33 | + // User get user => _user; |
| 34 | + User get user { | ||
| 35 | + User _user; | ||
| 36 | + if (App.sp.containsKey('user')) { | ||
| 37 | + String s = App.sp.getString('user'); | ||
| 38 | + _user = User.fromJson(json.decode(s)); | ||
| 39 | + } | ||
| 40 | + return _user; | ||
| 41 | + } | ||
| 35 | 42 | ||
| 36 | set registrationId(String registrationId) => _registrationId = registrationId; | 43 | set registrationId(String registrationId) => _registrationId = registrationId; |
| 37 | 44 | ||
| @@ -44,12 +51,12 @@ class UserModel with ChangeNotifier { | @@ -44,12 +51,12 @@ class UserModel with ChangeNotifier { | ||
| 44 | } | 51 | } |
| 45 | 52 | ||
| 46 | /// 初始化 User | 53 | /// 初始化 User |
| 47 | - void initUser() { | ||
| 48 | - if (App.sp.containsKey('user')) { | ||
| 49 | - String s = App.sp.getString('user'); | ||
| 50 | - _user = User.fromJson(json.decode(s)); | ||
| 51 | - } | ||
| 52 | - } | 54 | + // void initUser() { |
| 55 | + // if (App.sp.containsKey('user')) { | ||
| 56 | + // String s = App.sp.getString('user'); | ||
| 57 | + // _user = User.fromJson(json.decode(s)); | ||
| 58 | + // } | ||
| 59 | + // } | ||
| 53 | 60 | ||
| 54 | /// 登录 | 61 | /// 登录 |
| 55 | Future<String> login(BuildContext context, Map<String, String> params, | 62 | Future<String> login(BuildContext context, Map<String, String> params, |
| @@ -377,7 +384,8 @@ class UserModel with ChangeNotifier { | @@ -377,7 +384,8 @@ class UserModel with ChangeNotifier { | ||
| 377 | 384 | ||
| 378 | /// 保存用户信息到 sp | 385 | /// 保存用户信息到 sp |
| 379 | saveUserInfo(User user) { | 386 | saveUserInfo(User user) { |
| 380 | - _user = user; | 387 | + // _user = user; |
| 388 | + // notifyListeners(); | ||
| 381 | App.sp.setString('user', json.encode(user.toJson())); | 389 | App.sp.setString('user', json.encode(user.toJson())); |
| 382 | } | 390 | } |
| 383 | } | 391 | } |
-
Please register or login to post a comment