<template>
  <div>
    <el-dialog
      title="查看供应商"
      :visible.sync="dialogShow"
      width="800px"
      :before-close="seeClose"
    >
      <el-form :model="form" ref="form"  label-width="100px" :inline="true">
        <el-form-item label="供应商:">
          <span v-model="form.name" style="width: 240px; display: inline-block"> {{form.name}}</span>
        </el-form-item>
        <el-form-item label="联系人:">
          <span v-model="form.contact" style="width: 240px; display: inline-block"> {{form.contact}}</span>
        </el-form-item>
        <el-form-item label="手机号码:">
          <span v-model="form.phone" style="width: 240px; display: inline-block"> {{form.phone}}</span>
        </el-form-item>
        <el-form-item label="备注:">
          <span v-model="form.remark" style="width: 240px; display: inline-block"> {{form.remark}}</span>
        </el-form-item>
      </el-form>
      <!-- 按钮 -->
      <div slot="footer" class="dialog-footer">
        <el-button @click="seeClose">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { getSupplierDetail } from "@/api/business/supplier";
export default {
  props: {
    // 弹框显示
    dialogShow: {
      type: Boolean,
      default: false,
    },
    // ID
    id: {
      type:[Number, String],
      default: ''
    }
  },
  data() {
    return {
      loading: false,
      form: {},
    };
  },
  created() {
    if(this.id){
      getSupplierDetail(this.id).then(res => {
        const { name, phone, contact, remark} = res.data
        this.form = { name, phone, contact, remark}
      })
    }
  },
  methods: {
    // 关闭弹框
    seeClose() {
      this.$emit("seeClose");
      this.loading = false;
    },
  },
};
</script>
<style scoped>
.channel {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tip {
  font-size: 12px;
  color: #999;
}
</style>
