success.uvue 8.5 KB
Newer Older
VK1688's avatar
VK1688 已提交
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 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
<template>
	<view class="app">
		<view class="header">
			<image :src="successImages" class="success-image"></image>
			<view><text class="success-title-text">支付成功</text></view>
			<view class="hr"></view>
		</view>
		<view class="info-box">
			<view class="info-amount"><text class="text">¥ {{ amountFormat(myOptions.getNumber('total_fee')) }}</text></view>
			<view class="left-circle"></view>
			<view class="right-circle"></view>
			<view class="info-main">
				<view class="info-cell">
					<view class="left"><text class="text">订单编号</text></view>
					<view class="right"><text class="text">{{ myOptions['order_no'] }}</text></view>
				</view>
			</view>
		</view>
		<!-- 广告位开始 -->
		<view class="uni-ad">
			<!-- 红包广告,uniappx暂不支持-->
			<!-- <ad-interactive v-if="myOptions['adpid']" :adpid="myOptions['adpid']" v-slot:default="{data, loading, error}"
				open-page-path="/uni_modules/uni-pay-x/pages/ad-interactive-webview/ad-interactive-webview" @error="onaderror">
				<view v-if="data" class="ad-interactive">
					<image :src="data.imgUrl" mode="widthFix"></image>
				</view>
			</ad-interactive> -->
		</view>
		<!-- 广告位结束 -->
		<view v-if="myOptions['return_url']" class="button-query" @click="queryOrder"><text class="text">查看订单</text></view>
		<view class="footer-hr"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				myOptions: {
					adpid: "",
					order_no: "",
					out_trade_no: "",
					total_fee: null,
					pay_date: "",
					return_url: ""
				} as UTSJSONObject,
				successImages: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABAEAYAAAD6+a2dAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAACAlJREFUeNrtnVlszF8Ux++d4B+JWhqERGJvlRJLJQ1RHsQeFEXFUmt5scWWiPVB2qKERIglSpEg9vJAYn8RQlRFI5ryYm+prbZ7/g/fOdPOtNPfdDrjzEx/n5dvf3fuTM895869v3t/997RKswhQ4ZM69a4SkpSWmmle/TAdbdu0JgYaIsW0ObNoU2auH/a16/QT5+gpaXQwkLos2fQggJFihTdvq0d2qEd795J+yHiQaD794dmZxMREeXnQ40hEfj/5ufDru3boQkJ0v4KW+DApk2hK1bAwU+fygS4rhQUuMphyJCJipL2b8gBR0VHQzdtgpaUSIcuOHC5Nm6EcpdUj0DBtcY3YuZMXL97Jx0aGT5+hC5ZAnU4pOMTvMAbMmS6dEFB796Vdn1ocucOtHNn6XgFLvBERJScDC0tlXZxeFBWBp06VTp+fgbc4YDu2CHtyrCHRxdEFNJdBAxt1AiGHj8u7bfI5Ngx+Llhw0DFTQcq8JiAOXsWqaNGyVXF+kBeHiaikpMxEfX7t7+f5HeTghqpNQK/fz9S7cD/G0aPht9zchAH/7uGOvYp2dnQmTOlXVI/SU1FS5CZ6e8n1LoLQJOfkoIaePKktAtsKjNtmtZaa33ihK/v8LkCoKnh8emDB9BmzaSLbFOZz5+hffuiIhQVWb3Dsgtw9fVKKaWOHIHagQ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F0ZTptb2RpZnkAMjAyMi0xMC0yN1QxNDowMzowMiswODowMPuZTR8AAABQdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL2hvbWUvYWRtaW4vaWNvbi1mb250L3RtcC9pY29uX3ZwM212emVpcjcvemhpZnVjaGVuZ2dvbmcuc3ZntdPldAAAAABJRU5ErkJggg==",
				// 默认颜色
				color: {
					wxpay: "#01be6e",
					alipay: "#108ee9"
				}
			}
		},
		// 监听 - 页面每次【加载时】执行(如:前进)
		onLoad(options) {
			this.myOptions['adpid'] = options['adpid'];
			this.myOptions['order_no'] = options['order_no'];
			this.myOptions['out_trade_no'] = options['out_trade_no'];
			this.myOptions['total_fee'] = parseFloat(options['total_fee'] as string);
			this.myOptions['pay_date'] = options['pay_date'];
			this.myOptions['return_url'] = options['return_url'];
		},
		// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
		onReady() { },
		// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
		onShow() { },
		// 监听 - 页面每次【隐藏时】执行(如:返回)
		onHide() { },
		// 函数
		methods: {
			queryOrder() {
				let return_url = this.myOptions['return_url'] as string;
				let out_trade_no = this.myOptions['out_trade_no'] as string;
				let order_no = this.myOptions['order_no'] as string;
				let url = return_url + `?out_trade_no=${out_trade_no}&order_no=${order_no}`;
				if (url.indexOf("/") != 0) url = `/${url}`;
				uni.navigateTo({
					url,
				});
			},
			// 广告加载失败事件
			onaderror(e : any) {
				console.log("ad-error", e);
			},
			amountFormat(totalFee : number | null) :string{
				if (totalFee == null) {
					return "0";
				} else {
					return (totalFee / 100).toFixed(2)
				}
			}
		},
		// 监听器
		watch: {

		},
		// 计算属性
		computed: {

		}
	}
