10.10综合交易所原始源码_移动端
1
admin
2026-01-06 03043192ddf00f9a36b7454799a9152cd1b50a0b
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
<template>
  <!-- 申请身份认证 -->
  <div style="padding-bottom: 30px" class="text-26 authentication">
    <fx-header @back="loginOut">
      <template #title>
        {{ $t('primaryCertification') }}
      </template>
    </fx-header>
    <!-- <country-list /> -->
    <div v-if="show">
      <div class="pt-14 pb-14 box-border border-b-color" v-if="disabled() || status === 3">
        <div class="flex justify-between items-center px-8 textColor">
          <div class="text-26">{{ $t('authVerify') }}</div>
          <div class="flex items-center" v-if="resultArr[status]">
            <!-- <img
              :src="require(`@/assets/image/assets-center/${resultArr[status] && resultArr[status].split('_')[0]}.png`)"
              alt="success img" class="w-9 h-9" /> -->
            <img src="@/assets/image/assets-center/identifing.png" v-if="status == 1" class="w-10 h-10" />
            <img src="@/assets/image/assets-center/small-success.png" v-if="status == 0 || status == 2"
              class="w-10 h-10" />
            <img src="@/assets/image/assets-center/icon-close.png" v-if="status == 3" class="w-10 h-10" />
            <div class="text-24 ml-4">{{ resultArr[status] && resultArr[status].split('_')[1] }}</div>
          </div>
        </div>
      </div>
      <div class="pl-8 pr-8">
        <div class="">
          <div class=" mb-3 text-28 textColor">{{ $t('nationality') }}</div>
          <div class="pt-7 pb-7 pl-10 pr-10 flex justify-between items-center rounded inputBackground textColor box"
            @click="openBtn">
            <div class="flex items-center ml-2">
              <!-- <div class="iti-flag" :class="key" style="transform: scale(2.1)"></div> -->
              <div class="iti-flag mr-10 " :class="countryCode" style="transform: scale(2.1)"></div>
              <div>{{ countryName }}</div>
            </div>
 
            <img src="@/assets/image/down-arrow.png" class="w-5 h-3" alt="arrow" />
          </div>
        </div>
        <ExInput :label="$t('realName')" :disabled="disabled()" :clearBtn="!disabled()"
          :placeholderText="$t('entryRealName')" v-model="name" />
 
        <ExInput :label="$t('credentPassport')" :disabled="disabled()" :clearBtn="!disabled()"
          :placeholderText="$t('entryCredentPassport')" v-model="idnumber" />
 
        <ExInput :label="$t('phoneNum')" :disabled="disabled()" :clearBtn="!disabled()"
          :placeholderText="$t('entryPhone')" v-model="phone" :area="true" :dialCode="dialCode"
          @selectArea="onSelectArea" :icon="icon" v-if="!disabled()" />
 
        <p class="label mt-2 textColor" v-if="disabled()">{{ $t("phoneNum") }}</p>
        <div class="iptbox inputBackground" v-if="disabled()">
          <input class="inputBackground textColor" style="background: none;" type="text" v-model="phone" disabled />
        </div>
 
        <!-- 验证码输入框已隐藏 -->
        <!-- <p class="label mt-2 textColor" v-if="!disabled()">{{ $t("verificationCode") }}</p>
        <div class="iptbox inputBackground" v-if="!disabled()">
          <input class="inputBackground textColor" type="text" :placeholder="$t('entryVerifyCode')" v-model="verifyCode"
            :disabled="disabled()" />
          <span @click="sendCode" :class="{ 'disabled': time > 0 }">
            {{ $t("sendVerifyCode") }}
            <template v-if="time"> ({{ time }})s</template>
          </span>
        </div> -->
        <div>
          <div v-if="resultArr.length > 0" class="mt-1 mb-3 textColor">{{ $t('uploadCredentPassport') }} </div>
          <div v-else class="mt-4 mb-12 textColor">{{ $t('uploadPicCredentPassport') }}</div>
          <div class="flex mb-10 justify-between">
            <div class="flex-1 flex flex-col text-center justify-center items-center">
              <div class="upload-wrap">
                <img src="../../assets/image/kyc/0.png" alt="" class="w-full"
                  v-if="[1, 2].includes(status) && frontFile.length === 0" />
                <van-uploader v-model="frontFile" :max-count="1" :deletable="!disabled()" :after-read="afterRead"
                  @click-upload="onClickUpload('frontFile')" v-else />
 
              </div>
              <div class="text-28 h-10 textColor1">{{ $t('credentFront') }}</div>
            </div>
            <div class="flex-1 flex flex-col text-center justify-center items-center">
              <div class="upload-wrap">
                <img src="../../assets/image/kyc/1.png" alt="" class="w-full"
                  v-if="[1, 2].includes(status) && reverseFile.length === 0" />
                <van-uploader v-model="reverseFile" :max-count="1" :disabled="disabled()" :deletable="!disabled()"
                  :after-read="afterRead" @click-upload="onClickUpload('reverseFile')" v-else />
              </div>
              <div class="text-28 h-10 textColor1">{{ $t('credentObverse') }}</div>
            </div>
            <!-- <div class="flex-1 flex flex-col text-center justify-center items-center">
              <div class="upload-wrap">
                <img src="../../assets/image/kyc/2.png" alt="" class="w-full"
                  v-if="[1, 2].includes(status) && fileList.length === 0" />
                <van-uploader v-model="fileList" :max-count="1" :disabled="disabled()" :deletable="!disabled()"
                  :after-read="afterRead" @click-upload="onClickUpload('fileList')" v-else />
              </div>
              <div class="text-28 h-10" style="color:#868D9A;">{{ $t('handCredent') }}</div>
            </div> -->
          </div>
        </div>
        <template v-if="!disabled()">
          <!-- <div class="text-28 mb-8 textColor">{{ $t('photoExample') }}</div> -->
          <!-- <img src="@/assets/image/kyc/kyc-demo.png" alt="" style="width:100%;height:auto;" class="w-auto h-56 mb-5"> -->
          <!-- <div class="mb-5 flex justify-center">
            <div class="flex flex-1 justify-center">
              <img src="../../assets/image/kyc/kyc_demo1.png" alt="" class="w-80 h-80" />
            </div>
            <div class="flex flex-1 justify-center">
              <img src="../../assets/image/kyc/kyc_demo2.png" alt="" class="w-80 h-80" />
            </div>
          </div> -->
        </template>
        <button class="apply-btn btnMain text-white text-26 h-24 rounded" @click="onSubmit" v-if="!disabled()">{{
          $t('Apply')
          }}</button>
        <div class="pt-9 pb-16 text-24" v-if="!disabled() || status === 3">
          <span class="text-grey">{{ $t('uploadTitle1') }} {{ $t('photoExample') }}</span>
          <span class="text-blue service-text" @click="tokefu"> {{ $t('ContactService') }}</span>
        </div>
        <nationality-list ref='controlChild' :title="$t('selectNation')" @getName="getName" v-if="!disabled()">
        </nationality-list>
 
        <nationality-list ref="controlChildRef" :title="$t('selectArea')" @getName="getName1"></nationality-list>
      </div>
    </div>
  </div>
