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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
| <template>
| <view>
| <view class="icon">
| <image src="/static/success.png"></image>
| </view>
| <view class="tis">
| 订单支付成功
| </view>
| <view class="pay-amount">
| 支付金额:{{amount}}元
| </view>
| <view class="back">
| <view class="btn" @tap="toIndex">{{content}}</view>
| </view>
| </view>
| </template>
|
| <script>
| let app = getApp()
| var that; // 当前页面对象
| var vk; // vk依赖
| export default {
| data() {
| return {
| amount: 0,
| type: 0 // 支付类型 0:默认返回首页 1:购买课程 2:充值学习币
| };
| },
| onLoad(e) {
| vk = this.vk;
| this.amount = parseFloat(e.amount).toFixed(2);
| this.type = Number(e.type)
| },
| onShow: function() {
| //支付完成返回,开始处理数据
| if (app.globalData.payStatus != null && app.globalData.payStatus != undefined) {
| let orderno = app.globalData.orderNo;
| console.log('接收到返回支付结果', app.globalData.payStatus);
| console.log('订单号', orderno);
| //处理您自己的业务
| }
| },
| computed: {
| content() {
| switch (this.type) {
| case 1:
| return '前往我的课程'
| case 2:
| return '返回我的账户'
| default:
| return '返回首页'
| }
| }
| },
| methods: {
| toIndex() {
| let url = '/pages/index/homePage'
| switch (this.type) {
| case 1:
| url = '/pages/mine/my-course/index'
| break
| case 2:
| url = '/pages/mine/account/study-coins'
| break
| }
| vk.redirectTo(url)
| }
| },
| }
| </script>
|
| <style lang="scss">
| view {
| display: flex;
| flex-wrap: wrap;
| justify-content: center;
| }
|
| .icon {
| width: 100%;
| margin-top: 10vw;
|
| image {
| width: 25vw;
| height: 25vw;
| }
| }
|
| .tis {
| width: 100%;
| margin-top: 20upx;
| font-size: 48upx;
| }
|
| .pay-amount {
| width: 100%;
| margin-top: 10upx;
| font-size: 32upx;
| }
|
| .back {
| position: absolute;
| width: 100%;
| bottom: 80upx;
|
| .btn {
| padding: 0 50upx;
| height: 70upx;
| border: solid 2upx #025BFF;
| color: #025BFF;
| align-items: center;
| border-radius: 10upx;
| font-size: 34upx;
| }
| }
| </style>
|
|