add-files.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896
  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. if (this.userInfo.userType == '07') {
  295. this.updateFlag = true
  296. let info = JSON.parse(o.info)
  297. this.baseFormData.lrHjdz = info.lrHjdz
  298. this.groupId = info.lrHjdz.substring(0, 6)
  299. this.baseFormData = info
  300. this.src = config.baseUrl + info.lrTx
  301. }
  302. // 查询街道和社区
  303. this.getAddressList(this.baseFormData.lrHjdz)
  304. },
  305. methods: {
  306. tkChange(e) {
  307. this.tkzmList = e
  308. },
  309. dbChange(e) {
  310. this.dbzmList = e
  311. },
  312. zcChange(e) {
  313. this.zczmList = e
  314. },
  315. getAddressList(code) {
  316. GetChildListByCode({
  317. code: code
  318. }).then(res => {
  319. if (res.data) {
  320. this.jiedaoData = res.data
  321. this.shequData = res.data[0].children
  322. this.jiedaoValue = this.jiedaoData[0]
  323. this.shequValue = this.shequData[0]
  324. this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
  325. this.baseFormData.lrHjdz = this.shequValue.code
  326. }
  327. })
  328. },
  329. callbackFace(res) {
  330. uni.hideLoading()
  331. if (res.data.error_msg == 'SUCCESS') {
  332. this.score = res.data.result.score;
  333. this.baseFormData.lrTxdb = JSON.stringify({
  334. "lrJmzjhm": this.idcardMD5,
  335. "xsfs": this.score
  336. })
  337. if (this.score >= config.score) {
  338. this.show = false
  339. // this.baseFormData.lzzt = 3
  340. this.baseFormData.lzzt = 0
  341. // this.baseFormData.lrSpyj = '同意'
  342. this.baseFormData.lrSpyj = ''
  343. } else {
  344. // 低于80选项是否人工审核,是的话进记录表
  345. // 身份证头像保存后端
  346. // 人脸库注册人脸、身份证md5
  347. // 修改的时候去人脸库搜索,搜索不到不允许修改
  348. // 修改成功替换原始人脸库照片
  349. // 首次修改搜索身份证
  350. // 后端没入库,人脸库相应删除
  351. // ocr失败身份证原版入库,ocr成功人脸入库
  352. // showConfirm('人像与身份证不符,请重新上传')
  353. // this.baseFormData.lzzt = 1
  354. // this.baseFormData.lrSpyj = ''
  355. this.baseFormData.lzzt = 0
  356. this.baseFormData.lrSpyj = ''
  357. this.show = true
  358. }
  359. // this.baseFormData.prelrZjz = this.zjcaijianSrc
  360. } else {
  361. showConfirm(res.data.error_msg)
  362. this.faceBase64 = ''
  363. }
  364. },
  365. callbackToken(e) {
  366. this.token = e
  367. },
  368. callbackIdcard(words) {
  369. uni.hideLoading()
  370. if (!this.cardType) {
  371. this.cardType = uni.getStorageSync("cardType")
  372. }
  373. if (this.cardType == 'front') {
  374. if (!words) {
  375. showConfirm('请上传正确的身份证人像面')
  376. return
  377. }
  378. if (words.image_status == "other_type_card") {
  379. showConfirm('请上传正确的身份证人像面')
  380. return
  381. }
  382. let id = words.words_result['公民身份号码'].words
  383. let csrq = words.words_result['出生'].words
  384. let sex = words.words_result['性别'].words
  385. let zz = words.words_result['住址'].words
  386. let info = idCardNoUtil.getIdCardInfo(id)
  387. if (!idCardNoUtil.checkIdCardNo(id)) {
  388. showConfirm('身份证号识别有误,请重新上传')
  389. return
  390. }
  391. if (info.birthday != csrq) {
  392. showConfirm('身份证出生日期识别有误,请重新上传')
  393. return
  394. }
  395. if (info.gender != sex) {
  396. showConfirm('身份证性别识别有误,请重新上传')
  397. return
  398. }
  399. if (words.image_status == "reversed_side") {
  400. showConfirm('请上传身份证人像面')
  401. return
  402. }
  403. if (words.risk_type != "normal") {
  404. // normal-正常身份证;copy-复印件;temporary-临时身份证;screen-翻拍;unknown-其他未知情况
  405. showConfirm('请上传正确的身份证人像面')
  406. return
  407. }
  408. // todo 根据身份证号查询此人信息是否可修改。this.isCheck = true
  409. this.frontBase64 = words.card_image
  410. this.zjcaijianSrc = 'data:image/jpeg;base64,' + words.card_image
  411. this.disabled = false
  412. // this.baseFormData.lrXb = getDictInfo(this.dicts.C0007, words.words_result['性别'].words)[0].value
  413. // this.baseFormData.lrMz = getDictInfo(this.dicts.C0009, words.words_result['民族'].words)[0].value
  414. this.baseFormData.lrXb = sex
  415. this.baseFormData.lrMz = words.words_result['民族'].words
  416. this.idcardFace = words.photo
  417. this.idcardFaceUrl = base64ToUrl(words.photo);
  418. this.baseFormData.lrZjhm = id
  419. this.baseFormData.lrCsrq = csrq
  420. this.idcardMD5 = CryptoJS.MD5(this.baseFormData.lrZjhm).toString()
  421. this.baseFormData.lrXm = words.words_result['姓名'].words
  422. this.baseFormData.lrHjbcxx = zz
  423. this.ocrXm = words.words_result['姓名'].words
  424. if (this.userInfo.userType != '07') {
  425. GetLrByZjhm({
  426. lrJmzjhm: this.idcardMD5
  427. }).then(res => {
  428. if (res.data) this.baseFormData = decryptData_ECB(res.data, ["lrZjhm", "lrXm",
  429. "lrHjbcxx",
  430. "lrXjdzBcxx",
  431. "lrCydh", "lrPoxm", "lrPoZjmh", "jhrXm", "jhrSjhm", "zlrXm", "zlrDh",
  432. "cjzh",
  433. "yhzh", "khmc", "jhrxm", "jhrlxdh"
  434. ], [2, 1, 4, 4, 3, 1, 2, 1, 2, 1, 3, 5, 5, 5]);
  435. if (this.baseFormData.lrTx) this.src = config.baseUrl + this.baseFormData.lrTx
  436. if (this.baseFormData.lrHjdz) {
  437. this.jiedaoData.forEach(e => {
  438. if (e.children.length > 0) {
  439. e.children.forEach(ee => {
  440. if (ee) {
  441. if (ee.code == this.baseFormData.lrHjdz) {
  442. this.shequValue = ee
  443. this.jiedaoValue = e
  444. this.diqu = this.jiedaoValue
  445. .label +
  446. '/' + this.shequValue.label
  447. }
  448. } else {
  449. if (e.code == this.baseFormData.lrHjdz) {
  450. this.jiedaoValue = e
  451. this.diqu = this.jiedaoValue.label
  452. }
  453. }
  454. })
  455. }
  456. })
  457. } else {
  458. // 地区回显
  459. this.getAddressList()
  460. }
  461. if (res.data && res.data.sfzzpb) this.zjcaijianSrcFan = res.data.sfzzpb
  462. if (res.data && res.data.tkzm) this.tkzmList = [res.data.tkzm]
  463. if (res.data && res.data.dbzm) this.dbzmList = [res.data.dbzm]
  464. if (res.data && res.data.zczm) this.zczmList = [res.data.zczm]
  465. if (res.data) this.updateFlag = true
  466. })
  467. }
  468. // if (id) {
  469. // GetLrByZjhm({
  470. // lrJmzjhm: this.idcardMD5
  471. // }).then(res => {
  472. // if (res.data) {
  473. // showConfirm('该信息已存在,请登录').then(res => {
  474. // if (res.confirm == true) {
  475. // uni.reLaunch({
  476. // url: '/pages/login/index'
  477. // })
  478. // }
  479. // })
  480. // } else {
  481. // this.disabled = false
  482. // }
  483. // })
  484. // }
  485. } else if (this.cardType == 'back') {
  486. if (!words) {
  487. showConfirm('请上传正确的身份证国徽面')
  488. return
  489. }
  490. if (words.image_status == "other_type_card") {
  491. showConfirm('请上传正确的身份证国徽面')
  492. return
  493. }
  494. if (words.risk_type != "normal") {
  495. // normal-正常身份证;copy-复印件;temporary-临时身份证;screen-翻拍;unknown-其他未知情况
  496. showConfirm('请上传正确的身份证国徽面')
  497. return
  498. }
  499. // words.words_result['失效日期'].words
  500. // words.words_result['签发日期'].words
  501. // words.words_result['签发机关'].words
  502. if (words && words.words_result) {
  503. this.baseFormData.sfzqfjg = words.words_result['签发机关'].words
  504. this.baseFormData.sfzyxqxs = words.words_result['签发日期'].words
  505. this.baseFormData.sfzyxqxz = words.words_result['失效日期'].words
  506. this.backBase64 = words.card_image
  507. this.zjcaijianSrcFan = 'data:image/jpeg;base64,' + words.card_image
  508. }
  509. }
  510. },
  511. toggle(type) {
  512. uni.hideKeyboard()
  513. this.shequData = this.jiedaoData[0].children
  514. // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
  515. this.$refs.popup.open(type)
  516. },
  517. bindChange(e) {
  518. if (e.detail.value.length == 1) {
  519. this.jiedaoValue = this.jiedaoData[e.detail.value[0]]
  520. this.shequData = this.jiedaoData[e.detail.value[0]].children
  521. if (this.shequData.length > 0 && this.shequData[0] != null) {
  522. this.shequValue = this.shequData[0]
  523. this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
  524. this.baseFormData.lrHjdz = this.shequValue.code
  525. } else {
  526. this.shequData = []
  527. this.shequValue = ''
  528. this.diqu = this.jiedaoValue.label
  529. this.baseFormData.lrHjdz = this.jiedaoValue.code
  530. }
  531. } else {
  532. let index = e.detail.value[0] ? e.detail.value[0] : 0
  533. this.jiedaoValue = this.jiedaoData[index]
  534. this.shequValue = this.shequData[e.detail.value[1]]
  535. this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
  536. this.baseFormData.lrHjdz = this.shequValue.code
  537. }
  538. },
  539. buildDataByLevel(data, pid) {
  540. let result = [];
  541. data.filter(e => {
  542. return e.parent_id === pid
  543. }).forEach(e => {
  544. result.push({
  545. value: e.code,
  546. text: e.name,
  547. id: e.id,
  548. children: this.buildDataByLevel(data, e.id)
  549. })
  550. })
  551. return result.length > 0 ? result : []
  552. },
  553. paizhao(type) {
  554. this.type = type
  555. if (this.type == 'back' && !this.ocrXm) {
  556. showConfirm('请先拍摄身份证人像面')
  557. return
  558. }
  559. uni.setStorageSync("cardType", type)
  560. uni.navigateTo({
  561. url: '/pages/info/card'
  562. })
  563. },
  564. onchange(e) {
  565. console.log("onchange", e);
  566. },
  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. console.log(res);
  717. window.open(res.data.url, '_self');
  718. } else {
  719. toast('该功能暂未开放')
  720. // uni.navigateBack()
  721. }
  722. })
  723. }, 1000)
  724. }
  725. })
  726. } else {
  727. // that.baseFormData.lzzt = 1
  728. SaveKhjbxx(that.baseFormData).then(r => {
  729. uni.hideLoading()
  730. if (r.code == 200) {
  731. toast('保存成功,正在前往刷脸激活')
  732. that.baseFormData.id = r.data
  733. setTimeout(function() {
  734. let param = {
  735. id: that.baseFormData.id,
  736. url: config.redirectUrl + that.baseFormData.id
  737. }
  738. GetUrl(param).then(res => {
  739. if (res.code == 200) {
  740. window.open(res.data.url, '_self');
  741. } else {
  742. toast('该功能暂未开放')
  743. // uni.navigateBack()
  744. }
  745. })
  746. }, 1000)
  747. }
  748. })
  749. }
  750. }).catch(err => {
  751. uni.hideLoading()
  752. })
  753. })
  754. }, 500)
  755. } else {
  756. showConfirm('请重新上传人像')
  757. return
  758. }
  759. }
  760. }
  761. }
  762. </script>
  763. <style scoped>
  764. .content {
  765. padding: 1vh;
  766. }
  767. .lzcOCR {
  768. display: flex;
  769. justify-content: space-between;
  770. margin-top: 5vh;
  771. }
  772. .imgBox {
  773. width: 47%;
  774. text-align: center;
  775. image {
  776. width: 100%;
  777. }
  778. .text {
  779. width: 100%;
  780. /* background-color: red; */
  781. }
  782. }
  783. .miaoshu {
  784. margin-top: 5vh;
  785. font-size: 14px;
  786. }
  787. .buttonClass {
  788. margin-top: 4vh;
  789. margin-left: 4vw;
  790. width: 68vw;
  791. /* height: 5vh; */
  792. border-radius: 5.8vw;
  793. /* border: 1px solid rgba(176, 179, 199, 1); */
  794. background: #28d87d;
  795. color: white;
  796. height: 5vh;
  797. display: flex;
  798. align-items: center;
  799. justify-content: center;
  800. box-shadow: 0rpx 4rpx 10rpx 1rpx rgba(40, 216, 125, 0.4);
  801. }
  802. .picker-view {
  803. width: 750rpx;
  804. height: 600rpx;
  805. margin-top: 20rpx;
  806. }
  807. .item {
  808. line-height: 100rpx;
  809. text-align: center;
  810. }
  811. </style>