</template>
 
<script setup>
import { _getIdentify, _info, _applyIdentify } from "@/service/user.api.js";
import { _uploadImage } from "@/service/upload.api.js";
import { _sendVerifyCode } from "@/service/login.api.js";
import { onMounted, onBeforeUnmount, ref } from 'vue';
import nationalityList from './components/nationalityList.vue'
import { useRouter } from "vue-router";
import { showToast, Uploader } from "vant"
import ExInput from "@/components/ex-input/index.vue";
import countries from "./components/countryList";
import { getCurrentInstance } from 'vue';
import { useI18n } from "vue-i18n";
const { locale, t } = useI18n()
const router = useRouter()
const countryName = ref(t('selectNation'))
const countryCode = ref('af')
const idnumber = ref('')
const name = ref('')
const phone = ref('')
const icon = ref('')
const dialCode = ref('')
const verifyCode = ref('')
const time = ref(0)
const timer = ref(null)
const frontFile = ref([])
const reverseFile = ref([])
const fileList = ref([])
const curFile = ref('frontFile')
const status = ref('')
const imgs = ref([])
const idcard_path_front_path = ref('')
const idcard_path_back_path = ref('')
const idcard_path_hold_path = ref('')
const resultArr = ref(['small-success_' + t('applynoView'), 'identifing_' + t('reviewing'), 'small-success_' + t('passView'), 'icon-close_' + t('noPassView')])
const show = ref(false)
const controlChild = ref(null)
const { proxy } = getCurrentInstance();
 
 
onMounted(() => {
  fetchInfo();
})
 
onBeforeUnmount(() => {
  if (timer.value) {
    clearInterval(timer.value)
    timer.value = null
  }
})
const loginOut = () => {
  router.push('/certificationCenter')
}
const fetchInfo = () => {   // 获取状态
  _getIdentify().then(data => {
    show.value = true
    status.value = data.status
    if (data.id != null) {
      countryName.value = countries[locale.value][data.nationality.toLowerCase()].name
      countryCode.value = data.nationality.toLowerCase()
 
      idnumber.value = data.idnumber
      name.value = data.name
      phone.value = data.phone || ''
      frontFile.value = data.idimg_1 ? [{ url: data.idimg_1_path, resURL: data.idimg_1 }] : []
      reverseFile.value = data.idimg_2 ? [{ url: data.idimg_2_path, resURL: data.idimg_2 }] : []
      // fileList.value = data.idimg_3 ? [{ url: data.idimg_3_path, resURL: data.idimg_3 }] : []
    }
  })
}
const onClickUpload = (type) => {
  console.log(type)
  curFile.value = type
}
const disabled = () => { // 是否禁用按钮
  return ![0, 3, ''].includes(status.value)
}
const afterRead = (file) => {
  file.status = 'uploading'
  file.message = t('uploading')
 
  _uploadImage(file).then(data => {
    file.status = 'success'
    file.message = t('uploadSuccess')
    file.resURL = data
  }).catch(err => {
    file.status = 'failed'
    file.message = t('uploadFailed')
  })
};
 
 
 
