matchPayDone.vue 2.85 KB
<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 '@/common/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>