Browse Source

修复付费已过期bug

xiaohaizhao 5 months ago
parent
commit
725e992c0f
2 changed files with 25 additions and 5 deletions
  1. 20 4
      pages/teams/addOrder.js
  2. 5 1
      pages/teams/addOrder.wxml

+ 20 - 4
pages/teams/addOrder.js

@@ -22,7 +22,8 @@ Page({
         this.setData({
             sys_payinstructions: wx.getStorageSync('siteP').sys_payinstructions,
             sys_payincidence: 1,
-            opUsers: options.users ? JSON.parse(options.users) : []
+            opUsers: options.users ? JSON.parse(options.users) : [],
+            today: formatTime(new Date(), '-').split(' ')[0]
         })
         sys_payorderid = options.sys_payorderid;
         this.getVersions(options.vid || "");
@@ -196,9 +197,11 @@ Page({
             let date = v.enddate[this.data.sys_site_systempartitionid];
             if (v.userid == wx.getStorageSync('userMsg').userid || v.isleader == 1) {
                 if (date) {
-                    // if (formatTime(new Date(), '-').split(" ")[0] >= date) users.push(v[idname] + '');
+                    if (formatTime(new Date(), '-').split(" ")[0] >= date) users.push(v[idname] + '');
+
                 } else {
                     if (!users.some(v => v == v[idname])) users.push(v[idname] + '');
+
                 }
             }
             if (users.some(id => id == v.userid) && v.isleader == 0) useDiscount += 1
@@ -220,8 +223,21 @@ Page({
         let users = this.data.users,
             useDiscount = this.data.useDiscount;
         if (users.some(v => v == id)) {
-            users = users.filter(s => s != id)
-            if (isleader == 0) useDiscount -= 1;
+
+            if (isleader) {
+                let item = this.data.userList.find(v => v.userid == id),
+                    date = item.enddate[this.data.sys_site_systempartitionid];
+                if (date && this.data.today >= date) {
+                    return;
+                } else {
+                    users = users.filter(s => s != id)
+                    if (isleader == 0) useDiscount -= 1;
+                }
+            } else {
+                users = users.filter(s => s != id)
+                if (isleader == 0) useDiscount -= 1;
+            }
+
         } else {
             users.push(id + "")
             if (isleader == 0) useDiscount += 1;

+ 5 - 1
pages/teams/addOrder.wxml

@@ -35,7 +35,8 @@
         <van-checkbox shape='square' icon-size='14' disabled="{{item.isleader && per.query(users,item.userid) && !item.enddate[sys_site_systempartitionid]}}" name="{{item.userid}}" />
         <view class="content">
             <view class="label">
-                {{item.name}} <van-tag custom-class='tag1' wx:if="{{item.isleader==1}}" text-color='#fff' round type="danger">主账号</van-tag>
+                {{item.name}}
+                <van-tag custom-class='tag1' wx:if="{{item.isleader==1}}" text-color='#fff' round type="danger">主账号</van-tag>
             </view>
             <view>
                 账号ID:{{item.accountno}}
@@ -49,6 +50,9 @@
             <view class="tag" wx:if="{{!item.enddate[sys_site_systempartitionid]}}">
                 未付费
             </view>
+            <view class="tag" wx:elif="{{item.enddate[sys_site_systempartitionid] < today}}">
+                已过期
+            </view>
         </view>
     </view>
 </van-checkbox-group>