1
李凌
2025-10-23 7907f9a7d414404effff61df799945c23573b25a
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
<template>
    <div class="setFond">
        <fx-header>
 
        </fx-header>
        <div class="content">
            <div class="title textColor">{{ $t('safeVertify') }}</div>
            <ExInput :label="$t('enterPassword')" :placeholderText="$t('funpasswordTips')" v-model="password"
                typeText="password" />
            <van-button class="w-full" style="margin-top:10px;" @click="submitBind" type="primary">{{ $t('confirm') }}
            </van-button>
            <p @click="router.push('/resetVerify?type=0')">{{ $t('enterNotPassword') }}</p>
        </div>
    </div>
</template>
 
<script setup>
import ExInput from "@/components/ex-input/index.vue";
import { _withdrawApply } from "@/service/withdraw.api";
import { c2cOrder, _getSessionToken } from "@/service/recharge.api";
import { ref, onMounted } from "vue";
import { showToast } from 'vant'
import { useI18n } from 'vue-i18n'
import { useRouter, useRoute } from "vue-router";
import { useUserStore } from '@/store/user';
const userStore = useUserStore()
const { t } = useI18n()
const router = useRouter()
const route = useRoute()
 
const password = ref('')
const payInfo = ref({})
const banType = ref({})
onMounted(async () => {
    if (route.query.payInfo) {
        payInfo.value = JSON.parse(route.query.payInfo)
    }
    if (route.query.bankType) {
        banType.value = route.query.bankType
    }
})
const submitBind = () => {
    if (password.value.length < 6) {
        showToast(t('funpasswordTips'))
        return false
    }
    if (route.query.type === 'bank') {
        // router.push('/order/submit')
        payInfo.value.safeword = password.value
        c2cOrder(payInfo.value).then((res) => {
            if (banType.value == 'recharge') {
                router.push('/order/submit?orderNo=' + res.order_no)
            } else {
                router.push('/order/apply-success?currentType=withdraw&type=bank')
            }
        }).catch(err => {
            _getSessionToken({}).then(res => {
                payInfo.value.session_token = res.session_token
            })
        })
 
    } else {
        _withdrawApply({
            session_token: route.query.session_token,
            amount: route.query.amount,
            from: route.query.from,
            safeword: password.value,
            channel: route.query.channel,
            token: userStore.userInfo && userStore.userInfo.token
        }).then((res) => {
            router.push('/order/apply-success?currentType=withdraw&type=hb')
        })
 
    }
}
 
</script>
 
<style lang="scss" scoped>
.setFond {
    width: 100%;
    box-sizing: border-box;
    font-size: 13px;
}
 
.content {
    padding: 0 16px;
 
    p {
        color:  $active_line;
        margin-top: 40px;
        text-align: center;
    }
}
 
.header {
    display: flex;
    justify-content: space-between;
    padding: 0 13px;
    font-size: 14px;
    height: 50px;
    line-height: 50px;
}
 
.title {
    font-weight: 700;
    font-size: 26px;
    margin-top: 25px;
    margin-bottom: 30px;
}
</style>