</script>
<style lang="scss" scoped>
	/* uniappx不支持自定义var变量,故此处只能使用 scss 变量*/
	$bgcolor: #f3f3f3;
	$main: #007aff;

	.app {
		background-color: $bgcolor;
		flex: 1;
	}

	.header {
		background-color: $main;
		display: flex;
		align-items: center;
		text-align: center;
		padding: 80rpx 30rpx 50rpx 30rpx;

		.success-image {
			width: 120rpx;
			height: 120rpx;
		}

		.success-title-text {
			color: #ffffff;
			font-size: 34rpx;
			margin-top: 40rpx;
			font-weight: bold;
		}

		.hr {
			margin-top: 40rpx;
			width: 750rpx;
			height: 30rpx;
			border-radius: 20rpx;
			opacity: 0.1;
			background-color: #000000;
		}
	}

	.info-box {
		width: 650rpx;
		margin: 0 50rpx;
		position: relative;
		margin-top: -64rpx;
		background-color: #ffffff;

		.info-amount {
			height: 150rpx;
			border-bottom: 4rpx dashed #f3f3f3;

			.text {
				line-height: 150rpx;
				color: $main;
				font-weight: bold;
				font-size: 60rpx;
				text-align: center;
			}
		}

		.left-circle {
			background-color: $bgcolor;
			position: absolute;
			width: 40rpx;
			height: 40rpx;
			border-radius: 20rpx;
			top: calc(150rpx - 20rpx);
			left: -20rpx;
		}

		.right-circle {
			background-color: $bgcolor;
			position: absolute;
			width: 40rpx;
			height: 40rpx;
			border-radius: 20rpx;
			top: calc(150rpx - 20rpx);
			right: -20rpx;
		}

		.info-main {
			padding: 30rpx;

			.info-cell {
				display: flex;
				flex-direction: row;
				line-height: 50rpx;

				.left {
					width: 200rpx;

					.text {
						text-align: left;
						font-size: 26rpx;
						color: #333333;
					}
				}

				.right {
					flex: 1;

					.text {
						text-align: right;
						font-size: 26rpx;
						color: #333333;
					}
				}
			}
		}
	}

	.uni-ad {
		margin-top: 50rpx;
		min-height: 100rpx;

		.ad-interactive {
			text-align: center;
		}
	}

	.button-query {
		background-color: $main;
		width: 630rpx;
		margin: 50rpx 60rpx 0 60rpx;
		padding: 20rpx 30rpx;
		border-radius: 50rpx;
		box-sizing: border-box;

		.text {
			color: #ffffff;
			text-align: center;
		}
	}

	.button-query:active {
		opacity: 0.7;
	}

	.footer-hr {
		height: 100rpx;
	}
</style>