You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  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="cardImageOcr('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="cardImageOcr('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. <!--
  43. <u-form-item label="性别">
  44. <u-input placeholder='请选择性别' v-model="state.form.gender" @click="userGenderAction()"
  45. type="select" />
  46. </u-form-item> -->
  47. <!-- <u-form-item label="身份证号">
  48. <u-input placeholder='请输入身份证' type="idcard" v-model="state.form.userIdNum" />
  49. </u-form-item> -->
  50. <u-form-item label="地址">
  51. <u-input placeholder='请输入地址' height='38' type='textarea' :autoHeight='true'
  52. v-model="state.form.address" />
  53. </u-form-item>
  54. <!-- <u-form-item label="证件有效期">
  55. <u-input v-model="state.form.begindate" type="select" />
  56. </u-form-item> -->
  57. <u-form-item label="手机号" class="phoneBox">
  58. <u-input placeholder='手机号' type="number" v-model="state.form.tel" maxlength="11" />
  59. <u-button type="success" size="mini" @click="getCode" v-if="waitTime==0">获取验证码</u-button>
  60. <text class="btn" v-else>{{waitTime}}后重试</text>
  61. </u-form-item>
  62. <u-form-item label="验证码">
  63. <u-input placeholder='请输入验证码' type="number" v-model="state.form.newMobileCode" />
  64. </u-form-item>
  65. </u-form>
  66. </view>
  67. <view class="green-tip">
  68. 如识别信息有误,请手动修改,确认无误后,点击下一步!
  69. </view>
  70. <view class="action">
  71. <button type="default" class="button" @click="savaHandle()">
  72. 下一步
  73. </button>
  74. </view>
  75. </view>
  76. </view>
  77. </template>
  78. <script lang="ts" setup>
  79. import {
  80. pathToBase64
  81. } from "@/utils/image-tools/index.js";
  82. import {
  83. getItem
  84. } from "@/utils/storage.ts"
  85. import {
  86. reactive,
  87. ref
  88. } from "vue";
  89. import {
  90. msg,
  91. checkStr
  92. } from "@/utils/utils";
  93. import {
  94. onLoad,
  95. onShow
  96. } from "@dcloudio/uni-app";
  97. import {
  98. etcOcrCard,
  99. userInfoChange,
  100. sendCode,
  101. envs,
  102. } from "@/utils/network/api.js";
  103. import {
  104. request
  105. } from "@/utils/network/request.js";
  106. import {
  107. stringToJson
  108. } from "@/utils/network/encryption.js";
  109. import {
  110. fileURL
  111. } from "@/datas/fileURL.js";
  112. const height = uni.getSystemInfoSync().windowHeight
  113. const defHeadstockImg = `${fileURL}image/applyCard/renxiang.png`;
  114. const defInstallImg = `${fileURL}image/applyCard/guohui.png`;
  115. // const state = reactive({
  116. // headstockImg: null,
  117. // installImg: null,
  118. // });
  119. const state = reactive({
  120. genderList: [{
  121. value: '男',
  122. label: '男'
  123. },
  124. {
  125. value: '女',
  126. label: '女'
  127. }
  128. ],
  129. codeTips: "获取验证码",
  130. form: {
  131. // orderId: "", //订单ID
  132. customerId: '', //用户编号
  133. customerName: "", //开户人姓名
  134. openId: getItem('openId'),
  135. // userIdType: "101", //用户证件类型 101//身份证
  136. // userIdNum: "", //用户证件号码
  137. userPosImgUrl: "", //身份证正面
  138. userNegImgUrl: "", //身份证反面
  139. tel: "", //开户人手机号
  140. address: "", //开户人地址
  141. newMobileCode: "" //手机号验证码
  142. // sceneType: "", //用户协议支撑服务场景(发行服务机构和用户签订的协议)
  143. // channelId: "", //渠道id
  144. // gender: "",
  145. // customerIdVld: "",
  146. // agentName: "",
  147. // agentGender: "",
  148. // agentTel: '',
  149. // agentPhone: "",
  150. // agentIdType: "101",
  151. // agentIdNum: "",
  152. // agentPosImgUrl: "",
  153. // agentNegImgUrl: "",
  154. // proxyUrl: "",
  155. // agentAddress: "",
  156. // agentIdVld: '',
  157. }
  158. })
  159. const strReplace = (str : string) => {
  160. let imgUrl = str.replace("http://192.168.101.145:9000", envs[process.env.NODE_ENV].baseUrl);
  161. imgUrl = imgUrl.replace("http://100.64.2.113:9000", envs[process.env.NODE_ENV].baseUrl);
  162. return imgUrl;
  163. };
  164. const getCode = () => {
  165. console.log(123);
  166. if (checkStr(state.form.tel, "mobile")) {
  167. sendCodeApi()
  168. codeInterval()
  169. } else {
  170. uni.showToast({
  171. title: '请输入正确的手机号',
  172. icon: 'none'
  173. });
  174. }
  175. }
  176. let waitTime = ref(0)
  177. //倒计时函数
  178. const codeInterval = () => {
  179. waitTime.value = 60
  180. let timer = setInterval(() => {
  181. if (waitTime.value == 1) {
  182. clearInterval(timer)
  183. }
  184. waitTime.value -= 1
  185. }, 1000)
  186. }
  187. // 发送验证码
  188. const sendCodeApi = (type) => {
  189. //参数说明
  190. let options = {
  191. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  192. data: {
  193. mobile: state.form.tel
  194. }, //请求参数
  195. method: "POST", //提交方式(默认POST)
  196. showLoading: true, //是否显示加载中(默认显示)
  197. };
  198. //调用方式
  199. request(sendCode, options)
  200. .then((res) => {
  201. let data = stringToJson(res.bizContent)
  202. console.log(data, "#################");
  203. if (data.info == "成功.") {
  204. console.log('######################CCCCCCCCCCCCCCCCC');
  205. }
  206. })
  207. .catch((err) => {
  208. console.log(err);
  209. });
  210. }
  211. //选择图片
  212. //orc接口调用
  213. const cardImageOcr = (val : any) => {
  214. console.log("点击了");
  215. var imageType = val;
  216. uni.chooseImage({
  217. count: 1, //只能选取一张照片
  218. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  219. sourceType: ["camera", "album"], //从相册选择
  220. success: function (res) {
  221. pathToBase64(res.tempFilePaths[0])
  222. .then((path) => {
  223. console.log(path);
  224. console.log("哈哈哈");
  225. var data = {
  226. source: "1",
  227. agencyId: "52010106004",
  228. imageType: imageType,
  229. fileName: res.tempFilePaths[0],
  230. imageBase64: path,
  231. };
  232. const options = {
  233. type: 2,
  234. data: data,
  235. method: "POST",
  236. showLoading: true,
  237. };
  238. request(etcOcrCard, options).then((res) => {
  239. // const data = stringToJson(res.bizContent);
  240. const data = JSON.parse(res.bizContent)
  241. if (val === "1") {
  242. state.form.customerName = data.name;
  243. state.form.userPosImgUrl = data.imageUrl;
  244. state.form.address = data.address;
  245. } else {
  246. state.form.customerIdVld = data.enddate;
  247. state.form.userNegImgUrl = data.imageUrl;
  248. }
  249. });
  250. })
  251. .catch((error) => { });
  252. },
  253. });
  254. };
  255. //下一步
  256. const savaHandle = () => {
  257. console.log(state.form);
  258. if (!state.form.userPosImgUrl) {
  259. msg("请上传身份证正面")
  260. return;
  261. }
  262. if (!state.form.userNegImgUrl) {
  263. msg("请上传身份证反面")
  264. return;
  265. }
  266. if (!state.form.customerName) {
  267. msg("请输入姓名")
  268. return;
  269. }
  270. if (!state.form.address) {
  271. msg("请输入地址")
  272. return;
  273. }
  274. if (!checkStr(state.form.tel, "mobile")) {
  275. msg("请输入正确的手机号")
  276. return;
  277. }
  278. if (!state.form.newMobileCode) {
  279. msg("请输入验证码")
  280. return;
  281. }
  282. const options = {
  283. type: 2,
  284. data: state.form,
  285. method: "POST",
  286. showLoading: true,
  287. };
  288. request(userInfoChange, options).then((res) => {
  289. // const data = stringToJson(res.bizContent);
  290. const data = JSON.parse(res.bizContent)
  291. console.log(data);
  292. uni.navigateBack({
  293. delta: 1
  294. });
  295. });
  296. }
  297. onLoad((options) => {
  298. console.log(options.customerId);
  299. state.form.customerId = options.customerId
  300. })
  301. </script>
  302. <style>
  303. page {
  304. background: #eef7f7;
  305. }
  306. </style>
  307. <style lang="scss" scoped>
  308. ::v-deep .u-size-mini {
  309. white-space: nowrap;
  310. }
  311. .main {
  312. // overflow: hidden;
  313. .content {
  314. padding: 50rpx 30rpx 50rpx 30rpx;
  315. .action {
  316. padding-left: 20rpx;
  317. padding-right: 20rpx;
  318. padding-bottom: 30rpx;
  319. .button {
  320. height: 80rpx;
  321. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  322. border-radius: 40rpx;
  323. font-size: 32rpx;
  324. font-weight: 400;
  325. color: #ffffff;
  326. line-height: 80rpx;
  327. }
  328. }
  329. .item-tips {
  330. .title {
  331. font-size: 30rpx;
  332. font-family: Microsoft YaHei;
  333. font-weight: 400;
  334. color: #000000;
  335. line-height: 24rpx;
  336. }
  337. .tip {
  338. margin-top: 16rpx;
  339. font-size: 24rpx;
  340. font-family: Microsoft YaHei;
  341. font-weight: 400;
  342. color: #999999;
  343. line-height: 24rpx;
  344. }
  345. }
  346. .picture-wrapper {
  347. margin-top: 40rpx;
  348. .bg {
  349. background: #ffffff;
  350. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  351. border-radius: 20rpx;
  352. padding: 40rpx;
  353. display: flex;
  354. // align-items: center;
  355. justify-content: space-between;
  356. .name {
  357. font-size: 34rpx;
  358. font-family: Microsoft YaHei;
  359. font-weight: 400;
  360. color: #000000;
  361. line-height: 34rpx;
  362. }
  363. .value {
  364. margin-top: 20rpx;
  365. font-size: 24rpx;
  366. font-family: Microsoft YaHei;
  367. font-weight: 400;
  368. color: #999999;
  369. line-height: 24rpx;
  370. }
  371. .tip {
  372. margin-top: 20rpx;
  373. text-align: center;
  374. width: 110rpx;
  375. height: 40rpx;
  376. background: rgba(33, 190, 177, 0.2);
  377. border-radius: 6rpx;
  378. .tip-value {
  379. font-size: 20rpx;
  380. font-family: Microsoft YaHei;
  381. font-weight: 400;
  382. color: #0a8f8a;
  383. line-height: 40rpx;
  384. opacity: 1;
  385. }
  386. }
  387. }
  388. .icon {
  389. width: 294rpx;
  390. height: 188rpx;
  391. }
  392. }
  393. .shibie-wrapper {
  394. margin-top: 40rpx;
  395. background: #fff;
  396. padding: 40rpx 30rpx;
  397. border-radius: 20rpx;
  398. box-shadow: 0 4rpx 13rpx 3rpx rgba(223, 223, 223, .8);
  399. .title {
  400. font-size: 30rpx;
  401. font-family: Microsoft YaHei;
  402. font-weight: 400;
  403. color: #000000;
  404. line-height: 30rpx;
  405. }
  406. .phoneBox {
  407. ::v-deep .u-form-item--right__content__slot {
  408. display: flex;
  409. .btn {
  410. flex: 1;
  411. background: transparent;
  412. font-size: 30rpx;
  413. color: #15E5C1;
  414. z-index: 999;
  415. }
  416. }
  417. }
  418. }
  419. .buchong-wrapper {
  420. margin-top: 60rpx;
  421. .title {
  422. font-size: 30rpx;
  423. font-family: Microsoft YaHei;
  424. font-weight: 400;
  425. color: #000000;
  426. line-height: 30rpx;
  427. }
  428. }
  429. .green-tip {
  430. margin-top: 50rpx;
  431. font-size: 24rpx;
  432. font-family: Microsoft YaHei;
  433. font-weight: 400;
  434. color: #00b38b;
  435. line-height: 24rpx;
  436. margin-bottom: 60rpx;
  437. }
  438. }
  439. }
  440. </style>