InspectionReport.vue 7.44 KB
<template>
    <view class="reportBox" :class="{ 'height152': !reportData.h5Url }">
        <view class="reportTitle">综合评分</view>
        <view v-if="reportData.h5Url">
            <view class="glskBox">
                <image src="/static/images/glsk.png" fit="cover" style="width:74px;height: 74px" />
            </view>

            <view class="averageHand">
                <view class="average" :class="reportData.overallScore >= 90 ? 'value_color1'
                    : reportData.overallScore >= 80 && reportData.overallScore <= 89 ? 'value_color2'
                        : reportData.overallScore >= 60 && reportData.overallScore <= 79 ? 'value_color3'
                            : reportData.overallScore < 60 ? 'value_color4' : ''">{{ reportData.overallScore || '0' }}
                </view>
                <view class="averageUnit">分</view>
                <!-- 优秀 90-100分 -->
                <view v-if="reportData.overallScore >= 90" class="averageBox averageBox_bg1">
                    优秀
                </view>
                <view v-if="reportData.overallScore >= 80 && reportData.overallScore <= 89"
                    class="averageBox averageBox_bg2">
                    良好
                </view>
                <view v-if="reportData.overallScore >= 60 && reportData.overallScore <= 79"
                    class="averageBox averageBox_bg3">
                    中
                </view>
                <view v-if="reportData.overallScore < 60" class="averageBox averageBox_bg3">较差</view>
                <!-- <view v-if="!reportData.overallScore">-</view> -->
            </view>

            <view class="rating">
                <text>外观</text>
                <text class="ratingValue"
                    :class="Number(reportData.exteriorScore || 0) >= 80 ? 'value_color1' : Number(reportData.exteriorScore || 0) >= 60 && Number(reportData.exteriorScore || 0) < 80 ? 'value_color2' : 'value_color4'">
                    {{ reportData.exteriorScore || '0' }}
                </text>
                <text>骨架</text>
                <text class="ratingValue"
                    :class="reportData.skeletonLevel == 'A' ? 'value_color1' : reportData.skeletonLevel == 'B' ? 'value_color2' : reportData.skeletonLevel == 'C' ? 'value_color3' : reportData.skeletonLevel == 'D' ? 'value_color4' : 'value_color4'">
                    {{ reportData.skeletonLevel || 'D' }}
                </text>
                <text>内饰</text>
                <text class="ratingValue"
                    :class="reportData.interiorLevel == 'A' ? 'value_color1' : reportData.interiorLevel == 'B' ? 'value_color2' : reportData.interiorLevel == 'C' ? 'value_color3' : 'value_color4'">
                    {{ reportData.interiorLevel || 'D' }}
                </text>
            </view>
            <view class="accident">
                <text :class="reportData.accident == 1 ? 'color_F5AE18' : ''">
                    {{ reportData.accident != 1 ? '无' : '' }}事故
                </text>
                <text class="accidentSeparator">|</text>
                <text :class="reportData.burn == 1 ? 'color_F5AE18' : ''">
                    {{ reportData.burn != 1 ? '无' : '' }}火烧
                </text>
                <text class="accidentSeparator">|</text>
                <text :class="reportData.wade == 1 ? 'color_F5AE18' : ''">
                    {{ reportData.wade != 1 ? '无' : '' }}水泡
                </text>
            </view>
            <view class="reportBtn" @click="handleTapp">查看完整检测报告</view>
        </view>
        <view v-else>
            <view class="noReport">车辆需现场看车,暂无检测报告</view>
        </view>
    </view>
</template>
<script lang="ts">
import { Component, Prop, Vue } from 'vue-facing-decorator';
import { AuctionController } from "@/api/AuctionController";
import { AuthService } from "@/common/AuthService";

@Component({})

export default class InspectionReport extends Vue {

    @Prop({ type: Object, required: true })
    auctionVehicle: any;


    reportData = {};

    created(): void {
        const that = this;
        setTimeout(() => {
            that.getReportVehicleData();
        }, 1000);
    }

    getReportVehicleData(): void {
        if (this.auctionVehicle.vehicle.vehicleId) {
            AuctionController.reportVehicleData(this.axios, this.auctionVehicle.vehicle.vehicleId).then(res => {
                this.reportData = res.data.data || {};
            });
        }
    }

    handleTapp() {
        const authService: AuthService = this.$auth;
        if (!authService.isLogin()) {
            uni.showToast({
                title: '请先登录', icon: 'none', duration: 2000, complete: function () {
                    setTimeout(() => {
                        uni.navigateTo({ url: '/pages/LoginPage' });
                    }, 2000);
                }
            });
            return console.log('请先登录');
        }
        uni.navigateTo({ url: '/module/auction/InspectionPreview?vehicleId=' + this.auctionVehicle.vehicle.vehicleId + '&aucvehId=' + this.auctionVehicle.aucvehId });
    }

}
</script>

<style scoped lang="scss">
.reportBox {
    width: 100%;
    height: 208px;
    border-radius: 8px;
    background: #ffffff;
    position: relative;
    background: linear-gradient(180deg, #e0effe 0%, #f8f9fb 100%);
}

.height152 {
    height: 152px !important;
}

.noReport {
    width: 100%;
    height: 32px;
    float: left;
    line-height: 32px;
    color: #676d7d;
    font-size: 13px;
    text-align: center;
    margin-top: 64px;
}

.glskBox {
    width: 74px;
    height: 74px;
    position: absolute;
    top: 2px;
    right: 2px;
    z-index: 99;
}

.reportTitle {
    width: 100%;
    height: 26px;
    float: left;
    margin-top: 16px;
    line-height: 26px;
    font-size: 18px;
    font-weight: 500;
    color: #333;
}

.averageHand {
    width: 100%;
    height: 32px;
    line-height: 32px;
    float: left;
    margin-top: 8px;
}

.average {
    float: left;
    color: #333333;
    font-size: 32px;
    font-weight: 600;
}

.averageUnit {
    height: 22px;
    line-height: 22px;
    color: #333333;
    font-size: 14px;
    float: left;
    margin-left: 4px;
    margin-top: 11px;
}

.averageBox {
    width: 34px;
    height: 20px;
    float: left;
    line-height: 20px;
    border-radius: 2px;

    font-size: 12px;
    text-align: center;
    margin-left: 12px;
    margin-top: 12px;
}

.averageBox_bg1 {
    color: #27cd5a;
}

.averageBox_bg2 {
    color: #F5AE18;
}

.averageBox_bg3 {
    color: #EE3140;
}

.color_F5AE18 {
    color: #F5AE18;
}


.rating {
    width: 100%;
    height: 18px;
    float: left;
    color: #666666;
    font-size: 12px;
    line-height: 18px;
    margin-top: 16px;
}

.ratingValue {
    padding-left: 6px;
    padding-right: 40px;
    font-size: 18px;
    font-weight: 600;
}

.value_color1 {
    color: rgb(125, 201, 64);
}

.value_color2 {
    color: rgb(125, 201, 64);
}

.value_color3 {
    color: rgb(247, 217, 68);
}

.value_color4 {
    color: rgb(239, 58, 58);
}

.accident {
    width: 100%;
    height: 16px;
    float: left;
    margin-top: 12px;
    color: #666666;
    font-size: 12px;
    line-height: 16px;
}

.accidentSeparator {
    padding: 0 8px;
}

.reportBtn {
    width: 100%;
    height: 40px;
    float: left;
    margin-top: 16px;
    line-height: 40px;
    border-radius: 40px;
    border: 1px solid #e6ebf5;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
    color: #666666;
    background: #f8f9fb;
}
</style>