<template>
  <!-- 添加运力信息 -->
  <div class="addCapacity">
    <PageTitle>返回</PageTitle>
    <div class="form_box">
      <el-form>
        <el-form-item label="收款客户编码：">
          <el-input v-model="form.companyCode"></el-input>
        </el-form-item>
        <el-form-item label="收款客户名称：">
          <el-input v-model="form.companyName"></el-input>
        </el-form-item>
      </el-form>
    </div>

    <div class="button_box">
      <el-button @click="cancel">取消</el-button>
      <el-button type="primary" @click="makeSure" :loading="addLoading"
        >确定</el-button
      >
    </div>
  </div>
</template>

<script>
import PageTitle from "@/components/Page/Title";
import { getCookie } from "@/utils/util.js";
export default {
  components: { PageTitle },
  data() {
    return {
      form:{
        materialCokeName:null
      },
      addLoading:false
    };
  },
  created() {
  
  },
  mounted() {
    
  },
  methods: {
    makeSure() {
      this.addLoading=true;
      if(!this.form || !this.form.companyCode || !this.form.companyName){
        this.$message.warning("请输入！");
        this.addLoading=false;
      }else{
        this.axios.post("/api/v1/rms/insertReceiveCompany",this.form).then(res => {
          if (res.data.code == "200") {
            this.$message.success("新增成功！");
            this.cancel();
          }else{
            this.$message.warning("新增失败！");
          }
          this.addLoading=false;
        }).catch(()=>{
          this.addLoading=false;
        });
      }
    },
    // 取消
    cancel() {
      this.$router.go(-1);
    }
  }
};
</script>
<style lang="scss">
.shippingCertificate {
  width: 200px;
}
.el-form--inline .el-form-item__content {
  display: inline-block;
  vertical-align: top;
  position: relative;
  left: 37px;
}
.addCapacity {
  .elForm {
    margin-left: 40%;
  }
  .form_box {
    width: 100%;
    margin-top: 30px;
    margin-left: 50px;
    display: flex;
    justify-content: center;
    .el-form-item {
      display: flex;
      justify-content: center;
      .el-form-item__label {
        display: flex;
        align-items: center;
      }
      .el-form-item__content {
        .el-select {
          width: 250px;
        }
        .el-input {
          width: 250px;
        }
      }
    }
  }
  .inputBox {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    .text {
      text-align: right;
      display: flex;
      align-items: center;
      margin-right: 5px;
    }
    .input {
      width: 250px;
    }
  }
  .button_box {
    display: flex;
    justify-content: center;
    .el-button {
      width: 80px;
      margin-right: 10px;
    }
  }
}
</style>
