<template>
  <view class="venue-card" @click="handleClick">
    <view class="venue-badge" v-if="isNearest">离我最近</view>
    <view class="venue-content">
      <view class="venue-info">
        <text class="venue-name">{{ venue.name || '获取中...' }}</text>
        <text class="venue-address" @click.stop="handleAddressClick">{{ venue.address || '获取中...' }}</text>
      </view>
      <view class="venue-action">
        <view class="map-icon">
          <iconfont name="icon-location" color="#e61818" size="16px"></iconfont>
        </view>
        <text class="map-more">所有场馆 ></text>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: 'VenueCard',
  props: {
    venue: {
      type: Object,
      default: () => ({})
    },
    isNearest: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    handleClick() {
      this.$emit('click', this.venue);
    },
    handleAddressClick() {
      this.$emit('nav', this.venue);
    }
  }
};
</script>

<style>
.venue-card {
  margin-top: 10px;
  background-color: #fcfcfc;
  border: 1px solid #f0f0f0;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  background-image: radial-gradient(circle at right center, rgba(240,240,240,0.8) 0%, transparent 50%);
}

.venue-badge {
  display: inline-block;
  font-size: 12px;
  color: #fff;
  background-color: #ff404f;
  padding: 1px 6px;
  border-radius: 4px;
  margin-bottom: 4px;
  width: fit-content;
}

.venue-content {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  width: 100%;
}

.venue-info {
  flex: 1;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.venue-name {
  font-size: 15px;
  font-weight: bold;
  color: #111;
}

.venue-address {
  font-size: 12px;
  color: #999;
  margin-top: 6px;
}

.venue-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-left: 12px;
}

.map-icon {
  width: 22px;
  height: 22px;
  background-color: #ffffff;
  border: 1.5px solid #f76464;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.map-more {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
  text-align: center;
}
</style>
