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.

opening-account-unit.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. <template>
  2. <navBar title="ETC开户新办申请-单位"></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
  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. } from "@dcloudio/uni-app";
  120. import {
  121. setItem,
  122. getItem,
  123. } from "@/utils/storage";
  124. import {
  125. msg,
  126. checkStr
  127. } from "@/utils/utils";
  128. const state = reactive({
  129. form: {
  130. orderId: "", //订单ID
  131. //营业执照信息
  132. userName: "", //开户名称/账户名称
  133. userIdType: "203", //用户证件类型 203//营业执照
  134. userIdNum: "", //营业执照号码
  135. posImgUrl: "", //营业执照证明
  136. department: '本部', //不超过50个字符,若单位仅开一个账户,填写“本部”
  137. address: "", //单位地址
  138. //经办人信息
  139. agentName: "",
  140. agentIdType: "101",
  141. agentIdNum: "",
  142. agentAddress: "",
  143. agentPhone: "",
  144. agentIdVld: '',
  145. tel: '',
  146. agentGender: '',
  147. agentPosImgUrl: "",
  148. agentNegImgUrl: "",
  149. proxyUrl: "",
  150. sceneType: "", //用户协议支撑服务场景(发行服务机构和用户签订的协议)
  151. channelId: "", //渠道id
  152. opId: '',
  153. orderSource: 'WECHAT',
  154. },
  155. orderId: "",
  156. vehiclePlateColor: ''
  157. });
  158. const savaHandle = () => {
  159. if (state.form.agentGender === '男') {
  160. state.form.agentGender = 'MAN'
  161. } else {
  162. state.form.agentGender = 'WOMAN'
  163. }
  164. if (!checkStr(state.form.agentIdNum, 'card')) {
  165. msg('请输入正确身份证');
  166. return;
  167. }
  168. if (!checkStr(state.form.tel, 'mobile')) {
  169. msg('请输入正确手机号');
  170. return;
  171. }
  172. //如果未登录||新用户
  173. if (!getItem('openId')) {
  174. let data = {
  175. userType: "ENTERPRISE",
  176. idNum: state.form.userIdNum,
  177. idType: state.form.userIdType,
  178. mobile: state.form.tel,
  179. name: state.form.userName,
  180. gender: 'UNKOWN',
  181. certifyChannel: "BAIDUOCR",
  182. address: state.form.address,
  183. agentIdNum: state.form.agentIdNum,
  184. agentIdType: state.form.agentIdType,
  185. agentName: state.form.agentName,
  186. department: state.form.department,
  187. userIdImgUrl: state.form.posImgUrl,
  188. userIdImgBase64: "",
  189. }
  190. const options = {
  191. type: 2,
  192. data: data,
  193. method: "POST",
  194. showLoading: true,
  195. };
  196. request(register, options).then((res) => {
  197. let result = stringToJson(res.bizContent);
  198. if (result.accessToken && result.openId) {
  199. setItem('token', result.accessToken)
  200. setItem('openId', result.openId)
  201. state.form.opId = result.openId;
  202. let data = state.form;
  203. const options = {
  204. type: 2,
  205. data: data,
  206. method: "POST",
  207. showLoading: true,
  208. };
  209. request(etcCompanyCardInfoSubmit, options).then((res) => {
  210. // let result = stringToJson(res.bizContent);
  211. console.log(res);
  212. uni.navigateTo({
  213. url: `/applyCard/car-release?orderId=${state.orderId}&vehiclePlateColor=${state.vehiclePlateColor}&type=1`,
  214. });
  215. });
  216. }
  217. })
  218. }else{
  219. var data = state.form;
  220. const options = {
  221. type: 2,
  222. data: data,
  223. method: "POST",
  224. showLoading: true,
  225. };
  226. request(etcCompanyCardInfoSubmit, options).then((res) => {
  227. const data = stringToJson(res.bizContent);
  228. uni.navigateTo({
  229. url: `/applyCard/car-release?orderId=${state.orderId}&&vehiclePlateColor=${state.vehiclePlateColor}`,
  230. });
  231. });
  232. }
  233. };
  234. onLoad((option: any) => {
  235. state.form.orderId = option.orderId;
  236. state.orderId = option.orderId;
  237. state.vehiclePlateColor = option.vehiclePlateColor;
  238. });
  239. //营业执照Orc接口调用
  240. const cardImageOcrYY = () => {
  241. uni.chooseImage({
  242. count: 1, //只能选取一张照片
  243. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  244. sourceType: ["camera", "album"], //从相册选择
  245. success: function(res) {
  246. pathToBase64(res.tempFilePaths[0])
  247. .then((path) => {
  248. var data = {
  249. type: 'business_license',
  250. base64: path,
  251. };
  252. const options = {
  253. type: 2,
  254. data: data,
  255. method: "POST",
  256. showLoading: true,
  257. };
  258. request(ocrAllQuery, options).then((res) => {
  259. const data = stringToJson(res.bizContent);
  260. if (data.result) {
  261. state.form.userName = stringToJson(data.result
  262. .businessLicense)[
  263. '名称'];
  264. state.form.userIdNum = stringToJson(data.result
  265. .businessLicense)[
  266. '统一社会信用代码'];
  267. cardFileImageUpdateyy(path)
  268. }
  269. });
  270. })
  271. .catch((error) => {});
  272. },
  273. });
  274. };
  275. const cardImageOcr = (val: any) => {
  276. var imageType = val;
  277. uni.chooseImage({
  278. count: 1, //只能选取一张照片
  279. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  280. sourceType: ["camera", "album"], //从相册选择
  281. success: function(res) {
  282. pathToBase64(res.tempFilePaths[0])
  283. .then((path) => {
  284. var data = {
  285. source: "WECHAT",
  286. agencyId: "52010106004",
  287. imageType: imageType,
  288. fileName: res.tempFilePaths[0],
  289. imageBase64: path,
  290. };
  291. const options = {
  292. type: 2,
  293. data: data,
  294. method: "POST",
  295. showLoading: true,
  296. };
  297. request(etcOcrCard, options).then((res) => {
  298. const data = stringToJson(res.bizContent);
  299. if (val === "1") {
  300. state.form.agentName = data.name;
  301. state.form.agentIdNum = data.idno;
  302. state.form.agentPosImgUrl = data.imageUrl;
  303. state.form.address = data.address;
  304. state.form.agentGender = data.gender;
  305. } else {
  306. state.form.agentIdVld = data.enddate;
  307. state.form.agentNegImgUrl = data.imageUrl;
  308. }
  309. });
  310. })
  311. .catch((error) => {});
  312. },
  313. });
  314. };
  315. //委托书获取图片给后端
  316. const cardFileImageUpdateyy = (val: any) => {
  317. var data = {
  318. fileBase64: val,
  319. };
  320. const options = {
  321. type: 2,
  322. data: data,
  323. method: "POST",
  324. showLoading: true,
  325. };
  326. request(fileUpload, options).then((res) => {
  327. const data = stringToJson(res.bizContent);
  328. state.form.posImgUrl = data.data.url;
  329. });
  330. };
  331. const cardFileImageUpdate = () => {
  332. uni.chooseImage({
  333. count: 1, //只能选取一张照片
  334. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  335. sourceType: ["camera", "album"], //从相册选择
  336. success: function(res) {
  337. pathToBase64(res.tempFilePaths[0])
  338. .then((path) => {
  339. var data = {
  340. fileBase64: path,
  341. };
  342. const options = {
  343. type: 2,
  344. data: data,
  345. method: "POST",
  346. showLoading: true,
  347. };
  348. request(fileUpload, options).then((res) => {
  349. const data = stringToJson(res.bizContent);
  350. state.form.proxyUrl = data.data.url;
  351. });
  352. })
  353. .catch((error) => {});
  354. },
  355. });
  356. };
  357. //替换图片地址
  358. const strReplace = (str: string) => {
  359. return str.replace('192.168.101.145:9000', '222.85.144.89:19002')
  360. }
  361. </script>
  362. <style lang="scss" scoped>
  363. .content-wrap {
  364. position: relative;
  365. margin-top: -50rpx;
  366. padding: 0rpx 30rpx;
  367. position: relative;
  368. .action {
  369. padding-left: 20rpx;
  370. padding-right: 20rpx;
  371. padding-bottom: 30rpx;
  372. .button {
  373. height: 80rpx;
  374. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  375. border-radius: 40rpx;
  376. font-size: 32rpx;
  377. font-weight: 400;
  378. color: #ffffff;
  379. line-height: 80rpx;
  380. }
  381. }
  382. .item-tips {
  383. .title {
  384. font-size: 30rpx;
  385. font-family: Microsoft YaHei;
  386. font-weight: 400;
  387. color: #000000;
  388. line-height: 24rpx;
  389. }
  390. .tip {
  391. margin-top: 16rpx;
  392. font-size: 24rpx;
  393. font-family: Microsoft YaHei;
  394. font-weight: 400;
  395. color: #999999;
  396. line-height: 24rpx;
  397. }
  398. }
  399. .picture-wrapper {
  400. margin-top: 40rpx;
  401. .bg {
  402. background: #ffffff;
  403. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  404. border-radius: 20rpx;
  405. padding: 40rpx;
  406. display: flex;
  407. // align-items: center;
  408. justify-content: space-between;
  409. .name {
  410. font-size: 34rpx;
  411. font-family: Microsoft YaHei;
  412. font-weight: 400;
  413. color: #000000;
  414. line-height: 34rpx;
  415. }
  416. .value {
  417. margin-top: 20rpx;
  418. font-size: 24rpx;
  419. font-family: Microsoft YaHei;
  420. font-weight: 400;
  421. color: #999999;
  422. line-height: 24rpx;
  423. }
  424. .tip {
  425. margin-top: 20rpx;
  426. text-align: center;
  427. width: 110rpx;
  428. height: 40rpx;
  429. background: rgba(33, 190, 177, 0.2);
  430. border-radius: 6rpx;
  431. .tip-value {
  432. font-size: 20rpx;
  433. font-family: Microsoft YaHei;
  434. font-weight: 400;
  435. color: #0a8f8a;
  436. line-height: 40rpx;
  437. opacity: 1;
  438. }
  439. }
  440. }
  441. .icon {
  442. width: 294rpx;
  443. height: 188rpx;
  444. }
  445. }
  446. .shibie-wrapper {
  447. margin-top: 60rpx;
  448. .title {
  449. font-size: 30rpx;
  450. font-family: Microsoft YaHei;
  451. font-weight: 400;
  452. color: #000000;
  453. line-height: 30rpx;
  454. }
  455. }
  456. .buchong-wrapper {
  457. margin-top: 60rpx;
  458. .title {
  459. font-size: 30rpx;
  460. font-family: Microsoft YaHei;
  461. font-weight: 400;
  462. color: #000000;
  463. line-height: 30rpx;
  464. }
  465. }
  466. .green-tip {
  467. margin-top: 50rpx;
  468. font-size: 24rpx;
  469. font-family: Microsoft YaHei;
  470. font-weight: 400;
  471. color: #00b38b;
  472. line-height: 24rpx;
  473. margin-bottom: 60rpx;
  474. }
  475. }
  476. </style>