Commit 5fb22abfbeb0f4fe08961bce02dfd6c4727b17e2

Authored by wdn127929
1 parent f0738df3

我的页面 有效期显示0天

... ... @@ -27,7 +27,6 @@ import 'package:one_key/provider/my_model.dart';
import 'package:one_key/provider/notebook_model.dart';
import 'package:one_key/provider/table_manage_model_or_reserve.dart';
import 'package:one_key/provider/tools.dart';
import 'package:one_key/provider/update_model.dart';
import 'package:one_key/provider/user_model.dart';
... ... @@ -118,8 +117,6 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
final XgFlutterPlugin tpush = new XgFlutterPlugin();
//实现监听
Future<dynamic> platformCallHandler(MethodCall call) async {
switch (call.method) {
... ... @@ -139,7 +136,6 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
// TODO: implement initState
super.initState();
LogUtil.v("home_initState");
// CachedNetworkImage.evictFromCache(
// 'https://qn.colorcun.com/template/heilanguodu-6.png');
... ... @@ -162,7 +158,6 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
// needUpdate = false;
// // print(map['type']);
// }
WidgetsBinding.instance.addObserver(this);
... ... @@ -224,9 +219,10 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
create: (_) => MarketingCenterProvider(),
child: ChangeNotifierProvider<SmsModel>(
create: (_) => SmsModel(),
child:ChangeNotifierProvider<PersonnelProvider>(
create: (_) => PersonnelProvider(),
child: TableManagerPage()))))))),
child: ChangeNotifierProvider<
PersonnelProvider>(
create: (_) => PersonnelProvider(),
child: TableManagerPage()))))))),
)))
..add(
ChangeNotifierProvider<FeastModel>(
... ... @@ -249,7 +245,6 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
// });
getSellerVersion();
initPlatformState();
// _getTableList();
_getSellerById();
... ... @@ -286,7 +281,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
}
if (widget.initialIndex == 0 ||
widget.initialIndex == 1 && needRefreshTemp == false) return;
_initNotification();
// _initNotification();
Future.delayed(Duration(minutes: 3), () {
//30000
// ContactModel.getInstance().uploadLocalContact(context);
... ... @@ -310,12 +305,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
});
}
getSellerVersion() async {
await collectStoreProvider.getSellerVersion(context,showLoading: false);
await collectStoreProvider.getSellerVersion(context, showLoading: false);
if (Constant.normalApp) {
_version();
} else {
... ... @@ -328,6 +320,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
_version();
}
}
if (widget.initialIndex == 0 ||
widget.initialIndex == 1 && needRefreshTemp == false) return;
_initNotification();
}
_version() {
... ... @@ -617,7 +612,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
_getSellerById() async {
StoreBaseIndoProvider storeBaseIndoProvider =
Provider.of<StoreBaseIndoProvider>(context, listen: false);
sellerInfoSunModel = await storeBaseIndoProvider.getSellerById(context,showLoading: false);
sellerInfoSunModel =
await storeBaseIndoProvider.getSellerById(context, showLoading: false);
if (sellerInfoSunModel != null) {
// if (sellerInfoSunModel.data.edate != null) {
// //获取到店铺过期时间
... ... @@ -724,8 +720,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
BaseIndoProvider _baseIndoProvider =
Provider.of<BaseIndoProvider>(context, listen: false);
bool success =
await _baseIndoProvider.getCustomerActivityBaseinfo(context, params,isShowLoading: false);
bool success = await _baseIndoProvider
.getCustomerActivityBaseinfo(context, params, isShowLoading: false);
if (success) {}
}
... ... @@ -1566,7 +1562,6 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
collectStoreProvider =
Provider.of<CollectStoreProvider>(context, listen: true);
return new WillPopScope(
child: Scaffold(
bottomNavigationBar: BottomNavigationBar(
... ...
... ... @@ -93,13 +93,12 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
// ///获取短信余量
// _getSmsInfo(context);
///获取积分
// _getMyIntegral(context);
// _getSellerById();
getMyPageCountData();
getMyPageCountData();
///apk版本检测
checkUpdate();
});
... ... @@ -175,19 +174,20 @@ getMyPageCountData();
// }
// }
getMyPageCountData()async{
Map<String, String> params = {
getMyPageCountData() async {
Map<String, String> params = {
'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid,
};
// if (Utils.getAuthority(context, '全店-月订单量')) {
// } else
// } else
if (Utils.getAuthority(context, '个人-月订单量')) {
params['uid'] = Provider.of<UserModel>(context,listen: false).user.openid ;
params['uid'] =
Provider.of<UserModel>(context, listen: false).user.openid;
}
await collectStoreProvider.getMyPageCountData(context,params,showLoading: false);
await collectStoreProvider.getMyPageCountData(context, params,
showLoading: false);
if (Constant.normalApp) {
if (collectStoreProvider.sellerNormal) {
if (collectStoreProvider.sellerNormalEdate != null) {
... ... @@ -197,10 +197,14 @@ getMyPageCountData()async{
edate = DateTime.fromMillisecondsSinceEpoch(
int.parse(collectStoreProvider.sellerNormalEdate) * 1000);
String from =
DateUtil.formatDate(DateTime.now(), format: DateFormats.y_mo_d) +
' 00:00:00';
DateTime datenow = DateUtil.getDateTime(from);
// String from =
// DateUtil.formatDate(DateTime.now(), format: DateFormats.y_mo_d) +
// ' 00:00:00';
// DateTime datenow = DateUtil.getDateTime(from);
DateTime datenow = DateTime.now();
//当前日期
// final datenow = DateTime.now();
//比较相差的天数
int difference = edate.difference(datenow).inDays;
... ... @@ -210,6 +214,8 @@ getMyPageCountData()async{
if (difference < 0 || (difference == 0 && differenceSeconds <= 0)) {
//过期
outDay = '0';
} else if (difference == 0 && differenceSeconds > 0) {
outDay = '1';
} else {
outDay = difference.toString();
}
... ... @@ -239,10 +245,8 @@ getMyPageCountData()async{
edate = DateTime.fromMillisecondsSinceEpoch(
int.parse(collectStoreProvider.sellerNormalEdate) * 1000);
String from = DateUtil.formatDate(DateTime.now(),
format: DateFormats.y_mo_d) +
' 00:00:00';
DateTime datenow = DateUtil.getDateTime(from);
DateTime datenow = DateTime.now();
//比较相差的天数
int difference = edate.difference(datenow).inDays;
... ... @@ -252,6 +256,8 @@ getMyPageCountData()async{
if (difference < 0 || (difference == 0 && differenceSeconds <= 0)) {
//过期
outDay = '0';
} else if (difference == 0 && differenceSeconds > 0) {
outDay = '1';
} else {
outDay = difference.toString();
}
... ... @@ -267,8 +273,7 @@ getMyPageCountData()async{
setState(() {});
}
}
}
}
_getSellerCountsListByMonth(
{isShowLoading = false, VoidCallback callback}) async {
... ... @@ -295,7 +300,7 @@ getMyPageCountData()async{
///获取短信余量
_getSmsInfo(context) async {
myModel = Provider.of<MyModel>(context, listen: false);
SmsInfoData smsInfoData = await myModel.getSmsInfo(context);
SmsInfoData smsInfoData = await myModel.getSmsInfo(context);
setState(() {
if (smsInfoData != null) {
... ... @@ -331,7 +336,7 @@ getMyPageCountData()async{
}
getSellerVersion() async {
await collectStoreProvider.getSellerVersion(context,showLoading: false);
await collectStoreProvider.getSellerVersion(context, showLoading: false);
if (Constant.normalApp) {
if (collectStoreProvider.sellerNormal) {
... ... @@ -342,22 +347,24 @@ getMyPageCountData()async{
edate = DateTime.fromMillisecondsSinceEpoch(
int.parse(collectStoreProvider.sellerNormalEdate) * 1000);
String from =
DateUtil.formatDate(DateTime.now(), format: DateFormats.y_mo_d) +
' 00:00:00';
DateTime datenow = DateUtil.getDateTime(from);
// String from =
// DateUtil.formatDate(DateTime.now(), format: DateFormats.y_mo_d) +
// ' 00:00:00';
DateTime datenow = DateTime.now();
//比较相差的天数
int difference = edate.difference(datenow).inDays;
int differenceSeconds = edate.difference(datenow).inSeconds;
if (difference < 0 || (difference == 0 && differenceSeconds <= 0)) {
//过期
outDay = '0';
} else {
outDay = difference.toString();
}
if (difference < 0 || (difference == 0 && differenceSeconds <= 0)) {
//过期
outDay = '0';
} else if (difference == 0 && differenceSeconds > 0) {
outDay = '1';
} else {
outDay = difference.toString();
}
// print(outDay);
} else {
... ... @@ -384,19 +391,18 @@ getMyPageCountData()async{
edate = DateTime.fromMillisecondsSinceEpoch(
int.parse(collectStoreProvider.sellerNormalEdate) * 1000);
String from = DateUtil.formatDate(DateTime.now(),
format: DateFormats.y_mo_d) +
' 00:00:00';
DateTime datenow = DateUtil.getDateTime(from);
DateTime datenow = DateTime.now();
//比较相差的天数
int difference = edate.difference(datenow).inDays;
int differenceSeconds = edate.difference(datenow).inSeconds;
if (difference < 0 || (difference == 0 && differenceSeconds <= 0)) {
if (difference < 0 || (difference == 0 && differenceSeconds <= 0)) {
//过期
outDay = '0';
} else if (difference == 0 && differenceSeconds > 0) {
outDay = '1';
} else {
outDay = difference.toString();
}
... ... @@ -574,7 +580,7 @@ getMyPageCountData()async{
'员工编号:' +
model.user.account +
" " +
(model.user.role_name_addition??'') ,
(model.user.role_name_addition ?? ''),
TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_ffffff,
... ... @@ -751,7 +757,8 @@ getMyPageCountData()async{
Row(
children: [
Text(
collectStoreProvider.reserveTotal,
collectStoreProvider
.reserveTotal,
style: TextStyle(
fontWeight: FontWeight.bold,
color:
... ... @@ -792,9 +799,7 @@ getMyPageCountData()async{
return;
}
if (Utils.getAuthority(context, '充值短信')) {
NavigatorUtil.goSmsManagePage(context
);
NavigatorUtil.goSmsManagePage(context);
}
},
child: Container(
... ... @@ -807,7 +812,8 @@ getMyPageCountData()async{
Row(
children: [
Text(
collectStoreProvider.smsInfo.isNotEmpty
collectStoreProvider
.smsInfo.isNotEmpty
? '${collectStoreProvider.smsInfo}'
: '0',
style: TextStyle(
... ... @@ -862,8 +868,8 @@ getMyPageCountData()async{
if (Utils.getAuthority(
context, '充值短信')) {
NavigatorUtil.goSmsManagePage(
context,
);
context,
);
}
})
],
... ...
... ... @@ -279,7 +279,7 @@ class HomePageSimState extends State<HomePageSim> with WidgetsBindingObserver {
// }
if (widget.initialIndex == 0 ||
widget.initialIndex == 1 && needRefreshTemp == false) return;
_initNotification();
// _initNotification();
Future.delayed(Duration(minutes: 3), () {
//30000
// ContactModel.getInstance().uploadLocalContact(context);
... ... @@ -357,6 +357,9 @@ class HomePageSimState extends State<HomePageSim> with WidgetsBindingObserver {
// //店铺过期日期
// _edateShow();
// });
if (widget.initialIndex == 0 ||
widget.initialIndex == 1 && needRefreshTemp == false) return;
_initNotification();
return true;
} else {
if (collectStoreProvider.sellerVersionList != null &&
... ... @@ -377,6 +380,9 @@ class HomePageSimState extends State<HomePageSim> with WidgetsBindingObserver {
NavigatorUtil.goHomePageSim(context, initialIndex: _currIndex);
}
}
if (widget.initialIndex == 0 ||
widget.initialIndex == 1 && needRefreshTemp == false) return;
_initNotification();
return false;
}
... ...
... ... @@ -118,7 +118,8 @@ class MyPageSimState extends State<MyPageSim> with WidgetsBindingObserver {
// _getMyIntegral(context);
// _getSellerById();
getMyPageCountData();
getMyPageCountData();
///apk版本检测
checkUpdate();
});
... ... @@ -126,7 +127,7 @@ getMyPageCountData();
Utils.changeStatusColor(color: MyColours.color_438E93);
});
EventBus().on('refreshMySms', (arg) {
getMyPageCountData();
getMyPageCountData();
});
}
... ... @@ -165,20 +166,20 @@ getMyPageCountData();
}
}
getMyPageCountData()async{
Map<String, String> params = {
getMyPageCountData() async {
Map<String, String> params = {
'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid,
};
// if (Utils.getAuthority(context, '全店-月订单量')) {
// } else
// } else
if (Utils.getAuthority(context, '个人-月订单量')) {
params['uid'] = Provider.of<UserModel>(context,listen: false).user.openid ;
params['uid'] =
Provider.of<UserModel>(context, listen: false).user.openid;
}
await collectStoreProvider.getMyPageCountData(context,params);
if (collectStoreProvider.sellerSimple) {
await collectStoreProvider.getMyPageCountData(context, params);
if (collectStoreProvider.sellerSimple) {
//极速版
//店铺过期提醒
// 计算时间差
... ... @@ -189,10 +190,7 @@ getMyPageCountData();
edate =
DateTime.fromMillisecondsSinceEpoch(int.parse(temp[0].edate) * 1000);
String from =
DateUtil.formatDate(DateTime.now(), format: DateFormats.y_mo_d) +
' 00:00:00';
DateTime datenow = DateUtil.getDateTime(from);
DateTime datenow = DateTime.now();
//比较相差的天数
int difference = edate.difference(datenow).inDays;
... ... @@ -202,6 +200,8 @@ getMyPageCountData();
if (difference < 0 || (difference == 0 && differenceSeconds <= 0)) {
//过期
outDay = '0';
} else if (difference == 0 && differenceSeconds > 0) {
outDay = '1';
} else {
outDay = difference.toString();
}
... ... @@ -218,8 +218,7 @@ getMyPageCountData();
}
setState(() {});
}
}
///获取店铺过期时间
// _getSellerById() async {
... ... @@ -395,10 +394,7 @@ getMyPageCountData();
edate =
DateTime.fromMillisecondsSinceEpoch(int.parse(temp[0].edate) * 1000);
String from =
DateUtil.formatDate(DateTime.now(), format: DateFormats.y_mo_d) +
' 00:00:00';
DateTime datenow = DateUtil.getDateTime(from);
DateTime datenow = DateTime.now();
//比较相差的天数
int difference = edate.difference(datenow).inDays;
... ... @@ -408,6 +404,8 @@ getMyPageCountData();
if (difference < 0 || (difference == 0 && differenceSeconds <= 0)) {
//过期
outDay = '0';
} else if (difference == 0 && differenceSeconds > 0) {
outDay = '1';
} else {
outDay = difference.toString();
}
... ... @@ -763,7 +761,8 @@ getMyPageCountData();
Row(
children: [
Text(
collectStoreProvider.reserveTotal,
collectStoreProvider
.reserveTotal,
style: TextStyle(
fontWeight: FontWeight.bold,
color:
... ... @@ -804,8 +803,7 @@ getMyPageCountData();
return;
}
if (Utils.getAuthority(context, '充值短信')) {
NavigatorUtil.goSmsManagePage(context
);
NavigatorUtil.goSmsManagePage(context);
}
},
child: Container(
... ... @@ -818,7 +816,8 @@ getMyPageCountData();
Row(
children: [
Text(
collectStoreProvider.smsInfo.isNotEmpty
collectStoreProvider
.smsInfo.isNotEmpty
? '${collectStoreProvider.smsInfo}'
: '0',
style: TextStyle(
... ...