<template>
  <div style="padding: 20px">
    <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane label="基本信息" :name="1">
        <div style="padding: 20px">
          <el-descriptions title="基本信息" :column="1">
            <el-descriptions-item label="店铺名称">{{
              shopInfo ? shopInfo.storeName : ""
            }}</el-descriptions-item>
            <el-descriptions-item label="店铺id">{{
              shopInfo ? shopInfo.id : ""
            }}</el-descriptions-item>
            <el-descriptions-item label="店铺归属人id	">{{
              shopInfo ? shopInfo.ownerBy : ""
            }}</el-descriptions-item>
            <el-descriptions-item label="店铺所在区域	">{{
              shopInfo ? shopInfo.storeArea : ""
            }}</el-descriptions-item>

            <el-descriptions-item label="经营区域">{{
              shopInfo ? (shopInfo.scope == 0 ? "全国" : "同城") : ""
            }}</el-descriptions-item>

            <el-descriptions-item label="店铺认证">
              <el-tag>{{
                shopInfo.authStatus == 0
                  ? "审核中"
                  : shopInfo.authStatus == 1
                  ? "审核通过"
                  : shopInfo.authStatus == 2
                  ? "审核未通过"
                  : ""
              }}</el-tag></el-descriptions-item
            >
            <el-descriptions-item label="店铺头像">
              <el-image
                :src="shopInfo ? shopInfo.storeLogoUrl : ''"
                mode=""
                style="width: 100px; height: 100px"
              />
            </el-descriptions-item>
            <el-descriptions-item label="店铺地址">
              {{ shopInfo ? shopInfo.storeAddress : "" }}
            </el-descriptions-item>
            <el-descriptions-item label="店铺背景图"
              ><el-image
                :src="shopInfo ? shopInfo.storeBackgroundUrl : ''"
                mode=""
                style="width: 100px; height: 100px"
            /></el-descriptions-item>
            <el-descriptions-item label="店铺简介"
              ><image :src="shopInfo ? shopInfo.storeIntro : ''" mode=""
            /></el-descriptions-item>
            <el-descriptions-item label="是否启用代金卷">
              <el-tag> {{ shopInfo.enableVoucher == 0 ? "未启用" : "启用" }}</el-tag>
            </el-descriptions-item>
            <el-descriptions-item label="使用代金卷类型">
              <el-tag> {{ shopInfo.useVoucherType == 0 ? "满减券" : "抵扣券" }}</el-tag>
            </el-descriptions-item>
          </el-descriptions>
        </div>
        <div style="padding: 20px">
          <el-descriptions title="联系方式" :column="1">
            <el-descriptions-item label="联系方式">
              {{ shopInfo ? shopInfo.storePhone : "" }}</el-descriptions-item
            >
            <el-descriptions-item label="营业地址">
              {{ shopInfo ? shopInfo.storeAddress : "" }}</el-descriptions-item
            >
          </el-descriptions>
        </div>
      </el-tab-pane>
      <el-tab-pane label="主体信息" :name="2">
        <div style="padding: 20px">
          <el-descriptions title="主体信息" :column="1">
            <el-descriptions-item label="入驻姓名">{{
              shopInfo.auth ? shopInfo.auth.authName : ""
            }}</el-descriptions-item>
            <el-descriptions-item label="入驻身份证号">{{
              shopInfo.auth ? shopInfo.auth.authIdNum : ""
            }}</el-descriptions-item>
            <el-descriptions-item label="入驻身份证">
              <el-image
                style="width: 100px; height: 100px"
                v-for="(item, index) in shopInfo.auth.idCardUrl
                  ? JSON.parse(shopInfo.auth.idCardUrl)
                  : []"
                :src="item"
                :key="index"
                :preview-src-list="
                  shopInfo.auth.idCardUrl ? JSON.parse(shopInfo.auth.idCardUrl) : []
                "
              />
            </el-descriptions-item>
          </el-descriptions>
        </div>
        <div style="padding: 20px">
          <el-descriptions title="营业执照资质信息" :column="1">
            <el-descriptions-item label="营业执照">
              <el-image
                style="width: 100px; height: 100px"
                :src="shopInfo.auth.businessLicenseUrl"
                :key="index"
                :preview-src-list="[shopInfo.auth.businessLicenseUrl]"
              />
            </el-descriptions-item>
            <el-descriptions-item label="营业执照信用代码">{{
              shopInfo ? shopInfo.auth.regNum : ""
            }}</el-descriptions-item>
          </el-descriptions>
        </div>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import { getStoreInfo } from "@/api/common/index";
export default {
  data() {
    return {
      activeName: 1,
      shopInfo: {},
    };
  },
  mounted() {
    this.getInfo();
  },
  methods: {
    getInfo() {
      getStoreInfo().then((res) => {
        if (res.code == 200) {
          this.shopInfo = res.data;
        }
      });
    },
  },
};
</script>

<style></style>
