|
|
@@ -1,11 +1,7 @@
|
|
|
<template>
|
|
|
<cwg-page-wrapper class="create-page" :isHeaderFixed="true">
|
|
|
+ <cwg-header :title="t('Custom.Withdraw.Title')" />
|
|
|
<view class="custom-withdraw">
|
|
|
- <!-- 标题 -->
|
|
|
- <!-- <view class="crm-title-box">
|
|
|
- <text class="tit">{{ t('Custom.Withdraw.Title') }}</text>
|
|
|
- </view> -->
|
|
|
-
|
|
|
<!-- 步骤1:选择账户 -->
|
|
|
<view class="box box-step1">
|
|
|
<view class="b-card">
|
|
|
@@ -65,7 +61,7 @@
|
|
|
|
|
|
<!-- 电子钱包地址输入 -->
|
|
|
<uni-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8"
|
|
|
- v-if="['CHANNEL_TYPE_WALLET', 'UCARD_WALLET', 'CHANNEL_TYPE_ALI_WALLET'].includes(channelData.type)">
|
|
|
+ v-if="['CHANNEL_TYPE_WALLET', 'CHANNEL_TYPE_ALI_WALLET'].includes(channelData.type)">
|
|
|
<uni-forms-item :label="getWalletLabel">
|
|
|
<uni-easyinput :clearable="false" v-model="form.address" :placeholder="t('placeholder.input')" />
|
|
|
</uni-forms-item>
|
|
|
@@ -185,7 +181,6 @@
|
|
|
</uni-col>
|
|
|
</uni-row>
|
|
|
</uni-col>
|
|
|
-
|
|
|
<!-- 出金金额 -->
|
|
|
<uni-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8" v-if="channelData.type !== 'BANK_TELEGRAPHIC'">
|
|
|
<uni-forms-item :label="t('Custom.Withdraw.Title3') + '(' + channelData.currency + ')'">
|
|
|
@@ -205,25 +200,26 @@
|
|
|
</uni-forms-item>
|
|
|
</uni-col>
|
|
|
</template>
|
|
|
-
|
|
|
</uni-row>
|
|
|
-
|
|
|
<!-- 协议同意 -->
|
|
|
<view class="agree">
|
|
|
- <label class="checkbox">
|
|
|
- <checkbox :checked="form.agree2" @click="form.agree2 = !form.agree2" />
|
|
|
- <text class="crm-cursor" style="text-decoration: underline;" @click="dialogCheckTip = true">{{
|
|
|
- t('Custom.Withdraw.Des') }}</text>
|
|
|
- </label>
|
|
|
+ <checkbox-group :value="form.agree2 ? ['1'] : []" @change="onAgreeChange('agree2', $event)">
|
|
|
+ <label class="checkbox">
|
|
|
+ <checkbox value="1" />
|
|
|
+ <text class="crm-cursor" style="text-decoration: underline;" @click="dialogCheckTip = true">{{
|
|
|
+ t('Custom.Withdraw.Des') }}</text>
|
|
|
+ </label>
|
|
|
+ </checkbox-group>
|
|
|
</view>
|
|
|
<view class="agree" v-if="dialogTipsIsShow">
|
|
|
- <label class="checkbox">
|
|
|
- <checkbox :checked="form.agree3" @click="form.agree3 = !form.agree3" />
|
|
|
- <text>* {{ t('Custom.Withdraw.item1') }}<br>{{ t('Custom.Withdraw.item1_1') }}<br>{{
|
|
|
- t('Custom.Withdraw.item1_2') }}</text>
|
|
|
- </label>
|
|
|
+ <checkbox-group :value="form.agree3 ? ['1'] : []" @change="onAgreeChange('agree3', $event)">
|
|
|
+ <label class="checkbox">
|
|
|
+ <checkbox value="1" />
|
|
|
+ <text>* {{ t('Custom.Withdraw.item1') }}<br>{{ t('Custom.Withdraw.item1_1') }}<br>{{
|
|
|
+ t('Custom.Withdraw.item1_2') }}</text>
|
|
|
+ </label>
|
|
|
+ </checkbox-group>
|
|
|
</view>
|
|
|
-
|
|
|
<button class="s-btn" type="primary" @click="openTips">{{ t('Btn.Submit') }}</button>
|
|
|
</uni-forms>
|
|
|
</view>
|
|
|
@@ -310,10 +306,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</uni-popup>
|
|
|
-
|
|
|
- <!-- 抽屉:新增/修改银行信息 -->
|
|
|
- <!-- <drawer :dialogInfoTradingAdd="dialogInfoTradingAdd" :addType="openType" @closeAdd="closeAdd"
|
|
|
- @confirmToReload="confirmToReload" /> -->
|
|
|
+ <add-bank-dialog ref="addBankDialogRef" @success="addSuccess" />
|
|
|
</view>
|
|
|
</cwg-page-wrapper>
|
|
|
|
|
|
@@ -328,7 +321,7 @@ import { financialApi } from '@/service/financial'
|
|
|
// import {ServiceA} from '@/service/activity'
|
|
|
import Config from '@/config/index'
|
|
|
import Decimal from 'decimal.js'
|
|
|
-// import Drawer from '@/components/Drawer.vue' // 假设抽屉组件已存在
|
|
|
+import AddBankDialog from '@/components/AddBankDialog.vue';
|
|
|
import PaymentMethodsList from './components/PaymentMethodsList.vue'
|
|
|
|
|
|
const { t, locale } = useI18n()
|
|
|
@@ -345,21 +338,21 @@ const loginComboxOptions = computed(() => {
|
|
|
const bankOptions = computed(() => {
|
|
|
return bankDate.value.map((item, index) => ({
|
|
|
text: isZh.value ? item.name : item.enName,
|
|
|
- value: index
|
|
|
+ value: item.id
|
|
|
}))
|
|
|
})
|
|
|
|
|
|
const digitalOptions = computed(() => {
|
|
|
return ruleForm.bankBlockchain.map((item, index) => ({
|
|
|
text: `${item.addressName}-${item.address}`,
|
|
|
- value: index
|
|
|
+ value: item.id
|
|
|
}))
|
|
|
})
|
|
|
|
|
|
const bankCardOptions = computed(() => {
|
|
|
return bankList.value.map((item, index) => ({
|
|
|
text: getBankLabel(item),
|
|
|
- value: index
|
|
|
+ value: item.id
|
|
|
}))
|
|
|
})
|
|
|
|
|
|
@@ -413,7 +406,6 @@ const channelData = ref({})
|
|
|
const introduce = ref({ introduce: '', enIntroduce: '' })
|
|
|
const bankDate = ref([])
|
|
|
const selectedBankIndex = ref(-1)
|
|
|
-const selectedBankLabel = ref('')
|
|
|
const ruleForm = reactive({
|
|
|
bankInfo: [],
|
|
|
bankWrit: [],
|
|
|
@@ -447,12 +439,14 @@ const bankList = computed(() => {
|
|
|
return []
|
|
|
})
|
|
|
const selectedBankCardIndex = ref(-1)
|
|
|
-const selectedBankCardLabel = ref('')
|
|
|
const selectedDigitalIndex = ref(-1)
|
|
|
-const selectedDigitalLabel = ref('')
|
|
|
const mAmount = reactive({ minAmount: '', maxAmount: '' })
|
|
|
const FreeNumber = ref(0)
|
|
|
const isFree = ref(false)
|
|
|
+const onAgreeChange = (key, e) => {
|
|
|
+ const vals = (e?.detail?.value) || []
|
|
|
+ form[key] = Array.isArray(vals) && vals.length > 0
|
|
|
+}
|
|
|
const dialogTipsIsShow = ref(true)
|
|
|
const dialogConfirmFee = ref(0)
|
|
|
|
|
|
@@ -606,8 +600,7 @@ const getBankInfo = async () => {
|
|
|
const selectBankCard = (item) => {
|
|
|
const index = bankList.value.findIndex(b => b.id === item.id)
|
|
|
if (index !== -1) {
|
|
|
- selectedBankCardIndex.value = index
|
|
|
- selectedBankCardLabel.value = getBankLabel(item)
|
|
|
+ selectedBankCardIndex.value = item.id
|
|
|
Object.assign(form, item)
|
|
|
}
|
|
|
}
|
|
|
@@ -615,8 +608,7 @@ const selectBankCard = (item) => {
|
|
|
const selectDigital = (item) => {
|
|
|
const index = ruleForm.bankBlockchain.findIndex(b => b.id === item.id)
|
|
|
if (index !== -1) {
|
|
|
- selectedDigitalIndex.value = index
|
|
|
- selectedDigitalLabel.value = `${item.addressName}-${item.address}`
|
|
|
+ selectedDigitalIndex.value = item.id
|
|
|
form.addressName = item.addressName
|
|
|
form.address = item.address
|
|
|
form.addressProve = item.addressProve
|
|
|
@@ -668,11 +660,8 @@ const showTable = () => {
|
|
|
Object.assign(form, { currency: 'USD', amount: '', amount1: '', agree2: false, agree3: false, address: '', addressName: '', addressProve: '', bankUname: '', bankCardNum: '', bankName: '', bankBranchName: '', swiftCode: '', customBankCode: '', bankAddr: '', agencyNo: '', cpf: '' })
|
|
|
if (bankDate.value.length) bankDate.value = []
|
|
|
selectedBankIndex.value = -1
|
|
|
- selectedBankLabel.value = ''
|
|
|
selectedBankCardIndex.value = -1
|
|
|
- selectedBankCardLabel.value = ''
|
|
|
selectedDigitalIndex.value = -1
|
|
|
- selectedDigitalLabel.value = ''
|
|
|
}
|
|
|
|
|
|
const isShowStep3 = (row) => {
|
|
|
@@ -721,11 +710,8 @@ const isShowStep3 = (row) => {
|
|
|
}
|
|
|
|
|
|
const onBankChange = (val) => {
|
|
|
- const index = val
|
|
|
- const item = bankDate.value[index]
|
|
|
+ const item = ruleForm.bankBlockchain.find(b => b.id === val)
|
|
|
if (item) {
|
|
|
- selectedBankIndex.value = index
|
|
|
- selectedBankLabel.value = (t('lang') === 'cn' || t('lang') === 'zhHant') ? item.name : item.enName
|
|
|
channelData.value.rate = item.rate
|
|
|
channelData.value.transformCurrency = item.currency
|
|
|
channelData.value.feeTypeBank = item.feeType
|
|
|
@@ -735,28 +721,18 @@ const onBankChange = (val) => {
|
|
|
}
|
|
|
|
|
|
const onBankCardChange = (val) => {
|
|
|
- const index = val
|
|
|
- const item = bankList.value[index]
|
|
|
- if (item) {
|
|
|
- selectedBankCardIndex.value = index
|
|
|
- selectedBankCardLabel.value = getBankLabel(item)
|
|
|
- Object.assign(form, item)
|
|
|
- }
|
|
|
+ const item = ruleForm.bankBlockchain.find(b => b.id === val)
|
|
|
}
|
|
|
|
|
|
const onDigitalCurrencyChange = (val) => {
|
|
|
- const index = val
|
|
|
- const item = ruleForm.bankBlockchain[index]
|
|
|
+ const item = ruleForm.bankBlockchain.find(b => b.id === val)
|
|
|
if (item && item.authStatus === 1) {
|
|
|
- selectedDigitalIndex.value = index
|
|
|
- selectedDigitalLabel.value = `${item.addressName}-${item.address}`
|
|
|
form.addressName = item.addressName
|
|
|
form.address = item.address
|
|
|
form.addressProve = item.addressProve
|
|
|
} else if (item && item.authStatus === 0) {
|
|
|
uni.showToast({ title: t('Msg.item11'), icon: 'none' })
|
|
|
selectedDigitalIndex.value = -1
|
|
|
- selectedDigitalLabel.value = ''
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -787,12 +763,13 @@ const onAmountInput = (val) => {
|
|
|
}
|
|
|
|
|
|
const openTips = () => {
|
|
|
+
|
|
|
// 校验
|
|
|
- if (channelData.value.type === 'DIGITAL_CURRENCY' && !myId.value) {
|
|
|
+ if (channelData.value.type === 'DIGITAL_CURRENCY' && !selectedDigitalIndex.value) {
|
|
|
uni.showToast({ title: t('blockchain.item11'), icon: 'none' })
|
|
|
return
|
|
|
}
|
|
|
- if (['BANK', 'BANK_TELEGRAPHIC', 'CHANNEL_TYPE_CARD'].includes(channelData.value.type) && !selectedBankCardIndex.value !== -1) {
|
|
|
+ if (['BANK', 'BANK_TELEGRAPHIC', 'CHANNEL_TYPE_CARD'].includes(channelData.value.type) && !selectedBankCardIndex.value) {
|
|
|
uni.showToast({ title: t('vaildate.withdrawBank.empty'), icon: 'none' })
|
|
|
return
|
|
|
}
|
|
|
@@ -809,6 +786,7 @@ const openTips = () => {
|
|
|
uni.showToast({ title: t('vaildate.amount.format'), icon: 'none' })
|
|
|
return
|
|
|
}
|
|
|
+ console.log(form.agree2, form.agree3, dialogTipsIsShow.value, 111111)
|
|
|
if (!form.agree2) {
|
|
|
uni.showToast({ title: t('vaildate.agree.empty'), icon: 'none' })
|
|
|
return
|
|
|
@@ -926,10 +904,98 @@ const submitCode = () => {
|
|
|
submit()
|
|
|
}
|
|
|
|
|
|
-const openAddBankCard = (type) => {
|
|
|
- openType.value = type
|
|
|
- dialogInfoTradingAdd.value = true
|
|
|
+// 新增银行信息
|
|
|
+const addBankDialogRef = ref(null);
|
|
|
+function openAddBankCard(type) {
|
|
|
+ console.log(type, 121212)
|
|
|
+ switch (type) {
|
|
|
+ case 'add_bankBlockchain':
|
|
|
+ openAddCrypto()
|
|
|
+ break;
|
|
|
+ case 'add_bankCard':
|
|
|
+ openAddUnionpay()
|
|
|
+ break;
|
|
|
+ case 'add_wireTransfer':
|
|
|
+ openAddBank()
|
|
|
+ break;
|
|
|
+ case 'add_CreditCard':
|
|
|
+ openAddCredit()
|
|
|
+ break;
|
|
|
+ }
|
|
|
+}
|
|
|
+function openAddCrypto() {
|
|
|
+ const wallets = bankCardOptions.value || []
|
|
|
+ // 1️⃣ 没有钱包
|
|
|
+ if (wallets.length === 0) {
|
|
|
+ addBankDialogRef.value?.open(4);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 2️⃣ 是否存在未认证钱包
|
|
|
+ const hasUnAuth = wallets.some(
|
|
|
+ item => item.authStatus === 0 || item.approveStatus === 1
|
|
|
+ );
|
|
|
+ if (hasUnAuth) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "加密钱包未认证",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 3️⃣ 是否达到上限
|
|
|
+ if (wallets.length >= 2) {
|
|
|
+ uni.showToast({
|
|
|
+ title: t('blockchain.item9'),
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 4️⃣ 正常打开
|
|
|
+ addBankDialogRef.value?.open(4);
|
|
|
}
|
|
|
+function openAddUnionpay() {
|
|
|
+ const wallets = bankCardOptions.value || []
|
|
|
+ if (wallets.length === 0) {
|
|
|
+ addBankDialogRef.value?.open(1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (wallets.length >= 2) {
|
|
|
+ uni.showToast({
|
|
|
+ title: t('Msg.UnionPayCARDS'),
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ addBankDialogRef.value?.open(1);
|
|
|
+}
|
|
|
+function openAddBank() {
|
|
|
+ const wallets = bankCardOptions.value || []
|
|
|
+ console.log(wallets, 121212)
|
|
|
+ if (wallets.length === 0) {
|
|
|
+ addBankDialogRef.value?.open(2);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (wallets.length >= 2) {
|
|
|
+ uni.showToast({
|
|
|
+ title: t('Msg.WireTransfers'),
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ addBankDialogRef.value?.open(2);
|
|
|
+}
|
|
|
+function openAddCredit() {
|
|
|
+ const wallets = bankCardOptions.value || []
|
|
|
+ if (wallets.length === 0) {
|
|
|
+ addBankDialogRef.value?.open(3);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ addBankDialogRef.value?.open(3);
|
|
|
+}
|
|
|
+// 新增银行信息成功回调
|
|
|
+const addSuccess = (e) => {
|
|
|
+ getBankInfo();
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
const closeAdd = (val) => {
|
|
|
dialogInfoTradingAdd.value = val
|
|
|
@@ -982,8 +1048,6 @@ onUnmounted(() => {
|
|
|
@import "@/uni.scss";
|
|
|
|
|
|
.custom-withdraw {
|
|
|
- background: var(--color-zinc-50);
|
|
|
- min-height: 100vh;
|
|
|
|
|
|
.box {
|
|
|
margin-bottom: px2rpx(20);
|
|
|
@@ -1344,4 +1408,4 @@ onUnmounted(() => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|