BidSuccessDialog.vue 6.57 KB
<template>
    <view class="dialog-container">
        <view class="bg-image" :style="{ backgroundImage: `url(${backgroundImageUrl})` }"></view>
        <view class="dialog-body">
            <view class="dialog-icon">
                <van-image width="100" height="100" fit="cover"
                    src="https://img02.glsx.com.cn/aus/images/order/payment.png"></van-image>
            </view>
            <view class="dialog-header">
                恭喜你中拍成功!
            </view>

            <view v-if="auctionVehicle.auction.auctionMode != 2" class="dialog-content">
                <text>请尽快支付款项以锁定车辆!</text>
            </view>

            <view v-if="auctionVehicle.auction.auctionMode == 2 && isNextAucVeh" class="nextTip">
                是否前往参拍下一辆车?
            </view>

            <view v-if="auctionVehicle.auction.auctionMode == 2" class="dialog-auctionMode">
                <view class="auctionMode-img">
                    <van-image width="28" height="28" style="margin: 6px;float: left;" fit="cover"
                        src="https://img02.glsx.com.cn/aus/images/roundBid/title_icon.png"></van-image>
                </view>
                <view class="auctionMode-text">
                    已中拍车辆可在【我的-购车订单】中进行付款与确认购车
                    <text style="color: #185EFE; cursor: pointer;display: inline-block;"
                        @click.stop="signContract()">前往购车确认</text>
                </view>
            </view>

            <view v-if="!isNextAucVeh" class="dialog-footer">
                <van-button class="dialog-footer_but" type="default" round block @click="handleClose()">取消</van-button>
                <van-button class="dialog-footer_but" type="primary" style="margin-left: 12px;" hairline round block
                    @click="signContract()">前往支付车款</van-button>
            </view>

            <view v-if="isNextAucVeh" class="dialog-footer">
                <van-button class="dialog-footer_but" type="default" round block @click="handleClose()">取消</van-button>
                <van-button class="dialog-footer_but" type="primary" style="margin-left: 12px;" hairline round block @click="toNextAucVeh()">
                    继续参拍
                    <text v-if="nextAucVehData.remainSecond">({{ Math.floor(nextAucVehData.remainSecond || 0) }}s)</text>
                </van-button>
            </view>

        </view>
    </view>

</template>
<script lang="ts">
import { Component, Prop, Vue } from "vue-facing-decorator";
import { BACKGROUND_IMAGE_2 } from "@/static/ResourceConstants";

@Component({
    components: {}
})
export default class BidSuccessDialog extends Vue {
    backgroundImageUrl = BACKGROUND_IMAGE_2;

    @Prop({ type: Number, required: true })
    orderId: number;

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

    nextAucVehData = {
        aucvehId: '',
        remainSecond: 0,
    };

    isNextAucVeh = false;
    isHandleClose = false;

    initData(data: any) {
        if (this.nextAucVehData.remainSecond) {
            return;
        }
        this.isHandleClose = false;
        const { aucvehId, remainSecond } = data || {};
        this.nextAucVehData.aucvehId = aucvehId || '';
        this.nextAucVehData.remainSecond = remainSecond || 0;
        this.isNextAucVeh = aucvehId ? true : false;
        this.setTimeoutSecond();
    }

    setTimeoutSecond() {
        if (this.nextAucVehData.aucvehId) {
            if (this.nextAucVehData.remainSecond && Number(this.nextAucVehData.remainSecond) > 0) {
                setTimeout(() => {
                    this.nextAucVehData.remainSecond = Math.floor(Number(this.nextAucVehData.remainSecond)) - 1;
                    this.setTimeoutSecond();
                }, 1000);
            } else {
                this.nextAucVehData.remainSecond = 0;
                if (!this.isHandleClose) {
                    this.toNextAucVeh();
                }
            }
        }
    }

    handleClose() {
        this.isHandleClose = true;
        this.$emit('close');
    }

    //跳转到下一辆车
    toNextAucVeh() {
        this.$emit('close');
        uni.navigateTo({ url: '/module/auction/AuctionVehiclePage?aucvehId=' + this.nextAucVehData.aucvehId });
    }

    signContract() {
        console.log('signContract called', this.orderId); // 添加调试信息
        // uni.navigateTo({ url: '/module/order/contract/ContractPage?orderId=' + this.orderId });
        uni.navigateTo({url: '/module/order/OrderDetailPage?orderId=' + this.orderId})
        this.$emit('close');
    }
}
</script>

<style lang="scss" scoped>
.dialog-container {
    //height: 200px;
    //min-height: 100vh;
    /* 避免内容被顶部导航栏遮挡(可选) */
    //padding-top: var(--status-bar-height);
    //box-sizing: border-box;
}

.bg-image {
    background-attachment: inherit;
    /* 将背景图固定不动 */
}

.dialog-body {
    padding: 20px;
}

.dialog-icon {
    text-align: center;
}

.dialog-header {
    position: relative;
    font-size: 26px;
    font-weight: 500;
    color: #185EFE;
    text-align: center;
}

.dialog-content {
    position: relative;
    text-align: center;
    text {
        font-size: 13px;
        font-weight: 400;
        line-height: 18.2px;
        color: #333333;
    }
}

.dialog-footer {
    width: 100%;
    margin-top: 24px;
    margin-bottom: 24px;
    float: left;
}

.dialog-footer_but {
    width: -webkit-calc(50% - 6px);
    width: -moz-calc(50% - 6px);
    width: calc(50% - 6px);
    float: left;
}

.dialog-auctionMode {
    width: 100%;
    height: 56px;
    border-radius: 4px;
    background: linear-gradient(0deg, #edf6ff 0%, #f7fbff 100%);
    margin-top: 16px;
    float: left;
}

.auctionMode-img {
    width: 40px;
    height: 40px;
    background: linear-gradient(0deg, #cce5ff 0%, #e6f4fe00 100%);
    border-radius: 50%;
    margin: 8px;
    float: left;
}

.auctionMode-text {
    width: -webkit-calc(100% - 64px);
    width: -moz-calc(100% - 64px);
    width: calc(100% - 64px);
    float: left;
    color: #676d7d;
    font-size: 12px;
    line-height: 20px;
    margin: 8px 0;
    position: relative; // 确保元素在正确的层级
    z-index: 1; // 确保元素在上方

    text {
        display: inline-block; // 确保文本块可点击
        padding: 2px 0; // 增加点击区域
    }
}

.nextTip {
    width: 100%;
    height: 22px;
    float: left;
    margin-top: 8px;
    text-align: center;
    color: #676d7d;
    font-size: 14px;
    font-weight: 常规体;
    font-family: "苹方-简";
    line-height: 22px;
}
</style>