OrderVehicleItem.vue 3.35 KB
<template>
    <view class="recharge-info" v-if="order">
        <van-image class="car-image" use-error-slot width="120" fit="cover" radius="16rpx"
                   height="90" :src="vehicle.cover?.url">
        </van-image>
        <view class="recharge-details">
            <view class="car-title">【{{ cityName }}】{{ vehicle.baseInfo.carSeriesName }} {{ vehicle.baseInfo.carTypeName }}</view>
            <view class="car-specs">{{ productionYear }}年 | {{ mileage }}万公里 | 国{{ vehicle.coreSpecs.emissionStandard }}</view>
            <view class="car-tags">
                <text class="tag" v-for="(feature, featureIndex) in vehicle.baseInfo?.tags">{{ feature }}</text>
            </view>
            <view class="car-favorite">
                <view class="location">
                    <uni-icons type="location" size="12" color="#185EFE"></uni-icons>
                    {{ vehicle.ownership.carProvinceName }} {{ vehicle.ownership.carCityName }}
                </view>
            </view>
        </view>
    </view>
</template>

<script lang="ts">
import {Component, Prop, Vue} from 'vue-facing-decorator';
import {AuctionOrder} from "lib/src/entity/auction/entity/AuctionOrder";
import dayjs from "dayjs";
import {Vehicle} from "lib/src/entity/vehicle/entity/Vehicle";

@Component({})
export default class OrderVehicleItem extends Vue {
    @Prop({type: Object, required: true})
    order: AuctionOrder;

    get vehicle() {
        return this.order.vehicle;
    }

    get licensePlate(): string {
        return this.vehicle.baseInfo?.licensePlate.substring(0, 2);
    }

    get cityName(): string {
        if (this.vehicle.ownership.carCityName) {
            return this.vehicle.ownership.carCityName.replace("市", "");
        }
        return this.vehicle.ownership.carCityName;
    }


    get productionYear(): number {
        return dayjs(this.vehicle.coreSpecs.productionDate as string).year();
    }

    get mileage(): string {
        return (this.vehicle.baseInfo.mileage / 10000).toFixed(2);
    }

}
</script>


<style scoped lang="scss">

/* 车辆信息 */
.recharge-info {
    background-color: #fff;
    padding: 12px;
    margin: 12px;
    display: flex;
    border-radius: 12px;
}

.car-image {
    margin-right: 12px;
}

.recharge-details {
    flex: 1;
}

.car-title {
    font-size: 15px;
    font-weight: 400;
    color: #333;
    margin-bottom: 4px;
    line-height: 20px;
}

.car-specs {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.car-tags {
    margin-bottom: 8px;
}

.tag {
    font-size: 10px;
    color: rgba(153, 153, 153, 1);
    background-color: #ffffff;
    border: 0.5px solid rgba(230, 235, 245, 1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
}

.car-favorite {
    display: flex;
    align-items: center;
}

.favorite-text {
    font-size: 12px;
    color: #ff976a;
    margin-left: 4px;
}

.price {
    font-size: 14px;
    font-weight: 500;
    color: #ff4d4f;
}

/* 中拍时间 */
.auction-time {
    padding: 1px;
    margin-bottom: 10px;
}

.time-label {
    color: rgba(51, 51, 51, 1);
    font-size: 15px;
    font-weight: 400;
}

.time-value {
    font-size: 15px;
    color: #333;
}

.location {
    border-radius: 2px;
    background: rgba(24, 94, 254, 0.1);
    font-size: 10px;
    font-weight: 400;
    line-height: 18px;
    color: #185EFE;
    text-align: left;
    padding: 2px 6px;
}
</style>