add-files.vue 30 KB

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