Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

opening-account-unit.vue 18KB

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