add-files.vue 31 KB

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