|
@@ -47,34 +47,7 @@ Component({
|
|
|
this.data.timer2 && clearInterval(this.data.timer2)
|
|
|
let _this = this
|
|
|
this.data.timer2 = setInterval(() => {
|
|
|
- // let expirationDate = app.globalData.snDisposition.expirationDate;
|
|
|
- let expirationDate = '2024-12-15';
|
|
|
- // let expirationDate = '2025-01-15';
|
|
|
- let visible = false
|
|
|
- let showCloseBtn = false
|
|
|
- if (expirationDate) {
|
|
|
- const now = new Date();
|
|
|
- const currentStr = new Date(formatTime(now,'YYYY-MM-DD 00:00:00'));
|
|
|
- const expirationDateStr = new Date(formatTime(expirationDate,'YYYY-MM-DD 00:00:00'));
|
|
|
- const expirationDateStr1 = new Date(expirationDateStr.getFullYear(), expirationDateStr.getMonth(), expirationDateStr.getDate() - 30);
|
|
|
- console.log(app.globalData.expirationDateOpenNum)
|
|
|
- if (currentStr.getTime() == expirationDateStr1.getTime() && app.globalData.expirationDateOpenNum == 0 && !this.data.cusModalObj.visible) {
|
|
|
- app.globalData.expirationDateOpenNum = app.globalData.expirationDateOpenNum + 1;
|
|
|
- _this.setData({
|
|
|
- 'cusModalObj.visible': true,
|
|
|
- 'cusModalObj.showCloseBtn': true,
|
|
|
- })
|
|
|
- console.log(currentStr.getTime() , expirationDateStr1.getTime(),currentStr.getTime() == expirationDateStr1.getTime())
|
|
|
- return
|
|
|
- }
|
|
|
- if(currentStr.getTime() >= expirationDateStr.getTime() && !this.data.cusModalObj.visible){
|
|
|
- console.log(currentStr.getTime() , expirationDateStr.getTime(),currentStr.getTime() >= expirationDateStr.getTime())
|
|
|
- _this.setData({
|
|
|
- 'cusModalObj.visible': true,
|
|
|
- 'cusModalObj.showCloseBtn': false,
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
+ _this.checkExpiryDate()
|
|
|
this.setData({
|
|
|
newDate: getDate()
|
|
|
})
|
|
@@ -87,6 +60,42 @@ Component({
|
|
|
* 组件的方法列表
|
|
|
*/
|
|
|
methods: {
|
|
|
+ checkExpiryDate() {
|
|
|
+ let expiryDate = app.globalData.snDisposition.expirationDate;
|
|
|
+ // let expiryDate = '2025-01-25';
|
|
|
+ // let expiryDate = '2024-12-26';
|
|
|
+ if (expiryDate) {
|
|
|
+ console.log(`弹窗次数:${app.globalData.expirationDateOpenNum}`);
|
|
|
+ let { cusModalObj } = this.data
|
|
|
+ const now = new Date();
|
|
|
+ // 计算当前日期
|
|
|
+ const currentDate = new Date(formatTime(now,'YYYY-MM-DD 00:00:00'));
|
|
|
+ // 计算到期日期
|
|
|
+ const expiry = new Date(formatTime(expiryDate,'YYYY-MM-DD 00:00:00'));
|
|
|
+ // 计算到期日期30天前
|
|
|
+ const expiryThirtyDate = new Date(expiry.getFullYear(), expiry.getMonth(), expiry.getDate() - 30);
|
|
|
+
|
|
|
+ // 检查是否在30天之前
|
|
|
+ if (app.globalData.expirationDateOpenNum == 0 && !cusModalObj.visible && currentDate.getTime() == expiryThirtyDate.getTime()) {
|
|
|
+ console.log(`您的FKJ账户将在 30 天后到期:${expiry.toLocaleDateString()}`);
|
|
|
+ app.globalData.expirationDateOpenNum = app.globalData.expirationDateOpenNum + 1;
|
|
|
+ this.setData({
|
|
|
+ 'cusModalObj.visible': true,
|
|
|
+ 'cusModalObj.showCloseBtn': true,
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果当前日期超过到期日期
|
|
|
+ if (!cusModalObj.visible && currentDate.getTime() >= expiry.getTime()) {
|
|
|
+ console.log(`您的FKJ账户已到期。${expiry.toLocaleDateString()}`);
|
|
|
+ this.setData({
|
|
|
+ 'cusModalObj.visible': true,
|
|
|
+ 'cusModalObj.showCloseBtn': false,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
onOk() {
|
|
|
this.setData({
|
|
|
'cusModalObj.visible': false
|