1
李凌
2025-09-06 b7eb749eb71ae802f9868e3b099aa362e23d7cc0
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<template>
    <div class="resetVerify">
        <fx-header>
            <template #title>
                {{ title }}
            </template>
        </fx-header>
        <div class="content">
            <div>
                <div class="textColor">{{ $t('uploadCredentPassport') }}</div>
                <div class="flex mt-4 mb-8 justify-between">
                    <div class="flex-1 flex flex-col text-center justify-center items-center">
                        <div class="upload-wrap">
                            <!-- <img :src="idcard_path_front_path" alt="" class="w-full imgShow" v-if="showImg1" /> -->
                            <van-uploader v-model="frontFile" multiple :max-count="1" :after-read="afterRead"
                                @click-upload="onClickUpload('frontFile')" />
                        </div>
                        <div class="mt-4 font-14 h-5 text-grey">{{ $t('credentFront') }}</div>
                    </div>
                    <div class="flex-1 flex flex-col text-center justify-center items-center">
                        <div class="upload-wrap">
                            <!-- <img :src="idcard_path_back_path" alt="" class="w-full imgShow" v-if="showImg2" /> -->
                            <van-uploader v-model="reverseFile" multiple :max-count="1" :after-read="afterRead"
                                @click-upload="onClickUpload('reverseFile')" />
                        </div>
                        <div class="mt-4 font-14 h-5 text-grey">{{ $t('credentObverse') }}</div>
                    </div>
                    <div class="flex-1 flex flex-col text-center justify-center items-center">
                        <div class="upload-wrap">
                            <!-- <img :src="idcard_path_hold_path" alt="" class="w-full imgShow" v-if="showImg3" /> -->
                            <van-uploader v-model="fileList" multiple :max-count="1" :after-read="afterRead"
                                @click-upload="onClickUpload('fileList')" />
                        </div>
                        <div class="mt-4 font-14 h-5 text-grey">{{ $t('handCredent') }}</div>
                    </div>
                </div>
            </div>
            <ExChecked class="mb-5" :list="list" @checkedSelect="onChecked"></ExChecked>
            <div v-if="currentType == 0">
                <ExInput :label="$t('fundsPassword')" :placeholderText="$t('fundsPasswordContTips')" v-model="password"
                    :tips="$t('funsPasswordTips')" typeText="password" />
                <ExInput :label="$t('confirmFundsPassword')" :placeholderText="$t('fundsPasswordContTips')"
                    v-model="repassword" :tips="$t('funsPasswordTips')" typeText="password" />
            </div>
            <ExInput :max="250" :label="$t('message')" :placeholderText="$t('entryMessage')" v-model="remark" />
            <van-button class="w-full" style="margin-top:10px;" @click="submit" type="primary">
                {{ $t('submit') }}
            </van-button>
        </div>
    </div>
</template>
 
<script setup>
import ExInput from "@/components/ex-input/index.vue";
import ExChecked from "@/components/ex-checked/index.vue";
import { _uploadImage } from '@/service/upload.api'
import { _getSafewordApply, _setSafewordApply } from '@/service/user.api.js'
import { Uploader } from 'vant';
import { ref, onMounted } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter, useRoute } from "vue-router";
const { t } = useI18n()
const router = useRouter()
const route = useRoute()
 
const title = ref('')
const remark = ref('')
const password = ref('')
const repassword = ref('')
const currentType = ref(0)
const list = ref([
    {
        name: t('resetFundsPassword'),
        type: 0
    },
    {
        name: t('resetPhone'),
        type: 1
    },
    {
        name: t('resetEmail'),
        type: 2
    },
    {
        name: t('resetGoogleVerify'),
        type: 3
    },
])
const frontFile = ref([])
const reverseFile = ref([])
const fileList = ref([])
const idcard_path_front_path = ref('')
const idcard_path_back_path = ref('')
const idcard_path_hold_path = ref('')
const curFile = ref('frontFile')
const status = ref('') // 0
const showImg1 = ref(false)
const showImg2 = ref(false)
const showImg3 = ref(false)
 
 
onMounted(() => {
    currentType.value = route.query.type;
    init(currentType.value);
    getSafewordApply();
})
 
const init = (type) => {
    if (type == 1) {
        title.value = t("artificialResetPhone");
    } else if (type == 2) {
        title.value = t("artificialResetEmail");
    } else if (type == 3) {
        title.value = t("artificialResetGoogleVerify");
    } else {
        title.value = t("artificialResetFundsPassword");
    }
}
const onChecked = (index) => {
    currentType.value = index;
    console.log(currentType.value)
    init(currentType.value)
}
const afterRead = (file) => { /// 处理文件
    console.log(file);
    file.status = 'uploading'
    file.message = t('uploading')
    _uploadImage(file).then(data => {
        file.status = 'success';
        file.message = t('uploadSuccess');
        file.resURL = data
        if (curFile.value == 'frontFile') {
            frontFile.value = [file]
        } else if (curFile.value == 'reverseFile') {
            reverseFile.value = [file]
        } else {
            fileList.value = [file]
        }
    }).catch(err => {
        file.status = 'failed';
        file.message = t('uploadFailed');
    })
}
const onClickUpload = (type) => {
    console.log(type);
    curFile.value = type
}
const getSafewordApply = () => {
    _getSafewordApply({
    }).then((data) => {
        if (data.length != 0) {
            status.value = data[0].status;
            idcard_path_front_path.value = data[0].idcard_path_front_path
            idcard_path_back_path.value = data[0].idcard_path_back_path
            idcard_path_hold_path.value = data[0].idcard_path_hold_path
        }
    })
}
const setSafewordApply = () => {
    let operate;
    if (currentType.value == 0) {
        operate = 0
    } else if (currentType.value == 1) {
        operate = 2
    } else if (currentType.value == 2) {
        operate = 3
    } else if (currentType.value == 3) {
        operate = 1
    }
    _setSafewordApply({
        idcard_path_front: frontFile.value.length && frontFile.value[0].resURL || idcard_path_front_path.value || '',
        idcard_path_back: reverseFile.value.length && reverseFile.value[0].resURL || idcard_path_back_path.value || '',
        idcard_path_hold: fileList.value.length && fileList.value[0].resURL || idcard_path_back_path.value || '',
        operate: operate, //0 修改资金 1取消谷歌绑定 ,2取消手机绑定 3取消邮箱绑定
        safeword: password.value,
        safeword_confirm: repassword.value,
        remark: remark.value
    }).then((res) => {
        router.push({ name: 'resetSuccess', query: { type: currentType.value } })
    })
}
const submit = () => {
    setSafewordApply();
 
}
 
 
</script>
 
<style lang="scss" scoped>
.resetVerify {
    width: 100%;
    box-sizing: border-box;
}
 
 
.content {
    font-size: 13px;
    padding: 16px;
    border-top: 1px solid $border-grey;
}
 
.btn {
    background: $btn_main;
    color: $text_color;
    height: 44px;
    line-height: 44px;
    text-align: center;
    font-size: 16px;
    border-radius: 5px;
}
 
.upload-wrap {
    width: 110px;
    height: 110px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
 
    img {
        height: 100%;
    }
}
 
.opacity0 {
    opacity: 0;
}
 
.opacity1 {
    opacity: 1;
}
 
.imgShow {
    top: 0;
    position: absolute;
}
</style>