ControlAuction.vue 3.58 KB
<template>
    <auction-base-info :auction="auction" :controllable="controllable" @add-vehicles="reloadAuction"></auction-base-info>
    <a-card :bordered="false" size="small" class="mt-10">
        <template #title>
            拍卖实时统计
        </template>
        <template #extra>
            最后更新时间:{{ currentTime }}
            <a-button type="text" class="mr-10" @click="reloadAuction">
                <template #icon>
                    <ReloadOutlined/>
                </template>
            </a-button>
        </template>
        <a-row :gutter="16" class="mt-10 mb-12">
            <a-col :span="5">
                <a-card class="stat-card">
                    <a-statistic title="围观人数" :value="auction?.browsingCount" :precision="0" suffix="人"></a-statistic>
                </a-card>
            </a-col>
            <a-col :span="5">
                <a-card class="stat-card">
                    <a-statistic title="参拍人数" :value="auction?.accountCount??0" :precision="0" suffix="人"></a-statistic>
                </a-card>
            </a-col>
            <a-col :span="5">
                <a-card class="stat-card">
                    <a-statistic title="总出价次数" :value="auction?.bidCount??0" :precision="0" suffix="次"></a-statistic>
                </a-card>
            </a-col>
            <a-col :span="5">
                <a-card class="stat-card">
                    <a-statistic title="当前中拍总额" :value="auction?.transactionVolume" :precision="0" suffix="元" prefix="¥"></a-statistic>
                </a-card>
            </a-col>
            <a-col :span="4">
                <a-card class="stat-card">
                    <a-statistic title="中拍率" :value="(auction?.auctionedCount/auction?.vehicleCount)*100" :precision="2" suffix="%"></a-statistic>
                </a-card>
            </a-col>
        </a-row>
    </a-card>
    <auction-vehicle-page ref="auctionVehiclePage" v-sec="'control_15'" :auction-id="auctionId" :auction="auction"></auction-vehicle-page>
</template>
<script lang="ts">

import {Component, Ref, Vue} from "vue-facing-decorator";
import {Auction} from "lib/src/entity/auction/entity/Auction";
import {AuctionController} from "@/api/AuctionController";
import AuctionVehiclePage from "@/views/auction/control/AuctionVehiclePage.vue";
import AuctionBaseInfo from "@/views/auction/auction/AuctionBaseInfo.vue";
import {ReloadOutlined} from "@ant-design/icons-vue";
import dayjs from "dayjs";
import VehicleDrawer from "@/views/vehicle/inventory/VehicleDrawer.vue";

@Component({
    components: {VehicleDrawer, AuctionBaseInfo, AuctionVehiclePage, ReloadOutlined}
})
export default class ControlAuction extends Vue {

    auctionId: any;

    auction: Auction | null = null;

    currentTime = null;

    @Ref("auctionVehiclePage")
    auctionVehiclePage: any;


    created(): void {
        this.auctionId = Number(this.$route.query.auctionId);
        this.reloadAuction();
    }

    reloadAuction(): void {
        AuctionController.getAuctionInfoById(this.axios, this.auctionId).then(response => {
            this.auction = response.data;
            this.currentTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
        });
        if (this.auctionVehiclePage) {
            this.auctionVehiclePage.pageRefresh();
        }
    }

    get controllable(): boolean {
        if (!this.auction) {
            return false;
        }
        return this.auction.auctionState === 'WAIT_AUCTION' || this.auction.auctionState === 'PREVIEW' || this.auction.auctionState === 'AUCTIONING';
    }

}
</script>

<style scoped lang="ts">

</style>