Newer
Older
smartKitchenFront / src / views / distributor / dealerinformation.vue
<!--经销商信息填报-->
<template>
  <div class="information-container">
    <div class="information-title">
      经销商信息填报
    </div>
    <div class="information-from">
      <div class="from-title">
        基础信息
      </div>
      <base-info ref="dealerBaseInfo"/>
    </div>

    <div class="information-from">
      <div class="from-title">
        三证信息
      </div>

      <cert-info ref="dealerCertInfo" @updateLegalPerson="cascadeUpdateLegalPerson"/>
    </div>

    <div class="information-from">
      <div class="from-title">
        联系人信息
      </div>
      <person-info ref="dealerPersonInfo"/>
    </div>

    <div class="information-from">
      <div class="from-title">
        业务信息
      </div>
      <business-info ref="dealerBusinessInfo"/>
    </div>

    <div class="information-from">
      <div class="from-title">
        经营信息
      </div>
      <operation-info ref="dealerOperationInfo"/>
    </div>

    <div class="information-from">
      <div class="from-title">
        经营许可信息
      </div>
      <licence-info ref="dealerLicenceInfo"/>
    </div>

    <div class="information-from">
      <div class="from-title">
        银行账户信息
      </div>
      <bank-info ref="dealerBankInfo"/>
    </div>

    <div class="information-from">
      <div class="from-title">
        管理体系认证信息
      </div>
      <man-system-info ref="dealerManSystemInfo"/>
    </div>

    <div class="information-from">
      <div class="from-title">
        资质认证信息
      </div>
      <qualify-info ref="dealerQualifyInfo"/>
    </div>

    <div class="btnBox">
      <el-button type="primary" class="save" style="background-color: #2483b3" @click="save">保存</el-button>
    </div>
  </div>
</template>

