matchPayDone.vue
2.82 KB
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
117
118
119
120
121
122
123
<template>
<view class="fixedbody">
<view class="successBox">
<view class="doneIcon">
<uni-icons type="checkbox-filled" size="100" color="#1EC886"></uni-icons>
</view>
<view v-if="chargeFlag=='0'" style="margin: 0 0 80rpx;">报名成功</view>
<view v-else style="margin: 0 0 80rpx;">
<view>支付成功</view>
<view class="ppp">订单金额<text class="orange">¥{{amount}}</text></view>
<view class="ppp">交易方式
<text v-if="payType=='0'">会员卡支付</text>
<text v-else-if="payType=='1'">微信支付</text>
<text v-else-if="payType=='2'">线下支付</text>
</view>
</view>
<view style="display: flex;justify-content: center;">
<button class="btn btn1" style="margin: 0 10px;" @click="download">下载凭证</button>
<button class="btn btn1" style="margin: 0 10px;" @click="goDetail">查看报项</button>
</view>
</view>
</view>
</template>
<script setup>
import { reactive, toRefs } from 'vue';
import * as match from '@/match/js/match.js';
import { onLoad } from '@dcloudio/uni-app';
import config from '@/config.js'
const data = reactive({
chargeFlag:'',
amount:'',
payType:''
})
const {chargeFlag,payType,amount } = toRefs(data);
const app = getApp();
let cptId
let groupId
let orderId
onLoad(option=>{
console.log(option)
// cptId groupId chargeFlag
cptId = option.cptId
groupId = option.groupId
chargeFlag.value = option.chargeFlag
orderId = option.orderId
// amount payType
if(option.amount){
amount.value = option.amount
}
if(option.payType){
payType.value = option.payType
}
})
function goDetail() {
// 前往报项详情
uni.redirectTo({
url: `/pages/usercenter/matchSignDetail?id=${cptId}&groupId=${groupId}&auditStatus=1}`
})
}
function download(){
match.downloadpz(cptId,groupId).then(res=>{
goWebView(res.data)
})
}
function goWebView(url) {
console.log(url)
url = url.replace("http://", "https://")
uni.showLoading({
title: '下载中'
});
uni.downloadFile({
url: url,
success: function(res) {
uni.hideLoading();
var filePath = res.tempFilePath;
uni.showLoading({
title: '正在打开'
});
uni.openDocument({
filePath: filePath,
showMenu: true,
success: function(res) {
uni.hideLoading();
},
fail: function(err) {
uni.hideLoading();
uni.showToast({
title: err,
icon: 'none',
duration: 2000
});
}
});
},
fail: function(error) {
uni.hideLoading();
uni.showToast({
title: `下载失败`,
icon: 'none',
duration: 2000
});
}
});
}
</script>
<style lang="scss" scoped>
.successBox{text-align: center;}
.doneIcon{margin: 5vh auto;}
.ppp{ text-align: left;
font-size: 30rpx;
padding: 0 30rpx;color: #a0a0a0;
margin: 20rpx 0;
text{ float: right;color: #000;}
}
</style>