|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
import 'package:common_utils/common_utils.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_ex_widget/ex_text.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
...
|
...
|
@@ -26,6 +27,9 @@ import 'package:one_key/widgets/v_empty_view.dart'; |
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import '../../app.dart';
|
|
|
|
import '../../models/get_seller_info_model.dart';
|
|
|
|
import '../../provider/store_base_info_provider.dart';
|
|
|
|
import '../../utils/dialog_util.dart';
|
|
|
|
import '../../utils/screen_util.dart';
|
|
|
|
|
|
|
|
class MyPage extends StatefulWidget {
|
|
...
|
...
|
@@ -45,6 +49,8 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
|
|
SmsInfoData smsInfoData;
|
|
|
|
CreateStoreModel createStoreModel;
|
|
|
|
|
|
|
|
String outDay = ''; //过期天数
|
|
|
|
DateTime edate; //过期时间
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
// TODO: implement initState
|
|
...
|
...
|
@@ -68,6 +74,8 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
|
|
///获取积分
|
|
|
|
_getMyIntegral(context);
|
|
|
|
|
|
|
|
_getSellerById();
|
|
|
|
|
|
|
|
///apk版本检测
|
|
|
|
checkUpdate();
|
|
|
|
});
|
|
...
|
...
|
@@ -110,6 +118,35 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///获取店铺过期时间
|
|
|
|
_getSellerById() async {
|
|
|
|
StoreBaseIndoProvider storeBaseIndoProvider =
|
|
|
|
Provider.of<StoreBaseIndoProvider>(context, listen: false);
|
|
|
|
GetSellerInfoSunModel sellerInfoSunModel =
|
|
|
|
await storeBaseIndoProvider.getSellerById(context);
|
|
|
|
if (sellerInfoSunModel != null) {
|
|
|
|
if (sellerInfoSunModel.data.edate != null) {
|
|
|
|
//店铺过期提醒
|
|
|
|
// 计算时间差
|
|
|
|
//店铺过期日期
|
|
|
|
edate = DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
int.parse(sellerInfoSunModel.data.edate) * 1000);
|
|
|
|
|
|
|
|
String from =
|
|
|
|
DateUtil.formatDate(DateTime.now(), format: DateFormats.y_mo_d) +
|
|
|
|
' 00:00:00';
|
|
|
|
DateTime datenow = DateUtil.getDateTime(from);
|
|
|
|
//比较相差的天数
|
|
|
|
outDay = edate.difference(datenow).inDays.toString();
|
|
|
|
// print(outDay);
|
|
|
|
} else {
|
|
|
|
outDay = '';
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
//
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///获取短信余量
|
|
|
|
_getSmsInfo(context) async {
|
|
|
|
// myModel = Provider.of<MyModel>(context, listen: false);
|
|
...
|
...
|
@@ -456,7 +493,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
|
|
'个',
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(22)),
|
|
|
|
)
|
|
|
|
],
|
|
...
|
...
|
@@ -500,7 +537,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
|
|
'条',
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(22)),
|
|
|
|
)
|
|
...
|
...
|
@@ -530,10 +567,42 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
|
|
ScreenUtil().setWidth(32 * 2),
|
|
|
|
color: MyColours.color_f3f3f3,
|
|
|
|
),
|
|
|
|
// if (outDay != '')
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
NavigatorUtil.goMyIntegralPage(context,
|
|
|
|
sunModel: myModel.integralSunModel);
|
|
|
|
// NavigatorUtil.goMyIntegralPage(context,
|
|
|
|
// sunModel: myModel.integralSunModel);
|
|
|
|
if (outDay != '') {
|
|
|
|
if (outDay == '0') {
|
|
|
|
DialogUtil
|
|
|
|
.cupertinoAlertSellerHasEdateDialog(
|
|
|
|
context,
|
|
|
|
title: '温馨提示',
|
|
|
|
isBold: true,
|
|
|
|
lCallback: () {
|
|
|
|
NavigatorUtil.goHomePage(context,
|
|
|
|
initialIndex: 4);
|
|
|
|
},
|
|
|
|
rCallback: () {
|
|
|
|
//立即续费
|
|
|
|
},
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
DialogUtil
|
|
|
|
.cupertinoAlertSellerEdateDialog(
|
|
|
|
context,
|
|
|
|
title: '温馨提示',
|
|
|
|
isBold: true,
|
|
|
|
content: DateUtil.formatDate(
|
|
|
|
edate,
|
|
|
|
format: DateFormats.full,
|
|
|
|
),
|
|
|
|
rCallback: () {
|
|
|
|
//立即续费
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
...
|
...
|
@@ -541,7 +610,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'${myModel.integralSunModel != null && myModel.integralSunModel.myIntegral != null ? myModel.integralSunModel?.myIntegral : '0'}',
|
|
|
|
outDay,
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: MyColours.color_515151,
|
|
...
|
...
|
@@ -549,10 +618,10 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
|
|
ScreenUtil().setSp(40)),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
'个',
|
|
|
|
'天',
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(22)),
|
|
|
|
)
|
|
...
|
...
|
@@ -560,10 +629,10 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
|
|
|
),
|
|
|
|
VEmptyView(8),
|
|
|
|
RoundButton(
|
|
|
|
text: '积分兑换',
|
|
|
|
gradientStart: MyColours.color_BFC4D4,
|
|
|
|
gradientEnd: MyColours.color_BFC4D4,
|
|
|
|
borderColor: MyColours.color_BFC4D4,
|
|
|
|
text: '有效期',
|
|
|
|
gradientStart: MyColours.color_438E93,
|
|
|
|
gradientEnd: MyColours.color_438E93,
|
|
|
|
borderColor: MyColours.color_438E93,
|
|
|
|
width: ScreenUtil().setWidth(48 * 2),
|
|
|
|
height: ScreenUtil().setWidth(18 * 2),
|
|
|
|
fontSize: 20,
|
...
|
...
|
|