ContractSignPage.vue 3.79 KB
<template>
    <view class="page-container">
        <van-notice-bar
            color="#EE3140" background="#EE31401A"
            left-icon="info"
            text="请在30分钟内完成签署,超时需重新发起签署流程。"/>

        <view class="content-card">
            <view class="image-card">
                <image src="https://img02.glsx.com.cn/aus/images/order/contract.png" class="contract-image"/>
            </view>
            <view class="content-text">
                <text>等待签署中...</text>
                <view v-if="accountInfo"> 已向您手机<span style="color: #007aff">{{ maskedMobile }} </span>发送签署短信</view>
            </view>
            <view class="operate-tip">
                <text>操作流程</text>
                <br/>
                1、查看短信打开手机短信,点击e签宝发送的签 署链接 <br/>2、 验证身份输入验证码完成身份验证 <br/>3、完成签署确认合同内容并完成电子签名
            </view>

        </view>
        <view class="footer">
            <van-button type="primary" hairline round block @click="naviback">返回</van-button>
        </view>
    </view>
</template>

<script lang="ts">
import {Component, Vue} from 'vue-facing-decorator';
import {AccountInfo} from "lib/src/entity/account/domain/AccountInfo";
import {AuthService} from "@/common/AuthService";
import {onHide, onLoad, onShow, onUnload} from "@dcloudio/uni-app";
import {AuctionOrderController} from "@/api/AuctionOrderController";

@Component({})
export default class ContractSignPage extends Vue {

    accountInfo: AccountInfo = null;

    orderId: number;

    // 定义一个变量来存储setInterval返回的ID
    intervalId: any;

    created(): void {
        this.accountInfo = (this.$auth as AuthService).getAuthentication();
        onLoad((option) => {
            this.orderId = option.orderId;
        });
        onShow((option) => {
            this.startFetchOrderState();
        });
        onHide(() => {
            this.stopFetchOrderState();
        });
        onUnload(() => {
            this.stopFetchOrderState();
        });
    }

    unmounted() {
        this.stopFetchOrderState();
    }

    startFetchOrderState(): void {
        this.intervalId = setInterval(() => {
            AuctionOrderController.getAuctionOrderStateById(this.axios, this.orderId).then(res => {
                if (res.data === 'UNPAID') {
                    this.stopFetchOrderState();
                    uni.navigateTo({url: '/module/order/contract/ContractSuccessPage?orderId=' + this.orderId});
                }
            });
        }, 4000);
    }

    stopFetchOrderState(): void {
        clearInterval(this.intervalId);
    }

    get maskedMobile(): string {
        const mobile = this.accountInfo.mobile;
        return mobile.slice(0, 3) + "****" + mobile.slice(7);
    }

    naviback(): void {
        uni.navigateBack({delta: 1});
    }
}
</script>


<style scoped lang="scss">
.page-container {
    background-color: #f8f8f8;
    //min-height: 100vh;
}

.content-card {
    background-color: #fff;
    border-radius: 12px;
    margin: 12px;
    padding: 12px;
    height: 100%;
}

.footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 16px;
    padding: 24rpx;
    background-color: #ffffff;
}

.image-card {
    padding-top: 42px;
    text-align: center;
}

.contract-image {
    width: 100px;
    height: 100px;
}

.content-text {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    line-height: 28px;
    padding-top: 12px;
    color: rgba(51, 51, 51, 1);
}

.operate-tip {
    border-radius: 2.21px;
    background: rgba(246, 249, 255, 1);
    padding: 16px;
    margin-top: 16px;
    font-size: 14px;
    font-weight: 400;
    line-height: 28px;
    color: rgba(51, 51, 51, 1);
    text-align: left;
}
</style>