add-files.vue 26 KB

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