index.js 8.89 KB
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
import Api from "~/service/Api"
import commonFunctions from "~/mixin/commonFunctions.js";
import commonDepend from "~/mixin/commonDepend.js";

export default {
  mixins: [commonFunctions, commonDepend],
  methods: {

    toDbablc() {
      this.routerPush({
        path: "/business/dbablc",
      });
    },

    toDbiblc(row) {
      this.routerPush({
        path: "/business/dbiblc",
        query: { inr: row.inr }
      });
    },
    toCicsel() {
      this.routerPush({
        path: "/business/cicsel",
      });
    },
    toEntatr() {
      this.routerPush({
        path: "/business/entatr",
      });
    },

    //融资申请
    bankApply(data) {
      return Api.post(`/Financing/wgbsel/bankApply`, data);
    },
    //融资校验
    check(data) {
      return Api.post(`/Financing/wgbsel/check`, data);
    },
    //上链重试
    retry(data) {
      return Api.post(`/Financing/wgbsel/retry`, data);
    },

    async init() {
      let rtnmsg = await Api.post('/Financing/wgbsel/init');
      if (rtnmsg.respCode == SUCCESS) {
        this.bchlist = rtnmsg.data.bchlist;
        this.wrkbchlist = rtnmsg.data.wrkbchlist;
        this.model.bchcod = rtnmsg.data.bchcod;
        this.model.ownbchcod = rtnmsg.data.ownbchcod;
      } else {
        this.$notify.error({ title: '错误', message: '服务请求失败!' });
      }
    },

    async handleSearch() {
      if (new Date(this.model.credatsta).getTime() > new Date(this.model.credatend).getTime()) {
        this.$notify.error({ title: '错误', message: '创建开始日期应小于结束日期!' });
        return
      }
      if (new Date(this.model.credatend).getTime() > new Date().getTime()) {
        this.$notify.error({ title: '错误', message: '创建结束日期不应大于当前日期!' });
        return
      }
      if (new Date(this.model.credatend).getTime() - new Date(this.model.credatsta).getTime() > 365 * 24 * 60 * 60 * 1000 * 1) {
        this.$notify.error({ title: '错误', message: '创建日期时间跨度不应超过1年!' });
        return
      }
      this.load = true;
      let params = {
        ...this.model,
        pageNumber: this.pagination.pageIndex,
        pageSize: this.pagination.pageSize,
      };
      delete params.markSet
      delete params.modifySet
      let rtnmsg = await Api.post('/Financing/wgbsel/queryFin', params);
      if (rtnmsg.respCode == SUCCESS) {
        this.tableData = [],
          this.tableData = rtnmsg.data.list;
        this.pagination.total = rtnmsg.data.total;
        this.load = false;
      } else {
        this.$notify.error({ title: '错误', message: '服务请求失败!' });
      }
    },

    async handleReset() {
      this.model = {}
    },

    // 处理
    async handler(row) {
      this.handleModel = row;
      this.trnUrl = 'Financing';
      this.inifrm = 'wgbsel';
      this.initdialog = true;
    },

    async handleClick(btn, row) {
      if (btn.code == 'dbeblc') {
        this.routerPush({
          path: "/business/" + btn.code.toLowerCase(),
          query: { inr: row.inr, pntinr: row.pntinr }
        });
        this.initdialog = false;
      } else if (btn.code == 'dbdblc') {
        this.initdialog = false;
        this.deldialogfig = true;
        this.deldialog = row;
      } else if (btn.code == 'logsrc') {
        this.initdialog = false;
        this.logdialogfig = true;
        this.load = true;
        let params = {
          fininr: row.inr,
          pageNumber: this.pagination.pageIndex,
          pageSize: this.pagination.pageSize,
        };
        const loading = this.loading('正在查询日志');
        let rtnmsg = await Api.post('/Financing/wgbsel/queryLogres', params);
        if (rtnmsg.respCode == SUCCESS) {
          loading.close();
          this.logresLst = [],
            this.logresLst = rtnmsg.data.list;
          this.pagination.total = rtnmsg.data.total;
          this.load = false;
        } else {
          this.$notify.error({ title: '错误', message: '服务请求失败!' });
        }
        loading.close();
      } else {
        let params = {
          recgrp: {
            rec: {
              inr: row.inr
            }
          }
        };
        switch (btn.code) {
          case "finapl":
            const loading1 = this.loading('正在调用融资申请接口');
            let rtnmsg1 = await this.bankApply(params);
            if (rtnmsg1.respCode == SUCCESS) {
              loading1.close();
              if (rtnmsg1.data.result) {
                this.model.recgrp.rec = rtnmsg1.data.fin;
                this.model.recgrp.fsa = rtnmsg1.data.fsa;
                this.$alert('接口调用成功!', '提示', {
                  confirmButtonText: "确认",
                  callback: action => {
                    if (action == 'confirm') {
                      this.initdialog = false;
                      this.queryDetail();
                    }
                  }
                })
              } else {
                this.$notify.error({ title: '错误', message: rtnmsg1.data.fsa.hinmsg });
              }
            } else {
              this.$notify.error({ title: '错误', message: '服务请求失败!' });
            }
            loading1.close();
            break;
          case "finchk":
            const loading2 = this.loading('正在调用融资核验接口');
            let rtnmsg2 = await this.check(params);
            if (rtnmsg2.respCode == SUCCESS) {
              loading2.close();
              if (rtnmsg2.data.result) {
                this.model.recgrp.rec = rtnmsg2.data.fin;
                this.model.recgrp.fsa = rtnmsg2.data.fsa;
                this.$alert('接口调用成功!', '提示', {
                  confirmButtonText: "确认",
                  callback: action => {
                    if (action == 'confirm') {
                      this.initdialog = false;
                      this.queryDetail();
                    }
                  }
                })
              } else {
                this.$notify.error({ title: '错误', message: rtnmsg2.data.fsa.hinmsg });
              }
            } else {
              this.$notify.error({ title: '错误', message: '服务请求失败!' });
            }
            loading2.close();
            break;
          case "retry":
            const loading3 = this.loading('正在调用上链重试接口');
            let rtnmsg3 = await this.retry(params);
            if (rtnmsg3.respCode == SUCCESS) {
              loading3.close();
              if (rtnmsg3.data.result) {
                this.model.recgrp.rec = rtnmsg3.data.fin;
                this.model.recgrp.fsa = rtnmsg3.data.fsa;
                this.$alert('接口调用成功!', '提示', {
                  confirmButtonText: "确认",
                  callback: action => {
                    if (action == 'confirm') {
                      this.initdialog = false;
                      this.queryDetail();
                    }
                  }
                })
              } else {
                this.$notify.error({ title: '错误', message: rtnmsg3.data.fsa.hinmsg });
              }
            } else {
              this.$notify.error({ title: '错误', message: '服务请求失败!' });
            }
            loading3.close();
            break;
          case "rfuacp":
            this.rfudialog = true;
            break;
          case "loaund":
            this.unddialog = true;
            break;
        }

      }
    },

    wait(ms) {
      return new Promise(resolve => setTimeout(resolve, ms));
    },

    //详情查询
    async queryDetail() {
      const loading = this.loading('正在调用详情查询接口');
      await this.wait(5000);
      Api.post(`/Financing/wgbsel/queryDetail`, this.model).then(res => {
        if (res.respCode == SUCCESS) {
          this.model.recgrp = res.data.blcgrp;
          this.model.recpan = res.data.blcp;
          loading.close();
        } else {
          this.$notify.error({ title: '错误', message: res.respMsg });
        }
        loading.close();
      });
      await this.handleSearch();
    },

    async getdbCode(codeType, uil, codeNam) {
      let params = {
        codeType: codeType,
        uil: uil ? uil : 'EN'
      }
      let rtnmsg = await Api.post("/manager/dic/listDicInfo", params)
      if (rtnmsg.respCode === SUCCESS) {
        let curList = rtnmsg.data.map(item => ({
          value: item.codeValue,
          label: item.codeName
        }));
        this.dbCodes[codeNam] = curList
      }
    },

    getBchcodlist(data) {
      return Api.post(`/Financing/wgbsel/getBchcodelist`, data);
    },

    // pageSize改变
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.pagination.pageIndex = 1;
      this.pagination.pageSize = val;
      this.handleSearch();
    },
    // 页码改变
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.pagination.pageIndex = val;
      this.handleSearch();
    },
  },
}