Browse Source

标准版的续费

姜永辉 1 năm trước cách đây
mục cha
commit
c23b96bcab
1 tập tin đã thay đổi với 55 bổ sung36 xóa
  1. 55 36
      pages/mine/mine.js

+ 55 - 36
pages/mine/mine.js

@@ -22,11 +22,11 @@ Page({
    * 页面的初始数据
    */
   data: {
-    imageUrl: config.image_url + '/static/img/', 
-    dueFlag:false,  // 到期标识
-    videoSrc:'https://s.dev01.dkiboss.com:7000/file/operate_guide/all.mp4',
-    cpEndDate:null,
-    playFlag:false, 
+    imageUrl: config.image_url + '/static/img/',
+    dueFlag: false,  // 到期标识
+    videoSrc: 'https://s.dev01.dkiboss.com:7000/file/operate_guide/all.mp4',
+    cpEndDate: null,
+    playFlag: false,
     companyName: null,
     staffName: 'null',
     orgName: null,
@@ -158,30 +158,30 @@ Page({
         let data = res.data.data
         let valueAmounts = []
         valueAmounts.push({
-          title:'销售金额(元)',
-          value:data.amtShouldSumAmount?data.amtShouldSumAmount:0.00
+          title: '销售金额(元)',
+          value: data.amtShouldSumAmount ? data.amtShouldSumAmount : 0.00
         })
         valueAmounts.push({
-          title:'收款金额(元)',
-          value:data.amtRecSumAmount?data.amtRecSumAmount:0.00
+          title: '收款金额(元)',
+          value: data.amtRecSumAmount ? data.amtRecSumAmount : 0.00
         })
         valueAmounts.push({
-          title:'库存成本金额(元)',
-          value:data.costAmtSumAmount?data.costAmtSumAmount:0.00
+          title: '库存成本金额(元)',
+          value: data.costAmtSumAmount ? data.costAmtSumAmount : 0.00
         })
         this.setData({
           valueAmounts,
         })
       }
     });
-  }, 
+  },
 
   /**
   * @desc : 跳转到微信聊天界面
   * @author : 周兴
   * @date : 2024/4/9
   */
-  handleWxService(e){
+  handleWxService(e) {
     // console.log('Constants.WX_SERVICE',Constants.WX_SERVICE);
     // let url= Constants.WX_SERVICE
     // wx.navigateTo({
@@ -191,10 +191,10 @@ Page({
     //   }
     // })
     wx.openCustomerServiceChat({
-      extInfo: {url: Constants.WX_SERVICE},
+      extInfo: { url: Constants.WX_SERVICE },
       corpId: Constants.WX_CPID,
       success(res) {
-        console.log('ddd',res);
+        console.log('ddd', res);
       }
     })
   },
@@ -203,7 +203,7 @@ Page({
   * @author : 周兴
   * @date : 2024/4/9
   */
-  handleRecharge(e){
+  handleRecharge(e) {
     let url = '/package-basic-data/pages/activity/activity'
     wx.navigateTo({
       url: url,
@@ -223,7 +223,7 @@ Page({
   * @author : 周兴
   * @date : 2024/4/9
   */
-  handleUpgrade(e){
+  handleUpgrade(e) {
     let url = '/package-basic-data/pages/activity/activity?upgrade=true'
     wx.navigateTo({
       url: url,
@@ -391,7 +391,7 @@ Page({
   */
   toSetting() {
     this.setData({
-      loading:true
+      loading: true
     })
     console.log(app.globalData, "toSetting");
     let _this = this
@@ -405,11 +405,11 @@ Page({
       success: function (res) {
         // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
         res.eventChannel.emit('params', { id: app.globalData.company.cpId, formMode: Constants.formMode.edit })
-        setTimeout(()=>{
+        setTimeout(() => {
           _this.setData({
-            loading:false
+            loading: false
           })
-        },2000)
+        }, 2000)
       }
     })
   },
@@ -418,9 +418,9 @@ Page({
   * @date : 2022/5/12 13:49
   * @author : 于继渤
   */
-  toBeginnerGuide(){
+  toBeginnerGuide() {
     this.setData({
-      loading:true
+      loading: true
     })
     let _this = this
     wx.navigateTo({
@@ -433,11 +433,11 @@ Page({
       success: function (res) {
         // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
         res.eventChannel.emit('params', {})
-        setTimeout(()=>{
+        setTimeout(() => {
           _this.setData({
-            loading:false
+            loading: false
           })
-        },1000)
+        }, 1000)
       }
     })
   },
@@ -654,26 +654,45 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    console.log( app.globalData.company," app.globalData.company");
+    console.log(app.globalData.company, " app.globalData.company");
     let res = wx.getSystemInfoSync();
     let statusHeight = res.statusBarHeight
     this.setData({
       statusHeight: statusHeight * 2 + 20
     })
-    if(app.globalData && app.globalData.company){
+    if (app.globalData && app.globalData.company) {
       let cpEndDate = app.globalData.company.endDate
       this.setData({
-        cpEndDate:cpEndDate, // 企业到期日期
+        cpEndDate: cpEndDate, // 企业到期日期
       })
       // 判断是否即将到期
       let endD = new Date(cpEndDate);
-        let nowD = new Date(new Date().toDateStr()).addDays(Constants.CP_ALERT_TIME);
-        if (endD < nowD) {
-            this.setData({
-              dueFlag:true
-            })
-        }
+      // 服务器的日期为准
+      let nowD = new Date(app.globalData.nowDate).addDays(Constants.CP_ALERT_TIME);
+      if (endD < nowD) {
+        this.setData({
+          dueFlag: true
+        })
+      }
+    }
+    // // 判断当前用户是否到期 标准版
+    if (app.globalData.company.gradeCode == Constants.gradeCode.STD
+      && !app.globalData.user.flgInit
+      && app.globalData.company.userEndDate) {
+      let endD = new Date(app.globalData.company.userEndDate);
+      // 服务器的日期为准
+      let nowD = new Date(app.globalData.nowDate).addDays(Constants.CP_ALERT_TIME);
+      if (endD < nowD) {
+        let cpEndDate = app.globalData.company.userEndDate
+        this.setData({
+          cpEndDate: cpEndDate, // 企业到期日期
+        })
+        this.setData({
+          dueFlag: true
+        })
+      }
     }
+
     let waitMenu = this.data.waitMenu;
     let waitMenuFlag = false;
     waitMenu.forEach(it => {
@@ -698,7 +717,7 @@ Page({
       }
     })
     // 标准版不显示待办
-    if(this.data.gradeCode == Constants.gradeCode.STD){
+    if (this.data.gradeCode == Constants.gradeCode.STD) {
       waitMenuFlag = false
     }