<template>
  <view class="container">
    <view class="content">
      <view class="img-box">
        <!-- <image :src="error || !loaded ? 'https://cdn.uviewui.com/uview/album/10.jpg' : item.logo" mode="scaleToFill" /> -->
        <image class='img' :src="item.logo " mode="scaleToFill" />
        <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>
  </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: 400rpx;
    .img-box {
      position: relative;
      height: 240rpx;
      .img {
        width: calc(50vw - 30rpx);
        height: 240rpx;
        border-radius: 10rpx;
      }
      .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;
        display: inline-block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
    .pd-10 {
      padding: 10rpx;
    }
  }
}
</style>
