<template>
  <view class="container">
    <view class="content">
      <view class="img-box">
        <image
          :src="
            error || !loaded
              ? 'https://cdn.uviewui.com/uview/album/10.jpg'
              : item.cover
          "
          mode="scaleToFill"
        ></image>
        <view class="name u-line-1">{{ item.name }}</view>
      </view>
      <view class="pd-10">{{ item.address }}</view>
      <view class="pd-10">{{ item.distance | mToKm }}</view>
      <!-- <view class="pd-10">{{ item.description }}</view> -->
    </view>
  </view>
</template>

<script>
export default {
  props: {
    item: {
      type: Object,
      default: () => {},
    },
  },
  filters: {
    mToKm(v) {
      return (Number(v) / 1000).toFixed(2) + 'km';
    },
  },
};
</script>

<style lang="scss" scoped>
.container {
  width: 100%;
  padding: 20rpx;
  box-sizing: border-box;
  .content {
    background-color: #ffffff;
    width: 100%;
    height: 100%;
    .img-box {
      position: relative;
      height: 240rpx;
      image {
        width: calc(50vw - 30rpx);
        height: 240rpx;
      }
      .name {
        width: 100%;
        position: absolute;
        bottom: 0;
        left: 0;
        background-color: rgba(0, 0, 0, 0.2);
        color: #ffffff;
        padding: 10rpx;
        box-sizing: border-box;
      }
    }
    .pd-10 {
      padding: 10rpx;
    }
  }
}
</style>
