add-files.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924
  1. <template>
  2. <view class="content">
  3. <uni-card class="card">
  4. <uni-section title="基本信息" type="line">
  5. <view>
  6. <view class="lzcOCR">
  7. <view class="imgBox">
  8. <image :src="zjcaijianSrc" style="width: 40vw;" mode="widthFix" @click="paizhao('front')">
  9. </image>
  10. <view class="text">拍摄人像面</view>
  11. </view>
  12. <view class="imgBox">
  13. <image :src="zjcaijianSrcFan" style="width: 40vw;" mode="widthFix" @click="paizhao('back')">
  14. </image>
  15. <view class="text">拍摄国徽面</view>
  16. </view>
  17. </view>
  18. <view class="miaoshu">
  19. 身份信息会跟进拍照的证件照片白动识别,不支持手动输入。如果识别错误,可尝试再次拍照.
  20. </view>
  21. </view>
  22. <uni-forms ref="baseForm" :modelValue="baseFormData" :rules="rules" style="margin-top: 5vh;">
  23. <uni-forms-item label="姓名" required name="lrXm">
  24. <uni-easyinput ref="xm" type="text" :disabled="disabled" v-model="baseFormData.lrXm"
  25. placeholder="请输入姓名" :inputBorder="true"></uni-easyinput>
  26. </uni-forms-item>
  27. <uni-forms-item label="手机号" required name="lrCydh">
  28. <uni-easyinput type="text" v-model="baseFormData.lrCydh" :disabled="disabled"
  29. placeholder="请输入手机号" :inputBorder="true"></uni-easyinput>
  30. </uni-forms-item>
  31. <uni-forms-item label="监护人姓名">
  32. <uni-easyinput ref="xm" type="text" :disabled="disabled" v-model="baseFormData.jhrxm"
  33. placeholder="请输入监护人姓名" :inputBorder="true"></uni-easyinput>
  34. </uni-forms-item>
  35. <uni-forms-item label="监护人联系电话" name="jhrlxdh">
  36. <uni-easyinput type="text" v-model="baseFormData.jhrlxdh" :disabled="disabled"
  37. placeholder="请输入监护人联系电话" :inputBorder="true"></uni-easyinput>
  38. </uni-forms-item>
  39. <uni-forms-item label="街道社区">
  40. <uni-easyinput type="text" v-model="diqu" @focus="toggle('bottom')"
  41. placeholder="请选择街道社区" :clearable="false"></uni-easyinput>
  42. </uni-forms-item>
  43. <uni-forms-item label="住址" required name="jzdz">
  44. <uni-easyinput type="text" v-model="baseFormData.jzdz" :disabled="disabled" placeholder="请输入住址"
  45. :inputBorder="true"></uni-easyinput>
  46. </uni-forms-item>
  47. <uni-forms-item label="是否特困">
  48. <uni-data-checkbox v-model="baseFormData.istk" :localdata="radioData"></uni-data-checkbox>
  49. </uni-forms-item>
  50. <uni-forms-item label="特困证明" v-if="baseFormData.istk == 1">
  51. <myfile :zczmList="tkzmList" @recordsChange="tkChange"></myfile>
  52. </uni-forms-item>
  53. <uni-forms-item label="是否低保">
  54. <uni-data-checkbox v-model="baseFormData.isdb" :localdata="radioData"></uni-data-checkbox>
  55. </uni-forms-item>
  56. <uni-forms-item label="低保证明" v-if="baseFormData.isdb == 1">
  57. <myfile :zczmList="dbzmList" @recordsChange="dbChange"></myfile>
  58. </uni-forms-item>
  59. <uni-forms-item label="是否重残">
  60. <uni-data-checkbox v-model="baseFormData.iszc" :localdata="radioData"></uni-data-checkbox>
  61. </uni-forms-item>
  62. <uni-forms-item label="重残证明" v-if="baseFormData.iszc == 1">
  63. <!-- <uni-file-picker v-model="zczm" @select="imgSelect3" @delete="imgDelete3"></uni-file-picker> -->
  64. <myfile :zczmList="zczmList" @recordsChange="zcChange"></myfile>
  65. </uni-forms-item>
  66. <view v-if="show">
  67. <uni-forms-item label="直接上传">
  68. <uni-data-checkbox v-model="radio" :localdata="radioData"></uni-data-checkbox>
  69. </uni-forms-item>
  70. <text>注意:人证比对不成功可以直接注册人工审核!</text>
  71. </view>
  72. <view class="miaoshu" v-if="isCheck">
  73. 该人员存在未审核信息,请先审核!
  74. </view>
  75. <view>
  76. <view v-if="isCheck">
  77. <button cursor-spacing="22px" :disabled="isCheck" class="buttonClass"
  78. @click="preSave()">认证</button>
  79. </view>
  80. <view v-else>
  81. <button v-if="faceBase64 && ((show && radio == '1') || (!show && radio == '0'))"
  82. cursor-spacing="22px" class="buttonClass" @click="save()">保存</button>
  83. <button v-else cursor-spacing="22px" class="buttonClass" @click="preSave()">认证</button>
  84. </view>
  85. </view>
  86. </uni-forms>
  87. </uni-section>
  88. </uni-card>
  89. <view>
  90. <!-- 普通弹窗 -->
  91. <uni-popup ref="popup" background-color="#fff">
  92. <picker-view :indicator-style="indicatorStyle" @change="bindChange" class="picker-view">
  93. <picker-view-column>
  94. <view class="item" v-for="(item,index) in jiedaoData" :key="index">{{item.label}}</view>
  95. </picker-view-column>
  96. <picker-view-column>
  97. <view class="item" v-for="(item,index) in shequData" :key="index">{{item.label}}</view>
  98. </picker-view-column>
  99. </picker-view>
  100. </uni-popup>
  101. </view>
  102. </view>
  103. </template>
  104. <script>
  105. import myfile from '@/components/my-file/my-file.vue';
  106. let jl = require('../../static/json/bufen.json')
  107. import {
  108. decryptRowData_ECB,
  109. decryptData_ECB
  110. } from '@/common/sm4.js'
  111. import {
  112. GetChildListByCode
  113. } from '@/api/dict.js'
  114. import {
  115. showConfirm,
  116. getDictInfo,
  117. toast,
  118. toBase64
  119. } from '@/common/common.js'
  120. import {
  121. UploadOne,
  122. UploadSome,
  123. UploadSomeFile
  124. } from '@/api/upload.js'
  125. import {
  126. Register
  127. } from '@/api/login.js'
  128. import {
  129. getUser
  130. } from '@/common/auth.js'
  131. import CryptoJS from 'crypto-js';
  132. import config from '@/config.js';
  133. import idCardNoUtil from '@/common/idcard.js'
  134. import {
  135. translate,
  136. base64ToUrl,
  137. blobToDataURI,
  138. translateAll,
  139. base64toFilen,
  140. fileToBlob
  141. } from '@/common/image.js'
  142. import {
  143. setToken,
  144. setOpenid,
  145. getOpenid,
  146. setUser
  147. } from '@/common/auth.js'
  148. import {
  149. getAccessToken,
  150. idcard,
  151. match
  152. } from '@/common/baiduUtil.js'
  153. import {
  154. updateKhjbxx,
  155. infoKhjbxx,
  156. GetLrByZjhm,
  157. SaveKhjbxx
  158. } from '@/api/kh.js'
  159. export default {
  160. components: {
  161. myfile
  162. },
  163. data() {
  164. return {
  165. diqu: '',
  166. tkzmList: [],
  167. dbzmList: [],
  168. zczmList: [],
  169. isCheck: false,
  170. indicatorStyle: `height: 50px;`,
  171. jiedaoData: [],
  172. shequData: [],
  173. jiedaoValue: {},
  174. shequValue: {},
  175. disabled: true,
  176. show: false,
  177. radio: "0",
  178. radioData: [{
  179. text: '否',
  180. value: "0"
  181. }, {
  182. text: '是',
  183. value: "1"
  184. }],
  185. // 字典
  186. dicts: {
  187. // 民族
  188. C0009: [],
  189. // 性别
  190. C0007: [],
  191. },
  192. // 百度云access_token
  193. token: '',
  194. // 人像地址
  195. src: "/static/images/head.png",
  196. // 身份拍摄地址
  197. zjSrc: "",
  198. // 身份证裁剪地址
  199. zjcaijianSrc: '/static/images/zhengmian.png',
  200. zjcaijianSrcFan: '/static/images/fanmian.png',
  201. cardType: 'front',
  202. frontBase64: '',
  203. backBase64: '',
  204. file1: "",
  205. file2: "",
  206. file3: "",
  207. file4: "",
  208. file5: "",
  209. file6: "",
  210. showSrc: "",
  211. // 人员信息
  212. userInfo: {},
  213. // 组
  214. groupId: '',
  215. // 身份证号加密
  216. idcardMD5: '',
  217. // 人像base64
  218. faceBase64: '',
  219. // 身份证base64
  220. idcardFace: '',
  221. idcardFaceUrl: '',
  222. // 对比份数
  223. score: 0,
  224. // ocrXm
  225. ocrXm: '',
  226. isSearch: false,
  227. baseFormData: {
  228. lrXm: '',
  229. lrZjhm: '',
  230. lrHjbcxx: '',
  231. lrCydh: '',
  232. code: '',
  233. diqu: '',
  234. lrHjdz: '',
  235. istk: "0",
  236. isdb: "0",
  237. iszc: "0",
  238. lzzt: 0,
  239. lrZjz: ""
  240. },
  241. rules: {
  242. jzdz: {
  243. rules: [{
  244. required: true,
  245. errorMessage: '住址不能为空'
  246. }]
  247. },
  248. lrXm: {
  249. rules: [{
  250. required: true,
  251. errorMessage: '姓名不能为空'
  252. }]
  253. },
  254. diqu: {
  255. rules: [{
  256. required: true,
  257. errorMessage: '请选择地区'
  258. }]
  259. },
  260. photo: {
  261. rules: [{
  262. required: true,
  263. errorMessage: '请上传人像'
  264. }]
  265. },
  266. lrCydh: {
  267. rules: [{
  268. required: true,
  269. errorMessage: '手机号不能为空'
  270. },
  271. {
  272. format: 'number',
  273. errorMessage: '请输入正确的手机号',
  274. },
  275. {
  276. pattern: '^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\\d{8})$',
  277. errorMessage: '请输入正确的手机号',
  278. }
  279. ]
  280. },
  281. jhrlxdh: {
  282. rules: [{
  283. required: false,
  284. errorMessage: '监护人联系电话不能为空'
  285. },
  286. {
  287. format: 'number',
  288. errorMessage: '请输入正确的手机号',
  289. },
  290. {
  291. pattern: '^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\\d{8})$',
  292. errorMessage: '请输入正确的手机号',
  293. }
  294. ]
  295. }
  296. },
  297. }
  298. },
  299. onLoad(o) {
  300. getAccessToken(this.callbackToken)
  301. window.addEventListener("message", e => {
  302. if (e.data.data && e.data.data.arg.base64) {
  303. setTimeout(() => {
  304. uni.showLoading({
  305. title: '正在识别中...'
  306. })
  307. }, 100);
  308. this.faceBase64 = ''
  309. this.cardType = uni.getStorageSync("cardType")
  310. console.log("正反面", this.cardType);
  311. if (this.cardType == 'front') e.data.data.arg.base64 = jl.chenhang
  312. if (this.cardType == 'back') e.data.data.arg.base64 = jl.back
  313. // 压缩
  314. translateAll(base64ToUrl(e.data.data.arg.base64), (base64, blobUrl) => {
  315. idcard(base64, this.token, this.cardType, this.callbackIdcard)
  316. })
  317. uni.removeStorageSync('cardType')
  318. }
  319. if (e.data.data && e.data.data.arg.faceBase64) {
  320. setTimeout(() => {
  321. uni.showLoading({
  322. title: '正在识别中...'
  323. })
  324. }, 100);
  325. this.faceBase64 = e.data.data.arg.faceBase64
  326. // 压缩
  327. translateAll(base64ToUrl(this.faceBase64), (base64, blobUrl) => {
  328. this.src = this.faceBase64
  329. match(this.token, base64.split(",")[1], this.idcardFace, this.callbackFace)
  330. })
  331. }
  332. }, false)
  333. this.getDictList(Object.keys(this.dicts), this.dicts)
  334. this.baseFormData.code = getOpenid()
  335. this.userInfo = getUser()
  336. this.baseFormData.lrHjdz = this.userInfo.dept.locationCode
  337. this.groupId = this.userInfo.dept.locationCode.substring(0, 6)
  338. if (this.userInfo.userType == '07') {
  339. this.updateFlag = true
  340. let info = JSON.parse(o.info)
  341. this.baseFormData.lrHjdz = info.lrHjdz
  342. this.groupId = info.lrHjdz.substring(0, 6)
  343. this.baseFormData = info
  344. this.src = config.baseUrl + info.lrTx
  345. }
  346. // 查询街道和社区
  347. this.getAddressList(this.baseFormData.lrHjdz)
  348. },
  349. methods: {
  350. tkChange(e) {
  351. this.tkzmList = e
  352. },
  353. dbChange(e) {
  354. this.dbzmList = e
  355. },
  356. zcChange(e) {
  357. this.zczmList = e
  358. },
  359. getAddressList(code) {
  360. GetChildListByCode({
  361. code: code
  362. }).then(res => {
  363. if (res.data) {
  364. this.jiedaoData = res.data
  365. this.shequData = res.data[0].children
  366. this.jiedaoValue = this.jiedaoData[0]
  367. this.shequValue = this.shequData[0]
  368. this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
  369. this.baseFormData.lrHjdz = this.shequValue.code
  370. }
  371. })
  372. },
  373. callbackFace(res) {
  374. uni.hideLoading()
  375. if (res.data.error_msg == 'SUCCESS') {
  376. this.score = res.data.result.score;
  377. this.baseFormData.lrTxdb = JSON.stringify({
  378. "lrJmzjhm": this.idcardMD5,
  379. "xsfs": this.score
  380. })
  381. if (this.score >= config.score) {
  382. this.show = false
  383. // this.baseFormData.lzzt = 3
  384. this.baseFormData.lzzt = 0
  385. // this.baseFormData.lrSpyj = '同意'
  386. this.baseFormData.lrSpyj = ''
  387. } else {
  388. // 低于80选项是否人工审核,是的话进记录表
  389. // 身份证头像保存后端
  390. // 人脸库注册人脸、身份证md5
  391. // 修改的时候去人脸库搜索,搜索不到不允许修改
  392. // 修改成功替换原始人脸库照片
  393. // 首次修改搜索身份证
  394. // 后端没入库,人脸库相应删除
  395. // ocr失败身份证原版入库,ocr成功人脸入库
  396. // showConfirm('人像与身份证不符,请重新上传')
  397. // this.baseFormData.lzzt = 1
  398. // this.baseFormData.lrSpyj = ''
  399. this.baseFormData.lzzt = 0
  400. this.baseFormData.lrSpyj = ''
  401. this.show = true
  402. }
  403. this.baseFormData.prelrZjz = this.zjcaijianSrc
  404. } else {
  405. showConfirm(res.data.error_msg)
  406. this.faceBase64 = ''
  407. }
  408. },
  409. callbackToken(e) {
  410. this.token = e
  411. },
  412. callbackIdcard(words) {
  413. uni.hideLoading()
  414. if (!this.cardType) {
  415. this.cardType = uni.getStorageSync("cardType")
  416. }
  417. console.log(words, this.cardType);
  418. if (this.cardType == 'front') {
  419. if (!words) {
  420. showConfirm('请上传正确的身份证人像面')
  421. return
  422. }
  423. if (words.image_status == "other_type_card") {
  424. showConfirm('请上传正确的身份证人像面')
  425. return
  426. }
  427. let id = words.words_result['公民身份号码'].words
  428. let csrq = words.words_result['出生'].words
  429. let sex = words.words_result['性别'].words
  430. let zz = words.words_result['住址'].words
  431. let info = idCardNoUtil.getIdCardInfo(id)
  432. if (!idCardNoUtil.checkIdCardNo(id)) {
  433. showConfirm('身份证号识别有误,请重新上传')
  434. return
  435. }
  436. if (info.birthday != csrq) {
  437. showConfirm('身份证出生日期识别有误,请重新上传')
  438. return
  439. }
  440. if (info.gender != sex) {
  441. showConfirm('身份证性别识别有误,请重新上传')
  442. return
  443. }
  444. if (words.image_status == "reversed_side") {
  445. showConfirm('请上传身份证人像面')
  446. return
  447. }
  448. if (words.risk_type != "normal") {
  449. // normal-正常身份证;copy-复印件;temporary-临时身份证;screen-翻拍;unknown-其他未知情况
  450. showConfirm('请上传正确的身份证人像面')
  451. return
  452. }
  453. // todo 根据身份证号查询此人信息是否可修改。this.isCheck = true
  454. this.frontBase64 = words.card_image
  455. this.zjcaijianSrc = 'data:image/jpeg;base64,' + words.card_image
  456. this.disabled = false
  457. // this.baseFormData.lrXb = getDictInfo(this.dicts.C0007, words.words_result['性别'].words)[0].value
  458. // this.baseFormData.lrMz = getDictInfo(this.dicts.C0009, words.words_result['民族'].words)[0].value
  459. this.baseFormData.lrXb = sex
  460. this.baseFormData.lrMz = words.words_result['民族'].words
  461. this.idcardFace = words.photo
  462. this.idcardFaceUrl = base64ToUrl(words.photo);
  463. this.baseFormData.lrZjhm = id
  464. this.baseFormData.lrCsrq = csrq
  465. this.idcardMD5 = CryptoJS.MD5(this.baseFormData.lrZjhm).toString()
  466. this.baseFormData.lrXm = words.words_result['姓名'].words
  467. this.baseFormData.lrHjbcxx = zz
  468. this.ocrXm = words.words_result['姓名'].words
  469. if (this.userInfo.userType != '07') {
  470. GetLrByZjhm({
  471. lrJmzjhm: this.idcardMD5
  472. }).then(res => {
  473. if (res.data) this.baseFormData = decryptData_ECB(res.data, ["lrZjhm", "lrXm",
  474. "lrHjbcxx",
  475. "lrXjdzBcxx",
  476. "lrCydh", "lrPoxm", "lrPoZjmh", "jhrXm", "jhrSjhm", "zlrXm", "zlrDh",
  477. "cjzh",
  478. "yhzh", "khmc", "jhrxm", "jhrlxdh"
  479. ], [2, 1, 4, 4, 3, 1, 2, 1, 2, 1, 3, 5, 5, 5]);
  480. if (this.baseFormData.lrTx) this.src = config.baseUrl + this.baseFormData.lrTx
  481. if (this.baseFormData.lrHjdz) {
  482. this.jiedaoData.forEach(e => {
  483. if (e.children.length > 0) {
  484. e.children.forEach(ee => {
  485. if (ee) {
  486. if (ee.code == this.baseFormData.lrHjdz) {
  487. this.shequValue = ee
  488. this.jiedaoValue = e
  489. this.diqu = this.jiedaoValue
  490. .label +
  491. '/' + this.shequValue.label
  492. }
  493. } else {
  494. if (e.code == this.baseFormData.lrHjdz) {
  495. this.jiedaoValue = e
  496. this.diqu = this.jiedaoValue.label
  497. }
  498. }
  499. })
  500. }
  501. })
  502. } else {
  503. // 地区回显
  504. this.getAddressList()
  505. }
  506. if (res.data && res.data.sfzzpb) this.zjcaijianSrcFan = res.data.sfzzpb
  507. if (res.data && res.data.tkzm) this.tkzmList = [res.data.tkzm]
  508. if (res.data && res.data.dbzm) this.dbzmList = [res.data.dbzm]
  509. if (res.data && res.data.zczm) this.zczmList = [res.data.zczm]
  510. if (res.data) this.updateFlag = true
  511. })
  512. }
  513. // if (id) {
  514. // GetLrByZjhm({
  515. // lrJmzjhm: this.idcardMD5
  516. // }).then(res => {
  517. // console.log(res);
  518. // if (res.data) {
  519. // showConfirm('该信息已存在,请登录').then(res => {
  520. // if (res.confirm == true) {
  521. // uni.reLaunch({
  522. // url: '/pages/login/index'
  523. // })
  524. // }
  525. // })
  526. // } else {
  527. // this.disabled = false
  528. // }
  529. // })
  530. // }
  531. } else if (this.cardType == 'back') {
  532. if (!words) {
  533. showConfirm('请上传正确的身份证国徽面')
  534. return
  535. }
  536. if (words.image_status == "other_type_card") {
  537. showConfirm('请上传正确的身份证国徽面')
  538. return
  539. }
  540. if (words.risk_type != "normal") {
  541. // normal-正常身份证;copy-复印件;temporary-临时身份证;screen-翻拍;unknown-其他未知情况
  542. showConfirm('请上传正确的身份证国徽面')
  543. return
  544. }
  545. // words.words_result['失效日期'].words
  546. // words.words_result['签发日期'].words
  547. // words.words_result['签发机关'].words
  548. if (words && words.words_result) {
  549. this.baseFormData.sfzqfjg = words.words_result['签发机关'].words
  550. this.baseFormData.sfzyxqxs = words.words_result['签发日期'].words
  551. this.baseFormData.sfzyxqxz = words.words_result['失效日期'].words
  552. this.backBase64 = words.card_image
  553. this.zjcaijianSrcFan = 'data:image/jpeg;base64,' + words.card_image
  554. }
  555. }
  556. },
  557. toggle(type) {
  558. uni.hideKeyboard()
  559. this.shequData = this.jiedaoData[0].children
  560. // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
  561. this.$refs.popup.open(type)
  562. },
  563. bindChange(e) {
  564. if (e.detail.value.length == 1) {
  565. this.jiedaoValue = this.jiedaoData[e.detail.value[0]]
  566. this.shequData = this.jiedaoData[e.detail.value[0]].children
  567. if (this.shequData.length > 0 && this.shequData[0] != null) {
  568. this.shequValue = this.shequData[0]
  569. this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
  570. this.baseFormData.lrHjdz = this.shequValue.code
  571. } else {
  572. this.shequData = []
  573. this.shequValue = ''
  574. this.diqu = this.jiedaoValue.label
  575. this.baseFormData.lrHjdz = this.jiedaoValue.code
  576. }
  577. } else {
  578. let index = e.detail.value[0] ? e.detail.value[0] : 0
  579. this.jiedaoValue = this.jiedaoData[index]
  580. this.shequValue = this.shequData[e.detail.value[1]]
  581. this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
  582. this.baseFormData.lrHjdz = this.shequValue.code
  583. }
  584. },
  585. buildDataByLevel(data, pid) {
  586. let result = [];
  587. data.filter(e => {
  588. return e.parent_id === pid
  589. }).forEach(e => {
  590. result.push({
  591. value: e.code,
  592. text: e.name,
  593. id: e.id,
  594. children: this.buildDataByLevel(data, e.id)
  595. })
  596. })
  597. return result.length > 0 ? result : []
  598. },
  599. paizhao(type) {
  600. this.type = type
  601. if (this.type == 'back' && !this.ocrXm) {
  602. showConfirm('请先拍摄身份证人像面')
  603. return
  604. }
  605. uni.setStorageSync("cardType", type)
  606. uni.navigateTo({
  607. url: '/pages/info/card'
  608. })
  609. },
  610. onchange(e) {
  611. console.log("onchange", e);
  612. },
  613. onnodeclick(node) {
  614. this.groupId = node.code.substring(0, 6)
  615. this.baseFormData.lrHjdz = this.groupId + '000000'
  616. },
  617. preSave() {
  618. if (this.baseFormData.lzzt != 0 && this.baseFormData.lzzt != 3 && this.baseFormData.lzzt != 6) {
  619. showConfirm('信息正在审核,请审核后重试')
  620. return
  621. }
  622. if (!this.ocrXm) {
  623. showConfirm('请先拍摄身份证人像面')
  624. return
  625. }
  626. if (this.zjcaijianSrcFan == '/static/images/fanmian.png') {
  627. showConfirm('请先拍摄身份证国徽面')
  628. return
  629. }
  630. if (this.baseFormData.istk == 1 && this.tkzmList.length == 0) {
  631. showConfirm('请先上传特困证明')
  632. return
  633. }
  634. if (this.baseFormData.isdb == 1 && this.dbzmList.length == 0) {
  635. showConfirm('请先上传低保证明')
  636. return
  637. }
  638. if (this.baseFormData.iszc == 1 && this.zczmList.length == 0) {
  639. showConfirm('请先上传重残证明')
  640. return
  641. }
  642. this.$refs['baseForm'].validate().then(res => {
  643. if (this.ocrXm != this.baseFormData.lrXm) {
  644. showConfirm('姓名与真实姓名不符,请重新上传身份证')
  645. return
  646. }
  647. uni.navigateTo({
  648. url: '/pages/info/face'
  649. })
  650. })
  651. },
  652. save() {
  653. if ((this.score >= config.score) || (this.score < config.score && this.radio == '1')) {
  654. uni.showLoading({
  655. title: '正在保存中...'
  656. })
  657. let paramFiles = []
  658. fileToBlob(base64toFilen('data:image/jpeg;base64,' + this.frontBase64), (e) => {
  659. this.file1 = e
  660. paramFiles.push({
  661. name: "file1",
  662. uri: this.file1
  663. })
  664. })
  665. if (this.backBase64) {
  666. fileToBlob(base64toFilen('data:image/jpeg;base64,' + this.backBase64), (e) => {
  667. this.file2 = e
  668. paramFiles.push({
  669. name: "file2",
  670. uri: this.file2
  671. })
  672. })
  673. }
  674. fileToBlob(base64toFilen(this.src), (e) => {
  675. this.file3 = e
  676. paramFiles.push({
  677. name: "file3",
  678. uri: this.file3
  679. })
  680. })
  681. if (this.baseFormData.istk == 1 && this.tkzmList.length == 1 && this.tkzmList[0].indexOf(
  682. 'data:image') > -1) {
  683. fileToBlob(base64toFilen(this.tkzmList[0]), (e) => {
  684. this.file4 = e
  685. paramFiles.push({
  686. name: "file4",
  687. uri: this.file4
  688. })
  689. })
  690. if (this.baseFormData.lzzt != 2 || this.baseFormData.lzzt != 1) {
  691. // 特殊材料待审核
  692. // this.baseFormData.lzzt = 5
  693. this.baseFormData.lzzt = 0
  694. this.baseFormData.lrSpyj = '无'
  695. }
  696. }
  697. if (this.baseFormData.isdb == 1 && this.dbzmList.length == 1 && this.dbzmList[0].indexOf(
  698. 'data:image') > -1) {
  699. fileToBlob(base64toFilen(this.dbzmList[0]), (e) => {
  700. this.file5 = e
  701. paramFiles.push({
  702. name: "file5",
  703. uri: this.file5
  704. })
  705. })
  706. if (this.baseFormData.lzzt != 2 || this.baseFormData.lzzt != 1) {
  707. // 特殊材料待审核
  708. // this.baseFormData.lzzt = 5
  709. this.baseFormData.lzzt = 0
  710. this.baseFormData.lrSpyj = '无'
  711. }
  712. }
  713. if (this.baseFormData.iszc == 1 && this.zczmList.length == 1 && this.zczmList[0].indexOf(
  714. 'data:image') > -1) {
  715. fileToBlob(base64toFilen(this.zczmList[0]), (e) => {
  716. this.file6 = e
  717. paramFiles.push({
  718. name: "file6",
  719. uri: this.file6
  720. })
  721. })
  722. if (this.baseFormData.lzzt != 2 || this.baseFormData.lzzt != 1) {
  723. // 特殊材料待审核
  724. // this.baseFormData.lzzt = 5
  725. this.baseFormData.lzzt = 0
  726. this.baseFormData.lrSpyj = '无'
  727. }
  728. }
  729. console.log("this1", this)
  730. let that = this
  731. setTimeout(function() {
  732. UploadSomeFile(paramFiles).then(res => {
  733. that.baseFormData.lrZjz = res.data.url1
  734. if (that.backBase64) {
  735. that.baseFormData.sfzzpb = res.data.url2
  736. }
  737. that.baseFormData.lrTx = res.data.url3
  738. if (that.baseFormData.istk == 1 && that.tkzmList.length == 1) {
  739. that.baseFormData.tkzm = res.data.url4
  740. }
  741. if (that.baseFormData.isdb == 1 && that.dbzmList.length == 1) {
  742. that.baseFormData.dbzm = res.data.url5
  743. }
  744. if (that.baseFormData.iszc == 1 && that.zczmList.length == 1) {
  745. that.baseFormData.zczm = res.data.url6
  746. }
  747. that.$refs['baseForm'].validate().then(res => {
  748. if (that.updateFlag) {
  749. updateKhjbxx(that.baseFormData).then(r => {
  750. uni.hideLoading()
  751. if (r.code == 200) {
  752. toast('保存成功')
  753. setTimeout(function() {
  754. uni.switchTab({
  755. url: '/pages/index/index'
  756. })
  757. }, 1000)
  758. }
  759. })
  760. } else {
  761. SaveKhjbxx(that.baseFormData).then(r => {
  762. uni.hideLoading()
  763. if (r.code == 200) {
  764. toast('保存成功')
  765. // setOpenid(r.data.openId)
  766. // setUser(r.data.sysUser)
  767. // setToken(r.data.token.access_token)
  768. setTimeout(function() {
  769. uni.switchTab({
  770. url: '/pages/index/index'
  771. })
  772. }, 1000)
  773. }
  774. })
  775. }
  776. }).catch(err => {
  777. uni.hideLoading()
  778. })
  779. })
  780. }, 500)
  781. } else {
  782. showConfirm('请重新上传人像')
  783. return
  784. }
  785. }
  786. }
  787. }
  788. </script>
  789. <style scoped>
  790. .content {
  791. padding: 1vh;
  792. }
  793. .lzcOCR {
  794. display: flex;
  795. justify-content: space-between;
  796. margin-top: 5vh;
  797. }
  798. .imgBox {
  799. width: 47%;
  800. text-align: center;
  801. image {
  802. width: 100%;
  803. }
  804. .text {
  805. width: 100%;
  806. /* background-color: red; */
  807. }
  808. }
  809. .miaoshu {
  810. margin-top: 5vh;
  811. font-size: 14px;
  812. }
  813. .buttonClass {
  814. margin-top: 4vh;
  815. margin-left: 4vw;
  816. width: 68vw;
  817. /* height: 5vh; */
  818. border-radius: 5.8vw;
  819. /* border: 1px solid rgba(176, 179, 199, 1); */
  820. background: #28d87d;
  821. color: white;
  822. height: 5vh;
  823. display: flex;
  824. align-items: center;
  825. justify-content: center;
  826. box-shadow:0rpx 4rpx 10rpx 1rpx rgba(40, 216, 125,0.4);
  827. }
  828. .picker-view {
  829. width: 750rpx;
  830. height: 600rpx;
  831. margin-top: 20rpx;
  832. }
  833. .item {
  834. line-height: 100rpx;
  835. text-align: center;
  836. }
  837. </style>