Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

opening-account-unit.vue 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. <template>
  2. <navBar title="ETC开户新办申请-单位" :scrollTop="scrollTop"></navBar>
  3. <navBgCar></navBgCar>
  4. <view class="content-wrap">
  5. <view class="item-tips">
  6. <view class="title"> 上传后请核对识别信息 </view>
  7. <view class="tip"> 如有错误请及时手动修改 </view>
  8. </view>
  9. <view class="picture-wrapper" @click="cardImageOcrYY()">
  10. <view class="bg">
  11. <view class="">
  12. <view class="name"> 营业执照 </view>
  13. <view class="value"> 上传企业的营业执照 </view>
  14. <view class="tip">
  15. <view class="tip-value"> 拍摄规范 </view>
  16. </view>
  17. </view>
  18. <image v-if="!state.form.posImgUrl" class="icon" :src="`${$imgUrl}applyCard/zhizhao.png`">
  19. </image>
  20. <image v-else class="icon" :src="strReplace(state.form.posImgUrl)"></image>
  21. </view>
  22. </view>
  23. <view class="picture-wrapper" @click="cardImageOcr('1')">
  24. <view class="bg">
  25. <view class="">
  26. <view class="name"> 人像面 </view>
  27. <view class="value"> 上传身份证的人像面 </view>
  28. <view class="tip">
  29. <view class="tip-value"> 拍摄规范 </view>
  30. </view>
  31. </view>
  32. <image v-if="!state.form.agentPosImgUrl" class="icon" :src="`${$imgUrl}applyCard/renxiang.png`">
  33. </image>
  34. <image v-else class="icon" :src="strReplace(state.form.agentPosImgUrl)"></image>
  35. </view>
  36. </view>
  37. <view class="picture-wrapper" @click="cardImageOcr('2')">
  38. <view class="bg">
  39. <view class="">
  40. <view class="name"> 国徽面 </view>
  41. <view class="value"> 上传身份证的国徽面 </view>
  42. <view class="tip">
  43. <view class="tip-value"> 拍摄规范 </view>
  44. </view>
  45. </view>
  46. <image v-if="!state.form.agentNegImgUrl" class="icon" :src="`${$imgUrl}applyCard/guohui.png`">
  47. </image>
  48. <image v-else class="icon" :src="strReplace(state.form.agentNegImgUrl)"></image>
  49. </view>
  50. </view>
  51. <view class="picture-wrapper" @click="cardFileImageUpdate()">
  52. <view class="bg">
  53. <view class="">
  54. <view class="name"> 委托书 </view>
  55. <view class="value"> 上传文字清晰的委托书 </view>
  56. <view class="tip">
  57. <view class="tip-value"> 拍摄规范 </view>
  58. </view>
  59. </view>
  60. <image v-if="!state.form.proxyUrl" class="icon" :src="`${$imgUrl}applyCard/weituoshu.png`">
  61. </image>
  62. <image v-else class="icon" :src="strReplace(state.form.proxyUrl)"></image>
  63. </view>
  64. </view>
  65. <view class="shibie-wrapper">
  66. <view class="title"> 识别内容如下 </view>
  67. <u-form label-width="200" :model="state.form" ref="uForm">
  68. <u-form-item label="公司名称">
  69. <u-input inputAlign="right" placeholder='请输入公司名称' v-model="state.form.userName" />
  70. </u-form-item>
  71. <u-form-item label="社会信用代码">
  72. <u-input inputAlign="right" placeholder='请输入社会信用代码' v-model="state.form.userIdNum" />
  73. </u-form-item>
  74. <u-form-item label="经办人姓名">
  75. <u-input inputAlign="right" placeholder='请输入经办人姓名' v-model="state.form.agentName" />
  76. </u-form-item>
  77. <u-form-item label="经办人身份证号">
  78. <u-input inputAlign="right" placeholder='请输入经办人身份证号' v-model="state.form.agentIdNum" />
  79. </u-form-item>
  80. <u-form-item label="经办人联系方式">
  81. <u-input inputAlign="right" placeholder='请输入经办人联系方式' v-model="state.form.tel" />
  82. </u-form-item>
  83. </u-form>
  84. </view>
  85. <view class="green-tip">
  86. 如识别信息有误,请手动修改,确认无误后,点击下一步!
  87. </view>
  88. <view class="action">
  89. <button type="default" class="button" @click="savaHandle()">
  90. 下一步
  91. </button>
  92. </view>
  93. </view>
  94. </template>
  95. <script setup lang="ts">
  96. import {
  97. reactive, ref
  98. } from "vue";
  99. import navBgCar from "./components/nav-bg-car3";
  100. import navBar from "../components/nav-bar/nav-bar2.vue";
  101. import {
  102. pathToBase64
  103. } from "@/utils/image-tools/index.js";
  104. import {
  105. ocrAllQuery,
  106. fileUpload,
  107. etcOcrCard,
  108. etcCompanyCardInfoSubmit,
  109. register,
  110. } from "@/utils/network/api.js";
  111. import {
  112. request
  113. } from "@/utils/network/request.js";
  114. import {
  115. stringToJson
  116. } from "@/utils/network/encryption";
  117. import {
  118. onLoad,
  119. onPageScroll,
  120. } from "@dcloudio/uni-app";
  121. import {
  122. setItem,
  123. getItem,
  124. } from "@/utils/storage";
  125. import {
  126. msg,
  127. checkStr
  128. } from "@/utils/utils";
  129. const scrollTop =ref(0);//滚动距离
  130. const state = reactive({
  131. form: {
  132. orderId: "", //订单ID
  133. //营业执照信息
  134. userName: "", //开户名称/账户名称
  135. userIdType: "203", //用户证件类型 203//营业执照
  136. userIdNum: "", //营业执照号码
  137. posImgUrl: "", //营业执照证明
  138. department: '本部', //不超过50个字符,若单位仅开一个账户,填写“本部”
  139. address: "", //单位地址
  140. //经办人信息
  141. agentName: "",
  142. agentIdType: "101",
  143. agentIdNum: "",
  144. agentAddress: "",
  145. agentPhone: "",
  146. agentIdVld: '',
  147. tel: '',
  148. agentGender: '',
  149. agentPosImgUrl: "",
  150. agentNegImgUrl: "",
  151. proxyUrl: "",
  152. sceneType: "", //用户协议支撑服务场景(发行服务机构和用户签订的协议)
  153. channelId: "", //渠道id
  154. opId: '',
  155. orderSource: 'WECHAT',
  156. },
  157. orderId: "",
  158. vehiclePlateColor: ''
  159. });
  160. const savaHandle = () => {
  161. if (state.form.agentGender === '男') {
  162. state.form.agentGender = 'MAN'
  163. } else {
  164. state.form.agentGender = 'WOMAN'
  165. }
  166. if (!checkStr(state.form.agentIdNum, 'card')) {
  167. msg('请输入正确身份证');
  168. return;
  169. }
  170. if (!checkStr(state.form.tel, 'mobile')) {
  171. msg('请输入正确手机号');
  172. return;
  173. }
  174. //如果未登录||新用户
  175. if (!getItem('openId')) {
  176. let data = {
  177. userType: "ENTERPRISE",
  178. idNum: state.form.userIdNum,
  179. idType: state.form.userIdType,
  180. mobile: state.form.tel,
  181. name: state.form.userName,
  182. gender: 'UNKOWN',
  183. certifyChannel: "BAIDUOCR",
  184. address: state.form.address,
  185. agentIdNum: state.form.agentIdNum,
  186. agentIdType: state.form.agentIdType,
  187. agentName: state.form.agentName,
  188. department: state.form.department,
  189. userIdImgUrl: state.form.posImgUrl,
  190. userIdImgBase64: "",
  191. }
  192. const options = {
  193. type: 2,
  194. data: data,
  195. method: "POST",
  196. showLoading: true,
  197. };
  198. request(register, options).then((res) => {
  199. let result = stringToJson(res.bizContent);
  200. if (result.accessToken && result.openId) {
  201. setItem('token', result.accessToken)
  202. setItem('openId', result.openId)
  203. state.form.opId = result.openId;
  204. let data = state.form;
  205. const options = {
  206. type: 2,
  207. data: data,
  208. method: "POST",
  209. showLoading: true,
  210. };
  211. request(etcCompanyCardInfoSubmit, options).then((res) => {
  212. // let result = stringToJson(res.bizContent);
  213. console.log(res);
  214. uni.redirectTo({
  215. url: `/applyCard/car-release?orderId=${state.orderId}&vehiclePlateColor=${state.vehiclePlateColor}&type=1`,
  216. });
  217. });
  218. }
  219. })
  220. }else{
  221. var data = state.form;
  222. const options = {
  223. type: 2,
  224. data: data,
  225. method: "POST",
  226. showLoading: true,
  227. };
  228. request(etcCompanyCardInfoSubmit, options).then((res) => {
  229. const data = stringToJson(res.bizContent);
  230. uni.redirectTo({
  231. url: `/applyCard/car-release?orderId=${state.orderId}&&vehiclePlateColor=${state.vehiclePlateColor}`,
  232. });
  233. });
  234. }
  235. };
  236. onLoad((option: any) => {
  237. state.form.orderId = option.orderId;
  238. state.orderId = option.orderId;
  239. state.vehiclePlateColor = option.vehiclePlateColor;
  240. });
  241. //监听页面滚动
  242. onPageScroll((e) => {
  243. scrollTop.value = e.scrollTop;
  244. });
  245. //营业执照Orc接口调用
  246. const cardImageOcrYY = () => {
  247. uni.chooseImage({
  248. count: 1, //只能选取一张照片
  249. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  250. sourceType: ["camera", "album"], //从相册选择
  251. success: function(res) {
  252. pathToBase64(res.tempFilePaths[0])
  253. .then((path) => {
  254. var data = {
  255. type: 'business_license',
  256. base64: path,
  257. };
  258. const options = {
  259. type: 2,
  260. data: data,
  261. method: "POST",
  262. showLoading: true,
  263. };
  264. request(ocrAllQuery, options).then((res) => {
  265. const data = stringToJson(res.bizContent);
  266. if (data.result) {
  267. state.form.userName = stringToJson(data.result
  268. .businessLicense)[
  269. '名称'];
  270. state.form.userIdNum = stringToJson(data.result
  271. .businessLicense)[
  272. '统一社会信用代码'];
  273. cardFileImageUpdateyy(path)
  274. }
  275. });
  276. })
  277. .catch((error) => {});
  278. },
  279. });
  280. };
  281. const cardImageOcr = (val: any) => {
  282. var imageType = val;
  283. uni.chooseImage({
  284. count: 1, //只能选取一张照片
  285. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  286. sourceType: ["camera", "album"], //从相册选择
  287. success: function(res) {
  288. pathToBase64(res.tempFilePaths[0])
  289. .then((path) => {
  290. var data = {
  291. source: "WECHAT",
  292. agencyId: "52010106004",
  293. imageType: imageType,
  294. fileName: res.tempFilePaths[0],
  295. imageBase64: path,
  296. };
  297. const options = {
  298. type: 2,
  299. data: data,
  300. method: "POST",
  301. showLoading: true,
  302. };
  303. request(etcOcrCard, options).then((res) => {
  304. const data = stringToJson(res.bizContent);
  305. if (val === "1") {
  306. state.form.agentName = data.name;
  307. state.form.agentIdNum = data.idno;
  308. state.form.agentPosImgUrl = data.imageUrl;
  309. state.form.address = data.address;
  310. state.form.agentGender = data.gender;
  311. } else {
  312. state.form.agentIdVld = data.enddate;
  313. state.form.agentNegImgUrl = data.imageUrl;
  314. }
  315. });
  316. })
  317. .catch((error) => {});
  318. },
  319. });
  320. };
  321. //委托书获取图片给后端
  322. const cardFileImageUpdateyy = (val: any) => {
  323. var data = {
  324. fileBase64: val,
  325. };
  326. const options = {
  327. type: 2,
  328. data: data,
  329. method: "POST",
  330. showLoading: true,
  331. };
  332. request(fileUpload, options).then((res) => {
  333. const data = stringToJson(res.bizContent);
  334. state.form.posImgUrl = data.data.url;
  335. });
  336. };
  337. const cardFileImageUpdate = () => {
  338. uni.chooseImage({
  339. count: 1, //只能选取一张照片
  340. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  341. sourceType: ["camera", "album"], //从相册选择
  342. success: function(res) {
  343. pathToBase64(res.tempFilePaths[0])
  344. .then((path) => {
  345. var data = {
  346. fileBase64: path,
  347. };
  348. const options = {
  349. type: 2,
  350. data: data,
  351. method: "POST",
  352. showLoading: true,
  353. };
  354. request(fileUpload, options).then((res) => {
  355. const data = stringToJson(res.bizContent);
  356. state.form.proxyUrl = data.data.url;
  357. });
  358. })
  359. .catch((error) => {});
  360. },
  361. });
  362. };
  363. //替换图片地址
  364. const strReplace = (str: string) => {
  365. return str.replace('192.168.101.145:9000', '222.85.144.89:19002')
  366. }
  367. </script>
  368. <style lang="scss" scoped>
  369. .content-wrap {
  370. position: relative;
  371. margin-top: -50rpx;
  372. padding: 0rpx 30rpx;
  373. position: relative;
  374. .action {
  375. padding-left: 20rpx;
  376. padding-right: 20rpx;
  377. padding-bottom: 30rpx;
  378. .button {
  379. height: 80rpx;
  380. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  381. border-radius: 40rpx;
  382. font-size: 32rpx;
  383. font-weight: 400;
  384. color: #ffffff;
  385. line-height: 80rpx;
  386. }
  387. }
  388. .item-tips {
  389. .title {
  390. font-size: 30rpx;
  391. font-family: Microsoft YaHei;
  392. font-weight: 400;
  393. color: #000000;
  394. line-height: 24rpx;
  395. }
  396. .tip {
  397. margin-top: 16rpx;
  398. font-size: 24rpx;
  399. font-family: Microsoft YaHei;
  400. font-weight: 400;
  401. color: #999999;
  402. line-height: 24rpx;
  403. }
  404. }
  405. .picture-wrapper {
  406. margin-top: 40rpx;
  407. .bg {
  408. background: #ffffff;
  409. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  410. border-radius: 20rpx;
  411. padding: 40rpx;
  412. display: flex;
  413. // align-items: center;
  414. justify-content: space-between;
  415. .name {
  416. font-size: 34rpx;
  417. font-family: Microsoft YaHei;
  418. font-weight: 400;
  419. color: #000000;
  420. line-height: 34rpx;
  421. }
  422. .value {
  423. margin-top: 20rpx;
  424. font-size: 24rpx;
  425. font-family: Microsoft YaHei;
  426. font-weight: 400;
  427. color: #999999;
  428. line-height: 24rpx;
  429. }
  430. .tip {
  431. margin-top: 20rpx;
  432. text-align: center;
  433. width: 110rpx;
  434. height: 40rpx;
  435. background: rgba(33, 190, 177, 0.2);
  436. border-radius: 6rpx;
  437. .tip-value {
  438. font-size: 20rpx;
  439. font-family: Microsoft YaHei;
  440. font-weight: 400;
  441. color: #0a8f8a;
  442. line-height: 40rpx;
  443. opacity: 1;
  444. }
  445. }
  446. }
  447. .icon {
  448. width: 294rpx;
  449. height: 188rpx;
  450. }
  451. }
  452. .shibie-wrapper {
  453. margin-top: 60rpx;
  454. .title {
  455. font-size: 30rpx;
  456. font-family: Microsoft YaHei;
  457. font-weight: 400;
  458. color: #000000;
  459. line-height: 30rpx;
  460. }
  461. }
  462. .buchong-wrapper {
  463. margin-top: 60rpx;
  464. .title {
  465. font-size: 30rpx;
  466. font-family: Microsoft YaHei;
  467. font-weight: 400;
  468. color: #000000;
  469. line-height: 30rpx;
  470. }
  471. }
  472. .green-tip {
  473. margin-top: 50rpx;
  474. font-size: 24rpx;
  475. font-family: Microsoft YaHei;
  476. font-weight: 400;
  477. color: #00b38b;
  478. line-height: 24rpx;
  479. margin-bottom: 60rpx;
  480. }
  481. }
  482. </style>