uni-OCRUploadPopup.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917
  1. <template>
  2. <view class='uni-page'>
  3. <u-popup :show="OCRUploadPopup" @close="close" closeable round="20rpx">
  4. <view class="dis dis header a-end j-c">
  5. <u-tabs :list="list" @click="click" :activeStyle="{color:'#333',fontWeight:'bold'}"
  6. :inactiveStyle="{color:'#999'}" :current="current" :scrollable="true" lineColor="#FDE935"
  7. lineWidth="100rpx"></u-tabs>
  8. </view>
  9. <view class="content">
  10. <!-- 车辆类型显示内容 -->
  11. <template v-if="checkType=='carInfo'">
  12. <view class="img" v-if="current==0">
  13. <image :src="carfrontImg?carfrontImg:'/static/image/carbackimg.png'" mode=""
  14. @click="carfrontChange"></image>
  15. </view>
  16. <view class="img" v-else>
  17. <image :src="carbackImg?carbackImg:'/static/image/carbackimg.png'" mode=""
  18. @click="carbackChange">
  19. </image>
  20. </view>
  21. </template>
  22. <template v-else>
  23. <!-- 人员信息显示内容 -->
  24. <template v-if="current==0">
  25. <!-- 正反面区分按钮 -->
  26. <view class="user-Subsection dis a-c">
  27. <view class="item dis a-c j-c " :class="[toggleModeIndex==index?'active':'']"
  28. v-for="(item,index) in toggleMode" :key="index" @click="Subsectionclick(index)">
  29. {{item.name}}
  30. </view>
  31. </view>
  32. <view class="img" v-if="toggleModeIndex==0">
  33. <image :src="userfrontImg?userfrontImg:'/static/image/userfrontImg.png'" mode=""
  34. @click="userfrontChange"></image>
  35. </view>
  36. <view class="img" v-else>
  37. <image :src="userbackImg?userbackImg:'/static/image/userbackImg.png'" mode=""
  38. @click="userbackChange">
  39. </image>
  40. </view>
  41. </template>
  42. <template v-else>
  43. <view class="img">
  44. <image :src="businessLicenseImg?businessLicenseImg:'/static/image/businessLicenseimg.png'"
  45. mode="" @click="businessLicenseChange"></image>
  46. </view>
  47. </template>
  48. </template>
  49. <view class="footer dis a-c j-s mt-2">
  50. <u-button class="btn" type="primary" text="关闭" shape="circle" plain color="#FDE935"
  51. :hairline="false" style="margin-right: 20px;" @click="close"></u-button>
  52. <u-button class="btn" type="primary" text="确定" shape="circle" color="#FDE935"
  53. v-if="checkType=='carInfo'" :disabled="!carfrontImg && !carbackImg" :hairline="false"
  54. @click="ocrInt"></u-button>
  55. <u-button class="btn" type="primary" text="确定" shape="circle" color="#FDE935"
  56. v-if="checkType=='ownerInfo'" :disabled="!userfrontImg && !userbackImg && !businessLicenseImg"
  57. :hairline="false" @click="ownerInfoInt"></u-button>
  58. <u-button class="btn" type="primary" text="确定" shape="circle" color="#FDE935"
  59. v-if="checkType=='policyHolderInfo'"
  60. :disabled="!userfrontImg && !userbackImg && !businessLicenseImg" :hairline="false"
  61. @click="policyHolderInfoInt"></u-button>
  62. <u-button class="btn" type="primary" text="确定" shape="circle" color="#FDE935"
  63. v-if="checkType=='insuredPersonInfo'"
  64. :disabled="!userfrontImg && !userbackImg && !businessLicenseImg" :hairline="false"
  65. @click="insuredPersonInfoInt"></u-button>
  66. </view>
  67. </view>
  68. </u-popup>
  69. </view>
  70. </template>
  71. <script>
  72. import store from '@/store';
  73. export default {
  74. props: {
  75. show: {
  76. type: Boolean,
  77. default: false
  78. },
  79. list: {
  80. type: Array,
  81. default: () => []
  82. },
  83. checkType: {
  84. type: String,
  85. default: 'carInfo'
  86. }
  87. },
  88. data() {
  89. return {
  90. OCRUploadPopup: this.show,
  91. current: 0,
  92. carfrontImg: null, //行驶证正面
  93. carbackImg: null, //行驶证反面
  94. carImageListId: [],
  95. carfront: {},
  96. carback: {},
  97. userfront: {},
  98. userback: {},
  99. userfrontImg: null, //人像面
  100. userbackImg: null, //国徽面
  101. businessLicenseImg: null, //营业执照
  102. businessLicenseInfo: {}, //营业执照识别内容
  103. ownerImageListId: [],
  104. policyHolderImageListId: [],
  105. insuredPersonImageListId: [],
  106. toggleMode: [{
  107. name: "人像面"
  108. }, {
  109. name: "国徽面",
  110. }],
  111. toggleModeIndex: 0,
  112. }
  113. },
  114. watch: {
  115. show(newVal) {
  116. this.OCRUploadPopup = newVal
  117. }
  118. },
  119. onShow() {},
  120. onLoad() {
  121. },
  122. methods: {
  123. Subsectionclick(item) {
  124. this.toggleModeIndex = item;
  125. },
  126. ocrInt() {
  127. let Info = Object.assign({}, this.carfront, this.carback)
  128. if (this.isEmptyObject(Info)) {
  129. uni.showToast({
  130. icon: 'none',
  131. title: '未检测到图片',
  132. duration: 1500
  133. });
  134. } else {
  135. let ImgList = this.carImageListId;
  136. let frontImg = this.carfrontImg;
  137. let backImg = this.carbackImg;
  138. this.$emit('carCallback', {
  139. Info,
  140. ImgList,
  141. frontImg,
  142. backImg,
  143. });
  144. this.userfrontImg = '';
  145. this.userbackImg = '';
  146. this.carfrontImg = '';
  147. this.carbackImg = '';
  148. this.current = 0;
  149. }
  150. },
  151. ownerInfoInt() {
  152. if (this.current == 0) {
  153. let Info = Object.assign({}, this.userfront, this.userback)
  154. if (this.isEmptyObject(Info)) {
  155. uni.showToast({
  156. icon: 'none',
  157. title: '未检测到图片',
  158. duration: 1500
  159. });
  160. } else {
  161. let ImgList = this.ownerImageListId;
  162. let frontImg = this.userfrontImg;
  163. let backImg = this.userbackImg;
  164. this.$emit('ownerInfoCallback', {
  165. Info,
  166. ImgList,
  167. frontImg,
  168. backImg,
  169. });
  170. this.userfrontImg = '';
  171. this.userbackImg = '';
  172. this.carfrontImg = '';
  173. this.carbackImg = '';
  174. this.businessLicenseImg = '';
  175. this.current = 0;
  176. }
  177. } else {
  178. let Info = Object.assign({}, this.businessLicenseInfo)
  179. if (this.isEmptyObject(Info)) {
  180. uni.showToast({
  181. icon: 'none',
  182. title: '未检测到图片',
  183. duration: 1500
  184. });
  185. } else {
  186. let ImgList = this.ownerImageListId;
  187. let businessLicenseImg = this.businessLicenseImg;
  188. this.$emit('ownerInfoCallback', {
  189. Info,
  190. ImgList,
  191. businessLicenseImg,
  192. });
  193. this.userfrontImg = '';
  194. this.userbackImg = '';
  195. this.carfrontImg = '';
  196. this.carbackImg = '';
  197. this.businessLicenseImg = '';
  198. this.current = 0;
  199. }
  200. }
  201. },
  202. policyHolderInfoInt() {
  203. if (this.current == 0) {
  204. let Info = Object.assign({}, this.userfront, this.userback)
  205. if (this.isEmptyObject(Info)) {
  206. uni.showToast({
  207. icon: 'none',
  208. title: '未检测到图片',
  209. duration: 1500
  210. });
  211. } else {
  212. let ImgList = this.policyHolderImageListId;
  213. let frontImg = this.userfrontImg;
  214. let backImg = this.userbackImg;
  215. this.$emit('applicantInfoCallback', {
  216. Info,
  217. ImgList,
  218. frontImg,
  219. backImg,
  220. });
  221. this.userfrontImg = '';
  222. this.userbackImg = '';
  223. this.carfrontImg = '';
  224. this.carbackImg = '';
  225. this.current = 0;
  226. }
  227. } else {
  228. let Info = Object.assign({}, this.businessLicenseInfo)
  229. if (this.isEmptyObject(Info)) {
  230. uni.showToast({
  231. icon: 'none',
  232. title: '未检测到图片',
  233. duration: 1500
  234. });
  235. } else {
  236. let ImgList = this.policyHolderImageListId;
  237. let businessLicenseImg = this.businessLicenseImg;
  238. this.$emit('applicantInfoCallback', {
  239. Info,
  240. ImgList,
  241. businessLicenseImg,
  242. });
  243. this.userfrontImg = '';
  244. this.userbackImg = '';
  245. this.carfrontImg = '';
  246. this.carbackImg = '';
  247. this.businessLicenseImg = '';
  248. this.current = 0;
  249. }
  250. }
  251. },
  252. insuredPersonInfoInt() {
  253. if (this.current == 0) {
  254. let Info = Object.assign({}, this.userfront, this.userback)
  255. if (this.isEmptyObject(Info)) {
  256. uni.showToast({
  257. icon: 'none',
  258. title: '未检测到图片',
  259. duration: 1500
  260. });
  261. } else {
  262. let ImgList = this.insuredPersonImageListId;
  263. let frontImg = this.userfrontImg;
  264. let backImg = this.userbackImg;
  265. this.$emit('InsuredInfoCallback', {
  266. Info,
  267. ImgList,
  268. frontImg,
  269. backImg,
  270. });
  271. this.userfrontImg = '';
  272. this.userbackImg = '';
  273. this.carfrontImg = '';
  274. this.carbackImg = '';
  275. this.businessLicenseImg = '';
  276. this.current = 0;
  277. }
  278. } else {
  279. let Info = Object.assign({}, this.businessLicenseInfo)
  280. if (this.isEmptyObject(Info)) {
  281. uni.showToast({
  282. icon: 'none',
  283. title: '未检测到图片',
  284. duration: 1500
  285. });
  286. } else {
  287. let ImgList = this.insuredPersonImageListId;
  288. let businessLicenseImg = this.businessLicenseImg;
  289. this.$emit('InsuredInfoCallback', {
  290. Info,
  291. ImgList,
  292. businessLicenseImg,
  293. });
  294. this.userfrontImg = '';
  295. this.userbackImg = '';
  296. this.carfrontImg = '';
  297. this.carbackImg = '';
  298. this.businessLicenseImg = '';
  299. this.current = 0;
  300. }
  301. }
  302. },
  303. click(item) {
  304. this.current = item.index;
  305. },
  306. close() {
  307. this.current = 0;
  308. this.$emit('close')
  309. },
  310. isEmptyObject(obj) {
  311. return JSON.stringify(obj) === '{}';
  312. },
  313. //car正面
  314. async carfrontChange() {
  315. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  316. count: 1,
  317. sizeType: ['compressed']
  318. });
  319. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  320. if (!size) {
  321. this.$refs.uToast.show({
  322. title: '上传图片大小不能超过 5MB!',
  323. type: 'error',
  324. })
  325. return false
  326. }
  327. if (chooseImageRes) {
  328. this.carfrontImg = chooseImageRes.tempFilePaths[0];
  329. uni.uploadFile({
  330. url: this.$base.baseUrl + '/file/upload',
  331. filePath: chooseImageRes.tempFilePaths[0],
  332. name: "file",
  333. formData: {
  334. 'type': 'image',
  335. },
  336. header: {
  337. Authorization: store.state.token,
  338. system_code: store.state.system_code ? store.state.system_code : ''
  339. },
  340. success: (imgRes) => {
  341. let data = JSON.parse(imgRes.data);
  342. console.log(data);
  343. if (data.code == '200') {
  344. if (this.carImageListId.some(v => v.imageCode == 'C01')) {
  345. this.carImageListId.map(val => {
  346. if (val.imageCode == 'C01') {
  347. val.imageBase64List[0].imageId = data.data.id;
  348. }
  349. })
  350. } else {
  351. this.carImageListId.push({
  352. imageBase64List: [{
  353. imageId: data.data.id
  354. }],
  355. imageCode: "C01",
  356. })
  357. }
  358. uni.uploadFile({
  359. url: this.$base.baseUrl + '/order/identify/drivingPermit',
  360. filePath: chooseImageRes.tempFilePaths[0],
  361. name: "image1",
  362. header: {
  363. Authorization: store.state.token,
  364. system_code: store.state.system_code ? store.state
  365. .system_code : ''
  366. },
  367. success: (uploadFileRes) => {
  368. let data = JSON.parse(uploadFileRes.data).data;
  369. let rdate = '';
  370. if (!!data.carInfo.registerDate) {
  371. rdate = data.carInfo.registerDate.substr(0,
  372. 4) +
  373. '-' + data.carInfo
  374. .registerDate.substr(4, 2) + '-' + data
  375. .carInfo
  376. .registerDate
  377. .substr(6,
  378. 2)
  379. }
  380. let isdate = '';
  381. if (!!data.carInfo.issueDate) {
  382. isdate = data.carInfo.issueDate.substr(0, 4) +
  383. '-' + data.carInfo
  384. .issueDate.substr(4, 2) + '-' + data
  385. .carInfo
  386. .issueDate.substr(6, 2)
  387. }
  388. this.carfront = {
  389. carOwner: data.carInfo.carOwner, //车主
  390. licenseNo: data.carInfo.plateNo, //车牌号
  391. brandName: data.carInfo.backOcrID, //品牌型号
  392. frameNo: data.carInfo.vin, //车架号
  393. engineNo: data.carInfo.engine, //发动机号
  394. vinNo: data.carInfo.vin, //车架号
  395. issueDate: isdate, //发证日期
  396. registerDate: rdate, //注册日期
  397. carKindCode: data.carInfo
  398. .plateType, //车辆种类
  399. carTypeCode: data.carInfo.category, //车辆类型
  400. carnature: data.carInfo.useNature,
  401. vehicleUseCode: data.carInfo
  402. .vehicleUse, //车辆用途
  403. }
  404. }
  405. });
  406. }
  407. }
  408. });
  409. } else {}
  410. },
  411. async carbackChange() {
  412. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  413. count: 1,
  414. sizeType: ['compressed']
  415. });
  416. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  417. if (!size) {
  418. this.$refs.uToast.show({
  419. title: '上传图片大小不能超过 5MB!',
  420. type: 'error',
  421. })
  422. return false
  423. }
  424. if (chooseImageRes) {
  425. this.carbackImg = chooseImageRes.tempFilePaths[0];
  426. uni.uploadFile({
  427. url: this.$base.baseUrl + '/file/upload',
  428. filePath: chooseImageRes.tempFilePaths[0],
  429. name: "file",
  430. formData: {
  431. 'type': 'image',
  432. },
  433. header: {
  434. Authorization: store.state.token,
  435. system_code: store.state.system_code ? store.state.system_code : ''
  436. },
  437. success: (imgRes) => {
  438. let data = JSON.parse(imgRes.data);
  439. if (data.code == '200') {
  440. if (this.carImageListId.some(v => v.imageCode == 'D01')) {
  441. this.carImageListId.map(val => {
  442. if (val.imageCode == 'D01') {
  443. val.imageBase64List[0].imageId = data.data.id;
  444. }
  445. })
  446. } else {
  447. this.carImageListId.push({
  448. imageBase64List: [{
  449. imageId: data.data.id
  450. }],
  451. imageCode: "D01",
  452. })
  453. }
  454. uni.uploadFile({
  455. url: this.$base.baseUrl + '/order/identify/drivingPermit',
  456. filePath: chooseImageRes.tempFilePaths[0],
  457. name: "image2",
  458. header: {
  459. Authorization: store.state.token,
  460. system_code: store.state.system_code ? store.state
  461. .system_code : ''
  462. },
  463. success: (uploadFileRes) => {
  464. let data1 = JSON.parse(uploadFileRes.data).data;
  465. this.carback = {
  466. vehicleweight: data1.carInfo
  467. .grossMass, //总质量
  468. completeKerbMass: data1.carInfo
  469. .unladenMass, //整备质量
  470. seatCount: data1.carInfo
  471. .approvedPassengersCapacity, //核定载客数
  472. limitLoad: data1.carInfo
  473. .limitLoad, //核定载质量
  474. }
  475. }
  476. });
  477. }
  478. }
  479. });
  480. } else {}
  481. },
  482. async userfrontChange() {
  483. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  484. count: 1,
  485. sizeType: ['compressed']
  486. });
  487. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  488. if (!size) {
  489. this.$refs.uToast.show({
  490. title: '上传图片大小不能超过 5MB!',
  491. type: 'error',
  492. })
  493. return false
  494. }
  495. if (chooseImageRes) {
  496. this.userfrontImg = chooseImageRes.tempFilePaths[0];
  497. uni.uploadFile({
  498. url: this.$base.baseUrl + '/file/upload',
  499. filePath: chooseImageRes.tempFilePaths[0],
  500. name: "file",
  501. formData: {
  502. 'type': 'image',
  503. },
  504. header: {
  505. Authorization: store.state.token,
  506. system_code: store.state.system_code ? store.state.system_code : ''
  507. },
  508. success: (imgRes) => {
  509. let data = JSON.parse(imgRes.data);
  510. if (data.code == '200') {
  511. switch (this.checkType) {
  512. case 'ownerInfo':
  513. if (this.ownerImageListId.some(v => v.imageCode == 'C02')) {
  514. this.ownerImageListId.map(val => {
  515. if (val.imageCode == 'C02') {
  516. val.imageBase64List[0].imageId = data.data.id;
  517. }
  518. })
  519. } else {
  520. this.ownerImageListId.push({
  521. imageBase64List: [{
  522. imageId: data.data.id
  523. }],
  524. imageCode: "C02",
  525. })
  526. }
  527. break;
  528. case 'policyHolderInfo':
  529. if (this.policyHolderImageListId.some(v => v.imageCode ==
  530. 'C03')) {
  531. this.policyHolderImageListId.map(val => {
  532. if (val.imageCode == 'C03') {
  533. val.imageBase64List[0].imageId = data.data.id;
  534. }
  535. })
  536. } else {
  537. this.policyHolderImageListId.push({
  538. imageBase64List: [{
  539. imageId: data.data.id
  540. }],
  541. imageCode: "C03",
  542. })
  543. }
  544. break;
  545. case 'insuredPersonInfo':
  546. if (this.insuredPersonImageListId.some(v => v.imageCode ==
  547. 'C04')) {
  548. this.insuredPersonImageListId.map(val => {
  549. if (val.imageCode == 'C04') {
  550. val.imageBase64List[0].imageId = data.data.id;
  551. }
  552. })
  553. } else {
  554. this.insuredPersonImageListId.push({
  555. imageBase64List: [{
  556. imageId: data.data.id
  557. }],
  558. imageCode: "C04",
  559. })
  560. }
  561. break;
  562. default:
  563. break;
  564. };
  565. uni.uploadFile({
  566. url: this.$base.baseUrl + '/order/identify/idCard',
  567. filePath: chooseImageRes.tempFilePaths[0],
  568. name: "image1",
  569. header: {
  570. Authorization: store.state.token,
  571. system_code: store.state.system_code ? store.state
  572. .system_code : ''
  573. },
  574. success: (uploadFileRes) => {
  575. let data = JSON.parse(uploadFileRes.data).data;
  576. this.userfront = {
  577. name: data.customerInfo.name,
  578. identifyNumber: data.customerInfo
  579. .identifyNumber,
  580. addr: data.customerInfo.addr,
  581. }
  582. }
  583. });
  584. }
  585. }
  586. });
  587. } else {}
  588. },
  589. //身份证背面
  590. async userbackChange() {
  591. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  592. count: 1,
  593. sizeType: ['compressed']
  594. });
  595. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  596. if (!size) {
  597. this.$refs.uToast.show({
  598. title: '上传图片大小不能超过 5MB!',
  599. type: 'error',
  600. })
  601. return false
  602. }
  603. if (chooseImageRes) {
  604. this.userbackImg = chooseImageRes.tempFilePaths[0];
  605. uni.uploadFile({
  606. url: this.$base.baseUrl + '/file/upload',
  607. filePath: chooseImageRes.tempFilePaths[0],
  608. name: "file",
  609. formData: {
  610. 'type': 'image',
  611. },
  612. header: {
  613. Authorization: store.state.token,
  614. system_code: store.state.system_code ? store.state.system_code : ''
  615. },
  616. success: (imgRes) => {
  617. let data = JSON.parse(imgRes.data);
  618. if (data.code == '200') {
  619. switch (this.checkType) {
  620. case 'ownerInfo':
  621. if (this.ownerImageListId.some(v => v.imageCode == 'D02')) {
  622. this.ownerImageListId.map(val => {
  623. if (val.imageCode == 'D02') {
  624. val.imageBase64List[0].imageId = data.data.id;
  625. }
  626. })
  627. } else {
  628. this.ownerImageListId.push({
  629. imageBase64List: [{
  630. imageId: data.data.id
  631. }],
  632. imageCode: "D02",
  633. })
  634. }
  635. break;
  636. case 'policyHolderInfo':
  637. if (this.policyHolderImageListId.some(v => v.imageCode ==
  638. 'D03')) {
  639. this.policyHolderImageListId.map(val => {
  640. if (val.imageCode == 'D03') {
  641. val.imageBase64List[0].imageId = data.data.id;
  642. }
  643. })
  644. } else {
  645. this.policyHolderImageListId.push({
  646. imageBase64List: [{
  647. imageId: data.data.id
  648. }],
  649. imageCode: "D03",
  650. })
  651. }
  652. break;
  653. case 'insuredPersonInfo':
  654. if (this.insuredPersonImageListId.some(v => v.imageCode ==
  655. 'D04')) {
  656. this.insuredPersonImageListId.map(val => {
  657. if (val.imageCode == 'D04') {
  658. val.imageBase64List[0].imageId = data.data.id;
  659. }
  660. })
  661. } else {
  662. this.insuredPersonImageListId.push({
  663. imageBase64List: [{
  664. imageId: data.data.id
  665. }],
  666. imageCode: "D04",
  667. })
  668. }
  669. break;
  670. default:
  671. break;
  672. };
  673. uni.uploadFile({
  674. url: this.$base.baseUrl + '/order/identify/idCard',
  675. filePath: chooseImageRes.tempFilePaths[0],
  676. name: "image2",
  677. header: {
  678. Authorization: store.state.token,
  679. system_code: store.state.system_code ? store.state
  680. .system_code : ''
  681. },
  682. success: (uploadFileRes) => {
  683. let data1 = JSON.parse(uploadFileRes.data).data;
  684. let identifyValidDate = '';
  685. if (!!data1.customerInfo
  686. .identifyValidDate) {
  687. identifyValidDate = data1
  688. .customerInfo
  689. .identifyValidDate
  690. .substr(0, 4) +
  691. '-' + data1
  692. .customerInfo
  693. .identifyValidDate
  694. .substr(4, 2) + '-' +
  695. data1
  696. .customerInfo
  697. .identifyValidDate
  698. .substr(6,
  699. 2)
  700. }
  701. let identifyValidEndDate = '';
  702. if (!!data1.customerInfo
  703. .identifyValidEndDate) {
  704. identifyValidEndDate =
  705. data1.customerInfo
  706. .identifyValidEndDate
  707. .substr(0,
  708. 4) + '-' + data1
  709. .customerInfo
  710. .identifyValidEndDate
  711. .substr(4, 2) + '-' +
  712. data1
  713. .customerInfo
  714. .identifyValidEndDate
  715. .substr(6, 2)
  716. }
  717. this.userback = {
  718. identifyValidDate: identifyValidDate, //起期
  719. identifyValidEndDate: identifyValidEndDate ==
  720. '长期--' ? '9999-12-31' :
  721. identifyValidEndDate, //止期
  722. }
  723. }
  724. });
  725. }
  726. }
  727. });
  728. } else {}
  729. },
  730. //营业执照识别
  731. async businessLicenseChange() {
  732. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  733. count: 1,
  734. sizeType: ['compressed']
  735. });
  736. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  737. if (!size) {
  738. this.$refs.uToast.show({
  739. title: '上传图片大小不能超过 5MB!',
  740. type: 'error',
  741. })
  742. return false
  743. }
  744. if (chooseImageRes) {
  745. this.businessLicenseImg = chooseImageRes.tempFilePaths[0];
  746. uni.uploadFile({
  747. url: this.$base.baseUrl + '/file/upload',
  748. filePath: chooseImageRes.tempFilePaths[0],
  749. name: "file",
  750. formData: {
  751. 'type': 'image',
  752. },
  753. header: {
  754. Authorization: store.state.token,
  755. system_code: store.state.system_code ? store.state.system_code : ''
  756. },
  757. success: (imgRes) => {
  758. let data = JSON.parse(imgRes.data);
  759. if (data.code == '200') {
  760. switch (this.checkType) {
  761. case 'ownerInfo':
  762. if (this.ownerImageListId.some(v => v.imageCode == 'Y02')) {
  763. this.ownerImageListId.map(val => {
  764. if (val.imageCode == 'Y02') {
  765. val.imageBase64List[0].imageId = data.data.id;
  766. }
  767. })
  768. } else {
  769. this.ownerImageListId.push({
  770. imageBase64List: [{
  771. imageId: data.data.id
  772. }],
  773. imageCode: "Y02",
  774. })
  775. }
  776. break;
  777. case 'policyHolderInfo':
  778. if (this.policyHolderImageListId.some(v => v.imageCode ==
  779. 'Y03')) {
  780. this.policyHolderImageListId.map(val => {
  781. if (val.imageCode == 'Y03') {
  782. val.imageBase64List[0].imageId = data.data.id;
  783. }
  784. })
  785. } else {
  786. this.policyHolderImageListId.push({
  787. imageBase64List: [{
  788. imageId: data.data.id
  789. }],
  790. imageCode: "Y03",
  791. })
  792. }
  793. break;
  794. case 'insuredPersonInfo':
  795. if (this.insuredPersonImageListId.some(v => v.imageCode ==
  796. 'Y04')) {
  797. this.insuredPersonImageListId.map(val => {
  798. if (val.imageCode == 'Y04') {
  799. val.imageBase64List[0].imageId = data.data.id;
  800. }
  801. })
  802. } else {
  803. this.insuredPersonImageListId.push({
  804. imageBase64List: [{
  805. imageId: data.data.id
  806. }],
  807. imageCode: "Y04",
  808. })
  809. }
  810. break;
  811. default:
  812. break;
  813. };
  814. uni.uploadFile({
  815. url: this.$base.baseUrl + '/order/identify/businessLicense',
  816. filePath: chooseImageRes.tempFilePaths[0],
  817. name: "image1",
  818. header: {
  819. Authorization: store.state.token,
  820. system_code: store.state.system_code ? store.state
  821. .system_code : ''
  822. },
  823. success: (uploadFileRes) => {
  824. let data = JSON.parse(uploadFileRes.data).data;
  825. this.businessLicenseInfo = {
  826. name: data.company,
  827. organizationCode: data
  828. .socialCreditCode, //社会信用代码
  829. addr: data.address,
  830. identifyType: "10",
  831. scope: data.businessScope,
  832. legalPerson: data.legalRepresentative,
  833. registeredCapital: data.registeredCapital
  834. }
  835. }
  836. });
  837. }
  838. }
  839. });
  840. } else {}
  841. }
  842. }
  843. }
  844. </script>
  845. <style lang="scss" scoped>
  846. .header {
  847. padding: 4rpx 27rpx;
  848. }
  849. .content {
  850. padding: 40rpx 60rpx;
  851. .img {
  852. background: #fff;
  853. image {
  854. width: 100%;
  855. height: 360rpx;
  856. }
  857. }
  858. .footer {
  859. .btn {
  860. color: #1F1F1F !important;
  861. }
  862. }
  863. .user-Subsection {
  864. width: fit-content;
  865. margin: 0 auto 40rpx;
  866. border-radius: 4rpx;
  867. .item {
  868. padding: 9rpx 24rpx;
  869. box-sizing: border-box;
  870. font-size: 30rpx;
  871. color: #666;
  872. border: 1rpx solid #eee;
  873. }
  874. .item:first-child {
  875. border-right-color: #FDE935;
  876. }
  877. .item:last-child {
  878. border-left: none;
  879. }
  880. .active {
  881. background: rgba(253, 233, 53, 0.2);
  882. font-size: 30rpx;
  883. color: #333;
  884. border-color: #FDE935;
  885. }
  886. }
  887. }
  888. </style>