<template>
|
<div class="recharge-page">
|
<!-- Header -->
|
<div class="header">
|
<a class="back-btn" @click="$router.go(-1)"></a>
|
<h2 class="title">{{ $t('jy534') }}</h2>
|
</div>
|
|
<!-- Security Banner -->
|
<div class="security-banner">
|
<span class="check-icon">✓</span>
|
<span class="security-text">{{ $t('jy535') }}</span>
|
</div>
|
|
<!-- Content Card -->
|
<div class="content-card">
|
<div class="amount-section">
|
<label class="amount-label">{{ $t('jy536') }}</label>
|
<div class="amount-input-wrapper">
|
<span class="currency-symbol">¥</span>
|
<input
|
type="text"
|
class="amount-input"
|
:placeholder="$t('jy537')"
|
disabled
|
/>
|
</div>
|
</div>
|
|
<div class="instructions">
|
<p class="instruction-item">1、{{ $t('jy538') }}</p>
|
<p class="instruction-item">2、{{ $t('jy539') }}</p>
|
</div>
|
|
<div class="contact-btn" @click="getHeaderlink(4)">
|
{{ $t('jy540') }}
|
</div>
|
</div>
|
</div>
|
</template>
|
<script>
|
import * as api from "@/axios/api";
|
import {getPayInfoDetail} from "../../axios/api";
|
import {Toast} from "mint-ui";
|
import APIUrl from "@/axios/api.url";
|
export default {
|
name: "recharge",
|
data() {
|
return {
|
timeoutId: null,
|
isLongPressed: false,
|
clickType: 0,
|
money: '',
|
password: '',
|
admin: APIUrl.baseURL,
|
moneyList: ['50000', '100000', '300000', '500000'],
|
jyzhimg: '',
|
channelName: "", //银行收款人,
|
channelDesc: "", //开户行,
|
channelAccount: "", //平台银行卡号,
|
transferName: "",//转账用户名
|
img1key: "",
|
imgStatus: false,
|
showBtn: true,
|
headers: {
|
USERTOKEN: localStorage.getItem("USERTOKEN")
|
},
|
};
|
},
|
mounted() {
|
this.getUserInfo()
|
this.getjyzh()
|
this.getPayInfo()
|
},
|
methods: {
|
handleAvatarSuccess(res, file) {
|
this.imgStatus = false;
|
this.img1key = res.data.url;
|
},
|
async getHeaderlink(val) {
|
let data = await api.getInfoSite()
|
if (data.status === 0) {
|
// this.onlineShow = true;
|
const u = navigator.userAgent;
|
const isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
|
if(isiOS){
|
location.href = data.data.siteQq;
|
window.onpageshow = function(event){
|
if(event.persisted){
|
setTimeout(function () {
|
location.reload(true);
|
}, 50)
|
}
|
};
|
let hidden = window.document.hidden || window.document.mozHidden || window.document.msHidden || window.document.webkitHidden
|
if (typeof hidden == "undefined" || hidden == false) {
|
location.href = data.data.siteQq;
|
}
|
} else {
|
window.open(data.data.siteQq, '_blank')
|
}
|
} else {
|
this.$store.commit('elAlertShow', { 'elAlertShow': true, 'elAlertText': data.msg });
|
}
|
},
|
rechargeMsg(msg){
|
Toast(this.$t("jy530"));
|
},
|
beforeAvatarUpload(file) {
|
this.imgStatus = true;
|
},
|
handleError() {
|
this.imgStatus = false;
|
},
|
onTouchStart(event, value) {
|
this.clickType = value
|
this.startLongPress(event);
|
},
|
onMouseDown(event) {
|
this.startLongPress(event);
|
},
|
onTouchEnd(event) {
|
this.endLongPress(event);
|
},
|
onMouseUp(event) {
|
this.endLongPress(event);
|
},
|
startLongPress(event) {
|
if (!this.isLongPressed) {
|
this.timeoutId = setTimeout(() => {
|
this.isLongPressed = true;
|
this.handleLongPress(event);
|
}, 500); // 长按时长,单位毫秒
|
}
|
},
|
endLongPress(event) {
|
if (this.timeoutId !== null) {
|
clearTimeout(this.timeoutId);
|
this.timeoutId = null;
|
}
|
this.isLongPressed = false;
|
},
|
handleLongPress(event) {
|
// 在这里处理长按事件的逻辑
|
if (this.clickType == 1) {
|
this.copyText(this.channelAccount)
|
} else if (this.clickType == 2) {
|
this.copyText(this.channelDesc)
|
} else if (this.clickType == 3) {
|
this.copyText(this.channelName)
|
}
|
},
|
xz(e) {
|
this.money = Number(e)
|
},
|
copyText(content) {
|
navigator.clipboard.writeText(content)
|
.then(() => {
|
this.$message.success('复制成功');
|
})
|
.catch(err => {
|
this.$message.error('复制失败');
|
});
|
},
|
async getPayInfo() {
|
// 获取支付渠道信息
|
let data = await getPayInfoDetail({payId: 8});
|
if (data.status === 0) {
|
const {channelName, channelDesc, channelAccount} = data.data;
|
this.channelName = channelName;
|
this.channelDesc = channelDesc;
|
this.channelAccount = channelAccount;
|
} else {
|
Toast(this.$t("jy543"));
|
}
|
},
|
Recharge() {
|
|
if (this.money == '' || this.money == null || this.money == undefined) {
|
this.$toast(this.$t('hj171'))
|
return
|
}
|
if (this.password == '' || this.password == null || this.password == undefined) {
|
this.$toast(this.$t('jy339'))
|
return
|
}
|
if (this.transferName == '' || this.transferName == null || this.transferName == undefined) {
|
this.$toast(this.$t("jy544"))
|
return
|
}
|
if (this.img1key == '' || this.img1key == null || this.img1key == undefined) {
|
this.$toast(this.$t("jy545"))
|
return
|
}
|
this.setRecharge()
|
},
|
async setRecharge() {
|
let data = {
|
amt: this.money,
|
payType: 1,
|
password: this.password,
|
img1key: this.img1key,
|
transferName: this.transferName,
|
}
|
let res = await api.inMoney(data)
|
if (res.code == 200) {
|
this.$toast(res.msg)
|
this.$router.go(-1)
|
} else {
|
this.$toast(res.msg)
|
}
|
},
|
async getUserInfo() {
|
// 获取用户信息
|
let data = await api.getUserInfo();
|
if (data.status === 0) {
|
// 判断是否登录
|
this.$store.commit('dialogVisible', false);
|
this.$store.state.userInfo = data.data;
|
} else {
|
this.$store.commit('dialogVisible', true);
|
}
|
},
|
async getjyzh() {
|
// 获取用户信息
|
let data = await api.getPayInfo();
|
if (data.status === 0) {
|
this.jyzhimg = data.data[0].channelImg
|
} else {
|
|
}
|
},
|
},
|
}
|
</script>
|
<style scoped lang="less">
|
.recharge-page {
|
width: 100%;
|
min-height: 100vh;
|
background: #f5f5f5;
|
}
|
|
.header {
|
width: 100%;
|
height: 1.2rem;
|
background: #fff;
|
position: relative;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
border-bottom: 1px solid #e5e5e5;
|
|
.back-btn {
|
position: absolute;
|
left: 0.4rem;
|
width: 0.48rem;
|
height: 0.48rem;
|
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%232196f3'%3E%3Cpath d='M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z'/%3E%3C/svg%3E") no-repeat center;
|
background-size: 0.48rem 0.48rem;
|
cursor: pointer;
|
}
|
|
.title {
|
font-size: 0.48rem;
|
font-weight: 500;
|
color: #333;
|
margin: 0;
|
}
|
}
|
|
.security-banner {
|
width: 100%;
|
background: #e8f5e9;
|
padding: 0.4rem 0.6rem;
|
display: flex;
|
align-items: center;
|
gap: 0.2rem;
|
|
.check-icon {
|
width: 0.4rem;
|
height: 0.4rem;
|
background: #4caf50;
|
border-radius: 50%;
|
color: #fff;
|
font-size: 0.28rem;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
font-weight: bold;
|
flex-shrink: 0;
|
}
|
|
.security-text {
|
font-size: 0.32rem;
|
color: #2e7d32;
|
}
|
}
|
|
.content-card {
|
background: #fff;
|
margin: 0.4rem;
|
border-radius: 0.28rem;
|
padding: 0.6rem;
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
.amount-section {
|
margin-bottom: 0.8rem;
|
|
.amount-label {
|
display: block;
|
font-size: 0.36rem;
|
color: #333;
|
font-weight: 500;
|
margin-bottom: 0.3rem;
|
}
|
|
.amount-input-wrapper {
|
display: flex;
|
align-items: center;
|
background: #f5f5f5;
|
border-radius: 0.2rem;
|
padding: 0 0.4rem;
|
height: 1.2rem;
|
|
.currency-symbol {
|
font-size: 0.4rem;
|
color: #666;
|
margin-right: 0.2rem;
|
}
|
|
.amount-input {
|
flex: 1;
|
border: none;
|
background: transparent;
|
font-size: 0.36rem;
|
color: #999;
|
outline: none;
|
|
&::placeholder {
|
color: #999;
|
}
|
|
&:disabled {
|
cursor: not-allowed;
|
}
|
}
|
}
|
}
|
|
.instructions {
|
margin-bottom: 0.8rem;
|
|
.instruction-item {
|
font-size: 0.32rem;
|
color: #666;
|
line-height: 0.56rem;
|
margin-bottom: 0.3rem;
|
|
&:last-child {
|
margin-bottom: 0;
|
}
|
}
|
}
|
|
.contact-btn {
|
width: 100%;
|
height: 1.2rem;
|
background: #2196f3;
|
border-radius: 0.2rem;
|
color: #fff;
|
font-size: 0.4rem;
|
font-weight: 500;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
cursor: pointer;
|
margin-top: 0.4rem;
|
|
&:active {
|
opacity: 0.8;
|
}
|
}
|
}
|
</style>
|