Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <template>
  2. <view class="item-tips">
  3. <view class="title"> 上传后请核对识别信息 </view>
  4. <view class="tip"> 如有错误请及时手动修改 </view>
  5. </view>
  6. <view class="content" v-if="state.userType == '1'">
  7. <view class="h2-title">用户证件信息</view>
  8. <view class="picture-wrapper" @click="takePhotoMode(1)">
  9. <view class="bg">
  10. <view class="">
  11. <view class="name"> 人像面 </view>
  12. <view class="value"> 上传身份证的人像面 </view>
  13. <view class="tip">
  14. <view class="tip-value"> 拍摄规范 </view>
  15. </view>
  16. </view>
  17. <image v-if="!submitForm.idCardFront" class="icon" :src="`${$imgUrl}issuance/sfz.png`">
  18. </image>
  19. <image v-else class="icon" :src="getFullImageUrl(submitForm.idCardFront)"></image>
  20. </view>
  21. </view>
  22. <view class="picture-wrapper" @click="takePhotoMode(2)">
  23. <view class="bg">
  24. <view class="">
  25. <view class="name"> 国徽面 </view>
  26. <view class="value"> 上传身份证的国徽面 </view>
  27. <view class="tip">
  28. <view class="tip-value"> 拍摄规范 </view>
  29. </view>
  30. </view>
  31. <image v-if="!submitForm.idCardBack" class="icon" :src="`${$imgUrl}issuance/sff.png`">
  32. </image>
  33. <image v-else class="icon" :src="getFullImageUrl(submitForm.idCardBack)"></image>
  34. </view>
  35. </view>
  36. </view>
  37. <template v-else-if="state.userType == '2'">
  38. <view class="content">
  39. <view class="h2-title">单位证件信息</view>
  40. <view class="picture-wrapper" @click="takePhotoMode(5)">
  41. <view class="bg">
  42. <view class="">
  43. <view class="name"> 营业执照 </view>
  44. <view class="value"> 上传企业的营业执照 </view>
  45. <view class="tip">
  46. <view class="tip-value"> 拍摄规范 </view>
  47. </view>
  48. </view>
  49. <image v-if="!submitForm.idCardFront" class="icon" :src="`${$imgUrl}applyCard/zhizhao.png`">
  50. </image>
  51. <image v-else class="icon" :src="getFullImageUrl(submitForm.idCardFront)"></image>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="content" >
  56. <view class="h2-title">经办人身份信息</view>
  57. <view class="picture-wrapper" @click="takePhotoMode(1)">
  58. <view class="bg">
  59. <view class="">
  60. <view class="name"> 人像面 </view>
  61. <view class="value"> 上传身份证的人像面 </view>
  62. <view class="tip">
  63. <view class="tip-value"> 拍摄规范 </view>
  64. </view>
  65. </view>
  66. <image v-if="!submitForm.agentIdCardFront" class="icon" :src="`${$imgUrl}issuance/sfz.png`">
  67. </image>
  68. <image v-else class="icon" :src="getFullImageUrl(submitForm.agentIdCardFront)"></image>
  69. </view>
  70. </view>
  71. <view class="picture-wrapper" @click="takePhotoMode(2)">
  72. <view class="bg">
  73. <view class="">
  74. <view class="name"> 国徽面 </view>
  75. <view class="value"> 上传身份证的国徽面 </view>
  76. <view class="tip">
  77. <view class="tip-value"> 拍摄规范 </view>
  78. </view>
  79. </view>
  80. <image v-if="!submitForm.agentIdCardBack" class="icon" :src="`${$imgUrl}issuance/sff.png`">
  81. </image>
  82. <image v-else class="icon" :src="getFullImageUrl(submitForm.agentIdCardBack)"></image>
  83. </view>
  84. </view>
  85. </view>
  86. </template>
  87. <view class="shibie-wrapper">
  88. <u-form label-width="230" :model="submitForm" ref="myForm" :label-style='labelStyle'>
  89. <view class="from">
  90. <u-form-item prop="name" :label="state.userType == '2' ? '单位名称' : '姓名'">
  91. <u-input v-model="submitForm.name" class="input" :placeholder="state.userType == '2' ? '请输入单位名称' : '请输入姓名'" inputAlign="right" />
  92. </u-form-item>
  93. <u-form-item prop="idNo" label="证件号">
  94. <u-input v-model="submitForm.idNo" class="input" placeholder="请输入证件号" inputAlign="right" />
  95. </u-form-item>
  96. <u-form-item prop="address" :label="state.userType == '2' ? '单位地址' : '身份证地址'" >
  97. <u-input v-model="submitForm.address" class="input" :placeholder="'请输入' + (state.userType == '2' ? '单位地址' : '身份证地址')" inputAlign="right" />
  98. </u-form-item>
  99. <template v-if="state.userType == '1'">
  100. <u-form-item prop="tel" label="手机号">
  101. <u-input v-model="submitForm.tel" class="input" placeholder="请输入手机号" inputAlign="right" />
  102. </u-form-item>
  103. <u-form-item prop="verifyCode" label="验证码" v-if="state.phoneStore !== submitForm.tel">
  104. <view class="from_item no-border">
  105. <u-input v-model="submitForm.verifyCode" placeholder="请输入验证码" class="input" inputAlign="right" type="number" />
  106. <view class="hint2" :style="{opacity: codeDuration !==0 ? 0.5: 1}">
  107. <view class="green">{{ codeDuration === 0 ? "" : codeDuration }}</view>
  108. <view class="grey" @click="getCode">{{ codeDuration === 0 ? "发送验证码" : "秒后可重发" }}</view>
  109. </view>
  110. </view>
  111. </u-form-item>
  112. </template>
  113. </view>
  114. </u-form>
  115. </view>
  116. <view class="shibie-wrapper" v-if="state.userType == '2'">
  117. <u-form label-width="230" :model="submitForm" ref="myForm" :label-style='labelStyle'>
  118. <view class="from">
  119. <u-form-item prop="agentName" label="经办人姓名">
  120. <u-input v-model="submitForm.agentName" class="input" placeholder="请输入经办人姓名" inputAlign="right" />
  121. </u-form-item>
  122. <u-form-item prop="agentIdNo" label="经办人证件号">
  123. <u-input v-model="submitForm.agentIdNo" class="input" placeholder="请输入经办人证件号" inputAlign="right" />
  124. </u-form-item>
  125. <u-form-item prop="tel" label="手机号">
  126. <u-input v-model="submitForm.tel" class="input" placeholder="请输入手机号" inputAlign="right" />
  127. </u-form-item>
  128. <u-form-item prop="verifyCode" label="验证码" v-if="state.phoneStore !== submitForm.tel">
  129. <view class="from_item no-border">
  130. <u-input v-model="submitForm.verifyCode" placeholder="请输入验证码" class="input" inputAlign="right" type="number" />
  131. <view class="hint2" :style="{opacity: codeDuration === 0 ? 1 : 0.5}">
  132. <view class="green">{{ codeDuration === 0 ? "" : codeDuration }}</view>
  133. <view class="grey" @click="getCode">{{ codeDuration === 0 ? "发送验证码" : "秒后可重发" }}</view>
  134. </view>
  135. </view>
  136. </u-form-item>
  137. </view>
  138. </u-form>
  139. </view>
  140. <FixedFooter>
  141. <button type="default" class="ui-btn" @click="submit">提交</button>
  142. </FixedFooter>
  143. <!--证件照上传 start-->
  144. <uploadOcr
  145. :isTakePhotoModeShow="state.isTakePhotoModeShow"
  146. :phoneType="state.choiceIndex"
  147. @close="close"
  148. @ocrResult="ocrResult">
  149. </uploadOcr>
  150. <!--证件照上传 end-->
  151. </template>
  152. <script setup lang="ts">
  153. import { ref, reactive } from 'vue'
  154. import { onReady, onLoad } from "@dcloudio/uni-app";
  155. import uploadOcr from '@/components/uploadOcr';
  156. import { msg, getFullImageUrl, compareDates, checkStr } from "@/utils/utils";
  157. import { changeUserInfo, sendMessage, getUserMsg, getCustomerDetail, userInfoIndex } from '@/utils/network/api'
  158. import { requestNew } from "@/utils/network/request.js";
  159. import FixedFooter from '@/components/common/FixedFooter'
  160. import { getItem } from '@/utils/storage'
  161. /*
  162. ** 页面接受参数
  163. */
  164. interface pageParams {
  165. isAdd: string, // 是否是新增 1 是新增,其他是否
  166. addType: string // 新增类型: 1:新增个人信息(暂无)2:新增公司类型
  167. }
  168. /**
  169. * 身份证ocr识别后接收参数
  170. */
  171. interface OCRData {
  172. imageUrl: string,
  173. bizContent: string,
  174. screditCode: string,
  175. enddate: string
  176. }
  177. //倒计时时常
  178. const codeDuration = ref(0);
  179. let interval = null;
  180. const myForm = ref(null);
  181. const userInfo = getItem('userInfo')
  182. const state = reactive({
  183. isTakePhotoModeShow: false,
  184. choiceIndex: 1, // 1 身份证正面 2 身份证反面 3:营业执照正面
  185. userType: '1', // 用户类型 1:个人用户 2: 公司用户
  186. phoneStore: '',
  187. isAdd: false
  188. })
  189. const labelStyle = {
  190. color: "#004576",
  191. fontSize: "28rpx",
  192. }
  193. const submitForm = reactive({
  194. name: '',
  195. idNo: '',
  196. address: '',
  197. agentName: '', // 经办人
  198. agentIdNo: '',
  199. idCardFront: '',
  200. idCardBack: '',
  201. agentIdCardFront: '',
  202. agentIdCardBack : '',
  203. tel: '',
  204. verifyCode: '',
  205. mobileChange: 1, // 默认为否 1: 否 2:是
  206. type: '1', // 1:个人 2:单位
  207. vld: '',
  208. customerId: userInfo.customerId,
  209. isAddEtc: '1' // 是否是新增用户 1:否 2 :是
  210. })
  211. onLoad((option: pageParams) => {
  212. let { isAdd, addType } = option
  213. if (isAdd !== '1') {
  214. getUserInfo()
  215. } else {
  216. if (addType === '2') {
  217. uni.setNavigationBarTitle({
  218. title: '单位信息新增'
  219. })
  220. } else {
  221. uni.setNavigationBarTitle({
  222. title: '个人信息新增'
  223. })
  224. }
  225. submitForm.isAddEtc = '2'
  226. }
  227. if (addType === '2') {
  228. submitForm.type = state.userType = '2'
  229. }
  230. })
  231. const submit = () => {
  232. if (!paramsVerify()) return
  233. let params = JSON.parse(JSON.stringify(submitForm))
  234. if (params.tel !== state.phoneStore) {
  235. params.mobileChange = 2
  236. }
  237. let option = {
  238. type: 2,
  239. data: params,
  240. method: "POST",
  241. showLoading: true,
  242. }
  243. requestNew(changeUserInfo, option).then(res => {
  244. uni.navigateTo({
  245. url: '/pages/common/submit-result'
  246. })
  247. })
  248. }
  249. // 字段校验
  250. const paramsVerify = () => {
  251. // 个人类型修改信息
  252. if (state.userType === '1') {
  253. if (!submitForm.idCardFront) {
  254. msg('请上传证件正面照')
  255. return false
  256. } else if (!submitForm.idCardBack) {
  257. msg('请上传证件反面照')
  258. return false
  259. } else if (!submitForm.name) {
  260. msg('请填写证件姓名')
  261. return false
  262. } else if (!submitForm.idNo) {
  263. msg('请填写证件号')
  264. return false
  265. } else if (!submitForm.tel) {
  266. msg('请填写手机号')
  267. return false
  268. } else if (submitForm.tel !== state.phoneStore && !submitForm.verifyCode) {
  269. msg('请填写验证码')
  270. return false
  271. }
  272. return true
  273. } else if (state.userType === '2') {
  274. if (!submitForm.idCardFront) {
  275. msg('请上传证件正面照')
  276. return false
  277. } else if (!submitForm.name) {
  278. msg('请填写证件姓名')
  279. return false
  280. } else if (!submitForm.idNo) {
  281. msg('请填写证件号')
  282. return false
  283. } else if (!submitForm.address) {
  284. msg('请填写单位地址')
  285. return false
  286. } else if (!submitForm.tel) {
  287. msg('请填写手机号')
  288. return false
  289. } else if (submitForm.tel !== state.phoneStore && !submitForm.verifyCode) {
  290. msg('请填写验证码')
  291. return false
  292. } else if (!submitForm.agentIdCardFront) {
  293. msg('请上传经办人身份证正面照')
  294. return false
  295. } else if (!submitForm.agentIdCardBack) {
  296. msg('请上传经办人身份证反面照')
  297. return false
  298. }
  299. return true
  300. }
  301. }
  302. // 获取用户详情
  303. const getUserInfo = () => {
  304. let option = {
  305. type: 2,
  306. data: {
  307. customerId: userInfo.customerId // 测试Id:52010125072300301
  308. },
  309. method: "POST",
  310. showLoading: true,
  311. }
  312. requestNew(getCustomerDetail, option).then(res => {
  313. state.userType = submitForm.type = res.userType === 'PERSONAL_USER' ? '1' : '2'
  314. state.phoneStore = submitForm.tel = res.customerTel
  315. if (state.userType === '1') {
  316. submitForm.name = res.customerName
  317. submitForm.idNo = res.channelId
  318. submitForm.address = res.customerAddress
  319. submitForm.idCardFront = res.customerPosImgUrl
  320. submitForm.idCardBack = res.customerNegImgUrl
  321. submitForm.vld = res.customerVid
  322. } else if (state.userType === '2') {
  323. submitForm.name = res.customerName
  324. submitForm.idNo = res.channelId
  325. submitForm.address = res.customerAddress
  326. submitForm.idCardFront = res.customerPosImgUrl
  327. submitForm.agentName = res.agentName
  328. submitForm.agentIdNo = res.agentIdNum
  329. submitForm.agentIdCardFront = res.agentPosImgUrl
  330. submitForm.agentIdCardBack = res.agentNegImgUrl
  331. }
  332. })
  333. }
  334. const close = (e) => {
  335. state.isTakePhotoModeShow = e
  336. }
  337. const takePhotoMode = (index: number) => {
  338. state.isTakePhotoModeShow = true
  339. state.choiceIndex = index
  340. }
  341. const ocrResult = (data: OCRData) => {
  342. let bizContent = data.bizContent = data.bizContent ? JSON.parse(data.bizContent) : {}
  343. if (state.choiceIndex === 1) {
  344. if (!bizContent.idno) {
  345. msg('识别失败,请重新上传')
  346. } else {
  347. if (state.userType === '1') {
  348. submitForm.name = bizContent.name;
  349. submitForm.address = bizContent.address;
  350. submitForm.idNo = bizContent.idno;
  351. submitForm.idCardFront = data.imageUrl;
  352. } else {
  353. submitForm.agentName = bizContent.name;
  354. submitForm.agentIdNo = bizContent.idno;
  355. submitForm.agentIdCardFront = data.imageUrl;
  356. }
  357. }
  358. } else if (state.choiceIndex === 2) {
  359. if (!bizContent.begindate) {
  360. msg('识别失败,请重新上传')
  361. } else {
  362. if (state.userType === '1') {
  363. submitForm.idCardBack = data.imageUrl;
  364. submitForm.vld = data.enddate
  365. compareDates(data.enddate)
  366. } else {
  367. submitForm.agentIdCardBack = data.imageUrl;
  368. }
  369. }
  370. } else if (state.choiceIndex === 5) {
  371. submitForm.name = bizContent.unitName;
  372. submitForm.address = bizContent.adress;
  373. submitForm.idNo = bizContent.screditCode;
  374. submitForm.idCardFront = data.imageUrl
  375. }
  376. }
  377. // 发送验证码
  378. const getCode = () => {
  379. if (codeDuration.value !== 0) {
  380. return;
  381. }
  382. if (!submitForm.tel) {
  383. msg("请输入手机号!");
  384. return;
  385. }
  386. if (!checkStr(submitForm.tel, "mobile")) {
  387. msg("请输入正确的手机号!");
  388. return;
  389. }
  390. const options = {
  391. type: 2,
  392. data: {
  393. mobile: submitForm.tel,
  394. businessType: 3
  395. },
  396. method: "POST",
  397. showLoading: true,
  398. };
  399. requestNew(sendMessage, options)
  400. .then(() => {
  401. codeInterval();
  402. msg("验证码发送成功!");
  403. })
  404. .catch((err) => {
  405. console.log(err);
  406. });
  407. }
  408. /* 验证码倒计时 */
  409. const codeInterval = () => {
  410. codeDuration.value = 60;
  411. interval = setInterval(() => {
  412. codeDuration.value--;
  413. if (codeDuration.value === 0) {
  414. if (interval) {
  415. clearInterval(interval);
  416. interval = null;
  417. }
  418. }
  419. }, 1000);
  420. };
  421. </script>
  422. <style lang="scss" scoped>
  423. .content{
  424. padding: 30rpx 30rpx;
  425. background-color: #FFFFFF;
  426. margin: 30rpx 30rpx 0;
  427. border-radius: 12rpx;
  428. .h2-title{
  429. font-size: 30rpx;
  430. font-weight: bold;
  431. }
  432. }
  433. .item-tips {
  434. margin: 24rpx 30rpx;
  435. .title {
  436. font-size: 30rpx;
  437. font-family: Microsoft YaHei;
  438. font-weight: 500;
  439. line-height: 30rpx;
  440. color: #CCB375;
  441. }
  442. .tip {
  443. margin-top: 16rpx;
  444. font-size: 24rpx;
  445. font-family: Microsoft YaHei;
  446. font-weight: 400;
  447. color: #999999;
  448. line-height: 24rpx;
  449. }
  450. }
  451. .picture-wrapper {
  452. margin: 30rpx 0 0;
  453. .bg {
  454. background: #F5F9FB;
  455. border-radius: 10rpx;
  456. padding: 40rpx 30rpx;
  457. display: flex;
  458. // align-items: center;
  459. justify-content: space-between;
  460. .name {
  461. padding-top: 30rpx;
  462. font-size: 32rpx;
  463. font-family: SourceHanSansSC, SourceHanSansSC;
  464. font-weight: 500;
  465. color: #111;
  466. line-height: 34rpx;
  467. }
  468. .value {
  469. margin-top: 20rpx;
  470. font-size: 22rpx;
  471. font-family: SourceHanSansSC, SourceHanSansSC;
  472. font-weight: 400;
  473. color: #999999;
  474. line-height: 24rpx;
  475. }
  476. .tip {
  477. margin-top: 20rpx;
  478. text-align: center;
  479. width: 100rpx;
  480. height: 30rpx;
  481. // background: rgba(204, 179, 117);
  482. border-radius: 6rpx;
  483. border: 1rpx solid #CCB375;
  484. .tip-value {
  485. font-size: 20rpx;
  486. font-family: Microsoft YaHei;
  487. font-weight: 400;
  488. color: #CCB375;
  489. line-height: 30rpx;
  490. opacity: 1;
  491. }
  492. }
  493. }
  494. .icon {
  495. width: 304rpx;
  496. height: 190rpx;
  497. background-image: var(--bgimg);
  498. background-size: 100% 100%;
  499. background-repeat: no-repeat;
  500. }
  501. }
  502. .shibie-wrapper {
  503. margin: 30rpx 30rpx;
  504. border-radius: 12rpx;
  505. background-color: #fff;
  506. box-sizing: border-box;
  507. overflow: hidden;
  508. }
  509. .from {
  510. background-color: #fff;
  511. padding: 24rpx 30rpx;
  512. ::v-deep .u-form-item {
  513. padding: 0;
  514. line-height: normal;
  515. .u-form-item__message {
  516. margin-bottom: 12rpx;
  517. }
  518. }
  519. .from_item {
  520. display: flex;
  521. flex-wrap: nowrap;
  522. justify-content: space-between;
  523. align-items: center;
  524. height: 80rpx;
  525. border-bottom: 1rpx solid #dcdcdc;
  526. .btn {
  527. font-size: 24rpx;
  528. font-family: Microsoft YaHei;
  529. font-weight: 400;
  530. color: #ffffff;
  531. background: #00b38b;
  532. border-radius: 10rpx;
  533. padding: 10rpx 15rpx;
  534. }
  535. ::v-deep .input {
  536. text-align: left;
  537. flex: 1;
  538. background: transparent;
  539. input {
  540. text-align: left;
  541. }
  542. }
  543. }
  544. .no-border{
  545. border-color: transparent;
  546. }
  547. }
  548. .hint2{
  549. display: flex;
  550. align-items: center;
  551. .grey{
  552. color: #004576;
  553. }
  554. }
  555. </style>