<template>
  <div class="detail_main">
    <div class="wrapper">
      <div class="wrapper_view">
        <div class="view_item" v-for="item in baseInfo" :key="item.value">
          <div class="view_item_left">{{ item.value }}</div>
          <van-image class="view_item_image" v-if="item.isImage" :src="item.label"></van-image>
          <div class="view_item_right" v-else>{{ item.label }}</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import {
  getSepTagInfo,
} from "@/service/api/custome";
export default {
    props:{
        custIdc: {
            type: String,
            default: "",   
        },
        dataSource: {
            type: Array,
            default: () => [],  
            required: false,
        },
        type: {
            type: String,
            default: "common",  
        }
    },
  data() {
    return {
      baseInfo: {
      },
    };
  },
  components: {
  },
  created() {
    this.init();
  },
  methods: {
    init() {
      if (this.type !== 'common') {
        this.baseInfo = this.dataSource;
        return;
      }
      if (!this.custIdc) return
      getSepTagInfo(this.custIdc).then((res) => {
        if (res.code == 200) {
            const { data = {} } = res;
          this.baseInfo = Object.keys(data).map(key => {
            return {
                value: key,
                label: data[key]
            }
          });
        }
      });
    }
  },
};
</script>

<style lang="less" scoped>
.wrapper {
  // padding-top: 46px;
  font-size: 14px;
  background-color: #fff;
}

.view_item {
  display: flex;
  justify-content: space-between;
  line-height: 40px;
  font-size: 14px;
  border-bottom: 1px solid rgba(245, 245, 245, 1);
  padding: 0 20px;
}

.view_item_left {
//   width: 40%;
  color: #7c7c7c;
}

.view_item_image {
  width: 100%;
}

.view_item_right {
//   width: 60%;
  color: rgb(22, 13, 13);
}


.label_color {
  /deep/ .van-field__label {
    color: rgb(22, 13, 13);
  }
  /deep/.van-field__control:disabled{
    color: rgb(22, 13, 13);
    -webkit-text-fill-color:rgb(22, 13, 13);
  }
}
</style>
