浏览代码

feat: 移动端留资模块新增检查是否已经留资方法

cuiyalong 1 年之前
父节点
当前提交
d870e6fbb6
共有 1 个文件被更改,包括 17 次插入0 次删除
  1. 17 0
      apps/mobile/src/utils/prototype/modules/leave-info.js

+ 17 - 0
apps/mobile/src/utils/prototype/modules/leave-info.js

@@ -102,6 +102,23 @@ class LeaveInfo {
     })
     return needAutoLeave
   }
+
+  // 检查是否已经留资(包括自动留资)。已留资返回true
+  async checkNeedLeaveInfo(source) {
+    const {
+      data = {},
+      info = {},
+      error_code: code = 0
+    } = await this.getLeaveInfoRequest(source)
+    if (code === 0 && data && data.retainedCapital) {
+      // 检查是否满足自动留资条件
+      const autoLeave = this.checkNeedAutoLeave(source, { info })
+      // autoLeave: true 满足自动留资条件,表示已经留资。
+      return autoLeave
+    } else {
+      return true
+    }
+  }
 }
 
 Vue.prototype.$leaveInfo = new LeaveInfo()