import Utils from "~/utils"
import Api from "~/service/Api"
export default {
  methods: {
    txfmodpCheckFn() {
      return new Promise(async (resolve) => {
        if (this.model.txfmod.txfflg == 'X' || this.model.txfmod.manbab == 'X') {
          resolve('2')
        } else {
          this.model.transName
          let rec = {
            transName: this.trnName,
            manbab: "",
            ...this.buildTxfReq(),
          }
          this.model.txfmod.rec = rec;
          this.model.txfmod.txfflg="";
          const rtnmsg = await Api.post(`/${this.moduleRouter()}/txfmod/checkYesOrNo`, this.model.txfmod);
          if (rtnmsg.respCode === SUCCESS) {
            if(rtnmsg.data.checkflg == "0"){
              resolve('1')
              this.$confirm("是否税务备案信息检验?", "提示", {
                closeOnClickModal:false,
                closeOnPressEscape:false,
                distinguishCancelAndClose:true,
                confirmButtonText: "是",
                cancelButtonText: "否",
                cancelButtonClass: 'btn-custom-cancel',
                type: "warning",
              }).then(() => {
                this.tabVal = 'txfp'
                this.model.txfmod.txfflg = 'X'
              }).catch((action) => {
                if (action === 'cancel') {
                  this.model.txfmod.manbab = 'X'
                }
              });
            } else {
              resolve('3')
            }
          } else {
            resolve('3')
          }
        }
      })
    }
  }
}