add.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. <template>
  2. <view class="check">
  3. <uni-forms ref="form" :model="datainfo" :rules="rules">
  4. <view class="chmain">
  5. <view class="plr6">
  6. <view class="rztit">请拍摄/上传孩子身份证照片</view>
  7. <view class="rzhbox">
  8. <view class="rzhboxa flexc">
  9. <view class="flex1">
  10. <view class="tit">身份证正面</view>
  11. <view class="txt">※ 身份证信息仅用于实名验证</view>
  12. <view class="txt">※ 我们会保护您的个人信息</view>
  13. </view>
  14. <view class="carbox" @click="getaddImagea('front')">
  15. <image :src="cara"></image>
  16. <!-- <image :src="baseUrl+datainfo.idCardBack" class="img" v-if="datainfo.idCardBack"></image>
  17. <image src="@/work/images/rz/cara.png" class="img" v-else></image> -->
  18. </view>
  19. </view>
  20. <view class="rzhboxa flexc">
  21. <view class="flex1">
  22. <view class="tit">学生照片</view>
  23. <view class="txt">※ 请上传近一年内的照片</view>
  24. <view class="txt">※ 上传的照片面部无遮挡</view>
  25. </view>
  26. <view class="carbox" @click="getaddImagea('front')">
  27. <image :src="carb"></image>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <uni-forms-item label="孩子姓名" name="residentIdCard">
  33. <view class="flexc">
  34. <uni-easyinput disabled v-model="datainfo.residentIdCard" :inputBorder='false' placeholder="自动识别" />
  35. <view class="rimg"></view>
  36. </view>
  37. </uni-forms-item>
  38. <uni-forms-item label="出生年月" name="residentName">
  39. <view class="flexc">
  40. <uni-easyinput :disabled="isdisabled" v-model="datainfo.residentName" :inputBorder='false' placeholder="自动识别" />
  41. <view class="rimg"></view>
  42. </view>
  43. </uni-forms-item>
  44. <uni-forms-item label="性别" name="idCardAddress">
  45. <view class="flexc">
  46. <uni-easyinput disabled v-model="datainfo.idCardAddress" :inputBorder='false' placeholder="自动识别" />
  47. <view class="rimg"></view>
  48. </view>
  49. </uni-forms-item>
  50. <uni-forms-item label="居住地址" name="idCardAddress">
  51. <view class="flexc">
  52. <uni-easyinput disabled v-model="datainfo.idCardAddress" :inputBorder='false' placeholder="自动识别" />
  53. <view class="rimg"></view>
  54. </view>
  55. </uni-forms-item>
  56. <uni-forms-item label="学校名称" name="residentPhone">
  57. <view class="flexc">
  58. <uni-easyinput :disabled="isdisabled" v-model="datainfo.residentPhone" :inputBorder='false' placeholder="请选择或输入学校" />
  59. <view class="rimg">
  60. <image :src="more"></image>
  61. </view>
  62. </view>
  63. </uni-forms-item>
  64. <uni-forms-item label="班级名称" name="residentPhone">
  65. <view class="flexc">
  66. <uni-easyinput :disabled="isdisabled" v-model="datainfo.residentPhone" :inputBorder='false' placeholder="请选择或输入班级" />
  67. <view class="rimg">
  68. <image :src="more"></image>
  69. </view>
  70. </view>
  71. </uni-forms-item>
  72. <!-- <uni-forms-item label="居住门户" name="houseId">
  73. <w-select
  74. style="margin-left: 20rpx;"
  75. v-model="datainfo.houseId"
  76. :list='fwlist'
  77. valueName='dictLabel'
  78. keyName="dictValue"
  79. :chosevalue="datainfo.detailedAddress"
  80. :filterable='filterable'
  81. @change='getchange'
  82. >
  83. </w-select>
  84. </uni-forms-item> -->
  85. <uni-forms-item label="防溺水通知" name="residentEmployer">
  86. <view class="flexc">
  87. <view class="flex1"></view>
  88. <view @click="noticeFlag=!noticeFlag" class="checkbox">
  89. <image :src="switcha" v-if="noticeFlag"></image>
  90. <image :src="switchb" v-else></image>
  91. </view>
  92. <view class="rimg"></view>
  93. </view>
  94. </uni-forms-item>
  95. </view>
  96. <view class="abtns mb14 mt50" @click="getRzFn">下一步,验证身份</view>
  97. <view class="lread" @click="checkflag=!checkflag">
  98. <view class="lreadl">
  99. <image :src="check" v-if="checkflag"></image>
  100. <image :src="ncheck" v-else></image>
  101. </view>
  102. <view class="tit">我已阅读并同意<text @click.stop="handlePrivacy">《用户授权协议》</text>及<text @click.stop="handlePrivacy">《用户隐私协议》</text></view>
  103. </view>
  104. <!-- <view class="rhbtn mt30 " @click="getEditFn" v-if="isdisabled">修改</view>
  105. <view class="rhbtn mt30 " @click="getSubmit" v-else>提交</view> -->
  106. </uni-forms>
  107. <loading></loading>
  108. </view>
  109. </template>
  110. <script>
  111. import config from '@/config'
  112. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  113. // import {uploadIdentify,uploadmore} from '@/utils/common.js'
  114. // import {getDictionaryFn} from "@/api/system/user.js"
  115. // import {selectValueKey} from "@/utils/common.js"
  116. // import {getOcrIdCard} from "@/api/system/card.js"
  117. import wSelect from "@/work/components/w-select/w-select.vue"
  118. export default {
  119. components: {wSelect},
  120. data() {
  121. return {
  122. cara:require('@/work/images/rz/cara.png'),
  123. carb:require('@/work/images/rz/carb.png'),
  124. more:require('@/work/images/rz/more.png'),
  125. switcha:require('@/work/images/rz/switcha.png'),
  126. switchb:require('@/work/images/rz/switchb.png'),
  127. check:require('@/static/images/check.png'),
  128. ncheck:require('@/static/images/ncheck.png'),
  129. baseUrl: config.baseUrl,
  130. datainfo: {
  131. },
  132. rules:{
  133. // residentName: {rules: [{required: true,errorMessage: '请输入姓名' }]},
  134. },
  135. isdisabled:false,
  136. ptype:'add',
  137. filterable:true,
  138. chooseValue:'',
  139. map:{text:'dictLabel',value:'dictValue'},
  140. userId:this.$store.state.user.userId,
  141. noticeFlag:true,
  142. checkflag:true,
  143. }
  144. },
  145. onLoad: function(e) {
  146. if(e.id){
  147. this.id=e.id;
  148. this.ptype="edit";
  149. // this.isdisabled=true;
  150. this.getDetail()
  151. }
  152. // this.init()
  153. },
  154. methods: {
  155. checkPermi,
  156. checkRole,
  157. getEditFn(){
  158. this.isdisabled=false;
  159. },
  160. handlePrivacy(){
  161. this.$tab.navigateTo(`/pages/agreement`)
  162. },
  163. statusFormats(data, list,type) {
  164. var aite=selectValueKey(list, data);
  165. return aite.actions;
  166. },
  167. getchange(e){
  168. this.datainfo.houseId=e.dictValue;
  169. this.datainfo.detailedAddress=e.dictLabel;
  170. },
  171. init(){
  172. //性别
  173. getDictionaryFn('gender').then(res=>{
  174. if(res.code==200){
  175. this.xbList = res.data.map(v => {
  176. return {
  177. dictLabel: v.dictLabel,
  178. dictValue: Number(v.dictValue)
  179. }
  180. })
  181. }
  182. })
  183. },
  184. getDetail(){
  185. residentInfoDet(this.id).then(res=>{
  186. if(res.code==200){
  187. this.datainfo=res.data;
  188. if(res.data.facePhoto){
  189. this.phofile=res.data.facePhoto.split(',')
  190. }
  191. }
  192. })
  193. },
  194. getRzFn(){
  195. // #ifdef APP-PLUS
  196. this.getFace()
  197. // #endif
  198. // #ifndef APP-PLUS
  199. // this.$toast("请在app端进行认证")
  200. // 跳h5页面进行人脸认证
  201. var user=JSON.parse(JSON.stringify(this.user));
  202. user.userId=this.userId;
  203. user.returnUrl='https://rzdbh.qs163.cn/pages/success';
  204. // var data={
  205. // idCard:user.idCard,
  206. // realName:user.realName,
  207. // returnUrl:'http://192.168.101.147:9092/pages/success'
  208. // }
  209. this.$tab.navigateTo('/pages/common/webview/faceauth?data='+encodeURIComponent(JSON.stringify(user)))
  210. // #endif
  211. },
  212. getFace(){
  213. var that=this;
  214. // initFace Y不需要,N需要人脸认证
  215. var user=this.user;
  216. var params={
  217. idCard:user.idCard,
  218. realName:user.realName,
  219. metaInfo:this.metaInfo,
  220. }
  221. // #ifndef APP-PLUS
  222. params.returnUrl='https://rzdb.qs163.cn';
  223. // #endif
  224. getOcrFn(params).then(res=>{
  225. if(res.code==200){
  226. // #ifdef APP-PLUS
  227. var id=res.data.certifyId;
  228. aliyunVerify.verify({
  229. "certifyId":id, // 填写从服务端获取的certifyId
  230. },
  231. function(response){
  232. var face='Y'
  233. if(response.code==1000){
  234. var reparams=that.user;
  235. reparams.userId=that.userId;
  236. // getIdCardAdd(reparams).then(resa=>{
  237. // if(resa.code==200){
  238. // that.$store.dispatch('checkInitFace', face).then(() => {
  239. // that.$tab.redirectTo('/work/pages/prove/addqy?from=rz')
  240. // })
  241. // }
  242. // })
  243. }
  244. }
  245. );
  246. // #endif
  247. // #ifndef APP-PLUS
  248. this.$toast("请在app端进行认证")
  249. // 跳h5页面进行人脸认证
  250. // console.log(MetaInfo)
  251. // var user=this.user;
  252. // var data={
  253. // url:res.data.certifyUrl,
  254. // realName:user.realName,
  255. // }
  256. // this.$tab.navigateTo('/pages/common/webview/faceauth?data='+encodeURIComponent(JSON.stringify(data)))
  257. // #endif
  258. }
  259. })
  260. },
  261. getSubmit(){
  262. var that=this;
  263. this.$refs.form.validate().then(res => {
  264. var params=JSON.parse(JSON.stringify(this.datainfo))
  265. if(this.ptype=='add'){
  266. familyInfoAdd(params).then(res=>{
  267. if(res.code==200){
  268. this.$toast("新增成功")
  269. setTimeout(function(){
  270. uni.$emit("residentInfoList")
  271. uni.navigateBack({
  272. delta:1
  273. })
  274. },1500)
  275. }
  276. })
  277. }else{
  278. params.isFilter=false
  279. residentInfoPut(params).then(res=>{
  280. if(res.code==200){
  281. this.$toast("修改成功")
  282. setTimeout(function(){
  283. uni.$emit("residentInfoList")
  284. uni.navigateBack({
  285. delta:1
  286. })
  287. },1500)
  288. }
  289. })
  290. }
  291. })
  292. },
  293. getaddImage(type){
  294. if(this.isdisabled){
  295. return
  296. }
  297. let that = this;
  298. let file =[],count=9
  299. uni.chooseImage({
  300. success:function(res){
  301. let img= res.tempFilePaths;
  302. if(img.length + file.length > count){
  303. uni.showToast({
  304. title: '最多上传'+count+'张图片',
  305. icon: 'none',
  306. duration: 2000
  307. })
  308. }else{
  309. let imglen = res.tempFilePaths.length;
  310. var fuwufile = [];
  311. uploadmore('/common/upload',img,0,0,0,imglen,fuwufile,function(rs){
  312. that.phofile = that.phofile.concat(rs);
  313. })
  314. }
  315. }
  316. });
  317. },
  318. getaddImagea(e) {
  319. let that = this;
  320. let file = []
  321. uni.chooseImage({
  322. count: 1,
  323. success: function(res) {
  324. let img = res.tempFilePaths;
  325. let imglen = res.tempFilePaths.length;
  326. var fuwufile = [];
  327. uploadIdentify('/common/upload', img, 0, 0, 0, imglen, fuwufile, function(rs) {
  328. var resurl = rs[0];
  329. if (e == 'front') {
  330. that.datainfo.idCardBack = resurl.fileName;
  331. if (rs && rs.length > 0) {
  332. var obj = {
  333. type: e,
  334. url: resurl.urlOnline
  335. }
  336. that.getOcrIdCard(obj)
  337. }
  338. } else {
  339. that.datainfo.idCardFront = resurl.fileName;
  340. }
  341. })
  342. }
  343. });
  344. },
  345. getOcrIdCard(obj) {
  346. var params = {
  347. image: obj.url,
  348. idCardSide: obj.type
  349. }
  350. getOcrIdCard(params).then(res => {
  351. if (res.code == 200) {
  352. var datainfo = res.data;
  353. if (obj.type == 'front') {
  354. this.datainfo.residentName = datainfo.realName;
  355. this.datainfo.residentIdCard = datainfo.idCard;
  356. this.datainfo.idCardAddress = datainfo.address;
  357. // } else {
  358. // this.datainfo.expirationDate = datainfo.expirationDate
  359. }
  360. }
  361. })
  362. }
  363. }
  364. }
  365. </script>
  366. <style lang="scss" scoped>
  367. .check /deep/ .select-wrap{border: none;width: 100%;}
  368. .check /deep/ .uni-forms-item{min-height: 106rpx;box-sizing: border-box;display: flex;align-items: center;margin-bottom: 0;border-bottom: 2rpx solid #E6E6E6;padding:10rpx 0;}
  369. // .check .cbox /deep/ .uni-forms-item:last-child{border: none;}
  370. .check /deep/ .uni-forms-item__label{font-weight: bold;font-size: 26rpx;color: #222327;flex: 0 0 auto;width: auto !important;}
  371. .check /deep/ .uni-forms-item__label text{min-width: 106rpx !important;text-align-last: justify;}
  372. .check /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 26rpx;color: #222327;}
  373. .check /deep/ .uni-easyinput__content-textarea{min-height: 40rpx;font-size: 26rpx;}
  374. .check /deep/ .uni-easyinput__placeholder-class{font-size: 26rpx;color: #AAAAAA;}
  375. .check /deep/ .uni-input-input{font-size: 26rpx;}
  376. .check /deep/ .uni-textarea-textarea{font-size: 26rpx;}
  377. .check /deep/ .is-disabled{color: #222327;background-color: #ffffff !important;}
  378. .check /deep/ .uni-data-checklist .checklist-group .checklist-box{margin:10rpx 8rpx 10rpx 16rpx;}
  379. .check /deep/ .uni-data-checklist{flex: 0 0 auto;}
  380. // .check /deep/ .is-required{font-size: 26rpx;color: #F40027;margin-right: 4rpx;}
  381. .check{box-sizing: border-box;padding: 36rpx 24rpx 40rpx;}
  382. .chmain{
  383. .checkbox{width: 80rpx;height: 40rpx;flex: 0 0 auto;margin-left: 12rpx;
  384. image{width: 100%;height: 100%;}
  385. }
  386. .rimg{width: 16rpx;height: 28rpx;flex: 0 0 auto;margin-left: 20rpx;
  387. image{width: 100%;height: 100%;}
  388. }
  389. }
  390. .rztit{font-weight: bold;font-size: 30rpx;color: #000000;margin-bottom: 20rpx;}
  391. .rzhbox{background: #F4F6F8;border-radius: 20rpx;
  392. .rzhboxa{padding: 24rpx;
  393. .tit{font-weight: bold;font-size: 30rpx;line-height: 48rpx;color: #000000;margin-bottom: 16rpx;}
  394. .txt{font-weight: 500;font-size: 24rpx;color: #999999;margin-bottom: 8rpx;}
  395. .carbox{width: 290rpx;height: 182rpx;flex: 0 0 auto;margin-left: 4rpx;
  396. image{width: 100%; height: 100%;}
  397. }
  398. }
  399. }
  400. .lread{
  401. display: flex;align-items: flex-start;justify-content: center;
  402. .lreadl{padding-top: 4rpx;
  403. image{width: 26rpx;height: 26rpx;margin-right: 12rpx;}
  404. }
  405. .tit{font-size: 24rpx;font-weight: 500;color: #222327;line-height: 32rpx;
  406. text{color:#0256FD;padding: 0 6rpx;}
  407. }
  408. }
  409. </style>