<template>
  <div class="app-container operations-container">
    <div class="common-title">基本信息</div>
    <div class="part-swiper">
      <div class="baseinfo">
        <div class="row">
          <div class="con">
            <Elselects
              title="企业性质"
              :list="companyType.companyNaturelist"
              :id="infos.customerId"
              :val="infos.companyNature"
              field="companyNature"
              @changenowedit="clickNowedit" />
          </div>
          <div class="con i">
            <Elselects
              title="企业级别"
              :list="companyType.companyLevellist"
              :id="infos.customerId"
              :val="infos.companyLevel"
              field="companyLevel"
              @changenowedit="clickNowedit" />
          </div>
        </div>
        <div class="row">
          <div class="con">
            <span>企业母公司：</span>
            <div class="inputxt" id="inputxt2">
              <div class="flex" v-if="nowedit == noweditis && isDisabled == false" >
                <el-input placeholder="待添加" v-model="superCompany"></el-input>
                <div class="flex">
                  <div class="btnsmall btn_primary h28" style="width: 56px" @click="editXMSL(superCompany)">确定</div>
                  <div class="cancels h28" @click="clickNowedit(-1)" style="">取消</div>
                </div>
              </div>
              <span :class="{txt:!superCompany}" v-else @click="clickNowedit(noweditis)">{{superCompany||'待添加'}}</span>
            </div>
          </div>
          <div class="con i">
            <Elselects
              title="上市公司"
              :list="companyType.isOnlistlist"
              :id="infos.customerId"
              :val="infos.isOn"
              field="isOn"
              @changenowedit="clickNowedit" />
          </div>
        </div>
        <div class="row">
          <div class="con">
            <Elselects
              title="局级大客户"
              :list="companyType.isOnlistlist"
              :id="infos.customerId"
              :val="infos.isMajor"
              field="isMajor"
              @changenowedit="clickNowedit" />
          </div>
          <div class="con i">
            <Elselects
              title="资信等级"
              :list="companyType.creditLevellist"
              :id="infos.customerId"
              :val="infos.creditLevel"
              field="creditLevel"
              @changenowedit="clickNowedit" />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>

import { customerUpdate } from '@/api/detail/party-a/cooperate'
import Elselects from "./elselects"
export default {
  name: "basicIinformation",
  props: ['infos','companyType','nowedit','noweditis'],
  components: {
    Elselects,
  },
  data() {
    return {
      isDisabled:false,
      isselect:false,
      superCompany:this.infos.superCompany,
    }
  },
  created(){
  },
  methods:{
    editXMSL(val){
      if(this.isDisabled == true)
        return false

      let params = {
        customerId: this.infos.customerId,
        superCompany: val,
      }
      this.clickNowedit(-1)
      customerUpdate(params).then(res=>{
        if (res.code == 200){
            this.$message.success('修改成功！')
        }else{
          this.$message.error(res.msg)
        }
      })
    },
    clickNowedit(e){
      this.$emit("focus-nowedit", e)
    }
  }
}
</script>

<style lang="scss" scoped>
.operations-container {
  margin: 0;
  padding: 24px 16px;
  background: #FFFFFF;
  border-radius: 4px;

  .part-swiper {
    position: relative;
    margin-top: 16px;
  }
}
.select-popper{
  top: 3px;
}
.inputxt .flex{
  background: #fff;
}
.baseinfo .row{
  padding-left: 0;
}
</style>
