Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

user-card.vue 12KB

před 2 roky
před 2 roky
před 1 rokem
před 2 roky
před 1 rokem
před 2 roky
před 1 rokem
před 1 rokem
před 10 měsíci
před 7 měsíci
před 2 roky
před 2 roky
před 1 rokem
před 10 měsíci
před 7 měsíci
před 7 měsíci
před 7 měsíci
před 2 roky
před 1 rokem
před 2 roky
před 1 rokem
před 7 měsíci
před 1 rokem
před 1 rokem
před 10 měsíci
před 7 měsíci
před 7 měsíci
před 7 měsíci
před 2 roky
před 1 rokem
před 7 měsíci
před 1 rokem
před 7 měsíci
před 7 měsíci
před 1 rokem
před 2 roky
před 10 měsíci
před 1 rokem
před 7 měsíci
před 1 rokem
před 7 měsíci
před 1 rokem
před 7 měsíci
před 1 rokem
před 2 roky
před 2 roky
před 1 rokem
před 1 rokem
před 1 rokem
před 2 roky
před 2 roky
před 2 roky
před 2 roky
před 2 roky
před 2 roky
před 1 rokem
před 2 roky
před 2 roky
před 2 roky
před 2 roky
před 10 měsíci
před 1 rokem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. <template>
  2. <view class="main" :style="{height: height+'px'}">
  3. <view class="content">
  4. <view class="item-tips">
  5. <view class="title"> 上传后请核对识别信息 </view>
  6. <view class="tip"> 如有错误请及时手动修改 </view>
  7. </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="!state.form.userPosImgUrl" class="icon" :src="`${$imgUrl}applyCard/renxiang.png`">
  18. </image>
  19. <image v-else class="icon" :src="strReplace(state.form.userPosImgUrl)"></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="!state.form.userNegImgUrl" class="icon" :src="`${$imgUrl}applyCard/guohui.png`">
  32. </image>
  33. <image v-else class="icon" :src="strReplace(state.form.userNegImgUrl)"></image>
  34. </view>
  35. </view>
  36. <view class="shibie-wrapper">
  37. <view class="title"> 识别内容如下 </view>
  38. <u-form label-width="200" :model="state.form" ref="uForm">
  39. <u-form-item label="姓名">
  40. <u-input v-model="state.form.customerName" placeholder='请输入姓名' />
  41. </u-form-item>
  42. <u-form-item label="地址">
  43. <u-input placeholder='请输入地址' height='38' type='textarea' :autoHeight='true'
  44. v-model="state.form.address" />
  45. </u-form-item>
  46. <u-form-item label="手机号" class="phoneBox">
  47. <u-input placeholder='手机号' type="number" v-model="state.form.tel" maxlength="11" />
  48. <text @click="getCode" v-if="waitTime==0" class="search">获取验证码</text>
  49. <text class="btn" v-else>{{waitTime}}后重试</text>
  50. </u-form-item>
  51. <u-form-item label="验证码">
  52. <u-input placeholder='请输入验证码' type="number" v-model="state.form.code" />
  53. </u-form-item>
  54. </u-form>
  55. </view>
  56. <view class="green-tip">
  57. 如识别信息有误,请手动修改,确认无误后,点击下一步!
  58. </view>
  59. <view class="action">
  60. <button type="default" class="button" @click="savaHandle()">
  61. 下一步
  62. </button>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="choice-takePhoto-wrap" v-if="state.isTakePhotoModeShow" @click="cancle">
  67. <view class="choice-takePhoto">
  68. <view @click.stop="takePhoto(state.choiceIndex)" style="border-radius: 20rpx 20rpx 0 0;">拍照</view>
  69. <view @click.stop="xiangce(state.choiceIndex)">从手机相册选择</view>
  70. <view @click.stop="cancle">取消</view>
  71. </view>
  72. </view>
  73. <viewfinder v-if="state.phoneType" :phoneType="state.phoneType" :images="state.images"
  74. :showStartPhoto="state.showImg" @confirmReturn="confirmReturn" @camera="camera"></viewfinder>
  75. </template>
  76. <script lang="ts" setup>
  77. import {
  78. getItem
  79. } from "@/utils/storage.ts"
  80. import {
  81. reactive,
  82. ref
  83. } from "vue";
  84. import {
  85. msg,
  86. checkStr,
  87. strReplace,
  88. uploadFile,
  89. chooseImageCompress
  90. } from "@/utils/utils";
  91. import {
  92. onLoad,
  93. onShow
  94. } from "@dcloudio/uni-app";
  95. import {
  96. idCardOcr,
  97. changeApply,
  98. etcMobileChangeSmsCode,
  99. } from "@/utils/network/api.js";
  100. import {
  101. request, requestNew
  102. } from "@/utils/network/request.js";
  103. import {
  104. stringToJson
  105. } from "@/utils/network/encryption.js";
  106. import {
  107. fileURL
  108. } from "@/datas/fileURL.js";
  109. import viewfinder from "../../../../components/viewfinder.vue"
  110. const height = uni.getSystemInfoSync().windowHeight
  111. const defHeadstockImg = `${fileURL}image/applyCard/renxiang.png`;
  112. const defInstallImg = `${fileURL}image/applyCard/guohui.png`;
  113. const state = reactive({
  114. phoneType: 0, // 1 身份证正面 2 身份证反面 3行驶证正面 4行驶证反面
  115. choiceIndex: 1, // 1 身份证正面 2 身份证反面
  116. isTakePhotoModeShow: false, //选择拍照方式是否出来
  117. showImg: true,
  118. images: "",
  119. genderList: [{
  120. value: '男',
  121. label: '男'
  122. },
  123. {
  124. value: '女',
  125. label: '女'
  126. }
  127. ],
  128. codeTips: "获取验证码",
  129. form: {
  130. customerId: '', //用户编号
  131. customerName: "", //开户人姓名
  132. openId: getItem('openId'),
  133. userPosImgUrl: "", //身份证正面
  134. userNegImgUrl: "", //身份证反面
  135. tel: "", //开户人手机号
  136. address: "", //开户人地址
  137. code: "", //手机号验证码
  138. validType:"MOBILE"
  139. }
  140. })
  141. const getCode = () => {
  142. console.log(123);
  143. if (checkStr(state.form.tel, "mobile")) {
  144. sendCodeApi()
  145. codeInterval()
  146. } else {
  147. uni.showToast({
  148. title: '请输入正确的手机号',
  149. icon: 'none'
  150. });
  151. }
  152. }
  153. let waitTime = ref(0)
  154. //倒计时函数
  155. const codeInterval = () => {
  156. waitTime.value = 60
  157. let timer = setInterval(() => {
  158. if (waitTime.value == 1) {
  159. clearInterval(timer)
  160. }
  161. waitTime.value -= 1
  162. }, 1000)
  163. }
  164. // 发送验证码
  165. const sendCodeApi = () => {
  166. //参数说明
  167. let options = {
  168. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  169. data: {
  170. mobile: state.form.tel,
  171. customerId:state.form.customerId
  172. }, //请求参数
  173. method: "POST", //提交方式(默认POST)
  174. showLoading: true, //是否显示加载中(默认显示)
  175. };
  176. //调用方式
  177. requestNew(etcMobileChangeSmsCode, options)
  178. .then((res) => {
  179. let data = res
  180. console.log(data, "#################");
  181. if (data.info == "成功.") {
  182. console.log('######################CCCCCCCCCCCCCCCCC');
  183. }
  184. })
  185. .catch((err) => {
  186. console.log(err);
  187. });
  188. }
  189. //下一步
  190. const savaHandle = () => {
  191. console.log(state.form);
  192. if (!state.form.userPosImgUrl) {
  193. msg("请上传身份证正面")
  194. return;
  195. }
  196. if (!state.form.userNegImgUrl) {
  197. msg("请上传身份证反面")
  198. return;
  199. }
  200. if (!state.form.customerName) {
  201. msg("请输入姓名")
  202. return;
  203. }
  204. if (!state.form.address) {
  205. msg("请输入地址")
  206. return;
  207. }
  208. if (!checkStr(state.form.tel, "mobile")) {
  209. msg("请输入正确的手机号")
  210. return;
  211. }
  212. if (!state.form.code) {
  213. msg("请输入验证码")
  214. return;
  215. }
  216. const options = {
  217. type: 2,
  218. data: state.form,
  219. method: "POST",
  220. showLoading: true,
  221. };
  222. requestNew(changeApply, options).then((res) => {
  223. const data = res
  224. msg('用户信息变更申请成功')
  225. setTimeout(() => {
  226. uni.navigateBack({
  227. delta: 1
  228. });
  229. }, 1500)
  230. console.log(data);
  231. });
  232. }
  233. onLoad((options) => {
  234. console.log(options.customerId);
  235. state.form.customerId = options.customerId
  236. })
  237. const takePhotoMode = (index) => {
  238. console.log("index", index)
  239. state.isTakePhotoModeShow = true
  240. state.choiceIndex = index
  241. }
  242. const camera = () => {
  243. state.phoneType = 0
  244. }
  245. const xiangce = (val) => {
  246. console.log("val", val)
  247. var imageType = val;
  248. chooseImageCompress((res)=>{
  249. state.images = res.tempFilePath?res.tempFilePath:res.tempFilePaths[0]
  250. state.showImg = false
  251. state.phoneType = state.choiceIndex
  252. state.isTakePhotoModeShow = false
  253. })
  254. }
  255. const takePhoto = (val) => {
  256. console.log("拍照", val)
  257. state.phoneType = val;
  258. state.showImg = true;
  259. }
  260. const confirmReturn = (val) => {
  261. state.phoneType = 0
  262. state.isTakePhotoModeShow = false
  263. var imageType = state.choiceIndex;
  264. console.log("图片地址val", val.tempImagePath)
  265. uploadFile(val.tempImagePath, imageType, idCardOcr).then((data) => {
  266. if (state.choiceIndex === "1") {
  267. state.form.customerName = data.name;
  268. state.form.userPosImgUrl = data.imageUrl;
  269. state.form.address = data.address;
  270. state.form.posOcrResultId = data.ocrResultId;
  271. } else {
  272. state.form.customerIdVld = data.enddate;
  273. state.form.userNegImgUrl = data.imageUrl;
  274. state.form.negOcrResultId = data.ocrResultId;
  275. }
  276. state.isTakePhotoModeShow = false
  277. })
  278. }
  279. const cancle = () => {
  280. state.isTakePhotoModeShow = false
  281. }
  282. </script>
  283. <style>
  284. page {
  285. background: #eef7f7;
  286. }
  287. </style>
  288. <style lang="scss" scoped>
  289. ::v-deep .u-size-mini {
  290. white-space: nowrap;
  291. }
  292. .main {
  293. .content {
  294. padding: 50rpx 30rpx 50rpx 30rpx;
  295. .action {
  296. padding-left: 20rpx;
  297. padding-right: 20rpx;
  298. padding-bottom: 30rpx;
  299. .button {
  300. height: 80rpx;
  301. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  302. border-radius: 40rpx;
  303. font-size: 32rpx;
  304. font-weight: 400;
  305. color: #ffffff;
  306. line-height: 80rpx;
  307. }
  308. }
  309. .item-tips {
  310. .title {
  311. font-size: 30rpx;
  312. font-family: Microsoft YaHei;
  313. font-weight: 400;
  314. color: #000000;
  315. line-height: 24rpx;
  316. }
  317. .tip {
  318. margin-top: 16rpx;
  319. font-size: 24rpx;
  320. font-family: Microsoft YaHei;
  321. font-weight: 400;
  322. color: #999999;
  323. line-height: 24rpx;
  324. }
  325. }
  326. .picture-wrapper {
  327. margin-top: 40rpx;
  328. .bg {
  329. background: #ffffff;
  330. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  331. border-radius: 20rpx;
  332. padding: 40rpx;
  333. display: flex;
  334. justify-content: space-between;
  335. .name {
  336. font-size: 34rpx;
  337. font-family: Microsoft YaHei;
  338. font-weight: 400;
  339. color: #000000;
  340. line-height: 34rpx;
  341. }
  342. .value {
  343. margin-top: 20rpx;
  344. font-size: 24rpx;
  345. font-family: Microsoft YaHei;
  346. font-weight: 400;
  347. color: #999999;
  348. line-height: 24rpx;
  349. }
  350. .tip {
  351. margin-top: 20rpx;
  352. text-align: center;
  353. width: 110rpx;
  354. height: 40rpx;
  355. background: rgba(33, 190, 177, 0.2);
  356. border-radius: 6rpx;
  357. .tip-value {
  358. font-size: 20rpx;
  359. font-family: Microsoft YaHei;
  360. font-weight: 400;
  361. color: #0a8f8a;
  362. line-height: 40rpx;
  363. opacity: 1;
  364. }
  365. }
  366. }
  367. .icon {
  368. width: 294rpx;
  369. height: 188rpx;
  370. }
  371. }
  372. .shibie-wrapper {
  373. margin-top: 40rpx;
  374. background: #fff;
  375. padding: 40rpx 30rpx;
  376. border-radius: 20rpx;
  377. box-shadow: 0 4rpx 13rpx 3rpx rgba(223, 223, 223, .8);
  378. .title {
  379. font-size: 30rpx;
  380. font-family: Microsoft YaHei;
  381. font-weight: 400;
  382. color: #000000;
  383. line-height: 30rpx;
  384. }
  385. .phoneBox {
  386. ::v-deep .u-form-item--right__content__slot {
  387. display: flex;
  388. .btn {
  389. flex: 1;
  390. background: transparent;
  391. font-size: 30rpx;
  392. color: #15E5C1;
  393. z-index: 999;
  394. }
  395. }
  396. }
  397. }
  398. .buchong-wrapper {
  399. margin-top: 60rpx;
  400. .title {
  401. font-size: 30rpx;
  402. font-family: Microsoft YaHei;
  403. font-weight: 400;
  404. color: #000000;
  405. line-height: 30rpx;
  406. }
  407. }
  408. .green-tip {
  409. margin-top: 50rpx;
  410. font-size: 24rpx;
  411. font-family: Microsoft YaHei;
  412. font-weight: 400;
  413. color: #00b38b;
  414. line-height: 24rpx;
  415. margin-bottom: 60rpx;
  416. }
  417. }
  418. }
  419. .choice-takePhoto {
  420. position: absolute;
  421. bottom: 0;
  422. background-color: white;
  423. width: 100%;
  424. border-radius: 20rpx 20rpx 0 0;
  425. }
  426. .choice-takePhoto>view:first-child {
  427. text-align: center;
  428. height: 80rpx;
  429. line-height: 80rpx;
  430. border-bottom: 1rpx solid rgba(127, 127, 127, 0.3);
  431. background-color: white;
  432. }
  433. .choice-takePhoto>view:last-child {
  434. text-align: center;
  435. height: 80rpx;
  436. line-height: 80rpx;
  437. border-top: 6rpx solid rgba(127, 127, 127, 0.1);
  438. background-color: white;
  439. }
  440. .choice-takePhoto>view {
  441. text-align: center;
  442. height: 80rpx;
  443. line-height: 80rpx;
  444. background-color: white;
  445. }
  446. .choice-takePhoto-wrap {
  447. width: 100%;
  448. height: 100vh;
  449. background-color: rgba(127, 127, 127, 0.2);
  450. position: fixed;
  451. left: 0;
  452. top: 0;
  453. z-index: 11111;
  454. }
  455. .search{
  456. color: #ffffff;
  457. border-color: #19be6b;
  458. background-color: #19be6b;
  459. font-size: 28rpx !important;
  460. padding: 8px 30rpx !important;
  461. white-space: nowrap;
  462. height: 30rpx;
  463. line-height: 30rpx;
  464. border-radius: 16rpx;
  465. }
  466. </style>