<template>
  <view class="service-item-wrapper">
    <view class="item-left-wrap">
      <image :src="pathPre + item.content.image" mode="aspectFill" />
      <text>{{ item.title }}</text>
    </view>
    <view class="item-right-wrap" :style="{ backgroundImage: `url(${minioUrl}/bg_service_03.png)` }">
      <view class="main-text" v-if="item.title === '司机之家'">{{ item.content.serviceContent }}</view>
      <view class="block-content" v-else>
        <view class="label">空闲</view>
        <view class="number-box">
          <view class="left-num">{{ item.content.availableCount }}</view>
          <view class="right-num">/{{ item.content.totalCount }}</view>
        </view>
      </view>
    </view>
  </view>
</template>

<script lang="ts" setup>
import { useGlobal } from '@/composables/index'
const { minioUrl, pathPre } = useGlobal()

defineProps({
  item: {
    type: Object,
    default: () => ({})
  }
})
</script>

<style lang="scss" scoped>
.service-item-wrapper {
  width: 314rpx;
  height: 56rpx;
  background-image: linear-gradient(90deg, #3f8bf9 0%, #4eaefa 100%), linear-gradient(#f0f6ff, #f0f6ff);
  background-blend-mode: normal, normal;
  border-radius: 8rpx;
  padding: 2rpx 2rpx 2rpx 12rpx;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  .item-left-wrap {
    display: flex;
    align-items: center;
    image {
      width: 26rpx;
      height: 34rpx;
      margin-right: 6rpx;
    }
    text {
      font-size: 22rpx;
      color: #fff;
      font-weight: 500;
    }
  }
  .item-right-wrap {
    width: 157rpx;
    height: 52rpx;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: 157rpx 52rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    .main-text {
      font-size: 25rpx;
      color: #222830;
    }
    .block-content {
      display: flex;
      align-items: center;
      .label {
        font-size: 24rpx;
        color: #333;
        line-height: 50rpx;
        margin-left: 6rpx;
      }
      .number-box {
        font-size: 28rpx;
        display: flex;
        align-items: center;
        margin-left: 10rpx;
        .left-num {
          color: #333;
          line-height: 50rpx;
        }
        .right-num {
          color: #999;
        }
      }
    }
  }
}
</style>
