初始化

This commit is contained in:
谢宇宁
2026-09-15 15:25:05 +07:00
commit 77c16ab4a2
1310 changed files with 132250 additions and 0 deletions
@@ -0,0 +1,525 @@
<template>
<div class="withdraw">
<Header
title="选择银行卡"
:class="{ 'edit-header': state.isEdit }"
:rightTitle="state.isEdit ? '完成' : '编辑'"
@rightFuc="state.isEdit = !state.isEdit"
/>
<div class="main">
<div
class="bank-card-cell flex-center-between"
v-for="item in state.bankCards"
:key="item.id"
@click="selectCard(item)"
>
<div class="bank-info-box flex-center-center">
<div class="bank-info">
<div class="name">
{{ getBankName(item.bankCode) }}
<span>{{ item.actName }}</span>
</div>
<div class="bankNo">卡号:{{ item.act }}</div>
</div>
</div>
<div v-if="!state.isEdit">
<div class="bank_selected" v-if="item.id == state.currentItem.id"></div>
<div class="bank_unselect" v-else></div>
</div>
<div v-if="state.isEdit">
<div class="bank_selected" v-if="item.checked"></div>
<div class="bank_unselect" v-else></div>
</div>
<!-- <template v-else>
<div class="radios">
<van-radio :checked="item.checked" checked-color="#F25477"></van-radio>
</div>
</template> -->
<!-- <SvgIcon @click.stop="openDelDialog(item.id)" name="bankDelIcon" class="delBtn" v-else></SvgIcon> -->
</div>
<div v-if="!state.isEdit" class="add-bank-card-cell" @click="state.showAdd = true">
<!-- <div class="add">+</div> -->
添加银行卡
</div>
</div>
<van-popup v-model:show="state.showAdd" @click-overlay="close">
<div class="add-bankcard-popup">
<div class="title flex-center-center">添加银行卡</div>
<div class="inputBox">
<van-field class="input-info" v-model="state.bankCardName" placeholder="请输入姓名" :border="false" />
<!-- <van-field class="input-info" v-model="state.bankCardNumber" placeholder="请输入银行名称" :border="false" /> -->
<van-field class="input-info" v-model="state.bankCardNumber" placeholder="请输入银行卡号" :border="false" />
</div>
<div class="addBtnBox flex-center-between">
<!-- <div class="addBtn addClose" @click="close">取消</div> -->
<div class="addBtn" @click="confirm">立即提交</div>
</div>
</div>
</van-popup>
<van-overlay :show="state.showDelDialog" @click="handleClose" z-index="9999">
<div class="wrapper flex-center-center">
<div class="content" @click.stop="void 0">
<div class="title">温馨提示</div>
<div class="horizontalLine"></div>
<div class="text">您是否移除该银行卡</div>
<div class="btnBox flex-center-between">
<div class="cancel" @click="handleClose">取消</div>
<div class="confirm" @click="confirmDel">确定</div>
</div>
</div>
</div>
</van-overlay>
<Loading v-if="state.loading" />
<div class="delBtnBox" v-if="state.isEdit">
<div class="delBtn flex-center-center" @click="confirmDel">删除</div>
</div>
</div>
</template>
<script lang="ts" setup>
import MineApi from '@/service/mine';
import { showToast } from 'vant';
import { reactive, computed } from 'vue';
import axios from 'axios';
import { getBank } from '@/utils/bankCardList';
import { useAppStore } from '@/stores/app';
import router from '@/router';
const appStore = useAppStore();
const state = reactive({
bankCards: <Array<Types.Recharge.BankCardItem>>[],
showAdd: false,
bankCardNumber: '',
bankCardName: '',
loading: false,
currentItem: <Types.Recharge.BankCardItem>{}, // 当前选中的银行卡
bankDatas: getBank(), // 银行列表
isEdit: false, // 编辑
showDelDialog: false, // 打开删除窗口
delId: '', // 删除的账号ID
isSelectAll: false, // 是否全选
});
const delCount = computed(() => {
return state.bankCards.filter((item) => item.checked).length;
});
const init = () => {
if (appStore.bankCard.act) {
state.currentItem = appStore.bankCard;
}
getBankCards();
};
const getBankCards = async () => {
try {
let res: any = await MineApi.queryBankCards();
let list = res.list || [];
state.bankCards = list;
} catch (e) {
console.log(e);
}
};
init();
// 选择银行卡
const selectCard = (item: Types.Recharge.BankCardItem) => {
if (state.isEdit) {
item.checked = !item.checked;
state.delId = item.id;
return;
}
state.currentItem = item;
appStore.setBankCard(item);
router.go(-1);
};
// 获取银行名称
const getBankName = (bankCode: string) => {
let str = '';
state.bankDatas.forEach((i: any) => {
if (i.value == bankCode) {
str = i.text;
}
});
return str;
};
const confirm = async () => {
if (!state.bankCardNumber) {
showToast('请输入银行卡号');
return;
}
if (!state.bankCardName) {
showToast('请输入持卡人姓名');
return;
}
let cardNo = state.bankCardNumber.split(' ').join('');
let retUrl = `https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&cardBinCheck=true&cardNo=${cardNo}`;
state.loading = true;
axios
.get(retUrl)
.then((res) => {
if (res.status === 200 && res.data.validated && res.data.bank && res.data.cardType) {
state.showAdd = false;
let req = {
actName: state.bankCardName,
act: res.data.key,
bankCode: res.data.bank,
cardType: res.data.cardType,
};
bindBankCard(req);
} else {
showToast('请输入正确的银行卡号');
state.loading = false;
}
})
.catch((err) => {
console.log(err);
});
};
// 绑定银行卡
const bindBankCard = async (queryData: any) => {
try {
let req = queryData;
await MineApi.bindBankCard(req);
state.bankCardName = '';
state.bankCardNumber = '';
showToast('添加成功');
getBankCards();
} catch (e) {
console.log(e);
} finally {
state.loading = false;
}
};
// 关闭
const close = () => {
state.showAdd = false;
state.bankCardNumber = '';
state.bankCardName = '';
};
const openDelDialog = (id: string) => {
state.delId = id;
state.showDelDialog = true;
};
const handleClose = () => {
state.delId = '';
state.showDelDialog = false;
};
// 删除账号
const confirmDel = async () => {
if (!state.delId) return showToast('请选择银行卡');
const delId = state.delId;
try {
let req = {
id: state.delId,
};
await MineApi.delBankCard(req);
if (delId == appStore.bankCard.id) {
await appStore.setBankCard({
id: '',
actName: '',
act: '',
bankCode: '',
cardType: '',
checked: false,
});
state.delId = '';
}
getBankCards();
handleClose();
showToast('删除成功');
} catch (e) {
console.log(e);
}
};
// 全选
const handleSelectAll = () => {
state.isSelectAll = !state.isSelectAll;
state.bankCards.forEach((item) => {
item.checked = state.isSelectAll;
});
};
</script>
<style lang="scss" scoped>
.withdraw {
height: 100%;
:deep(.header) {
.right-btn {
color: rgba(255, 255, 255, 0.45);
}
}
:deep(.edit-header) {
.right-btn {
color: $themeColor;
}
}
.main {
padding: 10px 16px;
.bank-card-cell {
margin-bottom: 10px;
background-color: rgba(255, 255, 255, 0.05);
padding: 17px 12px;
border-radius: 9px;
min-height: 80px;
.bank-info-box {
.bank-info {
// margin-left: 12px;
.name {
font-size: 16px;
font-weight: 500;
span {
font-size: 10px;
font-weight: 400;
color: rgba(255, 255, 255, 1);
}
}
}
.bankNo {
font-size: 12px;
margin-top: 10px;
font-weight: 400;
color: rgba(255, 255, 255, 1);
}
}
.bank_unselect {
height: 24px;
width: 24px;
border-radius: 50%;
// border: 1px solid rgb(51, 51, 51, 1);
background-image: url('@/assets/images/png/mine/unselect.png');
background-size: 100% 100%;
}
.bank_selected {
height: 24px;
width: 24px;
border-radius: 50%;
// background-color: #ffa500;
background-image: url('@/assets/images/png/mine/selected.png');
background-size: 100% 100%;
}
.delBtn {
height: 20px;
width: 20px;
}
}
.add-bank-card-cell {
display: flex;
justify-content: center;
align-items: center;
height: 44px;
border-radius: 3px;
font-size: 16px;
font-weight: 500;
color: white;
background-color: #f68804;
position: fixed;
bottom: calc(env(safe-area-inset-bottom) + 14px);
width: 343px;
left: 50%;
transform: translateX(-50%);
// .add {
// font-size: 26px;
// color: rgba(45, 45, 56, 1);
// margin: 0 3px 3px 0;
// }
}
}
.add-bankcard-popup {
border-radius: 12px;
width: 311px;
.title {
height: 65px;
font-size: 18px;
text-align: center;
border-bottom: solid 1px rgba(255, 255, 255, 0.1);
padding-top: 20px;
margin: 0 24px;
}
.inputBox {
padding: 20px;
box-sizing: border-box;
:deep(.van-cell) {
// border: solid 1px rgba(0, 0, 0, 0.05);
color: #fff;
border-radius: 6px;
height: 44px;
margin-bottom: 10px;
background-color: rgba(255, 255, 255, 0.1);
border: 0;
&:last-child {
margin-bottom: 0;
}
}
:deep(.van-field__control) {
color: #fff;
}
:deep(.van-field__control::placeholder) {
color: rgba(255, 255, 255, 0.45);
}
}
.addBtnBox {
// margin-top: 10px;
padding: 0 20px 20px 20px;
.addBtn {
height: 44px;
width: 263px;
// background: linear-gradient(142deg, #ffae61 0%, #ff1101 48%, #ff00b9 100%);
background: $themeColor;
color: white;
line-height: 44px;
font-size: 16px;
text-align: center;
border-radius: 3px;
font-weight: 500;
}
// .addClose {
// width: 108px;
// color: $textColor;
// background: #f6f6f6;
// }
}
}
}
:deep(.van-popup) {
background-color: transparent;
}
.wrapper {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
.content {
width: 300px;
background-color: white;
position: relative;
border-radius: 10px;
padding-bottom: 24px;
.title {
padding: 24px 0 18px;
font-size: 20px;
font-weight: 500;
text-align: center;
}
.horizontalLine {
height: 1px;
background-color: #ebebeb;
}
.text {
font-size: 20px;
text-align: center;
margin: 30px 0 18px;
span {
font-size: 28px;
color: $themeColor;
}
}
p {
font-size: 14px;
text-align: center;
opacity: 0.9;
}
.couponBox {
max-height: 100px;
margin-top: 14px;
overflow-y: auto;
overflow-x: hidden;
-webkit-overflow-scrolling: touch;
.couponItem {
padding: 0 30px;
font-size: 12px;
margin: 8px 0;
color: #fff;
.count {
flex: 1;
text-align: right;
margin-right: 11px;
}
.checkbox {
width: 12px;
height: 12px;
flex-shrink: 0;
border: 1px solid #fff;
border-radius: 50%;
}
&.active {
.checkbox {
background: #ffa500;
border-color: #ffa500;
}
}
}
}
.btnBox {
margin-top: 26px;
padding: 0 22px;
.cancel {
height: 38px;
width: 108px;
text-align: center;
line-height: 38px;
font-size: 14px;
border-radius: 38px;
background: #f6f6f6;
color: #333333;
}
.confirm {
height: 38px;
width: 134px;
text-align: center;
line-height: 38px;
font-size: 14px;
font-weight: 500;
border-radius: 38px;
// background: linear-gradient(142deg, #ffae61 0%, #ff1101 48%, #ff00b9 100%);
background: $themeColor;
color: white;
}
}
}
}
:deep(.van-cell) {
background: rgba(0, 0, 0, 0.05);
border: 1px solid rgba(255, 255, 255, 0.3);
border-radius: 30px;
height: 40px;
padding: 8px 20px;
font-size: 14px;
margin-bottom: 20px;
.van-field__control {
color: black;
}
::placeholder {
color: rgb(128, 128, 128);
}
}
.radios {
:deep(.van-badge__wrapper) {
border: 2px solid #70708c;
}
:deep(.van-radio) {
flex-direction: row-reverse;
}
}
.delBtnBox {
height: 44px;
width: 355px;
position: fixed;
left: 10px;
bottom: calc(env(safe-area-inset-bottom) + 14px);
z-index: 99;
display: flex;
align-items: center;
justify-content: center;
background: rgba(245, 44, 86, 1);
border-radius: 3px;
padding: 0 36px;
// transform: translateY(130px);
// transition: transform 0.5s;
color: #fff;
font-size: 18px;
.delBtn {
color: white;
height: 38px;
min-width: 101px;
font-weight: 500;
font-size: 16px;
}
}
</style>
+409
View File
@@ -0,0 +1,409 @@
<template>
<div class="withdraw">
<Header title="立即提现" rightTitle="明细" @rightFuc="$router.push('withdrawRecord')" />
<div class="main">
<div class="walletInfoBox">
<h2>余额(元)</h2>
<p>
<img src="@/assets/images/png/mine/coin.png" alt="" />
{{ userStore.walletInfo.income / 10 }}
</p>
</div>
<div class="infobox">
<div class="lable">提现币类:</div>
<div class="input">人民币</div>
</div>
<div class="infobox">
<div class="lable">提现金额:</div>
<div class="input">
<van-field
v-model="state.amount"
:placeholder="state.placeholder"
@input="changeAmount"
type="digit"
input-align="left"
:clearable="false"
:border="false"
/>
</div>
</div>
<div class="infobox">
<div class="lable">提现方式:</div>
<div class="input radios">
<van-radio-group v-model="state.checked" direction="horizontal" @change="changeType">
<van-radio name="bank" checked-color="#F68804">
<img src="@/assets/images/png/caseBand.png" alt="" />
银行卡
</van-radio>
<van-radio name="usdt" checked-color="#F68804">
<img src="@/assets/images/png/caseUsdt.png" alt="" />
USDT
</van-radio>
</van-radio-group>
</div>
</div>
<div class="infobox" v-if="state.checked == 'bank'">
<div class="lable">银行卡号:</div>
<div class="input">
<div class="accountBox" @click="$router.push('bindBankCard')">
<div class="withdrawAct" v-if="bankCard.act">
{{ getBankName(bankCard.bankCode) }}({{ bankCard.act.slice(-4) }}) {{ bankCard.actName }}
</div>
<div v-else>请选择提现账号</div>
<div class="rightArrow"></div>
</div>
</div>
</div>
<div class="infobox" v-if="state.checked == 'usdt'">
<div class="lable">钱包地址:</div>
<div class="input">
<van-field v-model="state.usdtAddress" placeholder="请输入USDT地址"></van-field>
</div>
</div>
<div class="infobox">
<div class="lable">手续费率:</div>
<div class="input fee-box">
<span class="fee">{{ state.handlingFee }} %</span>
<!-- <span>
本次提现手续:
<span class="fee">{{ state.formalitiesAmount || 0 }}</span>
</span> -->
<span>
实际到账金额:
<span class="fee">{{ state.realAmount }}</span>
</span>
</div>
</div>
<div class="withdrawTitle">提现规则:</div>
<!-- <p class="withdrawRule">1.收款账户卡号和姓名必须一致,为避免恶意刷单,到账时间为T+15天</p>
<p class="withdrawRule">2.银行卡每次提现最低200元起,USDT每次提现最低2000元起</p> -->
<p class="withdrawRule">
1、每次提现金额最低{{ state.minMoney }}元起,单笔提现最大{{ state.maxMoney }}元,且为整数。
</p>
<p class="withdrawRule">2、每次提现收取{{ state.handlingFee }}%手续费。</p>
<p class="withdrawRule">3、支持银行卡或USDT提现,收款账户卡号与姓名一致,到账时间未72小时内</p>
<p class="withdrawRule">4、申请提现后请随时关注收款账户进款通知,长时间未到账,请及时联系客服</p>
<div class="footer">
<div class="withdrawBtn" @click="confirm">立即提现</div>
<p class="mess">
提现中如有问题,请联系
<span @click="$router.push('/customerService')">在线客服</span>
</p>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { reactive } from 'vue';
import { useUserStore } from '@/stores/user';
import MineApi from '@/service/mine';
import { useAppStore } from '@/stores/app';
import { getBank } from '@/utils/bankCardList';
import { showToast } from 'vant';
const userStore = useUserStore();
const userInfo = userStore.userInfo;
const bankCard = useAppStore().bankCard;
const state = reactive({
amount: '', // 提现金额
minMoney: 0, // 提现最小金额
maxMoney: 0, // 提现最大金额
handlingFee: 0, // 手续费
formalitiesAmount: 0, //手续费金额
realAmount: 0, // 实际到账金额
bankDatas: getBank(), // 银行列表
usdtAddress: '', // usdt地址
placeholder: '单笔提现金额范围0-0元',
loading: true,
checked: 'bank',
});
const init = () => {
state.placeholder = '单笔提现金额范围' + state.minMoney + '-' + state.maxMoney + '元';
};
const changeType = () => {
getWithdrawMethod();
state.amount = '';
};
// 查询提现方式
const getWithdrawMethod = async () => {
try {
let req = {
payType: state.checked == 'bank' ? 'bankcard' : 'usdt',
};
let res: any = await MineApi.queryWithdrawMethod(req);
state.loading = false;
state.minMoney = Number(res.minMoney) / 100;
state.maxMoney = Number(res.maxMoney) / 100;
state.handlingFee = res.coinTax;
init();
} catch (e) {
console.log(e);
}
};
getWithdrawMethod();
// 获取银行名称
const getBankName = (bankCode: string) => {
let str = '';
state.bankDatas.forEach((i: any) => {
if (i.value == bankCode) {
str = i.text;
}
});
return str;
};
// 计算金额
const changeAmount = () => {
let money = userStore.walletInfo.income / 10;
if (Number(state.amount) > money) return showToast('提现金额大于自身拥有金额');
state.formalitiesAmount = Number(((Number(state.amount) * state.handlingFee) / 100).toFixed(2));
state.realAmount = Number((Number(state.amount) - state.formalitiesAmount).toFixed(2));
};
// 确认提现
const confirm = async () => {
if (state.checked == 'bank' && !bankCard.act) return showToast('请添加银行卡');
if (state.checked == 'usdt' && !state.usdtAddress) return showToast('请添写钱包地址');
let money = userStore.walletInfo.income / 10;
let req = {
name: userInfo.name,
money: Number(state.amount) * 100,
payType: state.checked == 'bank' ? 'bankcard' : 'usdt', // alipay,bankcard,usdt
withdrawType: 1, // 0: 代理提现 1: 金币提现
actName: bankCard.actName,
act: state.checked == 'bank' ? bankCard.act : state.usdtAddress,
devID: userInfo.devID,
productType: 0, // 0: 站群 1: 棋牌
};
if (Number(state.amount) == 0) return showToast('请输入提现金额');
if (Number(state.amount) > money) return showToast('提现金额大于自身拥有金额');
if (Number(state.amount) > state.maxMoney) return showToast(`单笔提现最大于${state.maxMoney}`);
if (Number(state.amount) < state.minMoney) return showToast(`单笔提现小于${state.minMoney}`);
try {
await MineApi.withdraw(req);
showToast('已提交申请');
userStore.updateWallet();
state.amount = '';
} catch (e) {
console.log(e);
}
};
</script>
<style lang="scss" scoped>
.withdraw {
height: 100%;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
:deep(.header) {
position: sticky;
top: 0;
z-index: 1;
// position: fixed;
// top: 0;
// left: 0;
// width: 100%;
// z-index: 1;
.right-btn {
color: rgba(255, 255, 255, 0.45);
}
}
.main {
padding: 20px 16px 207px 16px;
// overflow-y: auto;
// -webkit-overflow-scrolling: touch;
// height: calc(100vh - 57px);
// margin-top: 44px;
.walletInfoBox {
width: 100%;
padding: 20px 16px;
box-sizing: border-box;
// background: rgba(3, 15, 24, 1);
background: rgba(255, 255, 255, 0.05);
margin-bottom: 15px;
h2 {
font-size: 14px;
color: #f68804;
}
h2::before {
content: ' ';
width: 8px;
height: 22px;
display: inline-block;
background: #f68804;
border-radius: 0 5px 5px 0;
position: absolute;
left: -18px;
top: -5px;
}
p {
font-size: 32px;
margin: 25px 0 0 0;
background: linear-gradient(89.94deg, #ffe8be 1.65%, #e6b764 99.23%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
text-fill-color: transparent;
display: flex;
align-items: center;
font-weight: 500;
img {
width: 36px;
height: 36px;
margin-right: 5px;
}
}
}
.infobox {
width: 100%;
display: flex;
margin: 0 0 30px 0;
display: flex;
align-items: center;
// justify-content: center;
justify-content: space-between;
.lable {
min-width: 70px;
font-size: 14px;
}
.input {
font-size: 15px;
flex: 1;
color: rgba(152, 152, 152, 1);
span {
padding: 0 10px;
box-sizing: border-box;
font-size: 14px;
}
}
}
.accountBox {
position: relative;
height: 42px;
border-radius: 2px;
// background-color: rgba(32, 33, 51, 1);
background: rgba(255, 255, 255, 0.05);
line-height: 42px;
font-size: 14px;
color: rgba(153, 153, 153, 1);
padding-left: 15px;
.withdrawAct {
color: white;
}
.rightArrow {
height: 30px;
width: 30px;
background: url('@/assets/images/png/workRight.png') no-repeat;
background-size: 20px 20px;
background-position: center center;
position: absolute;
right: 6px;
top: 50%;
transform: translate(0, -50%);
}
}
.withdrawBtn {
color: #fff;
height: 44px;
width: 343px;
line-height: 44px;
background: #f68804;
border-radius: 3px;
text-align: center;
font-size: 16px;
position: fixed;
bottom: 70px;
left: 50%;
transform: translate(-50%, 0);
}
.mess {
width: 100%;
font-size: 12px;
text-align: center;
position: fixed;
bottom: 43px;
left: 50%;
transform: translate(-50%, 0);
color: rgb(255, 255, 255, 0.8);
span {
color: rgba(255, 212, 96, 1);
}
}
.radios {
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
img {
width: 30px;
height: 30px;
margin: 0 8px 0 0;
}
:deep(.van-radio__label) {
display: flex;
align-items: center;
justify-content: center;
color: rgba(153, 153, 153, 1);
margin-right: 10px;
box-sizing: border-box;
}
:deep(.van-radio) {
flex-direction: row-reverse;
.van-radio__icon--checked .van-icon {
color: #000;
}
}
}
}
.withdrawTitle {
font-size: 14px;
margin-bottom: 13px;
}
.withdrawRule {
font-size: 12px;
color: rgb(153, 153, 153);
line-height: 24px;
}
}
:deep(.van-cell) {
padding: 10px 5px 0 10px;
height: 42px;
background-color: rgba(255, 255, 255, 0.05);
border-radius: 2px;
::placeholder {
font-size: 14px;
color: rgba(82, 82, 82, 1);
}
.van-field__control {
font-size: 14px;
color: white;
}
}
.fee-box {
display: flex;
align-items: center;
span {
// color: #fff;
padding: 0 !important;
font-size: 12px !important;
&:nth-child(2) {
margin: 0 10px;
}
}
.fee {
color: rgba(152, 152, 152, 1);
}
}
.footer {
height: 117px;
// background: #0e141e;
position: fixed;
bottom: 0;
left: 0;
width: 100%;
}
</style>