//打开国家列表底部弹窗
const openBtn = () => {
  if (!disabled()) {
    proxy.$refs.controlChild.open()
  }
}
//获取到当前选中国家的code值
const getName = (params) => {
  countryName.value = params.name;
  countryCode.value = params.code;
}
 
//获取到当前选中国家的手机号code值
const getName1 = (params) => {
  icon.value = params.code;
  dialCode.value = params.dialCode;
};
 
const controlChildRef = ref(null);
const onSelectArea = () => {
  controlChildRef.value.open();
};
 
// 发送验证码
const sendCode = () => {
  if (!phone.value) {
    showToast(t('entryPhone'))
    return
  }
  // 校验手机号格式:必须是数字
  if (isNaN(phone.value) || phone.value.trim() === '') {
    showToast(t('请输入正确的手机号码'))
    return
  }
  if (time.value > 0) {
    return false
  }
  _sendVerifyCode({
    target: `${dialCode.value || ''}${phone.value}`,
  }).then((res) => {
    showToast(t("sendSuccess"))
    time.value = 30
    timer.value = setInterval(() => {
      if (time.value > 0) {
        time.value = time.value - 1
      } else {
        time.value = 0
        clearInterval(timer.value)
        timer.value = null
      }
    }, 1000)
  }).catch(err => {
    if (err.msg !== undefined) {
      showToast(err.msg)
    } else {
      showToast(t('sendFailed'))
    }
  })
}
 
const onSubmit = () => {
  if (!countryName.value) {
    showToast(t('selectNation'))
    return
  }
  if (!name.value) {
    showToast(t('entryName'))
    return
  }
  if (!idnumber.value) {
    showToast(t('entryCredent'))
    return
  }
  if (!phone.value) {
    showToast(t('entryPhone'))
    return
  }
  // 校验手机号格式:必须是数字
  if (isNaN(phone.value) || phone.value.trim() === '') {
    showToast(t('请输入正确的手机号码'))
    return
  }
  // 验证码校验已隐藏
  // if (!verifyCode.value) {
  //   showToast(t('entryVerifyCode'))
  //   return
  // }
  // if (verifyCode.value.length < 6) {
  //   showToast(t('entryVerifyTips'))
  //   return
  // }
  // if (!frontFile.value.length || !reverseFile.value.length || !fileList.value.length) {
  if (!frontFile.value.length || !reverseFile.value.length) {
    showToast(t('uploadComplete'))
    return
  }
  _applyIdentify({
    name: name.value,
    idnumber: idnumber.value,
    phone: "" + dialCode.value + phone.value,
    code: '', // 验证码已隐藏,传空值
    frontFile: frontFile.value,
    reverseFile: reverseFile.value,
    // fileList: fileList.value,
    countryName: countryCode.value // this.countryName 存储的 code, 回来再遍历
  }).then(() => {
    showToast(t('submitSuccess'))
    // router.push('/verified')
    router.go(-1)
    // this.fetchInfo()
  }).catch(err => {
    if (err.code === 'ECONNABORTED') { showToast('网络超时!'); }
    else if (err.msg !== undefined) { showToast(err.msg); }
  })
}
const tokefu = () => {
  router.push('/customerService')
}
 
</script>
<style lang="scss" scoped>
@import "@/views/authentication/components/intl.css";
 
.box {
  padding: 1.5rem !important;
}
 
.authentication {
  width: 100%;
  box-sizing: border-box;
}
 
.upload-wrap {
  // width: 220px;
  // height: 220px;
  display: flex;
  justify-content: center;
  align-items: center;
}
 
input {
  font-size: 35px;
}
 
input:disabled {
  background: $mainbgWhiteColor;
}
 
.list-view {
  overflow-y: scroll;
  border-bottom: 1px solid $border_color;
}
 
.kyc-input {
  width: 100%;
  border: none;
}
 
.apply-btn {
  border: none;
  outline: none;
  width: 100%;
  height: 50px;
}
 
.service-text {
  text-decoration: underline;
}
 
.rounded {
  padding: 0.6rem;
}
 
.mb-32 {
  margin-bottom: 16px;
}
 
.pt-35 {
  padding-top: 16px;
}
 
.label {
  font-size: 14px;
  margin-bottom: 9px;
}
 
.iptbox {
  height: 44px;
  margin-top: 8px;
  padding: 0 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 3px;
 
  input {
    flex: 1;
    height: 100%;
    border: none;
    padding-left: 10px;
    color: $text_color;
    font-size: 14px;
  }
 
  span {
    color: $color_main;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    margin-left: 10px;
 
    &.disabled {
      color: $text_color1;
      cursor: not-allowed;
    }
  }
}
</style>