dengchaochao
2024-07-27 ce3533dad7bebb53ffc730b55e08092b19ae090c
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
<!-- 实名验证 -->
<template>
  <div>
    <div style="margin-top: 50px">
      <Steps :stepIndex="2" />
      <main class="main css-6q12pm">
        <div class="css-108ucgm">
          <div class="binance-row css-16kn2us">
            <div class="binance-col css-1wz0uwi" style="margin-left: -12px">
              <div class="css-cz4mv2">
                <div class="css-6x3lo1">
                  <div class="css-vurnku">
                    <div class="css-ojbpe7">
                      {{ $t("message.user.shimingrenzheng") }}
                    </div>
 
                    <div class="css-vurnku">
                      <!-- 信息编写 -->
                      <div>
                        <!-- 国籍选择 -->
                        <div class="label">{{ $t("message.user.guoji") }}</div>
 
                        <vue3-country-intl v-model="nationality" :disabled="identifyStatus == 1" :showAreaCode="false"
                          type="country" :useChinese="isUseChinese" :placeholder="$t('message.user.qingxuanzeguoji')"
                          :noDataText="$t('message.user.nationNodata')" />
 
                        <!-- 姓名 -->
                        <div class="label label_top">
                          {{ $t("message.user.xingming") }}
                        </div>
                        <el-input :disabled="identifyStatus == 1" v-model="name"
                          :placeholder="$t('message.user.qsr_xingming')"></el-input>
                        <!-- 身份证号码 -->
                        <div class="label label_top">
                          {{ $t("message.user.zhengjianhao") }}
                        </div>
                        <el-input v-model="idNumber" :disabled="identifyStatus == 1"
                          :placeholder="$t('message.user.qsr_zengjianhaoma')"></el-input>
                        <!-- 图片上传 -->
                        <div class="label label_top">
                          {{
                            $t("message.user.shimingrenzhengtupianshangchuan")
                          }}
                        </div>
                        <div class="image_upload">
                          <div class="text-center">
                            <el-upload class="avatar-uploader" :action="`${nowUrl}/wap/public/uploadimg!execute.action`"
                              :headers="uploadHeader" accept=".jpg,.jpeg,.png,.gif.JPG,.JPEG,.PNG,.GIF"
                              :show-file-list="false" :on-success="handelDoucumentsFront" :on-error="onErrorUpload"
                              :before-upload="beforeAvatarUpload">
                              <img v-if="oneImg" :src="oneImg" class="avatar" />
                              <el-icon v-else class="avatar-uploader-icon">
                                <Plus />
                              </el-icon>
                            </el-upload>
                            <p>{{ $t("message.user.zhengjianzhengmian") }}</p>
                          </div>
                          <div class="text-center" style="margin: 0 10px">
                            <el-upload class="avatar-uploader" :action="`${nowUrl}/wap/public/uploadimg!execute.action`"
                              :headers="uploadHeader" accept=".jpg,.jpeg,.png,.gif.JPG,.JPEG,.PNG,.GIF"
                              :show-file-list="false" :on-success="handelDoucumentsBack" :on-error="onErrorUpload"
                              :before-upload="beforeAvatarUpload">
                              <img v-if="twoImg" :src="twoImg" class="avatar" />
                              <el-icon v-else class="avatar-uploader-icon">
                                <Plus />
                              </el-icon>
                            </el-upload>
                            <p>{{ $t("message.user.zhengjianfanmian") }}</p>
                          </div>
                          <!-- <div class="text-center">
                            <el-upload class="avatar-uploader" :action="`${nowUrl}/wap/public/uploadimg!execute.action`"
                              :headers="uploadHeader" accept=".jpg,.jpeg,.png,.gif.JPG,.JPEG,.PNG,.GIF"
                              :show-file-list="false" :on-success="holdIdCardSuccess" :on-error="onErrorUpload"
                              :before-upload="beforeAvatarUpload">
                              <img v-if="threeImg" :src="threeImg" class="avatar" />
                              <el-icon v-else class="avatar-uploader-icon">
                                <Plus />
                              </el-icon>
                            </el-upload>
                            <p>{{ $t("message.user.shouchizhengjianzhao") }}</p>
                          </div> -->
                        </div>
                        <!-- 拍摄示例 -->
                        <div class="label label_top">
                          {{ $t("paisheshili") }}
                        </div>
                        <img style="width: 100%" src="@/assets/images/login/shili.png" />
                      </div>
                      <!-- 绑定和跳过 -->
                      <button data-bn-type="button" @click="applyBtn" class="css-1bsmpdm">
                        {{ $t("message.user.bangding") }}
                      </button>
                      <div @click="jumpOver" style="
                          text-align: center;
                          padding: 20px 0;
                          color: #868d9a;
                          cursor: pointer;
                        ">
                        {{ $t("tiaoguo") }}
                      </div>
                    </div>
                    <div class="css-vurnku"></div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </main>
    </div>
  </div>
