<template>
  <view class="page">
    <view class="title">
      <view class="body">
        <view class="name">{{ data.name }}</view>
        <view class="desc" v-if="data.address">{{ data.address }}</view>
      </view>
      <image :src="data.banner" class="logo" mode="aspectFit"></image>
    </view>
    <view class="content">
      <view class="content-title">商铺介绍</view>
      <template v-if="data.intro_img && data.intro_img.length">
        <image
          v-for="src in data.intro_img"
          :src="src"
          :key="src"
          mode="widthFix"
          class="content-img"
        ></image>
      </template>
      <view v-if="data.intro" v-html="data.intro" />
    </view>
  </view>
</template>

<script>
import { getShopDetail } from "@/lib/api/shop";

export default {
  name: "VipDetail",
  data() {
    return {
      id: 0,
      data: null,
    };
  },
  onLoad(data) {
    this.id = data.id;
    this.getShopDetail();
  },
  methods: {
    async getShopDetail() {
      const data = await getShopDetail(this.id);
      this.data = data.data;
    },
  },
};
</script>

<style lang="scss">
page {
  background: #f5f5f5;
}
.title {
  display: flex;
  align-items: center;
  margin: 40rpx;
  padding: 40rpx;
  background-color: #fff;
  border-radius: 20rpx;
  .body {
    flex: 1;
    .name {
      font-weight: bold;
    }
    .desc {
      color: #999;
      font-size: 24rpx;
      margin-top: 20rpx;
    }
  }
  .logo {
    display: block;
    width: 200rpx;
    height: 200rpx;
  }
}
.content {
  padding: 30rpx 40rpx;
  font-size: 28rpx;
  line-height: 1.5;
  background-color: #fff;
  .content-title {
    margin-bottom: 20rpx;
    font-size: 36rpx;
  }
  .content-img {
    width: 100%;
  }
}
</style>
