index.js 11.7 KB
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10
import commonFunctions from '~/mixin/commonFunctions.js';
import Api from '~/service/Api';
export default {
    mixins: [commonFunctions],
    methods: {
        queryOwnref() {
            let params = this.model.bpdgrp;
            let ptainr = this.model.bpdgrp.fia.pts.ptainr;
            const loading = this.loading();
            let trnName = this.root.trnName.toUpperCase();
fukai committed
11
            Api.post(`/${this.moduleRouter()}/ref/bpt?ptaInr=${ptainr}&trnName=${trnName}`, params).then(res => {
fukai committed
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
                loading.close();
                if (res.respCode === SUCCESS) {
                    this.model.bpdgrp.rec.ownref = res.data.ownref;
                    //借据号
                    this.model.bpdgrp.rec.fincod = res.data.ownref;
                    this.model.bpdgrp.rec.matdat = res.data.matdat;
                }
            }).catch(() => {
                loading.close();
            });
        },
        getRecNam() {
            this.model.bpdgrp.rec.nam = (this.model.bpdgrp.cbs.max.cur + " " + this.model.bpdgrp.cbs.max.amt + " " + this.model.bpdgrp.fia.pts.nam).slice(0, 40)
        },
        async onAccounts() {
            if (this.model.bpdgrp.fia.pts.ptyinr == "" || this.model.bpdgrp.cbs.max.cur == "") {
                return;
            }
            let data = {
                ptyinr: this.model.bpdgrp.fia.pts.ptyinr,
                ptainr: this.model.bpdgrp.fia.pts.ptainr,
                cur: this.model.bpdgrp.cbs.max.cur,
                amt: this.model.bpdgrp.cbs.max.amt,

            }
            const loading = this.loading();
fukai committed
38
            let res = await Api.post(`/${this.moduleRouter()}/bpfopn/defaultAccountsN1100`, data);
fukai committed
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
            loading.close();
            if (res.respCode === SUCCESS) {
                this.model.finmod.act1Set = res.data.act1Set;
                this.model.finmod.intactSet = res.data.intactSet;
                this.$set(this.codes, 'act1List', res.data.act1Set)
                if (this.model.finmod.act1 != '') {
                    if (res.data.act1Set != null && res.data.act1Set.length > 0) {
                        if (!res.data.act1Set.includes(this.model.finmod.act1)) {
                            this.model.finmod.act1 = ''
                        }
                    } else {
                        this.model.finmod.act1 = ''
                    }
                }
            }
        },
        cal() {
            let tolrat = this.model.bpdgrp.rec.tolrat;
            console.log("tolrat:" + tolrat);
            if (tolrat <= '0.000000') {
                this.$notify.error({ title: this.$t('factoring.错误'), message: this.$t('factoring.执行利率必须大于0!') });
                return;
            }
            let params = {
                ...this.model,
                transName: this.trnName,
            };
            const loading = this.loading();
            let trnName = this.root.trnName.toLowerCase();
fukai committed
68
            Api.post(`/factoring/${trnName}/cal`, params).then(res => {
fukai committed
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
                loading.close();
                if (res.respCode === SUCCESS) {
                    this.model.finmod.intamt = res.data.finmod.intamt;
                }
            }).catch(() => {
                loading.close();
            });
        },
        getIntrat() {
            this.model.bpdgrp.rec.intrat = "3.000000";
            /*if (this.model.bpdgrp.cbs.max.cur == "") {
                this.$notify.error({title: this.$t('financing.错误'), message: this.$t('financing.请先选择币种!')});
                return;
            }
            if (this.model.finmod.ratchgtyp == "") {
                this.$notify.error({
                    title: this.$t('financing.错误'),
                    message: this.$t('financing.请先选择利率调整方式!')
                });
                return;
            }
            if (this.model.bpdgrp.rec.matdat == null || this.model.bpdgrp.rec.matdat == "") {
                this.$notify.error({title: this.$t('financing.错误'), message: this.$t('financing.请先选择到期日!')});
                return;
            }
            if (['7', '8', '9'].includes(this.model.finmod.ratchgtyp) && this.model.finmod.ratchgprd == "") {
                this.$notify.error({
                    title: this.$t('financing.错误'),
                    message: this.$t('financing.请先选择利率调整周期!')
                });
                return;
            }
            if (this.model.bpdgrp.cbs.max.cur == "CNY" && this.model.finmod.dinmod.jzllgz == "1" && this.model.bpdgrp.rec.lprtyp == "") {
                this.$notify.error({title: this.$t('financing.错误'), message: this.$t('financing.请选择LPR期限品种')});
                return;
            }
            let params = {
                ...this.model,
                transName: this.trnName,
            };
            const loading = this.loading();
            let trnName = this.root.trnName.toLowerCase();
fukai committed
111
            Api.post(`/financing/${trnName}/getIntrat`, params).then(res => {
fukai committed
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 283 284 285 286 287
                loading.close();
                if (res.respCode === SUCCESS) {
                    this.model.bpdgrp.rec.intrat = res.data.bpdgrp.rec.intrat;
                }
            }).catch(() => {
                loading.close();
            });*/
        },
        changeFlttyp() {
            let flttyp = this.model.finmod.flttyp;
            let fltvalDis = !("1" == flttyp || "2" == flttyp)
            if (fltvalDis) {
                this.model.finmod.fltval = "0"
            }
            this.fltvalDis = fltvalDis
        },
        changeFinTypes() {
            this.defaultBptpFinTypesN1000();
            this.defaultBpdgrpRecFfttypN1000()

        },
        changeIntprd() {
            let intprd = this.model.finmod.intprd;
            if (intprd != '7') {
                this.model.finmod.intamt = '';
                this.model.finmod.inttyp = '';
            }
            if (['1', '2', '3', '4', '5'].includes(intprd)) {
                if (this.model.finmod.intdat == '') {
                    this.model.finmod.intdat = '20';
                }
            } else {
                this.model.finmod.intdat = '';
            }
            let fintyp = this.model.bpdgrp.rec.fintyp;
            switch (fintyp) {
                case "F":
                case "G":
                    if (intprd == "7") {
                        this.isShowFfttyp = true;
                        this.ffttypList = ['0']
                    } else {
                        this.model.bpdgrp.rec.ffttyp = '';
                        this.isShowFfttyp = false;
                    }
                    break;
                default:
                    this.model.bpdgrp.rec.ffttyp = '';
                    this.isShowFfttyp = false;

            }
        },
        defaultBptpFinTypesN1000() {
            let fintyp = this.model.bpdgrp.rec.fintyp;
            switch (fintyp) {
                //# Discount
                case "D":
                    this.isShowDistyp = true;
                    this.isShowPurtyp = false;
                    this.model.bptp.purtyp = "";
                    this.model.bpdgrp.rec.rsktyp = this.model.bptp.distyp;
                    this.model.finmod.intprd = "6"
                    break;
                case "T":
                    // # Discount 国内证贴现
                    this.isShowDistyp = true;
                    this.isShowPurtyp = false;
                    this.model.bptp.purtyp = "";
                    this.model.bpdgrp.rec.rsktyp = this.model.bptp.distyp;
                    this.model.finmod.intprd = "6"
                    break;
                case "P":
                    // # Purchase
                    this.isShowPurtyp = true;
                    this.isShowDistyp = false;
                    this.model.bptp.distyp = "";
                    if (this.model.bpdgrp.rec.pnttyp == "BOD" || (this.model.bpdgrp.rec.pnttyp == "BED" && this.model.bedgrp.rec.doctypcod !== "P")) {
                        // Disable(PURTYP)
                        this.model.bptp.purtyp = "DSB"
                    }

                    this.model.bpdgrp.rec.rsktyp = this.model.bptp.purtyp
                    this.model.finmod.intprd = "6"
                    break;
                case "M":
                    //# Purchase  国内证押汇
                    this.isShowPurtyp = true;
                    this.isShowDistyp = false;
                    Clear(DISTYP)
                    if (this.model.bpdgrp.rec.pnttyp == "BED" && this.model.bedgrp.rec.doctypcod !== "P") {
                        // Disable(PURTYP)
                        this.model.bptp.purtyp = "DSB"
                    }
                    this.model.bpdgrp.rec.rsktyp = this.model.bptp.purtyp
                    this.model.finmod.intprd = "6"
                    break;
                case "F":
                case "U":
                case "G":
                case "V":
                    this.isShowPurtyp = false;
                    this.model.bptp.purtyp = ""
                    this.isShowDistyp = false;
                    this.model.bptp.distyp = ""
                    this.model.finmod.intprd = "7"
                    break;
                default:
                    this.isShowPurtyp = false;
                    this.model.bptp.purtyp = ""
                    this.isShowDistyp = false;
                    this.model.bptp.distyp = ""
                    this.model.bpdgrp.rec.rsktyp = ""
                    this.model.finmod.intprd = "6"

            }
            if (this.model.bpdgrp.rec.pntinr == '') {
                this.purtypList = ['NB0', 'DSB', 'BO']
            } else {
                this.purtypList = ['NB0', 'DSB']
            }
        },
        defaultBpdgrpRecFfttypN1000() {
            //default BPDGRP\REC\FFTTYP
            let fintyp = this.model.bpdgrp.rec.fintyp;
            switch (fintyp) {
                case "F":
                case "G":
                    let intprd = this.model.finmod.intprd;
                    if (intprd == "7") {
                        this.isShowFfttyp = true;
                        this.ffttypList = ['0']
                    } else {
                        this.model.bpdgrp.rec.ffttyp = '';
                        this.isShowFfttyp = false;
                    }
                    break;
                default:
                    this.model.bpdgrp.rec.ffttyp = '';
                    this.isShowFfttyp = false;

            }
        },
        resetCipmod() {
            if (this.model.cipmodVo.covflg == '') {
                this.model.cipmodVo.cfkkhh = ''
                this.model.cipmodVo.cfkkhm = ''
                this.model.cipmodVo.cfkrzh = ''
                this.model.cipmodVo.cfkrmc = ''
                this.model.cipmodVo.cfkdz1 = ''
                this.model.cipmodVo.cfkdz2 = ''
                this.model.cipmodVo.cfkdz3 = ''
                this.model.cipmodVo.cfkdz4 = ''
                this.model.cipmodVo.cfkdz5 = ''
                this.model.cipmodVo.cfkdz6 = ''
                this.model.cipmodVo.cfkdz7 = ''
                this.model.cipmodVo.cskkhh = ''
                this.model.cipmodVo.cskkhm = ''
                this.model.cipmodVo.cskrzh = ''
                this.model.cipmodVo.cskrmc = ''
                this.model.cipmodVo.cskdz1 = ''
                this.model.cipmodVo.cskdz2 = ''
                this.model.cipmodVo.cskdz3 = ''
                this.model.cipmodVo.cskdz4 = ''
                this.model.cipmodVo.cskdz5 = ''
                this.model.cipmodVo.cskdz6 = ''
                this.model.cipmodVo.cskdz7 = ''
                this.model.cipmodVo.czjjg1 = ''
                this.model.cipmodVo.czj1mc = ''
                this.model.cipmodVo.covfuy = ''
                this.model.cipmodVo.covfy2 = ''
                this.model.cipmodVo.covfy3 = ''
                this.model.cipmodVo.covfy4 = ''
            }
        },
    },
}