index.js 3.04 KB
import commonFunctions from "~/mixin/commonFunctions.js";
import Api from "~/service/Api";

export default {
  mixins: [commonFunctions],
  methods: {
    async getOwnref() {
      if (this.model.fxdgrp.rec.fxtyp == "") {
        this.$notify.warning({
          title: "提示",
          message: "请先选择结售汇类型!",
        });
        return;
      }
      const loading = this.loading();
      let res = await Api.post(
        `/${this.moduleRouter()}/fxtsss/getRef`,
        this.model
      );
      loading.close();
      if (res.respCode !== SUCCESS) {
        this.$message.error(res.respMsg);
        return;
      }
      this.model.fxdgrp.rec.ownref = res.data;
    },

    async defaultAccountsN1000() {
      if (this.model.fxdgrp.rec.fxtyp == "") {
        return;
      }
      if (this.model.fxdgrp.cbs.max.cur == "") {
        return;
      }
      if (this.model.fxdgrp.apl.pts.ptyinr == "") {
        return;
      }
      const loading = this.loading();
      let res = await Api.post(
        `/${this.moduleRouter()}/fxtsss/defaultAccountsN1000`,
        this.model
      );
      loading.close();
      if (res.respCode !== SUCCESS) {
        this.$message.error(res.respMsg);
        return;
      }
      // this.updateValueSet(res.codeSet);
      this.accLst = res.codeSet["accLst"];
      this.accLst2 = res.codeSet["acc2Lst"];
      this.model.fxdgrp.rec.acc = res.data.fxdgrp.rec.acc;
      this.model.fxdgrp.rec.acc2 = res.data.fxdgrp.rec.acc2;
    },

    async defaultRateN1000() {
      if (this.model.fxdgrp.rec.fxtyp == "") {
        return;
      }
      if (this.model.fxdgrp.cbs.max.cur == "") {
        return;
      }
      if (this.model.fxdgrp.apl.pts.ptyinr == "") {
        return;
      }
      const loading = this.loading();
      let res = await Api.post(
        `/${this.moduleRouter()}/fxtsss/defaultRateN1000`,
        this.model
      );
      loading.close();
      if (res.respCode !== SUCCESS) {
        this.$message.error(res.respMsg);
        return;
      }
      this.model.fxdgrp.rec.rat = res.data.fxdgrp.rec.rat;
      this.model.fxdgrp.rec.midrat = res.data.fxdgrp.rec.midrat;
    },

    async defaultAccAndRate() {
      this.defaultAccountsN1000();
      await this.defaultRateN1000();
      this.defaultCalculateN1100();
    },

    async defaultCalculateN1100() {
      if (this.model.fxdgrp.rec.rat == "") {
        return;
      }
      if (this.model.fxdgrp.cbs.max.cur == "") {
        return;
      }
      if (
        this.model.fxdgrp.cbs.max.amt == "" ||
        this.model.fxdgrp.cbs.max.amt == 0
      ) {
        this.model.fxdgrp.cbs.nom1.amt = "0.00";
        return;
      }
      const loading = this.loading();
      let res = await Api.post(
        `/${this.moduleRouter()}/fxtsss/defaultCalculateN1100`,
        this.model
      );
      loading.close();
      if (res.respCode !== SUCCESS) {
        this.$message.error(res.respMsg);
        return;
      }
      this.model.fxdgrp.cbs.max.amt = res.data.fxdgrp.cbs.max.amt;
      this.model.fxdgrp.cbs.nom1.amt = res.data.fxdgrp.cbs.nom1.amt;
    },
  },
};