paySuccess.vue
2.79 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
124
125
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';
import { ElButton } from 'element-plus';
import wx from 'weixin-js-sdk';
import EnvironmentDetector from '#/composables/environmentDetector';
const route = useRoute();
const loadLoading = ref(false);
const queryData = ref<any>({});
const detector = ref();
const init = async () => {
queryData.value = route.query || {};
};
const handleBack = () => {
if (queryData.value.redirectUrl) {
window.location.href = queryData.value.redirectUrl;
} else if (
wx !== undefined &&
wx.miniProgram &&
detector.value?.env.isMiniProgram
) {
wx.miniProgram.switchTab({
url: `/pages/newhome/newhome`,
});
}
};
onMounted(() => {
init();
detector.value = new EnvironmentDetector();
});
</script>
<template>
<div class="cashier-container" v-loading="loadLoading">
<!-- 正常支付界面 -->
<div class="cashier-wrapper">
<div class="pt-[40px]">
<div class="flex flex-col items-center justify-center">
<img src="/success.png" class="w-[64px]" />
<p class="color-[#49250B] mt-2 text-[18px] font-bold">支付成功</p>
</div>
<div class="color-[#333] flex flex-col gap-4 p-[40px]">
<div class="flex justify-between">
<div>支付方式</div>
<div>{{ queryData?.payType }}</div>
</div>
<div class="flex justify-between">
<div>支付金额</div>
<div>{{ queryData?.amount }} 元</div>
</div>
<div class="flex justify-between">
<div>收款方</div>
<div class="w-[70%] break-words">
{{ queryData?.payee }}
</div>
</div>
<div class="mt-10 flex justify-between">
<ElButton
class="pay-button"
plain
type="primary"
size="large"
@click="handleBack"
>
完成
</ElButton>
</div>
</div>
</div>
</div>
</div>
</template>
<style scoped lang="scss">
.cashier-container {
min-height: 100vh;
background: linear-gradient(
to bottom,
#fff9f1 0%,
#ffe9d4 20%,
#ffe3c8 29%,
#fff 45%,
#fff 100%
);
}
.cashier-wrapper {
display: flex;
flex-direction: column;
max-width: 500px;
min-height: 100vh;
margin: 0 auto;
}
.pay-button {
width: 100%;
height: 42px;
font-size: 18px;
font-weight: 600;
color: #ea4200;
background: #fff;
border: 1px solid #ea4200;
border-radius: 21px;
&:hover:not(:disabled) {
background: #f7f7f7;
box-shadow: 0 6px 20px rgb(234 66 0 / 40%);
}
&:active:not(:disabled) {
transform: scale(0.98);
}
&:disabled {
cursor: not-allowed;
opacity: 0.5;
}
}
</style>