add.vue 22 KB

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