</template>
<script>
import { Plus } from "@element-plus/icons-vue";
import Steps from "../components/steps.vue";
import Axios from "@/api/my.js";
export default {
  name: "idSet",
  components: {
    Steps,
    Plus,
  },
  data() {
    return {
      nowUrl: "",
 
      msg: "", //错误提示
      identifyStatus: "", //认证状态
      nationality: "", //国籍
      name: "", //姓名
      idNumber: "", //证件号码
 
      // 提交给后端的图片data
      idFrontImg: "", //证件正面
      idBackImg: "", //证件背面
      handheldPhoto: "", //手持身份证
      //上传之后后展示的图片httpurl
      oneImg: "",
      twoImg: "",
      threeImg: "",
    };
  },
  mounted() {
    this.nowUrl = "https://www.coinzne.com";
    let interimToken = localStorage.getItem("spToken");
    if (interimToken) {
      this.getIdentify();
    }
  },
  computed: {},
  methods: {
    beforeAvatarUpload(file) {
      let types = [
        "image/jpeg",
        "image/jpg",
        "image/gif",
        "image/bmp",
        "image/png",
      ];
      const isImage = types.includes(file.type);
      const isJPG = file.type === "image/jpeg";
 
      const isLt5M = file.size / 1024 / 1024 < 5;
      console.log("图片大小", file.size / 1024 / 1024);
      if (!isImage) {
        this.$message.error(this.$t("message.user.shangchuan1"));
      }
      if (!isLt5M) {
        this.$message.error(this.$t("message.user.shangchuan2"));
      }
      return isImage && isLt5M;
    },
 
    //上传正面
    handelDoucumentsFront(res, file) {
      // const { path, httpUrl } = res.data;
      // this.oneImg = httpUrl;
      const data = res.data;
      this.oneImg = `${this.nowUrl}/wap/public/showimg!showImg.action?imagePath=${data}`;
      this.idFrontImg = data;
    },
    //上传背面
    handelDoucumentsBack(res, file) {
      // const { path, httpUrl } = res.data;
      // this.twoImg = httpUrl;
      const path = res.data;
      this.twoImg = `${this.nowUrl}/wap/public/showimg!showImg.action?imagePath=${path}`;
      this.idBackImg = path;
    },
    //手持身份证
    holdIdCardSuccess(res, file) {
      // const { path, httpUrl } = res.data;
      // this.threeImg = httpUrl;
      const path = res.data;
      this.threeImg = `${this.nowUrl}/wap/public/showimg!showImg.action?imagePath=${path}`;
      this.handheldPhoto = path;
    },
 
    onErrorUpload() {
      this.$message.warning(this.$t("message.user.shangchuan3"));
    },
    jumpOver() {
      this.$router.push("/secureBind"); //安全绑定
    },
    //获取用户实名认证信息
    getIdentify() {
      Axios.getIdentify({}).then((res) => {
        const {
          status,
          nationality,
          msg,
          name,
          idNumber,
          idimg_1_path,
          idimg_2_path,
          idimg_3_path,
        } = res.data || {};
        this.identifyStatus = status;
        // if (status == 2 || status == 3) {
        this.nationality = nationality;
        this.name = name;
        this.idNumber = idNumber;
        this.oneImg = idimg_1_path;
        this.twoImg = idimg_2_path;
        this.threeImg = idimg_3_path;
        this.msg = msg;
        // }
      });
    },
 
    //申请认证
    applyBtn() {
      if (!this.nationality || !this.name || !this.idNumber) {
        this.$message.warning(this.$t("qsr_wanzhengdexinxi"));
        return;
      }
 
      if (!this.idFrontImg || !this.idBackImg) {
        this.$message.warning(this.$t("message.user.shangchuan6"));
        return;
      }
      Axios.apply({
        nationality: this.nationality,
        idnumber: this.idNumber,
        idname: "id/passpost",
        name: this.name,
        idimg_1: this.idFrontImg,
        idimg_2: this.idBackImg,
        // idimg_3: this.handheldPhoto,
      }).then((res) => {
        if (res.code == "0") {
          this.$message.success(this.$t("message.user.bangdingchenggong"));
          this.$router.push("/secureBind"); //安全绑定
        }
      });
    },
    handClose() {
      this.visible = false;
    },
  },
};
</script>
<style scoped>
@import url("@/assets/css/login/register.css");
@import url("@/assets/css/my/security.css");
 
.el-input--suffix>>>.el-input__inner {
  padding-right: 30px;
  outline: none;
  border: none;
}
 
.flex_center {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}
 
.state_tip {
  margin-top: 10px;
  font-weight: 600;
}
 
/* 图片上传 */
.image_upload {
  display: flex;
  /* justify-content: space-between; */
}
 
.avatar-uploader .el-upload:hover {
  border-color: var(--el-color-primary);
}
 
.el-icon.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 110px;
  height: 110px;
  line-height: 110px;
  text-align: center;
}
 
.avatar {
  width: 110px;
  height: 110px;
  display: block;
}
 
.status_show {
  display: flex;
  flex-direction: column;
  align-items: center;
}
</style>