路泰科技体检小程序UI设计新版本
1
wwl
5 天以前 a6cdbcfe28fcc40ebb4919f57d60fb20122e8e57
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<template>
    <view class="container">
        <view class="pay-result">
            <view class="success" v-if="status">
                <view class="msg">付款成功</view>
                <view class="btns">
                    <navigator class="btn" url="../../pagesB/mine/myReservation/myReservation" open-type="redirect">查看订单</navigator>
                    <navigator class="btn" url="../appointment/appointment" open-type="switchTab">继续逛</navigator>
                </view>
            </view>
            <view class="error" v-if="!status">
                <view class="msg">付款失败</view>
                <view class="tips">
                    <view class="p">
                        请在
                        <text class="time">半小时</text>
                        内完成付款
                    </view>
                    <view class="p">否则订单将会被系统取消</view>
                </view>
                <view class="btns">
                    <navigator class="btn" url="../../pagesB/mine/myReservation/myReservation" open-type="redirect">查看订单</navigator>
                    <view class="btn" @tap="payOrder">重新付款</view>
                </view>
            </view>
        </view>
    </view>
</template>
 
<script>
    import {
        prepay,
        reservation,
        submit
    } from "@/api/system/cart";
    export default {
        data() {
            return {
                status: false,
                orderId: 0
            };
        },
        onLoad: function(options) {
            // 页面初始化 options为页面跳转所带来的参数
 
            this.orderId = options.orderId;
                this.status = options.status === '1' ? true : false
 
        },
        onReady: function() {},
        onShow: function() {
            // 页面显示
        },
        onHide: function() {
            // 页面隐藏
        },
        onUnload: function() {
            // 页面关闭
        },
        methods: {
            payOrder() {
                let that = this;
                let data = {
                    orderId: that.orderId
                }
                prepay(data).then((res) => {
                    if (res.code === 200) {
                        const payParam = res.data;
                        console.log('支付过程开始');
                        uni.requestPayment({
                            timeStamp: payParam.timeStamp,
                            nonceStr: payParam.nonceStr,
                            package: payParam.packageValue,
                            signType: payParam.signType,
                            paySign: payParam.paySign,
                            success: function(res) {
                                console.log('支付过程成功');
                                that.status = true
                            },
                            fail: function(res) {
                                console.log('支付过程失败');
                                this.$modal.showToast('支付失败');
                            },
                            complete: function(res) {
                                console.log('支付过程结束');
                            }
                        });
                    }
                });
            }
        }
    };
</script>
<style>
    @import './payResult.css';
</style>