xiaohaizhao пре 2 година
родитељ
комит
d6ebc90d97
1 измењених фајлова са 58 додато и 37 уклоњено
  1. 58 37
      packageA/contract/detail.js

+ 58 - 37
packageA/contract/detail.js

@@ -3,7 +3,10 @@ const _Http = getApp().globalData.http,
     CNY = value => currency(value, {
         symbol: "¥",
         precision: 2
-    }).format();
+    }).format(),
+    {
+        formatTime
+    } = require("../../utils/getTime");
 Page({
     data: {
         isLeader: false, //是否为负责人
@@ -165,13 +168,10 @@ Page({
             editdataleader = s.data.editdataleader == 1;
         }
         if (status != '已终止' && status != '已过期') {
-            if (isAdmin) tabbarList = [{
+            if (status == '已提交' && isAdmin) tabbarList.unshift({
                 icon: "icon-genjin",
                 label: "审核"
-            }, {
-                icon: "icon-genjin",
-                label: "反审核"
-            }].concat(tabbarList);
+            })
             if (isLeader || isAdmin) {
                 if (editdataleader) tabbarList.unshift({
                     icon: "icon-zhuanyi",
@@ -203,10 +203,20 @@ Page({
                 }
             };
         } else {
-            tabbarList = [{
-                icon: "icon-shanchu",
-                label: "作废"
-            }];
+            if (status == '已过期') {
+                tabbarList = [{
+                    icon: "icon-genjin",
+                    label: "反审核"
+                }, {
+                    icon: "icon-shanchu",
+                    label: "作废"
+                }]
+            } else {
+                tabbarList = [{
+                    icon: "icon-shanchu",
+                    label: "作废"
+                }];
+            }
         }
         this.setData({
             isLeader,
@@ -264,7 +274,6 @@ Page({
                 value: data.status
             }];
         if (data.typemx) {
-            console.log(data)
             briefs.splice(3, 0, {
                 label: "项目",
                 value: data.projectname
@@ -533,33 +542,45 @@ Page({
                 })
                 break;
             case "审核":
-                if (data.status != '已提交') return wx.showToast({
-                    title: '当前状态不可审核!',
-                    icon: "none"
-                })
-                wx.showModal({
-                    title: '提示',
-                    content: `是否通过当前协议`,
-                    complete: (res) => {
-                        if (res.confirm) _Http.basic({
-                            "id": 20221121203102,
-                            "version": 1,
-                            "content": {
-                                "type": 1, //0:不通过,1:通过
-                                "sa_contractids": [that.data.sa_contractid]
-                            }
-                        }).then(res => {
-                            console.log("审核合同", res)
-                            wx.showToast({
-                                title: res.msg == '成功' ? "审核成功" : res.msg,
-                                icon: "none"
-                            })
-                            if (res.msg == '成功') setTimeout(() => {
-                                that.getDetail();
-                            }, 300)
+                // enddate
+                if (formatTime().split(" ")[0] <= that.data.detail.enddate) {
+                    wx.showModal({
+                        title: '提示',
+                        content: `是否通过当前协议`,
+                        complete: (res) => {
+                            if (res.confirm) handle()
+                        }
+                    })
+                } else {
+                    wx.showModal({
+                        title: '提示',
+                        content: `当前合同已过期,是否确认继续审核`,
+                        complete: (res) => {
+                            if (res.confirm) handle()
+                        }
+                    })
+                }
+
+                function handle() {
+                    _Http.basic({
+                        "id": 20221121203102,
+                        "version": 1,
+                        "content": {
+                            "type": 1, //0:不通过,1:通过
+                            "sa_contractid": that.data.sa_contractid
+                        }
+                    }).then(res => {
+                        console.log("审核合同", res)
+                        wx.showToast({
+                            title: res.msg == '成功' ? "审核成功" : res.msg,
+                            icon: "none"
                         })
-                    }
-                })
+                        if (res.msg == '成功') setTimeout(() => {
+                            that.getDetail();
+                        }, 300)
+                    })
+                }
+
                 break;
             case "撤回":
                 if (data.status != '已提交') return wx.showToast({