Showing
6 changed files
with
206 additions
and
76 deletions
| @@ -15,8 +15,8 @@ class Constant { | @@ -15,8 +15,8 @@ class Constant { | ||
| 15 | 15 | ||
| 16 | // }; | 16 | // }; |
| 17 | 17 | ||
| 18 | - static const bool simpleApp = true; //极速版 | ||
| 19 | - // static const bool simpleApp = false; //标准版 | 18 | + static const bool normalApp = true; //屏蔽极速版,打包正常版本 |
| 19 | + // static const bool normalApp = false; //极速和正常版本 | ||
| 20 | static const Map<String, List<String>> authorityConfig = { | 20 | static const Map<String, List<String>> authorityConfig = { |
| 21 | '充值短信': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], | 21 | '充值短信': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], |
| 22 | '有效期': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], | 22 | '有效期': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], |
| @@ -14,6 +14,7 @@ import 'package:one_key/models/new_unmessage_model.dart'; | @@ -14,6 +14,7 @@ import 'package:one_key/models/new_unmessage_model.dart'; | ||
| 14 | import 'package:one_key/models/pull_marketing_by_uid_model.dart'; | 14 | import 'package:one_key/models/pull_marketing_by_uid_model.dart'; |
| 15 | 15 | ||
| 16 | import 'package:one_key/pages/message/message_page.dart'; | 16 | import 'package:one_key/pages/message/message_page.dart'; |
| 17 | +import 'package:one_key/pages/my/contant_left_page.dart'; | ||
| 17 | import 'package:one_key/pages/my/my_page.dart'; | 18 | import 'package:one_key/pages/my/my_page.dart'; |
| 18 | import 'package:one_key/pages/notebook/notebook_page.dart'; | 19 | import 'package:one_key/pages/notebook/notebook_page.dart'; |
| 19 | import 'package:one_key/pages/table/table_manager_page.dart'; | 20 | import 'package:one_key/pages/table/table_manager_page.dart'; |
| @@ -40,6 +41,7 @@ import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; | @@ -40,6 +41,7 @@ import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; | ||
| 40 | import 'package:flutter_app_badger/flutter_app_badger.dart'; | 41 | import 'package:flutter_app_badger/flutter_app_badger.dart'; |
| 41 | import 'package:one_key/models/message.dart'; | 42 | import 'package:one_key/models/message.dart'; |
| 42 | 43 | ||
| 44 | +import '../../constant/constant.dart'; | ||
| 43 | import '../../constant/state.dart'; | 45 | import '../../constant/state.dart'; |
| 44 | import '../../models/customer_by_seller_model.dart'; | 46 | import '../../models/customer_by_seller_model.dart'; |
| 45 | 47 | ||
| @@ -299,64 +301,71 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -299,64 +301,71 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 299 | 301 | ||
| 300 | getSellerVersion() async { | 302 | getSellerVersion() async { |
| 301 | await collectStoreProvider.getSellerVersion(context); | 303 | await collectStoreProvider.getSellerVersion(context); |
| 302 | - if (collectStoreProvider.sellerSimple) { | ||
| 303 | - //极速版 | ||
| 304 | - App.sp.remove('sellerEdate'); | ||
| 305 | - App.sp.remove('sellerEdateModule'); | ||
| 306 | - NavigatorUtil.goHomePageSim(context); //跳转到极速版 页面 | 304 | + if (Constant.normalApp) { |
| 305 | + _version(); | ||
| 307 | } else { | 306 | } else { |
| 308 | - if (collectStoreProvider.sellerVersionList != null && | ||
| 309 | - collectStoreProvider.sellerVersionList.length > 0) { | 307 | + if (collectStoreProvider.sellerSimple) { |
| 308 | + //极速版 | ||
| 309 | + App.sp.remove('sellerEdate'); | ||
| 310 | + App.sp.remove('sellerEdateModule'); | ||
| 311 | + NavigatorUtil.goHomePageSim(context); //跳转到极速版 页面 | ||
| 312 | + } else { | ||
| 313 | + _version(); | ||
| 314 | + } | ||
| 315 | + } | ||
| 316 | + } | ||
| 317 | + | ||
| 318 | + _version() { | ||
| 319 | + if (collectStoreProvider.sellerVersionList != null && | ||
| 320 | + collectStoreProvider.sellerVersionList.length > 0) { | ||
| 310 | //获取到店铺过期时间 | 321 | //获取到店铺过期时间 |
| 311 | - //店铺过期提醒 | ||
| 312 | - // 计算时间差 | ||
| 313 | - //店铺过期日期 | ||
| 314 | - List<SellerVersionSunModel> showData = []; | ||
| 315 | - // App.sp.remove('sellerEdateModule'); | ||
| 316 | - if (App.sp.containsKey('sellerEdateModule')) { | ||
| 317 | - dataSp = json.decode(App.sp.getString('sellerEdateModule')); | ||
| 318 | - } | 322 | + //店铺过期提醒 |
| 323 | + // 计算时间差 | ||
| 324 | + //店铺过期日期 | ||
| 325 | + List<SellerVersionSunModel> showData = []; | ||
| 326 | + // App.sp.remove('sellerEdateModule'); | ||
| 327 | + if (App.sp.containsKey('sellerEdateModule')) { | ||
| 328 | + dataSp = json.decode(App.sp.getString('sellerEdateModule')); | ||
| 329 | + } | ||
| 319 | 330 | ||
| 320 | - collectStoreProvider.sellerVersionList.forEach((element) { | ||
| 321 | - _edateSellerModuleShow(showData, element, dataSp); | ||
| 322 | - }); | ||
| 323 | - print(showData); | ||
| 324 | - print(dataSp); | ||
| 325 | - if (dataSp.length > 0) { | ||
| 326 | - App.sp.setString("sellerEdateModule", json.encode(dataSp)); | ||
| 327 | - // var data = json.decode(App.sp.getString('sellerEdateModule')); | ||
| 328 | - // var str = App.sp.getString('sellerEdateModule'); | ||
| 329 | - // print(str); | ||
| 330 | - // print(data); | ||
| 331 | - } | 331 | + collectStoreProvider.sellerVersionList.forEach((element) { |
| 332 | + _edateSellerModuleShow(showData, element, dataSp); | ||
| 333 | + }); | ||
| 334 | + print(showData); | ||
| 335 | + print(dataSp); | ||
| 336 | + if (dataSp.length > 0) { | ||
| 337 | + App.sp.setString("sellerEdateModule", json.encode(dataSp)); | ||
| 338 | + // var data = json.decode(App.sp.getString('sellerEdateModule')); | ||
| 339 | + // var str = App.sp.getString('sellerEdateModule'); | ||
| 340 | + // print(str); | ||
| 341 | + // print(data); | ||
| 342 | + } | ||
| 332 | 343 | ||
| 333 | - if (showData != null && showData.length > 0) { | ||
| 334 | - DialogUtil.showSellerVersionEdateDialog( | ||
| 335 | - context, showData, (object) {}); | ||
| 336 | - } | ||
| 337 | - //通过showdata 弹窗 | ||
| 338 | - | ||
| 339 | - // timerSellerModuleEdate = Timer.periodic(Duration(days: 1), (_) { | ||
| 340 | - // //店铺过期提醒 | ||
| 341 | - // // 计算时间差 | ||
| 342 | - // //店铺过期日期 | ||
| 343 | - // _edateShow(); | ||
| 344 | - // }); | ||
| 345 | - return true; | ||
| 346 | - } else { | ||
| 347 | - if (_currIndex != 4) { | ||
| 348 | - if (App.sp.containsKey('sellerEdate')) { | ||
| 349 | - List<String> data = App.sp.getStringList('sellerEdate'); | ||
| 350 | - if (data.contains('-1')) { | ||
| 351 | - //已经弹过过期弹窗,默认我的 | ||
| 352 | - _currIndex = 4; | ||
| 353 | - } | 344 | + if (showData != null && showData.length > 0) { |
| 345 | + DialogUtil.showSellerVersionEdateDialog(context, showData, (object) {}); | ||
| 346 | + } | ||
| 347 | + //通过showdata 弹窗 | ||
| 348 | + | ||
| 349 | + // timerSellerModuleEdate = Timer.periodic(Duration(days: 1), (_) { | ||
| 350 | + // //店铺过期提醒 | ||
| 351 | + // // 计算时间差 | ||
| 352 | + // //店铺过期日期 | ||
| 353 | + // _edateShow(); | ||
| 354 | + // }); | ||
| 355 | + return true; | ||
| 356 | + } else { | ||
| 357 | + if (_currIndex != 4) { | ||
| 358 | + if (App.sp.containsKey('sellerEdate')) { | ||
| 359 | + List<String> data = App.sp.getStringList('sellerEdate'); | ||
| 360 | + if (data.contains('-1')) { | ||
| 361 | + //已经弹过过期弹窗,默认我的 | ||
| 362 | + _currIndex = 4; | ||
| 354 | } | 363 | } |
| 355 | - NavigatorUtil.goHomePage(context, initialIndex: _currIndex); | ||
| 356 | } | 364 | } |
| 357 | - | ||
| 358 | - return false; | 365 | + NavigatorUtil.goHomePage(context, initialIndex: _currIndex); |
| 359 | } | 366 | } |
| 367 | + | ||
| 368 | + return false; | ||
| 360 | } | 369 | } |
| 361 | } | 370 | } |
| 362 | 371 |
| @@ -145,10 +145,17 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver { | @@ -145,10 +145,17 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver { | ||
| 145 | // NavigatorUtil.goHomePage(context); | 145 | // NavigatorUtil.goHomePage(context); |
| 146 | //获取登陆接口返回的vid 如果是14 极速版,则跳转至极速版 | 146 | //获取登陆接口返回的vid 如果是14 极速版,则跳转至极速版 |
| 147 | // if (user['sellerVersion'] == '14') { | 147 | // if (user['sellerVersion'] == '14') { |
| 148 | - if (Provider.of<UserModel>(context,listen: false).user.sellerVersion == '14') { | ||
| 149 | - NavigatorUtil.goHomePageSim(context); | ||
| 150 | - } else { | 148 | + if (Constant.normalApp) { |
| 151 | NavigatorUtil.goHomePage(context); | 149 | NavigatorUtil.goHomePage(context); |
| 150 | + } else { | ||
| 151 | + if (Provider.of<UserModel>(context, listen: false) | ||
| 152 | + .user | ||
| 153 | + .sellerVersion == | ||
| 154 | + '14') { | ||
| 155 | + NavigatorUtil.goHomePageSim(context); | ||
| 156 | + } else { | ||
| 157 | + NavigatorUtil.goHomePage(context); | ||
| 158 | + } | ||
| 152 | } | 159 | } |
| 153 | }); | 160 | }); |
| 154 | } else { | 161 | } else { |
| @@ -29,6 +29,7 @@ import 'package:provider/provider.dart'; | @@ -29,6 +29,7 @@ import 'package:provider/provider.dart'; | ||
| 29 | 29 | ||
| 30 | import '../../app.dart'; | 30 | import '../../app.dart'; |
| 31 | 31 | ||
| 32 | +import '../../constant/constant.dart'; | ||
| 32 | import '../../models/get_seller_info_model.dart'; | 33 | import '../../models/get_seller_info_model.dart'; |
| 33 | import '../../provider/collect_store_provider.dart'; | 34 | import '../../provider/collect_store_provider.dart'; |
| 34 | import '../../provider/customer_provider.dart'; | 35 | import '../../provider/customer_provider.dart'; |
| @@ -232,13 +233,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | @@ -232,13 +233,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | ||
| 232 | getSellerVersion() async { | 233 | getSellerVersion() async { |
| 233 | await collectStoreProvider.getSellerVersion(context); | 234 | await collectStoreProvider.getSellerVersion(context); |
| 234 | 235 | ||
| 235 | - if (collectStoreProvider.sellerSimple) { | ||
| 236 | - //极速版 | ||
| 237 | - App.sp.remove('sellerEdate'); | ||
| 238 | - App.sp.remove('sellerEdateModule'); | ||
| 239 | - | ||
| 240 | - NavigatorUtil.goHomePageSim(context, initialIndex: 3); //跳转到极速版 我的 页面 | ||
| 241 | - } else { | 236 | + if (Constant.normalApp) { |
| 242 | if (collectStoreProvider.sellerNormal) { | 237 | if (collectStoreProvider.sellerNormal) { |
| 243 | if (collectStoreProvider.sellerNormalEdate != null) { | 238 | if (collectStoreProvider.sellerNormalEdate != null) { |
| 244 | //店铺过期提醒 | 239 | //店铺过期提醒 |
| @@ -268,11 +263,54 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | @@ -268,11 +263,54 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | ||
| 268 | } else { | 263 | } else { |
| 269 | outDay = '0'; | 264 | outDay = '0'; |
| 270 | } | 265 | } |
| 271 | - // setState(() {}); | 266 | + setState(() {}); |
| 272 | } else { | 267 | } else { |
| 273 | outDay = '0'; | 268 | outDay = '0'; |
| 274 | } | 269 | } |
| 275 | setState(() {}); | 270 | setState(() {}); |
| 271 | + } else { | ||
| 272 | + if (collectStoreProvider.sellerSimple) { | ||
| 273 | + //极速版 | ||
| 274 | + App.sp.remove('sellerEdate'); | ||
| 275 | + App.sp.remove('sellerEdateModule'); | ||
| 276 | + | ||
| 277 | + NavigatorUtil.goHomePageSim(context, initialIndex: 3); //跳转到极速版 我的 页面 | ||
| 278 | + } else { | ||
| 279 | + if (collectStoreProvider.sellerNormal) { | ||
| 280 | + if (collectStoreProvider.sellerNormalEdate != null) { | ||
| 281 | + //店铺过期提醒 | ||
| 282 | + // 计算时间差 | ||
| 283 | + //店铺过期日期 | ||
| 284 | + edate = DateTime.fromMillisecondsSinceEpoch( | ||
| 285 | + int.parse(collectStoreProvider.sellerNormalEdate) * 1000); | ||
| 286 | + | ||
| 287 | + String from = DateUtil.formatDate(DateTime.now(), | ||
| 288 | + format: DateFormats.y_mo_d) + | ||
| 289 | + ' 00:00:00'; | ||
| 290 | + DateTime datenow = DateUtil.getDateTime(from); | ||
| 291 | + | ||
| 292 | + //比较相差的天数 | ||
| 293 | + int difference = edate.difference(datenow).inDays; | ||
| 294 | + | ||
| 295 | + int differenceSeconds = edate.difference(datenow).inSeconds; | ||
| 296 | + | ||
| 297 | + if (difference < 0 || (difference == 0 && differenceSeconds <= 0)) { | ||
| 298 | + //过期 | ||
| 299 | + outDay = '0'; | ||
| 300 | + } else { | ||
| 301 | + outDay = difference.toString(); | ||
| 302 | + } | ||
| 303 | + | ||
| 304 | + // print(outDay); | ||
| 305 | + } else { | ||
| 306 | + outDay = '0'; | ||
| 307 | + } | ||
| 308 | + // setState(() {}); | ||
| 309 | + } else { | ||
| 310 | + outDay = '0'; | ||
| 311 | + } | ||
| 312 | + setState(() {}); | ||
| 313 | + } | ||
| 276 | } | 314 | } |
| 277 | } | 315 | } |
| 278 | 316 |
| @@ -103,14 +103,8 @@ class CollectStoreProvider with ChangeNotifier { | @@ -103,14 +103,8 @@ class CollectStoreProvider with ChangeNotifier { | ||
| 103 | sellerVersionList.forEach((element) { | 103 | sellerVersionList.forEach((element) { |
| 104 | versionCodeList.add(element.vid); | 104 | versionCodeList.add(element.vid); |
| 105 | }); | 105 | }); |
| 106 | - sellerSimple = versionCodeList.any((element) => element == '14'); | ||
| 107 | 106 | ||
| 108 | - if (sellerSimple) { | ||
| 109 | - //极速版 | ||
| 110 | - if (App.sp.containsKey("sellerEdate")) { | ||
| 111 | - App.sp.remove("sellerEdate"); | ||
| 112 | - } | ||
| 113 | - } else { | 107 | + if (Constant.normalApp) { |
| 114 | sellerCoupon = versionCodeList.any((element) => | 108 | sellerCoupon = versionCodeList.any((element) => |
| 115 | element == '1' || | 109 | element == '1' || |
| 116 | element == '2' || | 110 | element == '2' || |
| @@ -170,7 +164,6 @@ class CollectStoreProvider with ChangeNotifier { | @@ -170,7 +164,6 @@ class CollectStoreProvider with ChangeNotifier { | ||
| 170 | sellerNormalEdate = element.edate; | 164 | sellerNormalEdate = element.edate; |
| 171 | } | 165 | } |
| 172 | }); | 166 | }); |
| 173 | - | ||
| 174 | if (!sellerNormal) { | 167 | if (!sellerNormal) { |
| 175 | //超能版或者标准版过期 | 168 | //超能版或者标准版过期 |
| 176 | App.sp.setStringList("sellerEdate", ['-1']); | 169 | App.sp.setStringList("sellerEdate", ['-1']); |
| @@ -179,6 +172,84 @@ class CollectStoreProvider with ChangeNotifier { | @@ -179,6 +172,84 @@ class CollectStoreProvider with ChangeNotifier { | ||
| 179 | App.sp.remove("sellerEdate"); | 172 | App.sp.remove("sellerEdate"); |
| 180 | } | 173 | } |
| 181 | } | 174 | } |
| 175 | + } else { | ||
| 176 | + sellerSimple = versionCodeList.any((element) => element == '14'); | ||
| 177 | + | ||
| 178 | + if (sellerSimple) { | ||
| 179 | + //极速版 | ||
| 180 | + if (App.sp.containsKey("sellerEdate")) { | ||
| 181 | + App.sp.remove("sellerEdate"); | ||
| 182 | + } | ||
| 183 | + } else { | ||
| 184 | + sellerCoupon = versionCodeList.any((element) => | ||
| 185 | + element == '1' || | ||
| 186 | + element == '2' || | ||
| 187 | + element == '3' || | ||
| 188 | + element == '8'); | ||
| 189 | + | ||
| 190 | + sellerRecharge = versionCodeList.any((element) => | ||
| 191 | + element == '1' || | ||
| 192 | + element == '2' || | ||
| 193 | + element == '3' || | ||
| 194 | + element == '9'); | ||
| 195 | + | ||
| 196 | + sellerWine = versionCodeList.any((element) => | ||
| 197 | + element == '1' || | ||
| 198 | + element == '2' || | ||
| 199 | + element == '3' || | ||
| 200 | + element == '7'); | ||
| 201 | + | ||
| 202 | + sellerOrderCustomer = versionCodeList.any((element) => | ||
| 203 | + element == '1' || | ||
| 204 | + element == '2' || | ||
| 205 | + element == '3' || | ||
| 206 | + element == '6'); | ||
| 207 | + sellerOrderManager = versionCodeList.any((element) => | ||
| 208 | + element == '1' || | ||
| 209 | + element == '2' || | ||
| 210 | + element == '3' || | ||
| 211 | + element == '5'); | ||
| 212 | + sellerFeast = versionCodeList.any((element) => | ||
| 213 | + element == '1' || | ||
| 214 | + element == '2' || | ||
| 215 | + element == '3' || | ||
| 216 | + element == '12'); | ||
| 217 | + sellerPreserve = versionCodeList.any((element) => | ||
| 218 | + element == '1' || | ||
| 219 | + element == '2' || | ||
| 220 | + element == '3' || | ||
| 221 | + element == '10'); | ||
| 222 | + sellerMarketing = versionCodeList.any((element) => | ||
| 223 | + element == '1' || | ||
| 224 | + element == '2' || | ||
| 225 | + element == '3' || | ||
| 226 | + element == '11'); | ||
| 227 | + | ||
| 228 | + sellerNormal = versionCodeList.any((element) => | ||
| 229 | + element == '1' || | ||
| 230 | + element == '2' || | ||
| 231 | + element == '3' || | ||
| 232 | + element == '4' || | ||
| 233 | + element == '13'); | ||
| 234 | + sellerVersionList.forEach((element) { | ||
| 235 | + if (element.vid == '1' || | ||
| 236 | + element.vid == '2' || | ||
| 237 | + element.vid == '3' || | ||
| 238 | + element.vid == '4' || | ||
| 239 | + element.vid == '13') { | ||
| 240 | + sellerNormalEdate = element.edate; | ||
| 241 | + } | ||
| 242 | + }); | ||
| 243 | + | ||
| 244 | + if (!sellerNormal) { | ||
| 245 | + //超能版或者标准版过期 | ||
| 246 | + App.sp.setStringList("sellerEdate", ['-1']); | ||
| 247 | + } else { | ||
| 248 | + if (App.sp.containsKey("sellerEdate")) { | ||
| 249 | + App.sp.remove("sellerEdate"); | ||
| 250 | + } | ||
| 251 | + } | ||
| 252 | + } | ||
| 182 | } | 253 | } |
| 183 | } else { | 254 | } else { |
| 184 | //超能版或者标准版过期 && 极速版也没有 | 255 | //超能版或者标准版过期 && 极速版也没有 |
| @@ -113,7 +113,7 @@ class UserModel with ChangeNotifier { | @@ -113,7 +113,7 @@ class UserModel with ChangeNotifier { | ||
| 113 | 'token': baseResp.data[0]["token"]['token'], | 113 | 'token': baseResp.data[0]["token"]['token'], |
| 114 | 'nickname': user['nick_name'], | 114 | 'nickname': user['nick_name'], |
| 115 | 'edate': seller['edate'], | 115 | 'edate': seller['edate'], |
| 116 | - 'sellerVersion':sellerVersion | 116 | + 'sellerVersion': sellerVersion |
| 117 | }; | 117 | }; |
| 118 | await saveUserInfo(User.fromJson(userMap)); | 118 | await saveUserInfo(User.fromJson(userMap)); |
| 119 | 119 | ||
| @@ -217,11 +217,16 @@ class UserModel with ChangeNotifier { | @@ -217,11 +217,16 @@ class UserModel with ChangeNotifier { | ||
| 217 | App.sp.setString("is_call_tel", seller['is_call_tel'].toString()); | 217 | App.sp.setString("is_call_tel", seller['is_call_tel'].toString()); |
| 218 | pullMarketingByUid(context); | 218 | pullMarketingByUid(context); |
| 219 | //获取登陆接口返回的vid 如果是14 极速版,则跳转至极速版 | 219 | //获取登陆接口返回的vid 如果是14 极速版,则跳转至极速版 |
| 220 | - if (user['sellerVersion'] == '14') { | ||
| 221 | - NavigatorUtil.goHomePageSim(context); | ||
| 222 | - } else { | 220 | + if (Constant.normalApp) { |
| 223 | NavigatorUtil.goHomePage(context); | 221 | NavigatorUtil.goHomePage(context); |
| 222 | + } else { | ||
| 223 | + if (user['sellerVersion'] == '14') { | ||
| 224 | + NavigatorUtil.goHomePageSim(context); | ||
| 225 | + } else { | ||
| 226 | + NavigatorUtil.goHomePage(context); | ||
| 227 | + } | ||
| 224 | } | 228 | } |
| 229 | + | ||
| 225 | return null; | 230 | return null; |
| 226 | } | 231 | } |
| 227 | } | 232 | } |
-
Please register or login to post a comment