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
97
98
99
100
101
<template>
    <view class="pay-wrap" v-if="!loading">
        <view v-html='content'></view>
    </view>
</template>
 
 
<script>
    export default {
        data() {
            return {
                order_id: 0,
                order_type: '',
                pay_source: '',
                content: '',
                /*加载中*/
                loading: true,
                intervalId: null,
                use_balance:0
            }
        },
        onLoad(e) {
            this.order_id = e.order_id;
            this.order_type = e.order_type;
            this.use_balance = e.use_balance;
            if(e.platform){
                this.pay_source = 'payAppH5';
            }else{
                this.pay_source = 'payH5';
            }
            uni.showLoading({
                title: '加载中'
            });
            /*获取数据*/
            this.getData();
        },
        methods: {
            /*获取数据*/
            getData() {
                let self = this;
                console.log('self.pay_source='+self.pay_source);
                self._post('user.userweb/alipayH5', {
                    order_id: self.order_id,
                    order_type: self.order_type,
                    pay_source: self.pay_source,
                    use_balance:self.use_balance
                }, function(res) {
                    uni.hideLoading();
                    self.loading = false;
                    self.content = res.data.payment;
                    self.intervalId = setInterval(function(){
                        if(document.forms['alipaysubmit']){
                            clearInterval(self.intervalId);
                            document.forms['alipaysubmit'].submit();
                        }
                    },500);
                });
            }
 
        }
    }
</script>
 
<style>
    .product-pay-list {
        text-align: left;
    }
 
    .product-pay-list .pic {
        width: 120rpx;
        height: 120rpx;
    }
 
    .product-name {
        font-size: 30rpx;
    }
 
    .top-container {
        padding: 100rpx 0;
        text-align: center;
        background: #eeeeee;
        color: #333333;
    }
 
    .top-container .pay-title {
        font-size: 40rpx;
        font-weight: bold;
    }
 
    .pay-wrap .pay {
        display: block;
        height: 88rpx;
        line-height: 88rpx;
        font-size: 30rpx;
        color: #FFFFFF;
        text-align: center;
        border-radius: 8rpx;
        color: #FFFFFF;
        background: #04be01;
    }
</style>