您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

user-card.vue 10KB

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