import Api from '~/service/Api';
import buildFn from '../event/buildCommons.js';
import Utils from "~/utils/index"
import commonFunctions from '~/mixin/commonFunctions.js';
import Pts from '~/components/business/commonModel/Pts';
import dateFormat from '@/util/date/dateFormat.js';

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

    // async call6157(){
    //   const loading = this.loading('正在请求融资还款试算接口');
    //   let rtnmsg = await Api.post(`/${this.moduleRouter()}/trtset/call6157`, this.model);
    //   if (rtnmsg.respCode === SUCCESS) {
    //     this.model.setamt = rtnmsg.data.setamt
    //     this.model.finmod = rtnmsg.data.finmod
    //     this.model.clsflg = rtnmsg.data.clsflg
    //   }
    //   loading.close();
    // },

    async call6157(){
      const loading = this.loading('正在请求融资还款试算接口');
      let rtnmsg = await Api.post(`/${this.moduleRouter()}/trtset/call6157`, this.model);
      if (rtnmsg.respCode === SUCCESS) {
        loading.close();
        if (rtnmsg.data.code == "AAAAAAA") {
          this.model.setamt = rtnmsg.data.setamt
          this.model.finmod = rtnmsg.data.finmod
          this.model.clsflg = rtnmsg.data.clsflg
        } else {
          this.$notify.error({ title: '错误', message: rtnmsg.data.errorMsg });
        }
      } else {
        this.$notify.error({ title: '错误', message: '服务请求失败!' });
      }
      loading.close();
    },

    changeWipflg(){
      if(this.model.wipflg){
        this.model.finmod.reptyp = '1'
        call6157();
      }
    },

    changeReptyp(){
      this.model.finmod.cbs.calflg = ''
    }
  },
};