|
1
|
import 'dart:convert';
|
1
|
import 'dart:convert';
|
|
2
|
|
2
|
|
|
|
|
3
|
+import 'package:common_utils/common_utils.dart';
|
|
3
|
import 'package:flutter/material.dart';
|
4
|
import 'package:flutter/material.dart';
|
|
4
|
import 'package:flutter_ex_widget/ex_text.dart';
|
5
|
import 'package:flutter_ex_widget/ex_text.dart';
|
|
5
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
6
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
@@ -26,6 +27,9 @@ import 'package:one_key/widgets/v_empty_view.dart'; |
|
@@ -26,6 +27,9 @@ import 'package:one_key/widgets/v_empty_view.dart'; |
|
26
|
import 'package:provider/provider.dart';
|
27
|
import 'package:provider/provider.dart';
|
|
27
|
|
28
|
|
|
28
|
import '../../app.dart';
|
29
|
import '../../app.dart';
|
|
|
|
30
|
+import '../../models/get_seller_info_model.dart';
|
|
|
|
31
|
+import '../../provider/store_base_info_provider.dart';
|
|
|
|
32
|
+import '../../utils/dialog_util.dart';
|
|
29
|
import '../../utils/screen_util.dart';
|
33
|
import '../../utils/screen_util.dart';
|
|
30
|
|
34
|
|
|
31
|
class MyPage extends StatefulWidget {
|
35
|
class MyPage extends StatefulWidget {
|
|
@@ -45,6 +49,8 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
@@ -45,6 +49,8 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
45
|
SmsInfoData smsInfoData;
|
49
|
SmsInfoData smsInfoData;
|
|
46
|
CreateStoreModel createStoreModel;
|
50
|
CreateStoreModel createStoreModel;
|
|
47
|
|
51
|
|
|
|
|
52
|
+ String outDay = ''; //过期天数
|
|
|
|
53
|
+ DateTime edate; //过期时间
|
|
48
|
@override
|
54
|
@override
|
|
49
|
void initState() {
|
55
|
void initState() {
|
|
50
|
// TODO: implement initState
|
56
|
// TODO: implement initState
|
|
@@ -68,6 +74,8 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
@@ -68,6 +74,8 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
68
|
///获取积分
|
74
|
///获取积分
|
|
69
|
_getMyIntegral(context);
|
75
|
_getMyIntegral(context);
|
|
70
|
|
76
|
|
|
|
|
77
|
+ _getSellerById();
|
|
|
|
78
|
+
|
|
71
|
///apk版本检测
|
79
|
///apk版本检测
|
|
72
|
checkUpdate();
|
80
|
checkUpdate();
|
|
73
|
});
|
81
|
});
|
|
@@ -110,6 +118,35 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
@@ -110,6 +118,35 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
110
|
}
|
118
|
}
|
|
111
|
}
|
119
|
}
|
|
112
|
|
120
|
|
|
|
|
121
|
+ ///获取店铺过期时间
|
|
|
|
122
|
+ _getSellerById() async {
|
|
|
|
123
|
+ StoreBaseIndoProvider storeBaseIndoProvider =
|
|
|
|
124
|
+ Provider.of<StoreBaseIndoProvider>(context, listen: false);
|
|
|
|
125
|
+ GetSellerInfoSunModel sellerInfoSunModel =
|
|
|
|
126
|
+ await storeBaseIndoProvider.getSellerById(context);
|
|
|
|
127
|
+ if (sellerInfoSunModel != null) {
|
|
|
|
128
|
+ if (sellerInfoSunModel.data.edate != null) {
|
|
|
|
129
|
+ //店铺过期提醒
|
|
|
|
130
|
+ // 计算时间差
|
|
|
|
131
|
+ //店铺过期日期
|
|
|
|
132
|
+ edate = DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
133
|
+ int.parse(sellerInfoSunModel.data.edate) * 1000);
|
|
|
|
134
|
+
|
|
|
|
135
|
+ String from =
|
|
|
|
136
|
+ DateUtil.formatDate(DateTime.now(), format: DateFormats.y_mo_d) +
|
|
|
|
137
|
+ ' 00:00:00';
|
|
|
|
138
|
+ DateTime datenow = DateUtil.getDateTime(from);
|
|
|
|
139
|
+ //比较相差的天数
|
|
|
|
140
|
+ outDay = edate.difference(datenow).inDays.toString();
|
|
|
|
141
|
+ // print(outDay);
|
|
|
|
142
|
+ } else {
|
|
|
|
143
|
+ outDay = '';
|
|
|
|
144
|
+ }
|
|
|
|
145
|
+ setState(() {});
|
|
|
|
146
|
+//
|
|
|
|
147
|
+ }
|
|
|
|
148
|
+ }
|
|
|
|
149
|
+
|
|
113
|
///获取短信余量
|
150
|
///获取短信余量
|
|
114
|
_getSmsInfo(context) async {
|
151
|
_getSmsInfo(context) async {
|
|
115
|
// myModel = Provider.of<MyModel>(context, listen: false);
|
152
|
// myModel = Provider.of<MyModel>(context, listen: false);
|
|
@@ -456,7 +493,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
@@ -456,7 +493,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
456
|
'个',
|
493
|
'个',
|
|
457
|
style: TextStyle(
|
494
|
style: TextStyle(
|
|
458
|
fontWeight: FontWeight.bold,
|
495
|
fontWeight: FontWeight.bold,
|
|
459
|
- color: MyColours.color_515151,
|
496
|
+ color: MyColours.color_999999,
|
|
460
|
fontSize: ScreenUtil().setSp(22)),
|
497
|
fontSize: ScreenUtil().setSp(22)),
|
|
461
|
)
|
498
|
)
|
|
462
|
],
|
499
|
],
|
|
@@ -500,7 +537,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
@@ -500,7 +537,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
500
|
'条',
|
537
|
'条',
|
|
501
|
style: TextStyle(
|
538
|
style: TextStyle(
|
|
502
|
fontWeight: FontWeight.bold,
|
539
|
fontWeight: FontWeight.bold,
|
|
503
|
- color: MyColours.color_515151,
|
540
|
+ color: MyColours.color_999999,
|
|
504
|
fontSize:
|
541
|
fontSize:
|
|
505
|
ScreenUtil().setSp(22)),
|
542
|
ScreenUtil().setSp(22)),
|
|
506
|
)
|
543
|
)
|
|
@@ -530,10 +567,42 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
@@ -530,10 +567,42 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
530
|
ScreenUtil().setWidth(32 * 2),
|
567
|
ScreenUtil().setWidth(32 * 2),
|
|
531
|
color: MyColours.color_f3f3f3,
|
568
|
color: MyColours.color_f3f3f3,
|
|
532
|
),
|
569
|
),
|
|
|
|
570
|
+ // if (outDay != '')
|
|
533
|
InkWell(
|
571
|
InkWell(
|
|
534
|
onTap: () {
|
572
|
onTap: () {
|
|
535
|
- NavigatorUtil.goMyIntegralPage(context,
|
|
|
|
536
|
- sunModel: myModel.integralSunModel);
|
573
|
+ // NavigatorUtil.goMyIntegralPage(context,
|
|
|
|
574
|
+ // sunModel: myModel.integralSunModel);
|
|
|
|
575
|
+ if (outDay != '') {
|
|
|
|
576
|
+ if (outDay == '0') {
|
|
|
|
577
|
+ DialogUtil
|
|
|
|
578
|
+ .cupertinoAlertSellerHasEdateDialog(
|
|
|
|
579
|
+ context,
|
|
|
|
580
|
+ title: '温馨提示',
|
|
|
|
581
|
+ isBold: true,
|
|
|
|
582
|
+ lCallback: () {
|
|
|
|
583
|
+ NavigatorUtil.goHomePage(context,
|
|
|
|
584
|
+ initialIndex: 4);
|
|
|
|
585
|
+ },
|
|
|
|
586
|
+ rCallback: () {
|
|
|
|
587
|
+ //立即续费
|
|
|
|
588
|
+ },
|
|
|
|
589
|
+ );
|
|
|
|
590
|
+ } else {
|
|
|
|
591
|
+ DialogUtil
|
|
|
|
592
|
+ .cupertinoAlertSellerEdateDialog(
|
|
|
|
593
|
+ context,
|
|
|
|
594
|
+ title: '温馨提示',
|
|
|
|
595
|
+ isBold: true,
|
|
|
|
596
|
+ content: DateUtil.formatDate(
|
|
|
|
597
|
+ edate,
|
|
|
|
598
|
+ format: DateFormats.full,
|
|
|
|
599
|
+ ),
|
|
|
|
600
|
+ rCallback: () {
|
|
|
|
601
|
+ //立即续费
|
|
|
|
602
|
+ },
|
|
|
|
603
|
+ );
|
|
|
|
604
|
+ }
|
|
|
|
605
|
+ }
|
|
537
|
},
|
606
|
},
|
|
538
|
child: Column(
|
607
|
child: Column(
|
|
539
|
mainAxisAlignment: MainAxisAlignment.center,
|
608
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
@@ -541,7 +610,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
@@ -541,7 +610,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
541
|
Row(
|
610
|
Row(
|
|
542
|
children: [
|
611
|
children: [
|
|
543
|
Text(
|
612
|
Text(
|
|
544
|
- '${myModel.integralSunModel != null && myModel.integralSunModel.myIntegral != null ? myModel.integralSunModel?.myIntegral : '0'}',
|
613
|
+ outDay,
|
|
545
|
style: TextStyle(
|
614
|
style: TextStyle(
|
|
546
|
fontWeight: FontWeight.bold,
|
615
|
fontWeight: FontWeight.bold,
|
|
547
|
color: MyColours.color_515151,
|
616
|
color: MyColours.color_515151,
|
|
@@ -549,10 +618,10 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
@@ -549,10 +618,10 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
549
|
ScreenUtil().setSp(40)),
|
618
|
ScreenUtil().setSp(40)),
|
|
550
|
),
|
619
|
),
|
|
551
|
Text(
|
620
|
Text(
|
|
552
|
- '个',
|
621
|
+ '天',
|
|
553
|
style: TextStyle(
|
622
|
style: TextStyle(
|
|
554
|
fontWeight: FontWeight.bold,
|
623
|
fontWeight: FontWeight.bold,
|
|
555
|
- color: MyColours.color_515151,
|
624
|
+ color: MyColours.color_999999,
|
|
556
|
fontSize:
|
625
|
fontSize:
|
|
557
|
ScreenUtil().setSp(22)),
|
626
|
ScreenUtil().setSp(22)),
|
|
558
|
)
|
627
|
)
|
|
@@ -560,10 +629,10 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
@@ -560,10 +629,10 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
560
|
),
|
629
|
),
|
|
561
|
VEmptyView(8),
|
630
|
VEmptyView(8),
|
|
562
|
RoundButton(
|
631
|
RoundButton(
|
|
563
|
- text: '积分兑换',
|
|
|
|
564
|
- gradientStart: MyColours.color_BFC4D4,
|
|
|
|
565
|
- gradientEnd: MyColours.color_BFC4D4,
|
|
|
|
566
|
- borderColor: MyColours.color_BFC4D4,
|
632
|
+ text: '有效期',
|
|
|
|
633
|
+ gradientStart: MyColours.color_438E93,
|
|
|
|
634
|
+ gradientEnd: MyColours.color_438E93,
|
|
|
|
635
|
+ borderColor: MyColours.color_438E93,
|
|
567
|
width: ScreenUtil().setWidth(48 * 2),
|
636
|
width: ScreenUtil().setWidth(48 * 2),
|
|
568
|
height: ScreenUtil().setWidth(18 * 2),
|
637
|
height: ScreenUtil().setWidth(18 * 2),
|
|
569
|
fontSize: 20,
|
638
|
fontSize: 20,
|