Commit b6b50f8f770380a0811b6096560707cf5377ad53

Authored by weixin_45529955
2 parents 540afd59 b2515336

Merge branch 'v7.2.0+' into v7.3.0+

1 -  
2 class SellerVersionModel { 1 class SellerVersionModel {
3 int? ret; 2 int? ret;
4 List<SellerVersionSunModel>? data; 3 List<SellerVersionSunModel>? data;
@@ -37,6 +36,7 @@ class SellerVersionSunModel { @@ -37,6 +36,7 @@ class SellerVersionSunModel {
37 String? rdate; 36 String? rdate;
38 String? edate; 37 String? edate;
39 String? cdate; 38 String? cdate;
  39 + double? price;
40 40
41 SellerVersionSunModel( 41 SellerVersionSunModel(
42 {this.id, 42 {this.id,
@@ -46,9 +46,10 @@ class SellerVersionSunModel { @@ -46,9 +46,10 @@ class SellerVersionSunModel {
46 this.vname, 46 this.vname,
47 this.rdate, 47 this.rdate,
48 this.edate, 48 this.edate,
49 - this.cdate}); 49 + this.cdate,
  50 + this.price});
50 51
51 - SellerVersionSunModel.fromJson(Map<String, dynamic> json){ 52 + SellerVersionSunModel.fromJson(Map<String, dynamic> json) {
52 id = json['id']; 53 id = json['id'];
53 sid = json['sid']; 54 sid = json['sid'];
54 vid = json['vid']; 55 vid = json['vid'];
@@ -59,7 +60,10 @@ class SellerVersionSunModel { @@ -59,7 +60,10 @@ class SellerVersionSunModel {
59 // edate = json['vid'] == '4' ? '1695005146' : '1694832346'; 60 // edate = json['vid'] == '4' ? '1695005146' : '1694832346';
60 edate = json['edate']; 61 edate = json['edate'];
61 cdate = json['cdate']; 62 cdate = json['cdate'];
62 - } 63 + price = json['price'] is num
  64 + ? (json['price'] as num).toDouble()
  65 + : double.tryParse('${json['price']}');
  66 + }
63 67
64 Map<String, dynamic> toJson() { 68 Map<String, dynamic> toJson() {
65 final Map<String, dynamic> data = new Map<String, dynamic>(); 69 final Map<String, dynamic> data = new Map<String, dynamic>();
@@ -71,6 +75,7 @@ class SellerVersionSunModel { @@ -71,6 +75,7 @@ class SellerVersionSunModel {
71 data['rdate'] = this.rdate; 75 data['rdate'] = this.rdate;
72 data['edate'] = this.edate; 76 data['edate'] = this.edate;
73 data['cdate'] = this.cdate; 77 data['cdate'] = this.cdate;
  78 + data['price'] = this.price;
74 return data; 79 return data;
75 } 80 }
76 } 81 }
@@ -239,7 +239,7 @@ class DioUtil { @@ -239,7 +239,7 @@ class DioUtil {
239 239
240 return new BaseResp(_status, _code, _msg, _data, _responseData); 240 return new BaseResp(_status, _code, _msg, _data, _responseData);
241 } catch (e) { 241 } catch (e) {
242 - Loading.hideLoading(context); 242 + // Loading is dismissed once by the outer DioException handler below.
243 throw new DioException( 243 throw new DioException(
244 requestOptions: response.requestOptions, 244 requestOptions: response.requestOptions,
245 response: response, 245 response: response,
@@ -248,7 +248,7 @@ class DioUtil { @@ -248,7 +248,7 @@ class DioUtil {
248 ); 248 );
249 } 249 }
250 } 250 }
251 - Loading.hideLoading(context); 251 + // Loading is dismissed once by the outer DioException handler below.
252 throw new DioException( 252 throw new DioException(
253 requestOptions: response.requestOptions, 253 requestOptions: response.requestOptions,
254 response: response, 254 response: response,
@@ -3,7 +3,7 @@ class HttpUrl { @@ -3,7 +3,7 @@ class HttpUrl {
3 static const String server_address = "http://xt04.colorcun.com/"; //服务端请求地址 3 static const String server_address = "http://xt04.colorcun.com/"; //服务端请求地址
4 4
5 // static const String server_address = "http://192.168.5.90:8000/public/"; //服务端请求地址 5 // static const String server_address = "http://192.168.5.90:8000/public/"; //服务端请求地址
6 - 6 +
7 static const String app_user_login = 7 static const String app_user_login =
8 "?service=Android.User.AppUserLogin"; //登录地址 8 "?service=Android.User.AppUserLogin"; //登录地址
9 static const String user_token_init = 9 static const String user_token_init =
@@ -480,6 +480,8 @@ class HttpUrl { @@ -480,6 +480,8 @@ class HttpUrl {
480 480
481 static const String get_seller_version = 481 static const String get_seller_version =
482 "?service=App.SellerVersion.GetSellerVersion"; // 获取商家的版本信息 482 "?service=App.SellerVersion.GetSellerVersion"; // 获取商家的版本信息
  483 + static const String get_version_list =
  484 + "?service=App.SellerVersion.GetVersionList"; // 获取所有版本列表
483 485
484 static const String get_seller_template_color_list = 486 static const String get_seller_template_color_list =
485 "?service=App.Seller.GetSellerTemplateColorList"; // 模板/颜色配置信息 487 "?service=App.Seller.GetSellerTemplateColorList"; // 模板/颜色配置信息
@@ -675,14 +677,9 @@ class HttpUrl { @@ -675,14 +677,9 @@ class HttpUrl {
675 677
676 static const get_free_meal_config_by_seller = 678 static const get_free_meal_config_by_seller =
677 "?service=App.Activity.GetFreeMealConfigBySeller"; // 获取当餐免费的配置信息 679 "?service=App.Activity.GetFreeMealConfigBySeller"; // 获取当餐免费的配置信息
678 -static const clear_seller_user_wechat_bind = 680 + static const clear_seller_user_wechat_bind =
679 "?service=App.Wechat.ClearSellerUserWechatBind"; // 解绑员工账号微信 681 "?service=App.Wechat.ClearSellerUserWechatBind"; // 解绑员工账号微信
680 682
681 -  
682 -  
683 -  
684 -  
685 -  
686 static const get_customer_target_group_list = 683 static const get_customer_target_group_list =
687 "?service=App.Activity.GetCustomerTargetGroupList"; // 获取客户目标群体列表 684 "?service=App.Activity.GetCustomerTargetGroupList"; // 获取客户目标群体列表
688 685
@@ -98,7 +98,7 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { @@ -98,7 +98,7 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> {
98 // } 98 // }
99 99
100 /// 获取定位权限 100 /// 获取定位权限
101 - _requestLocationPermission() async { 101 + _requestLocationPermission({bool forceCenter = false}) async {
102 await AmapLocation.instance.updatePrivacyShow(true); 102 await AmapLocation.instance.updatePrivacyShow(true);
103 await AmapLocation.instance.updatePrivacyAgree(true); 103 await AmapLocation.instance.updatePrivacyAgree(true);
104 bool canLocation = false; 104 bool canLocation = false;
@@ -128,7 +128,8 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { @@ -128,7 +128,8 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> {
128 // App.sp.setString("lat", "39.684670899"); 128 // App.sp.setString("lat", "39.684670899");
129 // App.sp.setString("lng", "118.17630045"); 129 // App.sp.setString("lng", "118.17630045");
130 } else { 130 } else {
131 - if (widget.long == null || 131 + if (forceCenter ||
  132 + widget.long == null ||
132 widget.long == '' || 133 widget.long == '' ||
133 widget.long == 'null') { 134 widget.long == 'null') {
134 latitude = location.latLng!.latitude; 135 latitude = location.latLng!.latitude;
@@ -288,8 +289,7 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { @@ -288,8 +289,7 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> {
288 bottom: w(10), 289 bottom: w(10),
289 child: InkWell( 290 child: InkWell(
290 onTap: () { 291 onTap: () {
291 - _controller!.setCenterCoordinate(  
292 - LatLng(latitudeLocation, longitudeLocation)); 292 + _requestLocationPermission(forceCenter: true);
293 }, 293 },
294 child: Container( 294 child: Container(
295 decoration: BoxDecoration( 295 decoration: BoxDecoration(
@@ -162,6 +162,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -162,6 +162,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
162 // } 162 // }
163 163
164 WidgetsBinding.instance.addObserver(this); 164 WidgetsBinding.instance.addObserver(this);
  165 + EventBus().on('refreshSellerVersion', (arg) {
  166 + getSellerVersion();
  167 + });
165 168
166 _currIndex = widget.initialIndex; 169 _currIndex = widget.initialIndex;
167 170
@@ -2028,6 +2031,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -2028,6 +2031,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
2028 LogUtil.v("home_dispose"); 2031 LogUtil.v("home_dispose");
2029 2032
2030 // bus.off('refresh_token'); 2033 // bus.off('refresh_token');
  2034 + EventBus().off('refreshSellerVersion');
2031 if (timer != null) { 2035 if (timer != null) {
2032 timer!.cancel(); 2036 timer!.cancel();
2033 } 2037 }
@@ -592,6 +592,12 @@ class _ExportBookDataPageState extends State<ExportBookDataPage> { @@ -592,6 +592,12 @@ class _ExportBookDataPageState extends State<ExportBookDataPage> {
592 fields += element.code! + ','; 592 fields += element.code! + ',';
593 } 593 }
594 }); 594 });
  595 + // GetExportInfo 服务端会无条件读取 con_amount。若不导出该字段,
  596 + // 响应体会带 PHP Notice,Dio 无法解析 JSON,导致导出流程中断。
  597 + if (!customerProvider.reportFieldModelData!.any((element) =>
  598 + element.select && element.code == 'con_amount')) {
  599 + fields += 'con_amount,';
  600 + }
595 if (fields.endsWith(',')) { 601 if (fields.endsWith(',')) {
596 fields = fields.substring(0, fields.length - 1); 602 fields = fields.substring(0, fields.length - 1);
597 } 603 }
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:fluwx/fluwx.dart';
  4 +import 'package:one_key/models/seller_version_model.dart';
  5 +import 'package:one_key/models/wechat_pay_model.dart';
  6 +import 'package:one_key/provider/collect_store_provider.dart';
  7 +import 'package:one_key/provider/user_model.dart';
  8 +import 'package:one_key/res/colors.dart';
  9 +import 'package:one_key/utils/event_bus.dart';
  10 +import 'package:one_key/utils/utils.dart';
  11 +import 'package:one_key/widgets/system_app_bar.dart';
  12 +import 'package:provider/provider.dart';
  13 +
  14 +class FunctionUpgradePage extends StatefulWidget {
  15 + const FunctionUpgradePage({super.key, required this.collectStoreProvider});
  16 +
  17 + final CollectStoreProvider collectStoreProvider;
  18 +
  19 + @override
  20 + State<FunctionUpgradePage> createState() => _FunctionUpgradePageState();
  21 +}
  22 +
  23 +class _FunctionUpgradePageState extends State<FunctionUpgradePage> {
  24 + final List<_UpgradeModule> _modules = [];
  25 + bool _loading = true;
  26 + bool _loadFailed = false;
  27 +
  28 + late FluwxCancelable _wxPay;
  29 + final Fluwx _fluwx = Fluwx();
  30 +
  31 + _UpgradeModule? get _selectedModule {
  32 + for (final module in _modules) {
  33 + if (module.selected) {
  34 + return module;
  35 + }
  36 + }
  37 + return null;
  38 + }
  39 +
  40 + double get _total => _selectedModule?.price ?? 0;
  41 +
  42 + bool get _hasSelection => _selectedModule != null;
  43 +
  44 + @override
  45 + void initState() {
  46 + super.initState();
  47 + Utils.changeStatusColor(color: Colors.transparent);
  48 + _wxPay = _fluwx.addSubscriber((res) {
  49 + _wxPay.cancel();
  50 + if (res is WeChatPaymentResponse) {
  51 + if (res.errCode == 0) {
  52 + _handlePaySuccess();
  53 + } else if (res.errCode == -1) {
  54 + Utils.showToast('支付错误');
  55 + } else if (res.errCode == -2) {
  56 + Utils.showToast('您已取消支付');
  57 + }
  58 + }
  59 + });
  60 + WidgetsBinding.instance.addPostFrameCallback((_) {
  61 + _loadModules();
  62 + });
  63 + }
  64 +
  65 + Future<void> _loadModules() async {
  66 + setState(() {
  67 + _loading = true;
  68 + _loadFailed = false;
  69 + });
  70 +
  71 + final List<SellerVersionSunModel>? list =
  72 + await widget.collectStoreProvider.getFunctionUpgradeList(context);
  73 +
  74 + if (!mounted) {
  75 + return;
  76 + }
  77 +
  78 + setState(() {
  79 + _modules.clear();
  80 + if (list != null) {
  81 + for (final item in list) {
  82 + final _UpgradeModule? module = _mapModule(item);
  83 + if (module != null) {
  84 + module.selected = false;
  85 + _modules.add(module);
  86 + }
  87 + }
  88 + }
  89 + _loading = false;
  90 + _loadFailed = list == null;
  91 + });
  92 + }
  93 +
  94 + _UpgradeModule? _mapModule(SellerVersionSunModel item) {
  95 + final String? vid = item.vid;
  96 + final String? name = item.vname;
  97 + if (vid == null || name == null || name.trim().isEmpty) {
  98 + return null;
  99 + }
  100 +
  101 + final String vtype = item.vtype ?? '';
  102 + final String desc;
  103 + if (vtype == '1') {
  104 + desc = '包含现有全部功能组件模块以及未来扩展的功能模块。';
  105 + } else if (vtype == '3') {
  106 + desc = '$name为独立功能模块,开通后有效期一年。';
  107 + } else {
  108 + desc = '$name套餐,开通后有效期一年。';
  109 + }
  110 +
  111 + return _UpgradeModule(
  112 + vid: vid,
  113 + name: name,
  114 + desc: desc,
  115 + price: item.price ?? 0,
  116 + );
  117 + }
  118 +
  119 + void _toggleModule(int index) {
  120 + final bool selected = _modules[index].selected;
  121 + setState(() {
  122 + for (final module in _modules) {
  123 + module.selected = false;
  124 + }
  125 + _modules[index].selected = !selected;
  126 + });
  127 + }
  128 +
  129 + Future<void> _pay() async {
  130 + final _UpgradeModule? selected = _selectedModule;
  131 + if (selected == null) {
  132 + Utils.showToast('请先选择需要开通的模块');
  133 + return;
  134 + }
  135 + if (selected.price <= 0) {
  136 + Utils.showToast('当前模块暂不支持购买');
  137 + return;
  138 + }
  139 +
  140 + final bool isInstalled = await _fluwx.isWeChatInstalled;
  141 + if (!isInstalled) {
  142 + Utils.showToast('请先安装微信');
  143 + return;
  144 + }
  145 +
  146 + final String? sellerid =
  147 + Provider.of<UserModel>(context, listen: false).user?.sellerid;
  148 + if (sellerid == null || sellerid.isEmpty) {
  149 + Utils.showToast('商家信息异常');
  150 + return;
  151 + }
  152 +
  153 + final bool success = await widget.collectStoreProvider.appPayJiSuVersion(
  154 + context,
  155 + {'sellerid': sellerid, 'vid': selected.vid},
  156 + );
  157 +
  158 + if (!success || !mounted) {
  159 + return;
  160 + }
  161 +
  162 + final WechatPaySunModel? sunModel = widget.collectStoreProvider.sunModel;
  163 + if (sunModel == null ||
  164 + sunModel.appId == null ||
  165 + sunModel.package == null ||
  166 + sunModel.timeStamp == null ||
  167 + sunModel.nonceStr == null) {
  168 + Utils.showToast('支付参数异常');
  169 + return;
  170 + }
  171 +
  172 + final String prepayId = sunModel.package!.substring(10);
  173 + final Map<String, String?> signParams = {
  174 + 'appid': sunModel.appId,
  175 + 'partnerid': '1489752232',
  176 + 'prepayid': prepayId,
  177 + 'timestamp': sunModel.timeStamp,
  178 + 'noncestr': sunModel.nonceStr,
  179 + 'package': 'Sign=WXPay',
  180 + };
  181 + final String sign = Utils.keySort(signParams);
  182 +
  183 + _fluwx
  184 + .pay(
  185 + which: Payment(
  186 + appId: sunModel.appId!,
  187 + partnerId: '1489752232',
  188 + prepayId: prepayId,
  189 + packageValue: 'Sign=WXPay',
  190 + nonceStr: sunModel.nonceStr!,
  191 + timestamp: int.parse(sunModel.timeStamp!),
  192 + sign: sign,
  193 + ),
  194 + )
  195 + .then((data) {
  196 + print('version pay: $data');
  197 + }).catchError((error) {
  198 + print(error.toString());
  199 + Utils.showToast('支付调起失败');
  200 + });
  201 + }
  202 +
  203 + Future<void> _handlePaySuccess() async {
  204 + Utils.showToast('购买成功');
  205 + await widget.collectStoreProvider
  206 + .refreshSellerVersion(context, showLoading: false);
  207 + EventBus().emit('refreshSellerVersion');
  208 +
  209 + if (!mounted) {
  210 + return;
  211 + }
  212 + if (Navigator.canPop(context)) {
  213 + Navigator.pop(context);
  214 + }
  215 + }
  216 +
  217 + String _formatPrice(double price) {
  218 + if (price == price.roundToDouble()) {
  219 + return price.toInt().toString();
  220 + }
  221 + return price.toStringAsFixed(2);
  222 + }
  223 +
  224 + @override
  225 + void dispose() {
  226 + _wxPay.cancel();
  227 + EventBus().emit('changeStatusColor');
  228 + super.dispose();
  229 + }
  230 +
  231 + @override
  232 + Widget build(BuildContext context) {
  233 + return Scaffold(
  234 + backgroundColor: MyColours.color_F0F0F0,
  235 + appBar: SystemAppBar('功能升级'),
  236 + body: Column(
  237 + children: [
  238 + Expanded(child: _buildBody()),
  239 + _buildBottomBar(),
  240 + ],
  241 + ),
  242 + );
  243 + }
  244 +
  245 + Widget _buildBody() {
  246 + if (_loading) {
  247 + return const Center(
  248 + child: CircularProgressIndicator(color: MyColours.color_529EA4),
  249 + );
  250 + }
  251 +
  252 + return SingleChildScrollView(
  253 + padding: EdgeInsets.all(ScreenUtil().setWidth(24)),
  254 + child: Column(
  255 + crossAxisAlignment: CrossAxisAlignment.start,
  256 + children: [
  257 + Container(
  258 + width: double.infinity,
  259 + padding: EdgeInsets.symmetric(
  260 + horizontal: ScreenUtil().setWidth(24),
  261 + vertical: ScreenUtil().setWidth(18),
  262 + ),
  263 + decoration: BoxDecoration(
  264 + color: MyColours.color_529EA4,
  265 + borderRadius: BorderRadius.circular(
  266 + ScreenUtil().setWidth(10),
  267 + ),
  268 + ),
  269 + child: Text(
  270 + '请选择购买的组件模块,所有模块购买激活后均有一年有效期。',
  271 + style: TextStyle(
  272 + color: MyColours.color_ffffff,
  273 + fontSize: ScreenUtil().setSp(26),
  274 + height: 1.5,
  275 + ),
  276 + ),
  277 + ),
  278 + SizedBox(height: ScreenUtil().setWidth(24)),
  279 + if (_loadFailed)
  280 + _buildRetry()
  281 + else if (_modules.isEmpty)
  282 + _buildEmpty()
  283 + else
  284 + for (int index = 0; index < _modules.length; index++)
  285 + _buildModuleCard(index),
  286 + ],
  287 + ),
  288 + );
  289 + }
  290 +
  291 + Widget _buildRetry() {
  292 + return Container(
  293 + width: double.infinity,
  294 + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(80)),
  295 + alignment: Alignment.center,
  296 + child: Column(
  297 + children: [
  298 + Text(
  299 + '加载失败,请稍后重试',
  300 + style: TextStyle(
  301 + color: MyColours.color_999999,
  302 + fontSize: ScreenUtil().setSp(26),
  303 + ),
  304 + ),
  305 + SizedBox(height: ScreenUtil().setWidth(24)),
  306 + GestureDetector(
  307 + onTap: _loadModules,
  308 + child: Container(
  309 + padding: EdgeInsets.symmetric(
  310 + horizontal: ScreenUtil().setWidth(40),
  311 + vertical: ScreenUtil().setWidth(16),
  312 + ),
  313 + decoration: BoxDecoration(
  314 + color: MyColours.color_529EA4,
  315 + borderRadius: BorderRadius.circular(
  316 + ScreenUtil().setWidth(8),
  317 + ),
  318 + ),
  319 + child: Text(
  320 + '重新加载',
  321 + style: TextStyle(
  322 + color: MyColours.color_ffffff,
  323 + fontSize: ScreenUtil().setSp(26),
  324 + ),
  325 + ),
  326 + ),
  327 + ),
  328 + ],
  329 + ),
  330 + );
  331 + }
  332 +
  333 + Widget _buildEmpty() {
  334 + return Container(
  335 + width: double.infinity,
  336 + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(80)),
  337 + alignment: Alignment.center,
  338 + child: Text(
  339 + '暂无可升级的功能',
  340 + style: TextStyle(
  341 + color: MyColours.color_999999,
  342 + fontSize: ScreenUtil().setSp(26),
  343 + ),
  344 + ),
  345 + );
  346 + }
  347 +
  348 + Widget _buildModuleCard(int index) {
  349 + final _UpgradeModule module = _modules[index];
  350 + final bool selected = module.selected;
  351 +
  352 + return GestureDetector(
  353 + onTap: () => _toggleModule(index),
  354 + child: Container(
  355 + margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(20)),
  356 + padding: EdgeInsets.all(ScreenUtil().setWidth(24)),
  357 + decoration: BoxDecoration(
  358 + color: MyColours.color_ffffff,
  359 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(12)),
  360 + border: Border.all(
  361 + color: selected ? MyColours.color_529EA4 : MyColours.color_d9d9d9,
  362 + width: ScreenUtil().setWidth(2),
  363 + ),
  364 + ),
  365 + child: Row(
  366 + crossAxisAlignment: CrossAxisAlignment.center,
  367 + children: [
  368 + Image.asset(
  369 + Utils.getImgPath(selected ? 'base_radio_sel' : 'base_radio_un'),
  370 + width: ScreenUtil().setWidth(36),
  371 + height: ScreenUtil().setWidth(36),
  372 + ),
  373 + SizedBox(width: ScreenUtil().setWidth(18)),
  374 + Expanded(
  375 + child: Column(
  376 + crossAxisAlignment: CrossAxisAlignment.start,
  377 + children: [
  378 + Row(
  379 + crossAxisAlignment: CrossAxisAlignment.start,
  380 + children: [
  381 + Expanded(
  382 + child: Text(
  383 + module.name,
  384 + style: TextStyle(
  385 + color: MyColours.color_353535,
  386 + fontSize: ScreenUtil().setSp(30),
  387 + fontWeight: FontWeight.bold,
  388 + ),
  389 + ),
  390 + ),
  391 + SizedBox(width: ScreenUtil().setWidth(16)),
  392 + Text(
  393 + '¥${_formatPrice(module.price)}',
  394 + style: TextStyle(
  395 + color: MyColours.color_529EA4,
  396 + fontSize: ScreenUtil().setSp(30),
  397 + fontWeight: FontWeight.bold,
  398 + ),
  399 + ),
  400 + ],
  401 + ),
  402 + SizedBox(height: ScreenUtil().setWidth(12)),
  403 + Text(
  404 + module.desc,
  405 + style: TextStyle(
  406 + color: MyColours.color_999999,
  407 + fontSize: ScreenUtil().setSp(24),
  408 + height: 1.4,
  409 + ),
  410 + ),
  411 + ],
  412 + ),
  413 + ),
  414 + ],
  415 + ),
  416 + ),
  417 + );
  418 + }
  419 +
  420 + Widget _buildBottomBar() {
  421 + return Container(
  422 + color: const Color(0xFF98C0C8),
  423 + padding: EdgeInsets.fromLTRB(
  424 + ScreenUtil().setWidth(24),
  425 + ScreenUtil().setWidth(16),
  426 + ScreenUtil().setWidth(24),
  427 + ScreenUtil().setWidth(16),
  428 + ),
  429 + child: SafeArea(
  430 + top: false,
  431 + child: Row(
  432 + children: [
  433 + Text(
  434 + '¥${_formatPrice(_total)}',
  435 + style: TextStyle(
  436 + color: MyColours.color_ffffff,
  437 + fontSize: ScreenUtil().setSp(36),
  438 + fontWeight: FontWeight.bold,
  439 + ),
  440 + ),
  441 + const Spacer(),
  442 + GestureDetector(
  443 + onTap: _hasSelection ? _pay : null,
  444 + child: Container(
  445 + width: ScreenUtil().setWidth(220),
  446 + height: ScreenUtil().setWidth(78),
  447 + alignment: Alignment.center,
  448 + decoration: BoxDecoration(
  449 + color: MyColours.color_ffffff,
  450 + borderRadius:
  451 + BorderRadius.circular(ScreenUtil().setWidth(39)),
  452 + ),
  453 + child: Text(
  454 + '立即支付',
  455 + style: TextStyle(
  456 + color: _hasSelection
  457 + ? MyColours.color_515151
  458 + : MyColours.color_999999,
  459 + fontSize: ScreenUtil().setSp(30),
  460 + fontWeight: FontWeight.bold,
  461 + ),
  462 + ),
  463 + ),
  464 + ),
  465 + ],
  466 + ),
  467 + ),
  468 + );
  469 + }
  470 +}
  471 +
  472 +class _UpgradeModule {
  473 + _UpgradeModule({
  474 + required this.vid,
  475 + required this.name,
  476 + required this.desc,
  477 + required this.price,
  478 + });
  479 +
  480 + final String vid;
  481 + final String name;
  482 + final String desc;
  483 + final double price;
  484 + bool selected = false;
  485 +}
@@ -26,6 +26,7 @@ import 'package:one_key/widgets/h_empty_view.dart'; @@ -26,6 +26,7 @@ import 'package:one_key/widgets/h_empty_view.dart';
26 import 'package:one_key/widgets/my_item.dart'; 26 import 'package:one_key/widgets/my_item.dart';
27 import 'package:one_key/widgets/round_button.dart'; 27 import 'package:one_key/widgets/round_button.dart';
28 import 'package:one_key/widgets/v_empty_view.dart'; 28 import 'package:one_key/widgets/v_empty_view.dart';
  29 +import 'package:one_key/pages/my/function_upgrade_page.dart';
29 import 'package:provider/provider.dart'; 30 import 'package:provider/provider.dart';
30 31
31 import '../../app.dart'; 32 import '../../app.dart';
@@ -132,6 +133,10 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -132,6 +133,10 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
132 _getCustomerActivityBaseinfo(); 133 _getCustomerActivityBaseinfo();
133 // getMyPageCountData(); 134 // getMyPageCountData();
134 }); 135 });
  136 + EventBus().on('refreshSellerVersion', (arg) {
  137 + getSellerVersion();
  138 + getMyPageCountData();
  139 + });
135 } 140 }
136 141
137 @override 142 @override
@@ -143,6 +148,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -143,6 +148,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
143 EventBus().off('refreshMySms'); 148 EventBus().off('refreshMySms');
144 149
145 EventBus().off('refreshMyImage'); 150 EventBus().off('refreshMyImage');
  151 + EventBus().off('refreshSellerVersion');
146 } 152 }
147 153
148 @override 154 @override
@@ -2302,6 +2308,41 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -2302,6 +2308,41 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
2302 ], 2308 ],
2303 )), 2309 )),
2304 VEmptyView(48), 2310 VEmptyView(48),
  2311 + InkWell(
  2312 + onTap: () {
  2313 + Navigator.push(
  2314 + context,
  2315 + MaterialPageRoute(
  2316 + builder: (_) => FunctionUpgradePage(
  2317 + collectStoreProvider:
  2318 + collectStoreProvider),
  2319 + ),
  2320 + );
  2321 + },
  2322 + child: Row(
  2323 + children: [
  2324 + Image.asset(
  2325 + Utils.getImgPath('bbsj'),
  2326 + width: ScreenUtil().setWidth(22 * 2),
  2327 + ),
  2328 + HEmptyView(26),
  2329 + Text(
  2330 + '功能升级',
  2331 + style: TextStyle(
  2332 + fontWeight: FontWeight.bold,
  2333 + color: MyColours.color_515151,
  2334 + fontSize:
  2335 + ScreenUtil().setWidth(28)),
  2336 + ),
  2337 + Spacer(),
  2338 + Image.asset(
  2339 + "assets/arrow_right_new.png",
  2340 + width: ScreenUtil().setWidth(14),
  2341 + height: ScreenUtil().setWidth(22),
  2342 + )
  2343 + ],
  2344 + )),
  2345 + VEmptyView(48),
2305 Consumer<UserModel>( 2346 Consumer<UserModel>(
2306 builder: (BuildContext context, UserModel model, 2347 builder: (BuildContext context, UserModel model,
2307 Widget? child) { 2348 Widget? child) {
@@ -112,15 +112,11 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { @@ -112,15 +112,11 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
112 112
113 ///从时间选择器中获取分钟数字符串 00 or 30 113 ///从时间选择器中获取分钟数字符串 00 or 30
114 String _getMinuteStrFromPicker(List value) { 114 String _getMinuteStrFromPicker(List value) {
115 - if (value[1] == 0) { 115 + int? minute = SetTimeWidget.dateData[value[0]].values.last[value[1]];
  116 + if (minute == 0) {
116 return '00'; 117 return '00';
117 - } else if (value[1] == 1) {  
118 - return '15';  
119 - }  
120 - if (value[1] == 2) {  
121 - return '30';  
122 } 118 }
123 - return '45'; 119 + return '${minute}';
124 } 120 }
125 121
126 @override 122 @override
@@ -1930,7 +1926,8 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { @@ -1930,7 +1926,8 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
1930 FocusScope.of(context).requestFocus( 1926 FocusScope.of(context).requestFocus(
1931 FocusNode()); //点击空白处隐藏键盘 1927 FocusNode()); //点击空白处隐藏键盘
1932 }, 1928 },
1933 - keyboardType: TextInputType.numberWithOptions(), 1929 + keyboardType:
  1930 + TextInputType.numberWithOptions(),
1934 ), 1931 ),
1935 )), 1932 )),
1936 HEmptyView(20), 1933 HEmptyView(20),
@@ -2016,7 +2013,8 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { @@ -2016,7 +2013,8 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
2016 .requestFocus( 2013 .requestFocus(
2017 FocusNode()); //点击空白处隐藏键盘 2014 FocusNode()); //点击空白处隐藏键盘
2018 }, 2015 },
2019 - keyboardType: TextInputType.numberWithOptions(), 2016 + keyboardType: TextInputType
  2017 + .numberWithOptions(),
2020 ), 2018 ),
2021 )), 2019 )),
2022 HEmptyView(20), 2020 HEmptyView(20),
@@ -93,10 +93,14 @@ class TableManagerPage extends StatefulWidget { @@ -93,10 +93,14 @@ class TableManagerPage extends StatefulWidget {
93 } 93 }
94 } 94 }
95 95
96 -class TableManagerPageState extends State<TableManagerPage> { 96 +class TableManagerPageState extends State<TableManagerPage>
  97 + with WidgetsBindingObserver {
97 TableManagerModelOrReserve? tableManagerModel; 98 TableManagerModelOrReserve? tableManagerModel;
98 final ItemScrollController itemScrollController = ItemScrollController(); 99 final ItemScrollController itemScrollController = ItemScrollController();
99 bool isTap = false; 100 bool isTap = false;
  101 + bool _isFollowingToday = true;
  102 + late DateTime _lastObservedDay;
  103 + Timer? _dayCheckTimer;
100 // 进度监听对象 104 // 进度监听对象
101 int? min; 105 int? min;
102 int? max; 106 int? max;
@@ -200,6 +204,10 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -200,6 +204,10 @@ class TableManagerPageState extends State<TableManagerPage> {
200 dateTime = DateTime.now(); 204 dateTime = DateTime.now();
201 dateText = returnDate(dateTime); 205 dateText = returnDate(dateTime);
202 dateTimeSelect = dateTime; 206 dateTimeSelect = dateTime;
  207 + _lastObservedDay = DateTime(dateTime.year, dateTime.month, dateTime.day);
  208 +
  209 + WidgetsBinding.instance.addObserver(this);
  210 + _startDayCheckTimer();
203 211
204 personNumList = Utils.getPersonNumList(); 212 personNumList = Utils.getPersonNumList();
205 213
@@ -262,6 +270,7 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -262,6 +270,7 @@ class TableManagerPageState extends State<TableManagerPage> {
262 }; 270 };
263 await storeBaseIndoProvider.getMealSectionByDay(context, pramas, 271 await storeBaseIndoProvider.getMealSectionByDay(context, pramas,
264 showLoading: false); 272 showLoading: false);
  273 + if (!mounted) return;
265 initTimeTable(needInit: needInit); 274 initTimeTable(needInit: needInit);
266 } 275 }
267 276
@@ -431,6 +440,9 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -431,6 +440,9 @@ class TableManagerPageState extends State<TableManagerPage> {
431 //生成日期文本 440 //生成日期文本
432 createDateText1(BuildContext context, DateTime day) { 441 createDateText1(BuildContext context, DateTime day) {
433 if (Utils.isOneDay(day, dateTime)) return; //日期没变 442 if (Utils.isOneDay(day, dateTime)) return; //日期没变
  443 + final DateTime now = DateTime.now();
  444 + _isFollowingToday = Utils.isOneDay(day, now);
  445 + _lastObservedDay = DateTime(now.year, now.month, now.day);
434 dateTimeSelect = day; 446 dateTimeSelect = day;
435 447
436 dateText = returnDate(day); 448 dateText = returnDate(day);
@@ -473,6 +485,51 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -473,6 +485,51 @@ class TableManagerPageState extends State<TableManagerPage> {
473 return date; 485 return date;
474 } 486 }
475 487
  488 + void _startDayCheckTimer() {
  489 + _dayCheckTimer?.cancel();
  490 + _dayCheckTimer = Timer.periodic(const Duration(minutes: 1), (_) {
  491 + _checkDateRollover();
  492 + });
  493 + }
  494 +
  495 + void _refreshDateTexts() {
  496 + dateText = returnDate(dateTime);
  497 + selectDateStr = returnDayDateStr(dateTime);
  498 + if (currTimeIndex != null &&
  499 + (storeBaseIndoProvider.dayDateData?.length ?? 0) > 0) {
  500 + selectWeekAndLunarCalendar = returnWeekAndLunarCalendar(dateTime, context);
  501 + }
  502 + if (mounted) {
  503 + setState(() {});
  504 + }
  505 + }
  506 +
  507 + void _checkDateRollover() {
  508 + if (!mounted) return;
  509 +
  510 + final DateTime now = DateTime.now();
  511 + if (Utils.isOneDay(now, _lastObservedDay)) return;
  512 + _lastObservedDay = DateTime(now.year, now.month, now.day);
  513 +
  514 + if (_isFollowingToday) {
  515 + dateTime = now;
  516 + dateTimeSelect = dateTime;
  517 + _refreshDateTexts();
  518 + getMealSectionByDay();
  519 + } else {
  520 + // 用户手动选了其他日期时,只重算“今天/明天/后天”文案,不抢回今天。
  521 + _refreshDateTexts();
  522 + }
  523 + }
  524 +
  525 + @override
  526 + void didChangeAppLifecycleState(AppLifecycleState state) {
  527 + super.didChangeAppLifecycleState(state);
  528 + if (state == AppLifecycleState.resumed) {
  529 + _checkDateRollover();
  530 + }
  531 + }
  532 +
476 _getDoltStr(BuildContext context) { 533 _getDoltStr(BuildContext context) {
477 if ((storeBaseIndoProvider.dayDateData?.length ?? 0) > 0) { 534 if ((storeBaseIndoProvider.dayDateData?.length ?? 0) > 0) {
478 int index = storeBaseIndoProvider.dayDateData! 535 int index = storeBaseIndoProvider.dayDateData!
@@ -519,6 +576,8 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -519,6 +576,8 @@ class TableManagerPageState extends State<TableManagerPage> {
519 @override 576 @override
520 void dispose() { 577 void dispose() {
521 // TODO: implement dispose 578 // TODO: implement dispose
  579 + WidgetsBinding.instance.removeObserver(this);
  580 + _dayCheckTimer?.cancel();
522 super.dispose(); 581 super.dispose();
523 EventBus().off("refresh_tablemanager"); 582 EventBus().off("refresh_tablemanager");
524 EventBus().off("refresh_tablePhoto"); 583 EventBus().off("refresh_tablePhoto");
@@ -160,6 +160,9 @@ class HomePageSimState extends State<HomePageSim> with WidgetsBindingObserver { @@ -160,6 +160,9 @@ class HomePageSimState extends State<HomePageSim> with WidgetsBindingObserver {
160 // } 160 // }
161 161
162 WidgetsBinding.instance.addObserver(this); 162 WidgetsBinding.instance.addObserver(this);
  163 + EventBus().on('refreshSellerVersion', (arg) {
  164 + getSellerVersion();
  165 + });
163 166
164 _currIndex = widget.initialIndex; 167 _currIndex = widget.initialIndex;
165 168
@@ -2068,6 +2071,7 @@ class HomePageSimState extends State<HomePageSim> with WidgetsBindingObserver { @@ -2068,6 +2071,7 @@ class HomePageSimState extends State<HomePageSim> with WidgetsBindingObserver {
2068 LogUtil.v("home_dispose"); 2071 LogUtil.v("home_dispose");
2069 2072
2070 // bus.off('refresh_token'); 2073 // bus.off('refresh_token');
  2074 + EventBus().off('refreshSellerVersion');
2071 if (timer != null) { 2075 if (timer != null) {
2072 timer!.cancel(); 2076 timer!.cancel();
2073 } 2077 }
@@ -28,6 +28,7 @@ import 'package:one_key/widgets/h_empty_view.dart'; @@ -28,6 +28,7 @@ import 'package:one_key/widgets/h_empty_view.dart';
28 import 'package:one_key/widgets/my_item.dart'; 28 import 'package:one_key/widgets/my_item.dart';
29 import 'package:one_key/widgets/round_button.dart'; 29 import 'package:one_key/widgets/round_button.dart';
30 import 'package:one_key/widgets/v_empty_view.dart'; 30 import 'package:one_key/widgets/v_empty_view.dart';
  31 +import 'package:one_key/pages/my/function_upgrade_page.dart';
31 import 'package:provider/provider.dart'; 32 import 'package:provider/provider.dart';
32 33
33 import '../../app.dart'; 34 import '../../app.dart';
@@ -131,6 +132,10 @@ class MyPageSimState extends State<MyPageSim> with WidgetsBindingObserver { @@ -131,6 +132,10 @@ class MyPageSimState extends State<MyPageSim> with WidgetsBindingObserver {
131 EventBus().on('refreshMySms', (arg) { 132 EventBus().on('refreshMySms', (arg) {
132 getMyPageCountData(); 133 getMyPageCountData();
133 }); 134 });
  135 + EventBus().on('refreshSellerVersion', (arg) {
  136 + getSellerVersion();
  137 + getMyPageCountData();
  138 + });
134 } 139 }
135 140
136 void wxSubscriptionClose() => _wxPay?.cancel(); 141 void wxSubscriptionClose() => _wxPay?.cancel();
@@ -142,6 +147,7 @@ class MyPageSimState extends State<MyPageSim> with WidgetsBindingObserver { @@ -142,6 +147,7 @@ class MyPageSimState extends State<MyPageSim> with WidgetsBindingObserver {
142 // AzhonAppUpdate.dispose(); 147 // AzhonAppUpdate.dispose();
143 EventBus().off('changeStatusColor'); 148 EventBus().off('changeStatusColor');
144 EventBus().off('refreshMySms'); 149 EventBus().off('refreshMySms');
  150 + EventBus().off('refreshSellerVersion');
145 wxSubscriptionClose(); 151 wxSubscriptionClose();
146 } 152 }
147 153
@@ -1793,6 +1799,41 @@ class MyPageSimState extends State<MyPageSim> with WidgetsBindingObserver { @@ -1793,6 +1799,41 @@ class MyPageSimState extends State<MyPageSim> with WidgetsBindingObserver {
1793 ], 1799 ],
1794 )), 1800 )),
1795 VEmptyView(48), 1801 VEmptyView(48),
  1802 + InkWell(
  1803 + onTap: () {
  1804 + Navigator.push(
  1805 + context,
  1806 + MaterialPageRoute(
  1807 + builder: (_) => FunctionUpgradePage(
  1808 + collectStoreProvider:
  1809 + collectStoreProvider),
  1810 + ),
  1811 + );
  1812 + },
  1813 + child: Row(
  1814 + children: [
  1815 + Image.asset(
  1816 + Utils.getImgPath('bbsj'),
  1817 + width: ScreenUtil().setWidth(28 * 2),
  1818 + ),
  1819 + HEmptyView(26),
  1820 + Text(
  1821 + '功能升级',
  1822 + style: TextStyle(
  1823 + fontWeight: FontWeight.bold,
  1824 + color: MyColours.color_515151,
  1825 + fontSize:
  1826 + ScreenUtil().setWidth(28)),
  1827 + ),
  1828 + Spacer(),
  1829 + Image.asset(
  1830 + "assets/arrow_right_new.png",
  1831 + width: ScreenUtil().setWidth(14),
  1832 + height: ScreenUtil().setWidth(22),
  1833 + )
  1834 + ],
  1835 + )),
  1836 + VEmptyView(48),
1796 Consumer<UserModel>( 1837 Consumer<UserModel>(
1797 builder: (BuildContext context, UserModel model, 1838 builder: (BuildContext context, UserModel model,
1798 Widget? child) { 1839 Widget? child) {
@@ -101,15 +101,11 @@ class _StoreBaseInfoPageSimState extends State<StoreBaseInfoPageSim> { @@ -101,15 +101,11 @@ class _StoreBaseInfoPageSimState extends State<StoreBaseInfoPageSim> {
101 101
102 ///从时间选择器中获取分钟数字符串 00 or 30 102 ///从时间选择器中获取分钟数字符串 00 or 30
103 String _getMinuteStrFromPicker(List value) { 103 String _getMinuteStrFromPicker(List value) {
104 - if (value[1] == 0) { 104 + int? minute = SetTimeWidget.dateData[value[0]].values.last[value[1]];
  105 + if (minute == 0) {
105 return '00'; 106 return '00';
106 - } else if (value[1] == 1) {  
107 - return '15';  
108 - }  
109 - if (value[1] == 2) {  
110 - return '30';  
111 } 107 }
112 - return '45'; 108 + return '${minute}';
113 } 109 }
114 110
115 @override 111 @override
@@ -238,7 +238,7 @@ class CollectStoreProvider with ChangeNotifier { @@ -238,7 +238,7 @@ class CollectStoreProvider with ChangeNotifier {
238 // List<SellerVersionSunModel> tempList = 238 // List<SellerVersionSunModel> tempList =
239 // SellerVersionModel.fromJson(baseResp.responseData).data; 239 // SellerVersionModel.fromJson(baseResp.responseData).data;
240 240
241 - if (tempList != null && tempList.length > 0) { 241 + if (tempList.length > 0) {
242 tempList.forEach((element) { 242 tempList.forEach((element) {
243 DateTime dateTime = DateTime.fromMillisecondsSinceEpoch( 243 DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
244 int.parse(element.rdate.toString()) * 1000); 244 int.parse(element.rdate.toString()) * 1000);
@@ -274,7 +274,7 @@ class CollectStoreProvider with ChangeNotifier { @@ -274,7 +274,7 @@ class CollectStoreProvider with ChangeNotifier {
274 } 274 }
275 //准备好数据 275 //准备好数据
276 276
277 - if (sellerVersionList != null && sellerVersionList.length > 0) { 277 + if (sellerVersionList.length > 0) {
278 List<String?> versionCodeList = []; 278 List<String?> versionCodeList = [];
279 sellerVersionList.forEach((element) { 279 sellerVersionList.forEach((element) {
280 versionCodeList.add(element.vid); 280 versionCodeList.add(element.vid);
@@ -535,7 +535,7 @@ class CollectStoreProvider with ChangeNotifier { @@ -535,7 +535,7 @@ class CollectStoreProvider with ChangeNotifier {
535 } 535 }
536 //准备好数据 536 //准备好数据
537 537
538 - if (sellerVersionList != null && sellerVersionList.length > 0) { 538 + if (sellerVersionList.length > 0) {
539 List<String?> versionCodeList = []; 539 List<String?> versionCodeList = [];
540 sellerVersionList.forEach((element) { 540 sellerVersionList.forEach((element) {
541 versionCodeList.add(element.vid); 541 versionCodeList.add(element.vid);
@@ -740,6 +740,71 @@ class CollectStoreProvider with ChangeNotifier { @@ -740,6 +740,71 @@ class CollectStoreProvider with ChangeNotifier {
740 } 740 }
741 } 741 }
742 742
  743 + // 获取功能升级页可购买的版本/模块列表
  744 + Future<List<SellerVersionSunModel>?> getFunctionUpgradeList(
  745 + BuildContext context,
  746 + {bool showLoading = true}) async {
  747 + try {
  748 + final BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>(
  749 + context, Method.post, HttpUrl.get_version_list,
  750 + data: const <String, String?>{}, showLoading: showLoading);
  751 + if (baseResp.code == Constant.status_success) {
  752 + final Map<String, dynamic> response =
  753 + baseResp.responseData as Map<String, dynamic>;
  754 + final List<dynamic>? rawList = response['data'] as List<dynamic>?;
  755 + final List<SellerVersionSunModel> list = <SellerVersionSunModel>[];
  756 + if (rawList != null) {
  757 + for (final item in rawList) {
  758 + if (item is! Map) {
  759 + continue;
  760 + }
  761 + final Map<String, dynamic> map = Map<String, dynamic>.from(item);
  762 + final dynamic id = map['id'];
  763 + final dynamic name = map['name'];
  764 + if (id == null || name == null) {
  765 + continue;
  766 + }
  767 + list.add(SellerVersionSunModel(
  768 + vid: '$id',
  769 + vname: '$name',
  770 + vtype: map['type'] == null ? null : '${map['type']}',
  771 + price: map['price'] is num
  772 + ? (map['price'] as num).toDouble()
  773 + : double.tryParse('${map['price']}'),
  774 + ));
  775 + }
  776 + }
  777 + return list;
  778 + }
  779 + Utils.showToast(baseResp.msg ?? '请求失败,请重试');
  780 + } catch (error) {
  781 + print(error.toString());
  782 + Utils.showToast('请求失败,请重试');
  783 + }
  784 + return null;
  785 + }
  786 +
  787 + // 刷新商家版本信息,并同步通知依赖页面的 UI。
  788 + Future<bool> refreshSellerVersion(BuildContext context,
  789 + {bool showLoading = true}) async {
  790 + final bool success =
  791 + await getSellerVersion(context, showLoading: showLoading);
  792 +
  793 + final user = Provider.of<UserModel>(context, listen: false).user;
  794 + if (user != null) {
  795 + final Map<String, String?> params = {
  796 + 'sellerid': user.sellerid,
  797 + };
  798 + if (Utils.getAuthority(context, '个人-月订单量')) {
  799 + params['uid'] = user.openid;
  800 + }
  801 + await getMyPageCountData(context, params, showLoading: showLoading);
  802 + }
  803 +
  804 + notifyListeners();
  805 + return success;
  806 + }
  807 +
743 /// App调起支付(购买版本) 808 /// App调起支付(购买版本)
744 Future<bool> appPayJiSuVersion( 809 Future<bool> appPayJiSuVersion(
745 BuildContext context, Map<String, String?> params, 810 BuildContext context, Map<String, String?> params,
@@ -748,7 +813,7 @@ class CollectStoreProvider with ChangeNotifier { @@ -748,7 +813,7 @@ class CollectStoreProvider with ChangeNotifier {
748 BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>( 813 BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>(
749 context, Method.post, HttpUrl.app_pay_jisu_version, 814 context, Method.post, HttpUrl.app_pay_jisu_version,
750 data: params, showLoading: isShowLoading); 815 data: params, showLoading: isShowLoading);
751 - if (baseResp != null && baseResp.code == Constant.status_success) { 816 + if (baseResp.code == Constant.status_success) {
752 sunModel = WechatPayModel.fromJson( 817 sunModel = WechatPayModel.fromJson(
753 baseResp.responseData as Map<String, dynamic>) 818 baseResp.responseData as Map<String, dynamic>)
754 .data; 819 .data;
1 import 'dart:async'; 1 import 'dart:async';
2 2
3 -  
4 import 'dart:ui'; 3 import 'dart:ui';
5 4
6 import 'package:cached_network_image/cached_network_image.dart'; 5 import 'package:cached_network_image/cached_network_image.dart';
@@ -14,12 +13,12 @@ import 'package:flutter_lunar_datetime_picker/flutter_lunar_datetime_picker.dart @@ -14,12 +13,12 @@ import 'package:flutter_lunar_datetime_picker/flutter_lunar_datetime_picker.dart
14 import 'package:flutter_picker_plus/flutter_picker_plus.dart'; 13 import 'package:flutter_picker_plus/flutter_picker_plus.dart';
15 import 'package:flutter_screenutil/flutter_screenutil.dart'; 14 import 'package:flutter_screenutil/flutter_screenutil.dart';
16 15
17 -  
18 import 'package:one_key/models/filter_btn_model.dart'; 16 import 'package:one_key/models/filter_btn_model.dart';
19 import 'package:one_key/models/remark.dart'; 17 import 'package:one_key/models/remark.dart';
20 import 'package:one_key/models/seller_role_model.dart'; 18 import 'package:one_key/models/seller_role_model.dart';
21 import 'package:one_key/models/table_list.dart'; 19 import 'package:one_key/models/table_list.dart';
22 20
  21 +import 'package:one_key/pages/my/function_upgrade_page.dart';
23 import 'package:one_key/pages/message/message_dialog_item_f.dart'; 22 import 'package:one_key/pages/message/message_dialog_item_f.dart';
24 import 'package:one_key/provider/message_dialog_model.dart'; 23 import 'package:one_key/provider/message_dialog_model.dart';
25 24
@@ -78,6 +77,18 @@ typedef ClickkListCallbac = void Function(List<String?> value); @@ -78,6 +77,18 @@ typedef ClickkListCallbac = void Function(List<String?> value);
78 // }; 77 // };
79 78
80 class DialogUtil { 79 class DialogUtil {
  80 + static void goFunctionUpgradePage(BuildContext context) {
  81 + final CollectStoreProvider collectStoreProvider =
  82 + Provider.of<CollectStoreProvider>(context, listen: false);
  83 + Navigator.push(
  84 + context,
  85 + MaterialPageRoute(
  86 + builder: (_) =>
  87 + FunctionUpgradePage(collectStoreProvider: collectStoreProvider),
  88 + ),
  89 + );
  90 + }
  91 +
81 static List<Widget> labelSelectBtn(List<CustomerLabelSunModel> labelList, 92 static List<Widget> labelSelectBtn(List<CustomerLabelSunModel> labelList,
82 state, List<String?> datas, ClickkListCallbac callback) { 93 state, List<String?> datas, ClickkListCallbac callback) {
83 List<Widget> temp = []; 94 List<Widget> temp = [];
@@ -1084,6 +1095,7 @@ class DialogUtil { @@ -1084,6 +1095,7 @@ class DialogUtil {
1084 static showSellerVersionEdateDialog(BuildContext context, 1095 static showSellerVersionEdateDialog(BuildContext context,
1085 List<SellerVersionSunModel> showData, CustomCallBack callback, 1096 List<SellerVersionSunModel> showData, CustomCallBack callback,
1086 {GestureTapCallback? onTapLeft, GestureTapCallback? onTapRight}) { 1097 {GestureTapCallback? onTapLeft, GestureTapCallback? onTapRight}) {
  1098 + final BuildContext outerContext = context;
1087 List<String?> names = showData.map((e) => e.vname).toList(); 1099 List<String?> names = showData.map((e) => e.vname).toList();
1088 ScrollController controller = ScrollController(); 1100 ScrollController controller = ScrollController();
1089 return showDialog( 1101 return showDialog(
@@ -1204,17 +1216,12 @@ class DialogUtil { @@ -1204,17 +1216,12 @@ class DialogUtil {
1204 MyDivider(double.infinity, w(1), 1216 MyDivider(double.infinity, w(1),
1205 color: MyColours.color_DBDBDB), 1217 color: MyColours.color_DBDBDB),
1206 Row( 1218 Row(
1207 - // mainAxisAlignment: MainAxisAlignment.spaceBetween,  
1208 children: [ 1219 children: [
1209 Expanded( 1220 Expanded(
1210 flex: 1, 1221 flex: 1,
1211 child: RoundButton( 1222 child: RoundButton(
1212 text: '确定', 1223 text: '确定',
1213 - // width: (ScreenUtil().screenWidth -  
1214 - // ScreenUtil().setWidth(62) * 2) /  
1215 - // 2,  
1216 height: ScreenUtil().setWidth(112), 1224 height: ScreenUtil().setWidth(112),
1217 - // radius: ScreenUtil().setWidth(10),  
1218 gradientStart: Colors.transparent, 1225 gradientStart: Colors.transparent,
1219 gradientEnd: Colors.transparent, 1226 gradientEnd: Colors.transparent,
1220 textColor: MyColours.color_515151, 1227 textColor: MyColours.color_515151,
@@ -1225,6 +1232,25 @@ class DialogUtil { @@ -1225,6 +1232,25 @@ class DialogUtil {
1225 Navigator.pop(context); 1232 Navigator.pop(context);
1226 } 1233 }
1227 })), 1234 })),
  1235 + MyDivider(ScreenUtil().setWidth(2),
  1236 + ScreenUtil().setWidth(112),
  1237 + color: MyColours.color_DBDBDB),
  1238 + Expanded(
  1239 + flex: 1,
  1240 + child: RoundButton(
  1241 + text: '去购买',
  1242 + height: ScreenUtil().setWidth(112),
  1243 + gradientStart: Colors.transparent,
  1244 + gradientEnd: Colors.transparent,
  1245 + textColor: MyColours.color_438E93,
  1246 + fontSize: 32,
  1247 + onPressed: () {
  1248 + if (Navigator.canPop(context)) {
  1249 + Navigator.pop(context);
  1250 + }
  1251 + DialogUtil.goFunctionUpgradePage(
  1252 + outerContext);
  1253 + })),
1228 ], 1254 ],
1229 ), 1255 ),
1230 ]))); 1256 ])));
@@ -1419,6 +1445,7 @@ class DialogUtil { @@ -1419,6 +1445,7 @@ class DialogUtil {
1419 static showSellerVersionBuyDialog( 1445 static showSellerVersionBuyDialog(
1420 BuildContext context, String title, CustomCallBack callback, 1446 BuildContext context, String title, CustomCallBack callback,
1421 {GestureTapCallback? onTapLeft, GestureTapCallback? onTapRight}) { 1447 {GestureTapCallback? onTapLeft, GestureTapCallback? onTapRight}) {
  1448 + final BuildContext outerContext = context;
1422 return showDialog( 1449 return showDialog(
1423 context: context, 1450 context: context,
1424 barrierDismissible: true, 1451 barrierDismissible: true,
@@ -1501,41 +1528,25 @@ class DialogUtil { @@ -1501,41 +1528,25 @@ class DialogUtil {
1501 Navigator.pop(context); 1528 Navigator.pop(context);
1502 } 1529 }
1503 })), 1530 })),
1504 - // MyDivider(ScreenUtil().setWidth(2),  
1505 - // ScreenUtil().setWidth(112),  
1506 - // color: MyColours.color_DBDBDB),  
1507 - // Expanded(  
1508 - // flex: 1,  
1509 - // child: RoundButton(  
1510 - // text: '前往开通',  
1511 - // // width: (ScreenUtil().screenWidth -  
1512 - // // ScreenUtil().setWidth(62) * 2) /  
1513 - // // 2,  
1514 - // height: ScreenUtil().setWidth(112),  
1515 - // // radius: ScreenUtil().setWidth(10),  
1516 - // gradientStart: Colors.transparent,  
1517 - // gradientEnd: Colors.transparent,  
1518 - // textColor: MyColours.color_438E93,  
1519 - // fontSize: 32,  
1520 - // onPressed: () {  
1521 - // // Navigator.pop(context, {  
1522 - // // 'spec': menuSunModel.specCan != null &&  
1523 - // // menuSunModel.specCan.length > 0  
1524 - // // ? menuSunModel.specCan  
1525 - // // .where((element) =>  
1526 - // // element.select == true)  
1527 - // // .toList()  
1528 - // // : [],  
1529 - // // 'practice': menuSunModel.practice !=  
1530 - // // null &&  
1531 - // // menuSunModel.practice.length > 0  
1532 - // // ? menuSunModel.practice  
1533 - // // .where((element) =>  
1534 - // // element.select == true)  
1535 - // // .toList()  
1536 - // // : []  
1537 - // // });  
1538 - // })), 1531 + MyDivider(ScreenUtil().setWidth(2),
  1532 + ScreenUtil().setWidth(112),
  1533 + color: MyColours.color_DBDBDB),
  1534 + Expanded(
  1535 + flex: 1,
  1536 + child: RoundButton(
  1537 + text: '去购买',
  1538 + height: ScreenUtil().setWidth(112),
  1539 + gradientStart: Colors.transparent,
  1540 + gradientEnd: Colors.transparent,
  1541 + textColor: MyColours.color_438E93,
  1542 + fontSize: 32,
  1543 + onPressed: () {
  1544 + if (Navigator.canPop(context)) {
  1545 + Navigator.pop(context);
  1546 + }
  1547 + DialogUtil.goFunctionUpgradePage(
  1548 + outerContext);
  1549 + })),
1539 ], 1550 ],
1540 ), 1551 ),
1541 ]))); 1552 ])));
@@ -11378,6 +11389,7 @@ class DialogUtil { @@ -11378,6 +11389,7 @@ class DialogUtil {
11378 VoidCallback? lCallback, 11389 VoidCallback? lCallback,
11379 VoidCallback? rCallback}) async { 11390 VoidCallback? rCallback}) async {
11380 // bool isRed = content != '' ? false : true; 11391 // bool isRed = content != '' ? false : true;
  11392 + final BuildContext outerContext = context;
11381 final action = await showDialog( 11393 final action = await showDialog(
11382 context: context, 11394 context: context,
11383 barrierDismissible: false, 11395 barrierDismissible: false,
@@ -11464,15 +11476,13 @@ class DialogUtil { @@ -11464,15 +11476,13 @@ class DialogUtil {
11464 // Navigator.pop(context); 11476 // Navigator.pop(context);
11465 // }), 11477 // }),
11466 Row( 11478 Row(
11467 - // mainAxisAlignment: MainAxisAlignment.spaceBetween,  
11468 children: [ 11479 children: [
11469 RoundButton( 11480 RoundButton(
11470 text: lTitle, 11481 text: lTitle,
11471 width: (ScreenUtil().screenWidth - 11482 width: (ScreenUtil().screenWidth -
11472 ScreenUtil().setWidth(62) * 2) / 11483 ScreenUtil().setWidth(62) * 2) /
11473 - 2, 11484 + 3,
11474 height: ScreenUtil().setWidth(112), 11485 height: ScreenUtil().setWidth(112),
11475 - // radius: ScreenUtil().setWidth(10),  
11476 gradientStart: Colors.transparent, 11486 gradientStart: Colors.transparent,
11477 gradientEnd: Colors.transparent, 11487 gradientEnd: Colors.transparent,
11478 textColor: MyColours.color_E6000000, 11488 textColor: MyColours.color_E6000000,
@@ -11490,9 +11500,8 @@ class DialogUtil { @@ -11490,9 +11500,8 @@ class DialogUtil {
11490 text: rTitle, 11500 text: rTitle,
11491 width: (ScreenUtil().screenWidth - 11501 width: (ScreenUtil().screenWidth -
11492 ScreenUtil().setWidth(62) * 2) / 11502 ScreenUtil().setWidth(62) * 2) /
11493 - 2, 11503 + 3,
11494 height: ScreenUtil().setWidth(112), 11504 height: ScreenUtil().setWidth(112),
11495 - // radius: ScreenUtil().setWidth(10),  
11496 gradientStart: Colors.transparent, 11505 gradientStart: Colors.transparent,
11497 gradientEnd: Colors.transparent, 11506 gradientEnd: Colors.transparent,
11498 textColor: MyColours.color_438E93, 11507 textColor: MyColours.color_438E93,
@@ -11503,6 +11512,26 @@ class DialogUtil { @@ -11503,6 +11512,26 @@ class DialogUtil {
11503 Navigator.pop(context); 11512 Navigator.pop(context);
11504 } 11513 }
11505 }), 11514 }),
  11515 + MyDivider(ScreenUtil().setWidth(2),
  11516 + ScreenUtil().setWidth(112),
  11517 + color: MyColours.color_f3f3f3),
  11518 + RoundButton(
  11519 + text: '去购买',
  11520 + width: (ScreenUtil().screenWidth -
  11521 + ScreenUtil().setWidth(62) * 2) /
  11522 + 3,
  11523 + height: ScreenUtil().setWidth(112),
  11524 + gradientStart: Colors.transparent,
  11525 + gradientEnd: Colors.transparent,
  11526 + textColor: MyColours.color_438E93,
  11527 + fontSize: 32,
  11528 + onPressed: () {
  11529 + if (Navigator.canPop(context)) {
  11530 + Navigator.pop(context);
  11531 + }
  11532 + DialogUtil.goFunctionUpgradePage(
  11533 + outerContext);
  11534 + }),
11506 ], 11535 ],
11507 ) 11536 )
11508 ], 11537 ],
@@ -11521,7 +11550,7 @@ class DialogUtil { @@ -11521,7 +11550,7 @@ class DialogUtil {
11521 {String title = "", 11550 {String title = "",
11522 String content = "内容", 11551 String content = "内容",
11523 String lTitle = "我知道了", 11552 String lTitle = "我知道了",
11524 - String rTitle = "立即续费", 11553 + String rTitle = "去购买",
11525 Color rColor = MyColours.color_438E93, 11554 Color rColor = MyColours.color_438E93,
11526 bool isBold = false, 11555 bool isBold = false,
11527 bool isBoldContent = false, 11556 bool isBoldContent = false,
@@ -11529,6 +11558,7 @@ class DialogUtil { @@ -11529,6 +11558,7 @@ class DialogUtil {
11529 VoidCallback? lCallback, 11558 VoidCallback? lCallback,
11530 VoidCallback? rCallback}) async { 11559 VoidCallback? rCallback}) async {
11531 // bool isRed = content != '' ? false : true; 11560 // bool isRed = content != '' ? false : true;
  11561 + final BuildContext outerContext = context;
11532 final action = await showDialog( 11562 final action = await showDialog(
11533 context: context, 11563 context: context,
11534 barrierDismissible: false, 11564 barrierDismissible: false,
@@ -11600,62 +11630,46 @@ class DialogUtil { @@ -11600,62 +11630,46 @@ class DialogUtil {
11600 VEmptyView(66), 11630 VEmptyView(66),
11601 MyDivider(double.infinity, ScreenUtil().setWidth(2), 11631 MyDivider(double.infinity, ScreenUtil().setWidth(2),
11602 color: MyColours.color_f3f3f3), 11632 color: MyColours.color_f3f3f3),
11603 - RoundButton(  
11604 - text: lTitle,  
11605 - width: (ScreenUtil().screenWidth -  
11606 - ScreenUtil().setWidth(62) * 2),  
11607 - height: ScreenUtil().setWidth(112),  
11608 - // radius: ScreenUtil().setWidth(10),  
11609 - gradientStart: Colors.transparent,  
11610 - gradientEnd: Colors.transparent,  
11611 - textColor: MyColours.color_E6000000,  
11612 - isBold: false,  
11613 - fontSize: 32,  
11614 - onPressed: () {  
11615 - if (Navigator.canPop(context)) {  
11616 - Navigator.pop(context);  
11617 - }  
11618 - }),  
11619 - // Row(  
11620 - // // mainAxisAlignment: MainAxisAlignment.spaceBetween,  
11621 - // children: [  
11622 - // RoundButton(  
11623 - // text: lTitle,  
11624 - // width: (ScreenUtil().screenWidth -  
11625 - // ScreenUtil().setWidth(62) * 2) /  
11626 - // 2,  
11627 - // height: ScreenUtil().setWidth(112),  
11628 - // // radius: ScreenUtil().setWidth(10),  
11629 - // gradientStart: Colors.transparent,  
11630 - // gradientEnd: Colors.transparent,  
11631 - // textColor: MyColours.color_E6000000,  
11632 - // isBold: false,  
11633 - // fontSize: 32,  
11634 - // onPressed: () {  
11635 - // Navigator.pop(context);  
11636 - // }),  
11637 - // MyDivider(ScreenUtil().setWidth(2),  
11638 - // ScreenUtil().setWidth(112),  
11639 - // color: MyColours.color_f3f3f3),  
11640 - // RoundButton(  
11641 - // text: rTitle,  
11642 - // width: (ScreenUtil().screenWidth -  
11643 - // ScreenUtil().setWidth(62) * 2) /  
11644 - // 2,  
11645 - // height: ScreenUtil().setWidth(112),  
11646 - // // radius: ScreenUtil().setWidth(10),  
11647 - // gradientStart: Colors.transparent,  
11648 - // gradientEnd: Colors.transparent,  
11649 - // textColor: MyColours.color_438E93,  
11650 - // fontSize: 32,  
11651 - // onPressed: () {  
11652 - // rCallback();  
11653 - // Navigator.pop(  
11654 - // context,  
11655 - // );  
11656 - // }),  
11657 - // ],  
11658 - // ) 11633 + Row(
  11634 + children: [
  11635 + RoundButton(
  11636 + text: lTitle,
  11637 + width: (ScreenUtil().screenWidth -
  11638 + ScreenUtil().setWidth(62) * 2) /
  11639 + 2,
  11640 + height: ScreenUtil().setWidth(112),
  11641 + gradientStart: Colors.transparent,
  11642 + gradientEnd: Colors.transparent,
  11643 + textColor: MyColours.color_E6000000,
  11644 + isBold: false,
  11645 + fontSize: 32,
  11646 + onPressed: () {
  11647 + if (Navigator.canPop(context)) {
  11648 + Navigator.pop(context);
  11649 + }
  11650 + }),
  11651 + MyDivider(ScreenUtil().setWidth(2),
  11652 + ScreenUtil().setWidth(112),
  11653 + color: MyColours.color_f3f3f3),
  11654 + RoundButton(
  11655 + text: rTitle,
  11656 + width: (ScreenUtil().screenWidth -
  11657 + ScreenUtil().setWidth(62) * 2) /
  11658 + 2,
  11659 + height: ScreenUtil().setWidth(112),
  11660 + gradientStart: Colors.transparent,
  11661 + gradientEnd: Colors.transparent,
  11662 + textColor: MyColours.color_438E93,
  11663 + fontSize: 32,
  11664 + onPressed: () {
  11665 + if (Navigator.canPop(context)) {
  11666 + Navigator.pop(context);
  11667 + }
  11668 + DialogUtil.goFunctionUpgradePage(
  11669 + outerContext);
  11670 + }),
  11671 + ],
  11672 + )
11659 ], 11673 ],
11660 ), 11674 ),
11661 ), 11675 ),
@@ -11680,6 +11694,7 @@ class DialogUtil { @@ -11680,6 +11694,7 @@ class DialogUtil {
11680 VoidCallback? lCallback, 11694 VoidCallback? lCallback,
11681 VoidCallback? rCallback}) async { 11695 VoidCallback? rCallback}) async {
11682 // bool isRed = content != '' ? false : true; 11696 // bool isRed = content != '' ? false : true;
  11697 + final BuildContext outerContext = context;
11683 final action = await showDialog( 11698 final action = await showDialog(
11684 context: context, 11699 context: context,
11685 barrierDismissible: false, 11700 barrierDismissible: false,
@@ -11761,15 +11776,13 @@ class DialogUtil { @@ -11761,15 +11776,13 @@ class DialogUtil {
11761 // lCallback(); 11776 // lCallback();
11762 // }), 11777 // }),
11763 Row( 11778 Row(
11764 - // mainAxisAlignment: MainAxisAlignment.spaceBetween,  
11765 children: [ 11779 children: [
11766 RoundButton( 11780 RoundButton(
11767 text: lTitle, 11781 text: lTitle,
11768 width: (ScreenUtil().screenWidth - 11782 width: (ScreenUtil().screenWidth -
11769 ScreenUtil().setWidth(62) * 2) / 11783 ScreenUtil().setWidth(62) * 2) /
11770 - 2, 11784 + 3,
11771 height: ScreenUtil().setWidth(112), 11785 height: ScreenUtil().setWidth(112),
11772 - // radius: ScreenUtil().setWidth(10),  
11773 gradientStart: Colors.transparent, 11786 gradientStart: Colors.transparent,
11774 gradientEnd: Colors.transparent, 11787 gradientEnd: Colors.transparent,
11775 textColor: MyColours.color_E6000000, 11788 textColor: MyColours.color_E6000000,
@@ -11788,9 +11801,8 @@ class DialogUtil { @@ -11788,9 +11801,8 @@ class DialogUtil {
11788 text: rTitle, 11801 text: rTitle,
11789 width: (ScreenUtil().screenWidth - 11802 width: (ScreenUtil().screenWidth -
11790 ScreenUtil().setWidth(62) * 2) / 11803 ScreenUtil().setWidth(62) * 2) /
11791 - 2, 11804 + 3,
11792 height: ScreenUtil().setWidth(112), 11805 height: ScreenUtil().setWidth(112),
11793 - // radius: ScreenUtil().setWidth(10),  
11794 gradientStart: Colors.transparent, 11806 gradientStart: Colors.transparent,
11795 gradientEnd: Colors.transparent, 11807 gradientEnd: Colors.transparent,
11796 textColor: MyColours.color_438E93, 11808 textColor: MyColours.color_438E93,
@@ -11801,6 +11813,26 @@ class DialogUtil { @@ -11801,6 +11813,26 @@ class DialogUtil {
11801 Navigator.pop(context); 11813 Navigator.pop(context);
11802 } 11814 }
11803 }), 11815 }),
  11816 + MyDivider(ScreenUtil().setWidth(2),
  11817 + ScreenUtil().setWidth(112),
  11818 + color: MyColours.color_f3f3f3),
  11819 + RoundButton(
  11820 + text: '去购买',
  11821 + width: (ScreenUtil().screenWidth -
  11822 + ScreenUtil().setWidth(62) * 2) /
  11823 + 3,
  11824 + height: ScreenUtil().setWidth(112),
  11825 + gradientStart: Colors.transparent,
  11826 + gradientEnd: Colors.transparent,
  11827 + textColor: MyColours.color_438E93,
  11828 + fontSize: 32,
  11829 + onPressed: () {
  11830 + if (Navigator.canPop(context)) {
  11831 + Navigator.pop(context);
  11832 + }
  11833 + DialogUtil.goFunctionUpgradePage(
  11834 + outerContext);
  11835 + }),
11804 ], 11836 ],
11805 ) 11837 )
11806 ], 11838 ],
@@ -11819,7 +11851,7 @@ class DialogUtil { @@ -11819,7 +11851,7 @@ class DialogUtil {
11819 {String title = "", 11851 {String title = "",
11820 String content = "内容", 11852 String content = "内容",
11821 String lTitle = "我知道了", 11853 String lTitle = "我知道了",
11822 - String rTitle = "立即续费", 11854 + String rTitle = "去购买",
11823 Color rColor = MyColours.color_438E93, 11855 Color rColor = MyColours.color_438E93,
11824 bool isBold = false, 11856 bool isBold = false,
11825 bool isBoldContent = false, 11857 bool isBoldContent = false,
@@ -11827,6 +11859,7 @@ class DialogUtil { @@ -11827,6 +11859,7 @@ class DialogUtil {
11827 VoidCallback? lCallback, 11859 VoidCallback? lCallback,
11828 VoidCallback? rCallback}) async { 11860 VoidCallback? rCallback}) async {
11829 // bool isRed = content != '' ? false : true; 11861 // bool isRed = content != '' ? false : true;
  11862 + final BuildContext outerContext = context;
11830 final action = await showDialog( 11863 final action = await showDialog(
11831 context: context, 11864 context: context,
11832 barrierDismissible: false, 11865 barrierDismissible: false,
@@ -11892,64 +11925,47 @@ class DialogUtil { @@ -11892,64 +11925,47 @@ class DialogUtil {
11892 VEmptyView(66), 11925 VEmptyView(66),
11893 MyDivider(double.infinity, ScreenUtil().setWidth(2), 11926 MyDivider(double.infinity, ScreenUtil().setWidth(2),
11894 color: MyColours.color_f3f3f3), 11927 color: MyColours.color_f3f3f3),
11895 - RoundButton(  
11896 - text: lTitle,  
11897 - width: (ScreenUtil().screenWidth -  
11898 - ScreenUtil().setWidth(62) * 2),  
11899 - height: ScreenUtil().setWidth(112),  
11900 - // radius: ScreenUtil().setWidth(10),  
11901 - gradientStart: Colors.transparent,  
11902 - gradientEnd: Colors.transparent,  
11903 - textColor: MyColours.color_E6000000,  
11904 - isBold: false,  
11905 - fontSize: 32,  
11906 - onPressed: () {  
11907 - if (Navigator.canPop(context)) {  
11908 - Navigator.pop(context);  
11909 - }  
11910 - lCallback!();  
11911 - }),  
11912 - // Row(  
11913 - // // mainAxisAlignment: MainAxisAlignment.spaceBetween,  
11914 - // children: [  
11915 - // RoundButton(  
11916 - // text: lTitle,  
11917 - // width: (ScreenUtil().screenWidth -  
11918 - // ScreenUtil().setWidth(62) * 2) /  
11919 - // 2,  
11920 - // height: ScreenUtil().setWidth(112),  
11921 - // // radius: ScreenUtil().setWidth(10),  
11922 - // gradientStart: Colors.transparent,  
11923 - // gradientEnd: Colors.transparent,  
11924 - // textColor: MyColours.color_E6000000,  
11925 - // isBold: false,  
11926 - // fontSize: 32,  
11927 - // onPressed: () {  
11928 - // Navigator.pop(context);  
11929 - // lCallback();  
11930 - // }),  
11931 - // MyDivider(ScreenUtil().setWidth(2),  
11932 - // ScreenUtil().setWidth(112),  
11933 - // color: MyColours.color_f3f3f3),  
11934 - // RoundButton(  
11935 - // text: rTitle,  
11936 - // width: (ScreenUtil().screenWidth -  
11937 - // ScreenUtil().setWidth(62) * 2) /  
11938 - // 2,  
11939 - // height: ScreenUtil().setWidth(112),  
11940 - // // radius: ScreenUtil().setWidth(10),  
11941 - // gradientStart: Colors.transparent,  
11942 - // gradientEnd: Colors.transparent,  
11943 - // textColor: MyColours.color_438E93,  
11944 - // fontSize: 32,  
11945 - // onPressed: () {  
11946 - // rCallback();  
11947 - // Navigator.pop(  
11948 - // context,  
11949 - // );  
11950 - // }),  
11951 - // ],  
11952 - // ) 11928 + Row(
  11929 + children: [
  11930 + RoundButton(
  11931 + text: lTitle,
  11932 + width: (ScreenUtil().screenWidth -
  11933 + ScreenUtil().setWidth(62) * 2) /
  11934 + 2,
  11935 + height: ScreenUtil().setWidth(112),
  11936 + gradientStart: Colors.transparent,
  11937 + gradientEnd: Colors.transparent,
  11938 + textColor: MyColours.color_E6000000,
  11939 + isBold: false,
  11940 + fontSize: 32,
  11941 + onPressed: () {
  11942 + if (Navigator.canPop(context)) {
  11943 + Navigator.pop(context);
  11944 + }
  11945 + lCallback?.call();
  11946 + }),
  11947 + MyDivider(ScreenUtil().setWidth(2),
  11948 + ScreenUtil().setWidth(112),
  11949 + color: MyColours.color_f3f3f3),
  11950 + RoundButton(
  11951 + text: rTitle,
  11952 + width: (ScreenUtil().screenWidth -
  11953 + ScreenUtil().setWidth(62) * 2) /
  11954 + 2,
  11955 + height: ScreenUtil().setWidth(112),
  11956 + gradientStart: Colors.transparent,
  11957 + gradientEnd: Colors.transparent,
  11958 + textColor: MyColours.color_438E93,
  11959 + fontSize: 32,
  11960 + onPressed: () {
  11961 + if (Navigator.canPop(context)) {
  11962 + Navigator.pop(context);
  11963 + }
  11964 + DialogUtil.goFunctionUpgradePage(
  11965 + outerContext);
  11966 + }),
  11967 + ],
  11968 + )
11953 ], 11969 ],
11954 ), 11970 ),
11955 ), 11971 ),
@@ -13429,5 +13445,4 @@ class DialogUtil { @@ -13429,5 +13445,4 @@ class DialogUtil {
13429 }, 13445 },
13430 ); 13446 );
13431 } 13447 }
13432 -  
13433 } 13448 }
1 -  
2 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
3 import 'package:one_key/utils/dialog_util.dart'; 2 import 'package:one_key/utils/dialog_util.dart';
4 import 'package:one_key/utils/utils.dart'; 3 import 'package:one_key/utils/utils.dart';
@@ -9,76 +8,76 @@ class SetTimeWidget { @@ -9,76 +8,76 @@ class SetTimeWidget {
9 static SetTimeWidget init = SetTimeWidget(); 8 static SetTimeWidget init = SetTimeWidget();
10 static List dateData = [ 9 static List dateData = [
11 { 10 {
12 - '深夜00时': [00, 15, 30, 45] 11 + '深夜00时': [0, 10, 15, 20, 30, 40, 45, 50]
13 }, 12 },
14 { 13 {
15 - '深夜01时': [00, 15, 30, 45] 14 + '深夜01时': [0, 10, 15, 20, 30, 40, 45, 50]
16 }, 15 },
17 { 16 {
18 - '深夜02时': [00, 15, 30, 45] 17 + '深夜02时': [0, 10, 15, 20, 30, 40, 45, 50]
19 }, 18 },
20 { 19 {
21 - '深夜03时': [00, 15, 30, 45] 20 + '深夜03时': [0, 10, 15, 20, 30, 40, 45, 50]
22 }, 21 },
23 { 22 {
24 - '深夜04时': [00, 15, 30, 45] 23 + '深夜04时': [0, 10, 15, 20, 30, 40, 45, 50]
25 }, 24 },
26 { 25 {
27 - '深夜05时': [00, 15, 30, 45] 26 + '深夜05时': [0, 10, 15, 20, 30, 40, 45, 50]
28 }, 27 },
29 { 28 {
30 - '早上06时': [00, 15, 30, 45] 29 + '早上06时': [0, 10, 15, 20, 30, 40, 45, 50]
31 }, 30 },
32 { 31 {
33 - '早上07时': [00, 15, 30, 45] 32 + '早上07时': [0, 10, 15, 20, 30, 40, 45, 50]
34 }, 33 },
35 { 34 {
36 - '早上08时': [00, 15, 30, 45] 35 + '早上08时': [0, 10, 15, 20, 30, 40, 45, 50]
37 }, 36 },
38 { 37 {
39 - '早上09时': [00, 15, 30, 45] 38 + '早上09时': [0, 10, 15, 20, 30, 40, 45, 50]
40 }, 39 },
41 { 40 {
42 - '中午10时': [00, 15, 30, 45] 41 + '中午10时': [0, 10, 15, 20, 30, 40, 45, 50]
43 }, 42 },
44 { 43 {
45 - '中午11时': [00, 15, 30, 45] 44 + '中午11时': [0, 10, 15, 20, 30, 40, 45, 50]
46 }, 45 },
47 { 46 {
48 - '中午12时': [00, 15, 30, 45] 47 + '中午12时': [0, 10, 15, 20, 30, 40, 45, 50]
49 }, 48 },
50 { 49 {
51 - '中午13时': [00, 15, 30, 45] 50 + '中午13时': [0, 10, 15, 20, 30, 40, 45, 50]
52 }, 51 },
53 { 52 {
54 - '中午14时': [00, 15, 30, 45] 53 + '中午14时': [0, 10, 15, 20, 30, 40, 45, 50]
55 }, 54 },
56 { 55 {
57 - '下午15时': [00, 15, 30, 45] 56 + '下午15时': [0, 10, 15, 20, 30, 40, 45, 50]
58 }, 57 },
59 { 58 {
60 - '下午16时': [00, 15, 30, 45] 59 + '下午16时': [0, 10, 15, 20, 30, 40, 45, 50]
61 }, 60 },
62 { 61 {
63 - '下午17时': [00, 15, 30, 45] 62 + '下午17时': [0, 10, 15, 20, 30, 40, 45, 50]
64 }, 63 },
65 { 64 {
66 - '下午18时': [00, 15, 30, 45] 65 + '下午18时': [0, 10, 15, 20, 30, 40, 45, 50]
67 }, 66 },
68 { 67 {
69 - '晚上19时': [00, 15, 30, 45] 68 + '晚上19时': [0, 10, 15, 20, 30, 40, 45, 50]
70 }, 69 },
71 { 70 {
72 - '晚上20时': [00, 15, 30, 45] 71 + '晚上20时': [0, 10, 15, 20, 30, 40, 45, 50]
73 }, 72 },
74 { 73 {
75 - '晚上21时': [00, 15, 30, 45] 74 + '晚上21时': [0, 10, 15, 20, 30, 40, 45, 50]
76 }, 75 },
77 { 76 {
78 - '晚上22时': [00, 15, 30, 45] 77 + '晚上22时': [0, 10, 15, 20, 30, 40, 45, 50]
79 }, 78 },
80 { 79 {
81 - '晚上23时': [00, 15, 30, 45] 80 + '晚上23时': [0, 10, 15, 20, 30, 40, 45, 50]
82 } 81 }
83 ]; 82 ];
84 83
@@ -202,10 +201,14 @@ class SetTimeWidget { @@ -202,10 +201,14 @@ class SetTimeWidget {
202 context, data, hourAndMinute, SetTimeCallback setTimeCallback) { 201 context, data, hourAndMinute, SetTimeCallback setTimeCallback) {
203 DialogUtil.showSelectCusmanTimerDialog(context, data, (value) { 202 DialogUtil.showSelectCusmanTimerDialog(context, data, (value) {
204 setTimeCallback(value); 203 setTimeCallback(value);
205 - }, selecteds:hourAndMinute == null?[]: [  
206 - _getFirSelected(hourAndMinute, data),  
207 - _getSecSelected(hourAndMinute, data)  
208 - ]).then((value) { 204 + },
  205 + selecteds: hourAndMinute == null
  206 + ? []
  207 + : [
  208 + _getFirSelected(hourAndMinute, data),
  209 + _getSecSelected(hourAndMinute, data)
  210 + ])
  211 + .then((value) {
209 print(value); 212 print(value);
210 }); 213 });
211 } 214 }
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:flutter_test/flutter_test.dart';
  4 +import 'package:one_key/models/seller_version_model.dart';
  5 +import 'package:one_key/provider/collect_store_provider.dart';
  6 +import 'package:one_key/utils/dialog_util.dart';
  7 +import 'package:provider/provider.dart';
  8 +
  9 +class _FakeCollectStoreProvider extends CollectStoreProvider {
  10 + @override
  11 + Future<List<SellerVersionSunModel>?> getFunctionUpgradeList(
  12 + BuildContext context, {
  13 + bool showLoading = true,
  14 + }) async {
  15 + return <SellerVersionSunModel>[];
  16 + }
  17 +}
  18 +
  19 +Widget _buildTestApp(
  20 + _FakeCollectStoreProvider provider,
  21 + void Function(BuildContext context) openDialog,
  22 +) {
  23 + return ScreenUtilInit(
  24 + designSize: const Size(750, 1334),
  25 + minTextAdapt: true,
  26 + splitScreenMode: true,
  27 + builder: (context, child) {
  28 + return ChangeNotifierProvider<CollectStoreProvider>.value(
  29 + value: provider,
  30 + child: MaterialApp(
  31 + home: Scaffold(
  32 + body: Center(
  33 + child: Builder(
  34 + builder: (context) {
  35 + return TextButton(
  36 + onPressed: () => openDialog(context),
  37 + child: const Text('打开弹窗'),
  38 + );
  39 + },
  40 + ),
  41 + ),
  42 + ),
  43 + ),
  44 + );
  45 + },
  46 + );
  47 +}
  48 +
  49 +Future<void> _tapAndOpenUpgrade(WidgetTester tester) async {
  50 + await tester.tap(find.text('打开弹窗'));
  51 + await tester.pumpAndSettle();
  52 + expect(find.text('去购买'), findsOneWidget);
  53 +
  54 + await tester.tap(find.text('去购买'));
  55 + await tester.pump();
  56 + await tester.pump(const Duration(milliseconds: 600));
  57 + expect(find.text('功能升级'), findsOneWidget);
  58 +}
  59 +
  60 +void _setPhoneViewport(WidgetTester tester) {
  61 + tester.view.physicalSize = const Size(1080, 2340);
  62 + tester.view.devicePixelRatio = 1.0;
  63 + addTearDown(() {
  64 + tester.view.physicalSize = const Size(800, 600);
  65 + tester.view.devicePixelRatio = 1.0;
  66 + });
  67 +}
  68 +
  69 +void main() {
  70 + testWidgets('未购买模块弹窗可以去购买', (tester) async {
  71 + _setPhoneViewport(tester);
  72 + final provider = _FakeCollectStoreProvider();
  73 + await tester.pumpWidget(
  74 + _buildTestApp(provider, (context) {
  75 + DialogUtil.showSellerVersionBuyDialog(context, '宴会管理', (_) {});
  76 + }),
  77 + );
  78 + await _tapAndOpenUpgrade(tester);
  79 + });
  80 +
  81 + testWidgets('普通版模块过期弹窗可以去购买', (tester) async {
  82 + _setPhoneViewport(tester);
  83 + final provider = _FakeCollectStoreProvider();
  84 + final showData = <SellerVersionSunModel>[
  85 + SellerVersionSunModel(
  86 + vid: '12',
  87 + vname: '宴会管理',
  88 + edate: '1798761600',
  89 + ),
  90 + ];
  91 + await tester.pumpWidget(
  92 + _buildTestApp(provider, (context) {
  93 + DialogUtil.showSellerVersionEdateDialog(context, showData, (_) {});
  94 + }),
  95 + );
  96 + await _tapAndOpenUpgrade(tester);
  97 + });
  98 +
  99 + testWidgets('极速版模块过期弹窗可以去购买', (tester) async {
  100 + _setPhoneViewport(tester);
  101 + final provider = _FakeCollectStoreProvider();
  102 + await tester.pumpWidget(
  103 + _buildTestApp(provider, (context) {
  104 + DialogUtil.cupertinoAlertSellerEdateDialogSim(
  105 + context,
  106 + title: '温馨提示',
  107 + content: '2026-10-01',
  108 + rCallback: () {},
  109 + );
  110 + }),
  111 + );
  112 + await _tapAndOpenUpgrade(tester);
  113 + });
  114 +
  115 + testWidgets('普通版店铺过期弹窗可以去购买', (tester) async {
  116 + _setPhoneViewport(tester);
  117 + final provider = _FakeCollectStoreProvider();
  118 + await tester.pumpWidget(
  119 + _buildTestApp(provider, (context) {
  120 + DialogUtil.cupertinoAlertSellerHasEdateDialog(
  121 + context,
  122 + title: '温馨提示',
  123 + lCallback: () {},
  124 + rCallback: () {},
  125 + );
  126 + }),
  127 + );
  128 + await _tapAndOpenUpgrade(tester);
  129 + });
  130 +
  131 + testWidgets('极速版店铺过期弹窗可以去购买', (tester) async {
  132 + _setPhoneViewport(tester);
  133 + final provider = _FakeCollectStoreProvider();
  134 + await tester.pumpWidget(
  135 + _buildTestApp(provider, (context) {
  136 + DialogUtil.cupertinoAlertSellerHasEdateDialogSim(
  137 + context,
  138 + title: '温馨提示',
  139 + lCallback: () {},
  140 + rCallback: () {},
  141 + );
  142 + }),
  143 + );
  144 + await _tapAndOpenUpgrade(tester);
  145 + });
  146 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:flutter/services.dart';
  4 +import 'package:flutter_test/flutter_test.dart';
  5 +import 'package:one_key/models/seller_version_model.dart';
  6 +import 'package:one_key/provider/collect_store_provider.dart';
  7 +import 'package:one_key/utils/dialog_util.dart';
  8 +import 'package:provider/provider.dart';
  9 +
  10 +class _PreviewCollectStoreProvider extends CollectStoreProvider {
  11 + @override
  12 + Future<List<SellerVersionSunModel>?> getFunctionUpgradeList(
  13 + BuildContext context, {
  14 + bool showLoading = true,
  15 + }) async {
  16 + return <SellerVersionSunModel>[];
  17 + }
  18 +}
  19 +
  20 +Widget _buildPreviewApp(
  21 + _PreviewCollectStoreProvider provider,
  22 + void Function(BuildContext context) openDialog,
  23 +) {
  24 + return ScreenUtilInit(
  25 + designSize: const Size(750, 1334),
  26 + minTextAdapt: true,
  27 + splitScreenMode: true,
  28 + builder: (context, child) {
  29 + return ChangeNotifierProvider<CollectStoreProvider>.value(
  30 + value: provider,
  31 + child: MaterialApp(
  32 + home: Scaffold(
  33 + backgroundColor: Colors.white,
  34 + body: Center(
  35 + child: Builder(
  36 + builder: (context) {
  37 + return TextButton(
  38 + onPressed: () => openDialog(context),
  39 + child: const Text('打开弹窗'),
  40 + );
  41 + },
  42 + ),
  43 + ),
  44 + ),
  45 + ),
  46 + );
  47 + },
  48 + );
  49 +}
  50 +
  51 +void _setPhoneViewport(WidgetTester tester) {
  52 + tester.view.physicalSize = const Size(1080, 2340);
  53 + tester.view.devicePixelRatio = 1.0;
  54 + const MethodChannel statusBarChannel =
  55 + MethodChannel('plugins.sameer.com/statusbar');
  56 + tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
  57 + statusBarChannel,
  58 + (call) async => null,
  59 + );
  60 + addTearDown(() {
  61 + tester.view.physicalSize = const Size(800, 600);
  62 + tester.view.devicePixelRatio = 1.0;
  63 + tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
  64 + statusBarChannel,
  65 + null,
  66 + );
  67 + });
  68 +}
  69 +
  70 +void main() {
  71 + testWidgets('导出未购买和跳转预览图', (tester) async {
  72 + _setPhoneViewport(tester);
  73 + final provider = _PreviewCollectStoreProvider();
  74 + await tester.pumpWidget(
  75 + _buildPreviewApp(provider, (context) {
  76 + DialogUtil.showSellerVersionBuyDialog(context, '宴会管理', (_) {});
  77 + }),
  78 + );
  79 + await tester.tap(find.text('打开弹窗'));
  80 + await tester.pumpAndSettle();
  81 + await expectLater(
  82 + find.byType(MaterialApp),
  83 + matchesGoldenFile('goldens/preview_buy_dialog.png'),
  84 + );
  85 +
  86 + await tester.tap(find.text('去购买'));
  87 + await tester.pump();
  88 + await tester.pump(const Duration(milliseconds: 600));
  89 + await tester.pump(const Duration(milliseconds: 200));
  90 + await expectLater(
  91 + find.byType(MaterialApp),
  92 + matchesGoldenFile('goldens/preview_upgrade_page.png'),
  93 + );
  94 + });
  95 +
  96 + testWidgets('导出普通版模块过期预览图', (tester) async {
  97 + _setPhoneViewport(tester);
  98 + final provider = _PreviewCollectStoreProvider();
  99 + final showData = <SellerVersionSunModel>[
  100 + SellerVersionSunModel(
  101 + vid: '12',
  102 + vname: '宴会管理',
  103 + edate: '1798761600',
  104 + ),
  105 + ];
  106 + await tester.pumpWidget(
  107 + _buildPreviewApp(provider, (context) {
  108 + DialogUtil.showSellerVersionEdateDialog(context, showData, (_) {});
  109 + }),
  110 + );
  111 + await tester.tap(find.text('打开弹窗'));
  112 + await tester.pumpAndSettle();
  113 + await expectLater(
  114 + find.byType(MaterialApp),
  115 + matchesGoldenFile('goldens/preview_expire_dialog.png'),
  116 + );
  117 + });
  118 +
  119 + testWidgets('导出极速版模块过期预览图', (tester) async {
  120 + _setPhoneViewport(tester);
  121 + final provider = _PreviewCollectStoreProvider();
  122 + await tester.pumpWidget(
  123 + _buildPreviewApp(provider, (context) {
  124 + DialogUtil.cupertinoAlertSellerEdateDialogSim(
  125 + context,
  126 + title: '温馨提示',
  127 + content: '2026-10-01',
  128 + rCallback: () {},
  129 + );
  130 + }),
  131 + );
  132 + await tester.tap(find.text('打开弹窗'));
  133 + await tester.pumpAndSettle();
  134 + await expectLater(
  135 + find.byType(MaterialApp),
  136 + matchesGoldenFile('goldens/preview_sim_expire_dialog.png'),
  137 + );
  138 + });
  139 +
  140 + testWidgets('导出普通版店铺过期预览图', (tester) async {
  141 + _setPhoneViewport(tester);
  142 + final provider = _PreviewCollectStoreProvider();
  143 + await tester.pumpWidget(
  144 + _buildPreviewApp(provider, (context) {
  145 + DialogUtil.cupertinoAlertSellerHasEdateDialog(
  146 + context,
  147 + title: '温馨提示',
  148 + lCallback: () {},
  149 + rCallback: () {},
  150 + );
  151 + }),
  152 + );
  153 + await tester.tap(find.text('打开弹窗'));
  154 + await tester.pumpAndSettle();
  155 + await expectLater(
  156 + find.byType(MaterialApp),
  157 + matchesGoldenFile('goldens/preview_store_expire_dialog.png'),
  158 + );
  159 + });
  160 +
  161 + testWidgets('导出极速版店铺过期预览图', (tester) async {
  162 + _setPhoneViewport(tester);
  163 + final provider = _PreviewCollectStoreProvider();
  164 + await tester.pumpWidget(
  165 + _buildPreviewApp(provider, (context) {
  166 + DialogUtil.cupertinoAlertSellerHasEdateDialogSim(
  167 + context,
  168 + title: '温馨提示',
  169 + lCallback: () {},
  170 + rCallback: () {},
  171 + );
  172 + }),
  173 + );
  174 + await tester.tap(find.text('打开弹窗'));
  175 + await tester.pumpAndSettle();
  176 + await expectLater(
  177 + find.byType(MaterialApp),
  178 + matchesGoldenFile('goldens/preview_sim_store_expire_dialog.png'),
  179 + );
  180 + });
  181 +}