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

opening-account-unit.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  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="takePhotoMode('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="takePhotoMode('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" class="clearBg" placeholder='请输入公司名称' v-model="state.form.userName" />
  70. </u-form-item>
  71. <u-form-item label="部门名称">
  72. <u-input inputAlign="right" class="clearBg" placeholder='请输入部门名称' v-model="state.form.department" />
  73. </u-form-item>
  74. <u-form-item label="社会信用代码">
  75. <u-input inputAlign="right" class="clearBg" placeholder='请输入社会信用代码'
  76. v-model="state.form.userIdNum" />
  77. </u-form-item>
  78. <u-form-item label="经办人姓名">
  79. <u-input inputAlign="right" class="clearBg" placeholder='请输入经办人姓名' v-model="state.form.agentName" />
  80. </u-form-item>
  81. <u-form-item label="经办人身份证号">
  82. <u-input inputAlign="right" class="clearBg" placeholder='请输入经办人身份证号'
  83. v-model="state.form.agentIdNum" />
  84. </u-form-item>
  85. <u-form-item label="经办人联系方式">
  86. <u-input inputAlign="right" class="clearBg" placeholder='请输入经办人联系方式' v-model="state.form.tel" />
  87. </u-form-item>
  88. </u-form>
  89. </view>
  90. <view class="green-tip">
  91. 如识别信息有误,请手动修改,确认无误后,点击下一步!
  92. </view>
  93. <view class="action">
  94. <button type="default" class="button" @click="savaHandle()">
  95. 下一步
  96. </button>
  97. </view>
  98. <view class="choice-takePhoto-wrap" v-if="state.isTakePhotoModeShow" @click="cancle">
  99. <view class="choice-takePhoto">
  100. <view @click.stop="takePhoto(state.choiceIndex)" style="border-radius: 20rpx 20rpx 0 0;">拍照</view>
  101. <view @click.stop="xiangce(state.choiceIndex)">从手机相册选择</view>
  102. <view @click.stop="cancle">取消</view>
  103. </view>
  104. </view>
  105. <viewfinder v-if="state.phoneType" :phoneType="state.phoneType" :images="state.images"
  106. :showStartPhoto="state.showImg" @confirmReturn="confirmReturn" @camera="camera"></viewfinder>
  107. </view>
  108. </template>
  109. <script setup lang="ts">
  110. import {
  111. reactive, ref
  112. } from "vue";
  113. import navBgCar from "./components/nav-bg-car3";
  114. import navBar from "@/components/nav-bar/nav-bar2.vue";
  115. import viewfinder from "../../components/viewfinder.vue"
  116. import {
  117. ocrAllQuery,
  118. fileUpload,
  119. envs,
  120. etcOcrCard,
  121. etcCompanyCardInfoSubmit,
  122. register,
  123. } from "@/utils/network/api.js";
  124. import {
  125. request
  126. } from "@/utils/network/request.js";
  127. import {
  128. stringToJson
  129. } from "@/utils/network/encryption";
  130. import {
  131. onLoad,
  132. onPageScroll,
  133. } from "@dcloudio/uni-app";
  134. import {
  135. setItem,
  136. getItem,
  137. } from "@/utils/storage";
  138. import {
  139. msg,
  140. checkStr,
  141. strReplace,
  142. uploadFile
  143. } from "@/utils/utils";
  144. const scrollTop = ref(0);//滚动距离
  145. const state = reactive({
  146. phoneType: 0, // 1 身份证正面 2 身份证反面 3行驶证正面 4行驶证反面
  147. choiceIndex: 1, // 1 身份证正面 2 身份证反面
  148. isTakePhotoModeShow: false, //选择拍照方式是否出来
  149. images: '',
  150. showImg: true,
  151. form: {
  152. orderId: "", //订单ID
  153. //营业执照信息
  154. userName: "", //开户名称/账户名称
  155. userIdType: "203", //用户证件类型 203//营业执照
  156. userIdNum: "", //营业执照号码
  157. posImgUrl: "", //营业执照证明
  158. department: '本部', //不超过50个字符,若单位仅开一个账户,填写“本部”
  159. address: "", //单位地址
  160. //经办人信息
  161. agentName: "",
  162. agentIdType: "101",
  163. agentIdNum: "",
  164. agentAddress: "",
  165. agentPhone: "",
  166. agentIdVld: '',
  167. tel: '',
  168. agentGender: '',
  169. agentPosImgUrl: "",
  170. agentNegImgUrl: "",
  171. negImgUrl: "", //这个参数和国徽面一样的,都要传
  172. proxyUrl: "",
  173. sceneType: "", //用户协议支撑服务场景(发行服务机构和用户签订的协议)
  174. channelId: "", //渠道id
  175. opId: '',
  176. orderSource: 'WECHAT',
  177. },
  178. orderId: "",
  179. vehiclePlateColor: '',
  180. isSign: '',
  181. type: 1
  182. });
  183. const savaHandle = () => {
  184. if (state.form.agentGender === '男') {
  185. state.form.agentGender = 'MAN'
  186. } else {
  187. state.form.agentGender = 'WOMAN'
  188. }
  189. if (!state.form.posImgUrl) {
  190. msg('请上传营业执照');
  191. return;
  192. }
  193. if (!state.form.agentPosImgUrl) {
  194. msg('上传身份证的人像面');
  195. return;
  196. }
  197. if (!state.form.agentNegImgUrl) {
  198. msg('上传身份证的国徽面');
  199. return;
  200. }
  201. if (!state.form.proxyUrl) {
  202. msg('上传身份证的委托书');
  203. return;
  204. }
  205. if (!state.form.userName) {
  206. msg('请输入公司名称');
  207. return;
  208. }
  209. if (!state.form.department) {
  210. msg('请输入部门名称');
  211. return;
  212. }
  213. if (!state.form.userIdNum) {
  214. msg('请输入社会信用代码');
  215. return;
  216. }
  217. if (!state.form.agentName) {
  218. msg('请输入经办人姓名');
  219. return;
  220. }
  221. if (!checkStr(state.form.agentIdNum, 'card')) {
  222. msg('请输入正确的经办人身份证号');
  223. return;
  224. }
  225. if (!checkStr(state.form.tel, 'mobile')) {
  226. msg('请输入正确的经办人联系方式');
  227. return;
  228. }
  229. //如果未登录||新用户
  230. if (!getItem('openId')) {
  231. let data = {
  232. userType: "ENTERPRISE",
  233. idNum: state.form.userIdNum,
  234. idType: state.form.userIdType,
  235. mobile: state.form.tel,
  236. userName: state.form.userName,
  237. gender: 'UNKOWN',
  238. certifyChannel: "BAIDUOCR",
  239. address: state.form.address,
  240. agentIdNum: state.form.agentIdNum,
  241. agentIdType: state.form.agentIdType,
  242. agentName: state.form.agentName,
  243. department: state.form.department,
  244. userIdImgUrl: state.form.posImgUrl,
  245. userIdImgBase64: "",
  246. }
  247. const options = {
  248. type: 2,
  249. data: data,
  250. method: "POST",
  251. showLoading: true,
  252. };
  253. request(register, options).then((res) => {
  254. let result = stringToJson(res.bizContent);
  255. if (result.accessToken && result.openId) {
  256. setItem('token', result.accessToken)
  257. setItem('openId', result.openId)
  258. state.form.opId = result.openId;
  259. let data = state.form;
  260. const options = {
  261. type: 2,
  262. data: data,
  263. method: "POST",
  264. showLoading: true,
  265. };
  266. request(etcCompanyCardInfoSubmit, options).then((res) => {
  267. console.log(res);
  268. uni.redirectTo({
  269. url: `/subpackage/orders/car-release?orderId=${state.orderId}&vehiclePlateColor=${state.vehiclePlateColor}&type=${state.type}`,
  270. });
  271. });
  272. }
  273. })
  274. } else {
  275. var data = state.form;
  276. const options = {
  277. type: 2,
  278. data: data,
  279. method: "POST",
  280. showLoading: true,
  281. };
  282. request(etcCompanyCardInfoSubmit, options).then((res) => {
  283. const data = stringToJson(res.bizContent);
  284. uni.redirectTo({
  285. url: `/subpackage/orders/car-release?orderId=${state.orderId}&vehiclePlateColor=${state.vehiclePlateColor}&type=${state.type}`,
  286. });
  287. });
  288. }
  289. };
  290. onLoad((option : any) => {
  291. state.form.orderId = option.orderId;
  292. state.orderId = option.orderId;
  293. state.vehiclePlateColor = option.vehiclePlateColor;
  294. state.form.opId = getItem('openId') ? getItem('openId') : '';
  295. state.isSign = option.isSign;
  296. state.type = option.type;
  297. console.log("state.type", option)
  298. });
  299. //监听页面滚动
  300. onPageScroll((e) => {
  301. scrollTop.value = e.scrollTop;
  302. });
  303. //营业执照Orc接口调用
  304. const cardImageOcrYY = () => {
  305. uni.chooseImage({
  306. count: 1, //只能选取一张照片
  307. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  308. sourceType: ["camera", "album"], //从相册选择
  309. success: function (res) {
  310. uploadFile(res.tempFilePaths[0], "", ocrAllQuery).then((data) => {
  311. if (data.result) {
  312. state.form.userName = stringToJson(data.result
  313. .businessLicense)[
  314. '名称'];
  315. state.form.userIdNum = stringToJson(data.result
  316. .businessLicense)[
  317. '统一社会信用代码'];
  318. uploadFile(res.tempFilePaths[0], "", "").then((data) => {
  319. state.form.posImgUrl = data;
  320. })
  321. }
  322. })
  323. },
  324. });
  325. };
  326. const camera = () => {
  327. state.phoneType = 0
  328. }
  329. const cardFileImageUpdate = () => {
  330. uni.chooseImage({
  331. count: 1, //只能选取一张照片
  332. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  333. sourceType: ["camera", "album"], //从相册选择
  334. success: function (res) {
  335. uploadFile(res.tempFilePaths[0], "", "").then((data) => {
  336. state.form.proxyUrl = data;
  337. })
  338. },
  339. });
  340. };
  341. const takePhotoMode = (index) => {
  342. console.log("index", index)
  343. state.isTakePhotoModeShow = true
  344. state.choiceIndex = index
  345. }
  346. const xiangce = (val) => {
  347. console.log("val", val)
  348. var imageType = val;
  349. uni.chooseImage({
  350. count: 1, //只能选取一张照片
  351. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  352. sourceType: ["album"], //从相册选择
  353. success: function (res) {
  354. state.showImg = false
  355. state.images = res.tempFilePaths[0]
  356. state.phoneType = state.choiceIndex
  357. state.isTakePhotoModeShow = false
  358. console.log("tempFilePaths[0].startsWith('file://')", res.tempFilePaths[0], res.tempFilePaths[0].startsWith('file://'))
  359. },
  360. })
  361. }
  362. const takePhoto = (val) => {
  363. console.log("拍照", val)
  364. state.showImg = true
  365. state.phoneType = val;
  366. }
  367. const confirmReturn = (val) => {
  368. state.phoneType = 0
  369. state.isTakePhotoModeShow = false
  370. var imageType = state.choiceIndex;
  371. console.log("图片地址val", val.tempImagePath)
  372. uploadFile(val.tempImagePath, imageType, etcOcrCard).then((data) => {
  373. console.log("身份证上传", data)
  374. if (state.choiceIndex === "1") {
  375. state.form.agentName = data.name;
  376. state.form.agentIdNum = data.idno;
  377. state.form.agentPosImgUrl = data.imageUrl;
  378. state.form.address = data.address;
  379. state.form.agentGender = data.gender;
  380. } else {
  381. state.form.agentIdVld = data.enddate;
  382. state.form.agentNegImgUrl = data.imageUrl;
  383. state.form.negImgUrl = data.imageUrl;
  384. }
  385. state.isTakePhotoModeShow = false
  386. })
  387. }
  388. const cancle = () => {
  389. state.isTakePhotoModeShow = false
  390. }
  391. </script>
  392. <style lang="scss" scoped>
  393. .content-wrap {
  394. position: relative;
  395. margin-top: -50rpx;
  396. padding: 0rpx 30rpx;
  397. position: relative;
  398. .action {
  399. padding-left: 20rpx;
  400. padding-right: 20rpx;
  401. padding-bottom: 30rpx;
  402. .button {
  403. height: 80rpx;
  404. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  405. border-radius: 40rpx;
  406. font-size: 32rpx;
  407. font-weight: 400;
  408. color: #ffffff;
  409. line-height: 80rpx;
  410. }
  411. }
  412. .item-tips {
  413. .title {
  414. font-size: 30rpx;
  415. font-family: Microsoft YaHei;
  416. font-weight: 400;
  417. color: #000000;
  418. line-height: 24rpx;
  419. }
  420. .tip {
  421. margin-top: 16rpx;
  422. font-size: 24rpx;
  423. font-family: Microsoft YaHei;
  424. font-weight: 400;
  425. color: #999999;
  426. line-height: 24rpx;
  427. }
  428. }
  429. .picture-wrapper {
  430. margin-top: 40rpx;
  431. .bg {
  432. background: #ffffff;
  433. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  434. border-radius: 20rpx;
  435. padding: 40rpx;
  436. display: flex;
  437. // align-items: center;
  438. justify-content: space-between;
  439. .name {
  440. font-size: 34rpx;
  441. font-family: Microsoft YaHei;
  442. font-weight: 400;
  443. color: #000000;
  444. line-height: 34rpx;
  445. }
  446. .value {
  447. margin-top: 20rpx;
  448. font-size: 24rpx;
  449. font-family: Microsoft YaHei;
  450. font-weight: 400;
  451. color: #999999;
  452. line-height: 24rpx;
  453. }
  454. .tip {
  455. margin-top: 20rpx;
  456. text-align: center;
  457. width: 110rpx;
  458. height: 40rpx;
  459. background: rgba(33, 190, 177, 0.2);
  460. border-radius: 6rpx;
  461. .tip-value {
  462. font-size: 20rpx;
  463. font-family: Microsoft YaHei;
  464. font-weight: 400;
  465. color: #0a8f8a;
  466. line-height: 40rpx;
  467. opacity: 1;
  468. }
  469. }
  470. }
  471. .icon {
  472. width: 294rpx;
  473. height: 188rpx;
  474. }
  475. }
  476. .shibie-wrapper {
  477. margin-top: 60rpx;
  478. .title {
  479. font-size: 30rpx;
  480. font-family: Microsoft YaHei;
  481. font-weight: 400;
  482. color: #000000;
  483. line-height: 30rpx;
  484. }
  485. }
  486. .buchong-wrapper {
  487. margin-top: 60rpx;
  488. .title {
  489. font-size: 30rpx;
  490. font-family: Microsoft YaHei;
  491. font-weight: 400;
  492. color: #000000;
  493. line-height: 30rpx;
  494. }
  495. }
  496. .green-tip {
  497. margin-top: 50rpx;
  498. font-size: 24rpx;
  499. font-family: Microsoft YaHei;
  500. font-weight: 400;
  501. color: #00b38b;
  502. line-height: 24rpx;
  503. margin-bottom: 60rpx;
  504. }
  505. }
  506. ::v-deep .u-input__input {
  507. background: transparent;
  508. }
  509. ::v-deep .u-form-item--left .u-form-item--left__content {
  510. padding-right: 0px;
  511. }
  512. .choice-takePhoto {
  513. position: absolute;
  514. bottom: 0;
  515. background-color: white;
  516. width: 100%;
  517. border-radius: 20rpx 20rpx 0 0;
  518. }
  519. .choice-takePhoto>view:first-child {
  520. text-align: center;
  521. height: 80rpx;
  522. line-height: 80rpx;
  523. border-bottom: 1rpx solid rgba(127, 127, 127, 0.3);
  524. background-color: white;
  525. }
  526. .choice-takePhoto>view:last-child {
  527. text-align: center;
  528. height: 80rpx;
  529. line-height: 80rpx;
  530. border-top: 6rpx solid rgba(127, 127, 127, 0.1);
  531. background-color: white;
  532. }
  533. .choice-takePhoto>view {
  534. text-align: center;
  535. height: 80rpx;
  536. line-height: 80rpx;
  537. background-color: white;
  538. }
  539. .choice-takePhoto-wrap {
  540. width: 100%;
  541. height: 100vh;
  542. background-color: rgba(127, 127, 127, 0.2);
  543. position: fixed;
  544. left: 0;
  545. top: 0;
  546. z-index: 11111;
  547. }
  548. </style>