Browse Source

支付前判断是否有人还未到期

xiaohaizhao 1 year ago
parent
commit
d5b10b5106
1 changed files with 21 additions and 0 deletions
  1. 21 0
      pages/teams/addOrder.js

+ 21 - 0
pages/teams/addOrder.js

@@ -237,8 +237,29 @@ Page({
             }
         })
     },
+    isRenew() {
+        return new Promise((resolve, reject) => {
+            const idname = this.data.sys_payincidence == 1 ? 'userid' : 'sa_agentsid',
+                renew = this.data.users.map(v => this.data.userList.find(s => s[idname] == v)).filter(v => v.enddate[this.data.sys_site_systempartitionid]).map(v => v[this.data.sys_payincidence == 1 ? 'name' : 'agentname']).join(',');
+            if (renew) {
+                wx.showModal({
+                    title: '提示',
+                    content: `${renew}付费还未到期,是否继续付费`,
+                    confirmText: "继续付费",
+                    complete: (res) => {
+                        if (res.cancel) resolve(false)
+                        if (res.confirm) resolve(true)
+                    }
+                })
+            } else {
+                resolve(true)
+            }
+        })
+    },
     /* 支付 */
     async payment() {
+        let isRenew = await this.isRenew();
+        if (!isRenew) return;
         let isPayment = await this.examine();
         if (!isPayment) return;
         let that = this;