<template>
  <div class="dialog" v-if="dialogForm">
    <div class="head_box">
      <span class="title">典当物品信息详情</span>
      <div>
        <el-button size="small" @click="close">关闭</el-button>
      </div>
    </div>
    <div class="cntinfo">
      <el-form :model="listQuery" :label-width="230" label-position="left">
        <div class="form-row">
          <el-form-item label="业务流水号码">
            <el-input v-model="listQuery.ywlsh" placeholder="01131213"/>
          </el-form-item>
          <el-form-item label="典当物品类别">
            <el-input v-model="listQuery.ddwplb" placeholder="贵金属"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="典当人姓名">
            <el-input v-model="listQuery.ddrxm" placeholder="张三"/>
          </el-form-item>
          <el-form-item label="典当人证件号码">
            <el-input v-model="listQuery.ddrzjhm" placeholder="511111111111111111"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="典当人联系电话">
            <el-input v-model="listQuery.ddrlxdh" placeholder="15222222222"/>
          </el-form-item>
          <el-form-item label="典当物品名称">
            <el-input v-model="listQuery.ddwpmc" placeholder="100g金条"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="典当物品持有凭证">
            <el-input v-model="listQuery.cypz" placeholder="123"/>
          </el-form-item>
          <el-form-item label="典当物品数量">
            <el-input v-model="listQuery.ddwpsl" placeholder="5"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="典当物品照片">
            <div class="image-group">
              <div class="image-item" v-for="(item, index) in listQuery.plateImages" :key="index">
                <el-image :src="item.img" fit="cover"></el-image>
              </div>
            </div>
          </el-form-item>
        </div>
      </el-form>
    </div>
  </div>
</template>

<script setup>
import { ref, reactive } from 'vue';

const dialogForm = ref(false);
const listQuery = ref({
  plateImages: [
    {img:require('@/assets/images/person.png')},
    {img:require('@/assets/images/person.png')},
    {img:require('@/assets/images/person.png')},
  ]
});

// 初始化数据
const init = (type, row) => {
  dialogForm.value = true;
  // 根据type和row初始化表单数据
};

const close = () => {
  dialogForm.value = false;
};

defineExpose({init})
</script>

<style lang="scss" scoped>
.dialog {
  padding: 20px;

  :deep(.el-form-item__label) {
    background-color: #F7FAFB;
    padding: 0px 8px;
    color: #000;
    font-weight: 500;
    border: 1px solid #E3E7ED;
  }

  .head_box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
  }
  .cntinfo{
    height: calc(100% - 70px);
    overflow: hidden;
    overflow-y: auto;
  }

  .form-row {
    display: flex;
    
    .el-form-item {
      flex: 1;
    }
  }
  .image-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
  
    
    .image-item {
      width: 150px;
      height: 150px;
      border: 1px solid #dcdfe6;
      
      .el-image {
        width: 100%;
        height: 100%;
      }
    }
  }

   ::v-deep .el-input__inner{
    height: 36px !important;
    line-height: 36px !important;
    border-radius: 0;
    color: #777575;
  }
}
.el-form-item--default{
  margin-bottom: 0px;
}
</style>
