add-files.vue 31 KB

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