<script>
import BaseInfo from '@/views/companyDetail/baseInfo'
import CertInfo from '@/views/companyDetail/certInfo'
import PersonInfo from '@/views/companyDetail/personInfo'
import BusinessInfo from '@/views/companyDetail/businessInfo'
import OperationInfo from '@/views/companyDetail/operationInfo'
import LicenceInfo from '@/views/companyDetail/licenceInfo'
import BankInfo from '@/views/companyDetail/bankInfo'
import ManSystemInfo from '@/views/companyDetail/manSystemInfo'
import QualifyInfo from '@/views/companyDetail/qualifyInfo'
import { addDistributorInfo } from '@/api/distributor/distributor'
export default {
  name: 'DealerInfomation',
  components: {
    BaseInfo, CertInfo, PersonInfo, BusinessInfo, OperationInfo, LicenceInfo, BankInfo, ManSystemInfo, QualifyInfo
  },
  data() {
    return {
      companyFormInfo: {
        baseInfo: {
          distributorName: '',
          distributorArea: '',
          companyNature: '',
          companyType: '',
          companyProvince: '',
          companyCity: '',
          companyArea: '',
          companyAddress: ''
        },
        certificateInfo: {
          threeCertificatesInOne: 1,
          unifiedSocialCreditCode: '',
          licenseRegisterNumber: '',
          registerCapital: '',
          registerAddress: '',
          legalPerson: '',
          establishDate: '',
          businessTerm: '',
          businessScope: '',
          licenseScan: '',
          organizeCode: '',
          organizeCodeScan: '',
          taxpayerNature: '',
          taxRegisterCode: '',
          taxRegisterCodeScan: ''
        },
        personInfo: {
          legalPersonName: '',
          legalPersonPhone: '',
          legalPersonCertificateCode: '',
          legalPersonCertificateType: '',
          legalPersonCertificateFrontScan: '',
          legalPersonCertificateBackScan: '',
          businessLeaderName: '',
          businessLeaderCertificateType: '',
          businessLeaderCertificateCode: '',
          businessLeaderPhone: '',
          businessLeaderCertificateFrontScan: '',
          businessLeaderCertificateBackScan: '',
          backupPersonName: '',
          backupPersonPhone: '',
          backupPersonCertificateType: '',
          backupPersonCertificateCode: '',
          technicalLeaderName: '',
          technicalLeaderPhone: '',
          technicalLeaderCertificateType: '',
          technicalLeaderCertificateCode: '',
          saleLeaderName: '',
          saleLeaderPhone: '',
          saleLeaderCertificateType: '',
          saleLeaderCertificateCode: '',
          financeLeaderName: '',
          financeLeaderPhone: '',
          financeLeaderCertificateType: '',
          financeLeaderCertificateCode: ''
        },
        businessInfo: {
          businessType: '',
          mainCategory: '',
          businessNature: '',
          manageAddress: '',
          officeNature: '',
          officeSpace: '',
          currentYear: '',
          yearIncome: '',
          yearProfit: '',
          threeYearLiabilitiesTable: '',
          threeYearLossTable: '',
          threeYearFlowTable: '',
          licenseName: '',
          licenseTerm: '',
          licenseScan: '',
          systemCertificateName: '',
          systemCertificateTerm: '',
          systemCertificateScan: ''
        },
        busDetailBrands: [],
        busDetailBanks: [],
        busDetailQualifyCertificates: []
      },
      companyValid: true
    }
  },
  methods: {
    cascadeUpdateLegalPerson(legalPerson) {
      this.$refs.dealerPersonInfo.personInfo.legalPersonName = legalPerson
    },
    save: function() {
      this.companyValid = true

      // 校验并赋值基础信息
      this.companyValid = this.companyValid && this.validateBaseForm()
      // 校验并赋值三证信息
      this.companyValid = this.companyValid && this.validateCertForm()

      // 校验并赋值联系人信息
      this.companyValid = this.companyValid && this.validatePersonForm()

      // 校验业务信息并赋值
      this.companyValid = this.companyValid && this.validateBusinessForm()
      this.companyValid = this.companyValid && this.validateOperationForm()
      this.companyValid = this.companyValid && this.validateLicenceForm()
      this.companyValid = this.companyValid && this.validateManSystemForm()

      this.companyFormInfo.busDetailBrands = this.$refs.dealerBusinessInfo.busDetailBrands
      this.companyFormInfo.busDetailBanks = this.$refs.dealerBankInfo.busDetailBanks
      this.companyFormInfo.busDetailQualifyCertificates = this.$refs.dealerQualifyInfo.busDetailQualifyCertificates

      if (this.companyValid === true) {
        addDistributorInfo(this.companyFormInfo).then(response => {
          this.$message.success('新增经销商信息成功!')
          this.clearDistributorInfoForm()
        })
      }
    },
    validateBaseForm() {
      this.$refs.dealerBaseInfo.validateForm()
      if (this.$refs.dealerBaseInfo.baseInfoValid === true) {
        this.companyFormInfo.baseInfo.distributorName = this.$refs.dealerBaseInfo.baseInfo.name
        this.companyFormInfo.baseInfo.distributorArea = this.$refs.dealerBaseInfo.baseInfo.area
        this.companyFormInfo.baseInfo.companyNature = this.$refs.dealerBaseInfo.baseInfo.companyNature
        this.companyFormInfo.baseInfo.companyType = this.$refs.dealerBaseInfo.baseInfo.companyType
        this.companyFormInfo.baseInfo.companyProvince = this.$refs.dealerBaseInfo.baseInfo.companyProvince
        this.companyFormInfo.baseInfo.companyCity = this.$refs.dealerBaseInfo.baseInfo.companyCity
        this.companyFormInfo.baseInfo.companyArea = this.$refs.dealerBaseInfo.baseInfo.companyArea
        this.companyFormInfo.baseInfo.companyAddress = this.$refs.dealerBaseInfo.baseInfo.companyAddress
        return true
      } else {
        this.$message.error('基础信息校验未通过,请补充相关信息')
        return false
      }
    },
    validateCertForm() {
      this.$refs.dealerCertInfo.validateForm()
      if (this.$refs.dealerCertInfo.certInfoValid === true) {
        this.companyFormInfo.certificateInfo.threeCertificatesInOne = this.$refs.dealerCertInfo.certInfo.threeCertificatesInOne
        this.companyFormInfo.certificateInfo.unifiedSocialCreditCode = this.$refs.dealerCertInfo.certInfo.unifiedSocialCreditCode
        this.companyFormInfo.certificateInfo.licenseRegisterNumber = this.$refs.dealerCertInfo.certInfo.licenseRegisterNumber
        this.companyFormInfo.certificateInfo.registerCapital = this.$refs.dealerCertInfo.certInfo.registerCapital
        this.companyFormInfo.certificateInfo.registerAddress = this.$refs.dealerCertInfo.certInfo.registerAddress
        this.companyFormInfo.certificateInfo.legalPerson = this.$refs.dealerCertInfo.certInfo.legalPerson
        this.companyFormInfo.certificateInfo.establishDate = this.$refs.dealerCertInfo.certInfo.establishDate
        this.companyFormInfo.certificateInfo.businessTerm = this.$refs.dealerCertInfo.certInfo.businessTerm
        this.companyFormInfo.certificateInfo.businessScope = this.$refs.dealerCertInfo.certInfo.businessScope
        this.companyFormInfo.certificateInfo.licenseScan = this.$refs.dealerCertInfo.certInfo.licenseScan
        this.companyFormInfo.certificateInfo.organizeCode = this.$refs.dealerCertInfo.certInfo.organizeCode
        this.companyFormInfo.certificateInfo.organizeCodeScan = this.$refs.dealerCertInfo.certInfo.organizeCodeScan
        this.companyFormInfo.certificateInfo.taxpayerNature = this.$refs.dealerCertInfo.certInfo.taxpayerNature
        this.companyFormInfo.certificateInfo.taxRegisterCode = this.$refs.dealerCertInfo.certInfo.taxRegisterCode
        this.companyFormInfo.certificateInfo.taxRegisterCodeScan = this.$refs.dealerCertInfo.certInfo.taxRegisterCodeScan
        return true
      } else {
        this.$message.error('三证信息校验未通过,请补充相关信息')
        return false
      }
    },
    validatePersonForm() {
      this.$refs.dealerPersonInfo.validateForm()
      if (this.$refs.dealerPersonInfo.personInfoValid === true) {
        this.companyFormInfo.personInfo.legalPersonName = this.$refs.dealerPersonInfo.personInfo.legalPersonName
        this.companyFormInfo.personInfo.legalPersonPhone = this.$refs.dealerPersonInfo.personInfo.legalPersonPhone
        this.companyFormInfo.personInfo.legalPersonCertificateCode = this.$refs.dealerPersonInfo.personInfo.legalPersonCertificateCode
        this.companyFormInfo.personInfo.legalPersonCertificateType = this.$refs.dealerPersonInfo.personInfo.legalPersonCertificateType
        this.companyFormInfo.personInfo.legalPersonCertificateFrontScan = this.$refs.dealerPersonInfo.personInfo.legalPersonCertificateFrontScan
        this.companyFormInfo.personInfo.legalPersonCertificateBackScan = this.$refs.dealerPersonInfo.personInfo.legalPersonCertificateBackScan
        this.companyFormInfo.personInfo.businessLeaderName = this.$refs.dealerPersonInfo.personInfo.businessLeaderName
        this.companyFormInfo.personInfo.businessLeaderCertificateType = this.$refs.dealerPersonInfo.personInfo.businessLeaderCertificateType
        this.companyFormInfo.personInfo.businessLeaderCertificateCode = this.$refs.dealerPersonInfo.personInfo.businessLeaderCertificateCode
        this.companyFormInfo.personInfo.businessLeaderPhone = this.$refs.dealerPersonInfo.personInfo.businessLeaderPhone
        this.companyFormInfo.personInfo.businessLeaderCertificateFrontScan = this.$refs.dealerPersonInfo.personInfo.businessLeaderCertificateFrontScan
        this.companyFormInfo.personInfo.businessLeaderCertificateBackScan = this.$refs.dealerPersonInfo.personInfo.businessLeaderCertificateBackScan
        this.companyFormInfo.personInfo.backupPersonName = this.$refs.dealerPersonInfo.personInfo.backupPersonName
        this.companyFormInfo.personInfo.backupPersonPhone = this.$refs.dealerPersonInfo.personInfo.backupPersonPhone
        this.companyFormInfo.personInfo.backupPersonCertificateType = this.$refs.dealerPersonInfo.personInfo.backupPersonCertificateType
        this.companyFormInfo.personInfo.backupPersonCertificateCode = this.$refs.dealerPersonInfo.personInfo.backupPersonCertificateCode
        this.companyFormInfo.personInfo.technicalLeaderName = this.$refs.dealerPersonInfo.personInfo.technicalLeaderName
        this.companyFormInfo.personInfo.technicalLeaderPhone = this.$refs.dealerPersonInfo.personInfo.technicalLeaderPhone
        this.companyFormInfo.personInfo.technicalLeaderCertificateType = this.$refs.dealerPersonInfo.personInfo.technicalLeaderCertificateType
        this.companyFormInfo.personInfo.technicalLeaderCertificateCode = this.$refs.dealerPersonInfo.personInfo.technicalLeaderCertificateCode
        this.companyFormInfo.personInfo.saleLeaderName = this.$refs.dealerPersonInfo.personInfo.saleLeaderName
        this.companyFormInfo.personInfo.saleLeaderPhone = this.$refs.dealerPersonInfo.personInfo.saleLeaderPhone
        this.companyFormInfo.personInfo.saleLeaderCertificateType = this.$refs.dealerPersonInfo.personInfo.saleLeaderCertificateType
        this.companyFormInfo.personInfo.saleLeaderCertificateCode = this.$refs.dealerPersonInfo.personInfo.saleLeaderCertificateCode
        this.companyFormInfo.personInfo.financeLeaderName = this.$refs.dealerPersonInfo.personInfo.financeLeaderName
        this.companyFormInfo.personInfo.financeLeaderPhone = this.$refs.dealerPersonInfo.personInfo.financeLeaderPhone
        this.companyFormInfo.personInfo.financeLeaderCertificateType = this.$refs.dealerPersonInfo.personInfo.financeLeaderCertificateType
        this.companyFormInfo.personInfo.financeLeaderCertificateCode = this.$refs.dealerPersonInfo.personInfo.financeLeaderCertificateCode
        return true
      } else {
        this.$message.error('联系人校验未通过,请补充相关信息')
        return false
      }
    },
    validateBusinessForm() {
      this.$refs.dealerBusinessInfo.validateForm()
      if (this.$refs.dealerBusinessInfo.businessInfoValid === true) {
        this.companyFormInfo.businessInfo.businessType = this.$refs.dealerBusinessInfo.businessInfo.businessType
        this.companyFormInfo.businessInfo.mainCategory = this.$refs.dealerBusinessInfo.businessInfo.mainCategory
        this.companyFormInfo.businessInfo.businessNature = this.$refs.dealerBusinessInfo.businessInfo.businessNature
        this.companyFormInfo.businessInfo.manageAddress = this.$refs.dealerBusinessInfo.businessInfo.manageAddress
        this.companyFormInfo.businessInfo.officeNature = this.$refs.dealerBusinessInfo.businessInfo.officeNature
        this.companyFormInfo.businessInfo.officeSpace = this.$refs.dealerBusinessInfo.businessInfo.officeSpace
        return true
      } else {
        this.$message.error('业务信息校验未通过,请补充相关信息')
        return false
      }
    },
    validateOperationForm() {
      this.$refs.dealerOperationInfo.validateForm()
      if (this.$refs.dealerOperationInfo.operationInfoValid === true) {
        this.companyFormInfo.businessInfo.currentYear = this.$refs.dealerOperationInfo.operationInfo.currentYear
        this.companyFormInfo.businessInfo.yearIncome = this.$refs.dealerOperationInfo.operationInfo.yearIncome
        this.companyFormInfo.businessInfo.yearProfit = this.$refs.dealerOperationInfo.operationInfo.yearProfit
        this.companyFormInfo.businessInfo.threeYearLiabilitiesTable = this.$refs.dealerOperationInfo.operationInfo.threeYearLiabilitiesTable
        this.companyFormInfo.businessInfo.threeYearLossTable = this.$refs.dealerOperationInfo.operationInfo.threeYearLossTable
        this.companyFormInfo.businessInfo.threeYearFlowTable = this.$refs.dealerOperationInfo.operationInfo.threeYearFlowTable
        return true
      } else {
        this.$message.error('经营信息校验未通过,请补充相关信息')
        return false
      }
    },
    validateLicenceForm() {
      this.$refs.dealerLicenceInfo.validateForm()
      if (this.$refs.dealerLicenceInfo.licenceInfoValid === true) {
        this.companyFormInfo.businessInfo.licenseName = this.$refs.dealerLicenceInfo.licenceInfo.licenseName
        this.companyFormInfo.businessInfo.licenseTerm = this.$refs.dealerLicenceInfo.licenceInfo.licenseTerm
        this.companyFormInfo.businessInfo.licenseScan = this.$refs.dealerLicenceInfo.licenceInfo.licenseScan
        return true
      } else {
        this.$message.error('经营许可信息校验未通过,请补充相关信息')
        return false
      }
    },
    validateManSystemForm() {
      this.$refs.dealerManSystemInfo.validateForm()
      if (this.$refs.dealerManSystemInfo.manSystemInfoValid === true) {
        this.companyFormInfo.businessInfo.systemCertificateName = this.$refs.dealerManSystemInfo.manSystemInfo.systemCertificateName
        this.companyFormInfo.businessInfo.systemCertificateTerm = this.$refs.dealerManSystemInfo.manSystemInfo.systemCertificateTerm
        this.companyFormInfo.businessInfo.systemCertificateScan = this.$refs.dealerManSystemInfo.manSystemInfo.systemCertificateScan
        return true
      } else {
        this.$message.error('管理体系认证信息校验未通过,请补充相关信息')
        return false
      }
    },
    clearDistributorInfoForm() {
      this.$refs.dealerBaseInfo.clearForm()
      this.$refs.dealerCertInfo.clearForm()
      this.$refs.dealerPersonInfo.clearForm()
      this.$refs.dealerBusinessInfo.clearForm()
      this.$refs.dealerOperationInfo.clearForm()
      this.$refs.dealerLicenceInfo.clearForm()
      this.$refs.dealerManSystemInfo.clearForm()

      this.companyFormInfo.busDetailQualifyCertificates = []
      this.companyFormInfo.busDetailBrands = []
      this.companyFormInfo.busDetailBanks = []
    }
  }
}
</script>

<style lang='scss' scoped>
.information-container {
  .information-title {
    font-size: 22px;
    font-weight: bold;
    margin: 10px 0 10px 20px;
  }

  .information-from {
    .from-title {
      font-size: 22px;
      font-weight: bold;
      background-color: #2483b3;
      color: white;
      padding: 10px 0 10px 20px;
    }

    .from-inputBox {
      display: flex;
      margin-left: 20px;

      .input-item {
        width: 540px;
        display: flex;
        justify-content: space-between;
        align-items: center;
      }
    }

    .from-table {
      display: flex;
      margin: 10px 20px;

      .el-tab {}

      .table-btn {
        margin-left: 100px;
      }
    }
  }

  .btnBox {
    padding: 30px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-evenly;

    .save,
    .close {
      width: 100px;
    }

  }
}
</style>