householdCert.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. <template>
  2. <view class="bg-white" style="min-height: 100vh;">
  3. <view class="">
  4. <view class="flex justify-between " style="padding: 30rpx;box-sizing: border-box;">
  5. <view class="" style="font-size: 38rpx;">
  6. <text class="text-bold text-black">您的申请信息</text>
  7. </view>
  8. <view class="text-red" style="padding-top: 12rpx;">
  9. <text style="font-size: 38rpx;">{{totalStep}}</text>
  10. <text class="text-df">/{{totalStep}}</text>
  11. </view>
  12. </view>
  13. <view class="">
  14. <view style="padding: 50rpx 0 20rpx 48rpx;">
  15. <text class="cuIcon-locationfill text-blue padding-right-sm"></text>
  16. <text
  17. class="local_city_info">{{residential_name}},{{building_name}},{{unit_name}},{{room_name}}</text>
  18. </view>
  19. </view>
  20. <view class="form">
  21. <u-form :border="true" ref="uForm">
  22. <u-form-item :required="true" label="住户姓名:" prop="name" label-width="150">
  23. <u-input :border="true" placeholder="住户姓名,必填" v-model="name" type="text"></u-input>
  24. </u-form-item>
  25. <u-form-item :required="true" label="住户类型:" prop="type" label-width="150">
  26. <u-input :border="true" type="select" :select-open="typeShow" v-model="typeLabel"
  27. placeholder="请选择住户类型" @click="typeShow = true"></u-input>
  28. </u-form-item>
  29. <u-form-item :required="true" label="国籍:" prop="nationality" label-width="150">
  30. <u-input :border="true" type="select" :select-open="nationalityShow" v-model="nationalityLabel"
  31. @click="nationalityShow = true"></u-input>
  32. </u-form-item>
  33. <u-form-item label="证件类型:" prop="nationalityName" label-width="150">
  34. <u-input :disabled="true" :border="true" type="text" v-model="nationalityName"></u-input>
  35. </u-form-item>
  36. <u-form-item :required="type==0?true:false" label="证件号码" prop="id_card" label-width="150">
  37. <u-input :border="true" placeholder="请输入证件号码" type="text" :trim="true" maxlength="18"
  38. v-model="id_card"></u-input>
  39. </u-form-item>
  40. <view class="flex justify-end">
  41. <text class="text-sm text-orange">*住户类型不是业主时,不需要等待管理员审核</text>
  42. </view>
  43. <u-form-item :required="true" label="性别" prop="sex" label-width="150">
  44. <u-radio-group v-model="sex">
  45. <u-radio shape="circle" name="1">男</u-radio>
  46. <u-radio shape="circle" name="2">女</u-radio>
  47. </u-radio-group>
  48. </u-form-item>
  49. </u-form>
  50. </view>
  51. <view v-if="nationality==3" style="background-color: #FFFFFF;">
  52. <view class="form_group mb0" style="padding-left: 60rpx;">
  53. <view>
  54. <text class="sex">护照图片:</text>
  55. <text class="tips">(基本身份信息页)</text>
  56. </view>
  57. </view>
  58. <view @click="show=true;operaType=1"
  59. style="margin: 30rpx 0 10rpx 0;display: flex;align-items: center;flex-direction: column;">
  60. <upload-img :width="$isEmpty(show_passport_img_uri)?bgWidth:imgWidth"
  61. :height="$isEmpty(show_passport_img_uri)?bgHeight:imgHeight"
  62. :currentImage="show_passport_img_uri" :bgsrc="bgsrc">
  63. </upload-img>
  64. <view class="" style="color: #59a5f0;">
  65. <text class="cuIcon-camera padding-right-sm" style="font-size: 30rpx;"></text>
  66. <text v-if="$isEmpty(show_passport_img_uri)">点击上传护照</text>
  67. <text style="margin-top: 40rpx;display: inline-block;" v-else>点击重新上传</text>
  68. </view>
  69. </view>
  70. </view>
  71. <view v-if="nationality==3" style="background-color: #FFFFFF;">
  72. <view class="form_group mb0" style="padding-left: 60rpx;">
  73. <view>
  74. <text class="sex">入境证明:</text>
  75. <text class="tips">(入镜盖章页)</text>
  76. </view>
  77. </view>
  78. <view @click="show=true;operaType=2"
  79. style="margin: 30rpx 0 10rpx 0;display: flex;align-items: center;flex-direction: column;">
  80. <upload-img :width="$isEmpty(show_entry_img_uri)?bgWidth:imgWidth"
  81. :height="$isEmpty(show_entry_img_uri)?bgHeight:imgHeight" :currentImage="show_entry_img_uri"
  82. :bgsrc="bgsrc">
  83. </upload-img>
  84. <view class="" style="color: #59a5f0;">
  85. <text class="cuIcon-camera padding-right-sm" style="font-size: 30rpx;"></text>
  86. <text v-if="$isEmpty(show_entry_img_uri)">点击上传入境证明</text>
  87. <text style="margin-top: 40rpx;display: inline-block;" v-else>点击重新上传</text>
  88. </view>
  89. </view>
  90. </view>
  91. <!-- 人脸 begin ,微信小程序审核时,隐藏该模块 -->
  92. <view style="background-color: #FFFFFF;" v-if="vuex_appletType==1">
  93. <view class="form_group mb0" style="padding-left: 60rpx;">
  94. <view>
  95. <text class="sex">人脸:</text>
  96. <text class="tips">(人脸用于开门,请上传正脸图片)</text>
  97. </view>
  98. </view>
  99. <view @click="show=true;operaType=3"
  100. style="margin: 30rpx 0 10rpx 0;display: flex;align-items: center;flex-direction: column;">
  101. <upload-img :width="$isEmpty(show_image_uri)?bgWidth:imgWidth"
  102. :height="$isEmpty(show_image_uri)?bgHeight:imgHeight" :currentImage="show_image_uri"
  103. :bgsrc="bgsrc">
  104. </upload-img>
  105. <view class="" style="color: #59a5f0;">
  106. <text class="cuIcon-camera padding-right-sm" style="font-size: 30rpx;"></text>
  107. <text v-if="$isEmpty(show_image_uri)">点击上传人脸</text>
  108. <text style="margin-top: 40rpx;display: inline-block;" v-else>点击重新上传</text>
  109. </view>
  110. </view>
  111. <view class="category" style="padding-bottom: 140rpx;">
  112. <view v-for="(item, index) in iconArray" :key="index" class="category_item">
  113. <view class="category_item_wrap" :data-index="item.index">
  114. <view class="icon_wrap">
  115. <image :src="item.iconUrl" class="index_icon"></image>
  116. </view>
  117. <view class="category_item_text">
  118. <text>{{item.iconText}}</text>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. <!-- 人脸 end -->
  125. <u-action-sheet @click="photoChecked" z-index="999999" :list="list" v-model="show"></u-action-sheet>
  126. <u-select z-index="999999" mode="single-column" :list="typeArry" v-model="typeShow" @confirm="typeConfirm">
  127. </u-select>
  128. <u-select z-index="999999" mode="single-column" :list="nationalityArry" v-model="nationalityShow"
  129. @confirm="nationalityConfirm"></u-select>
  130. <view @click="showDialogBtn" class=" footer-fixed ">
  131. <view class="cu-btn flex text-lg bg-red-btn" style="padding: 46rpx 0;">
  132. 提交认证
  133. </view>
  134. </view>
  135. </view>
  136. </view>
  137. </template>
  138. <script>
  139. import uploadImg from '@/comps/uploadimg/uploadImg.vue'
  140. //获取app实例
  141. var app = getApp();
  142. export default {
  143. components: {
  144. uploadImg
  145. },
  146. data() {
  147. return {
  148. //小程序审核状态
  149. appletType: 0,
  150. //默认点击弹出拍照模态框的是人脸上传操作,1:护照,2:入境,3:人脸
  151. operaType: 3,
  152. //人脸上传模态框,上传照片或拍照
  153. list: [{
  154. text: '相册上传',
  155. }, {
  156. text: '拍照上传'
  157. }],
  158. show: false,
  159. //背景图
  160. bgsrc: 'https://szsq.nxzhsq.cn/community/miniofile/image/camera1.png',
  161. bgWidth: 350,
  162. bgHeight: 320,
  163. //显示图
  164. imgWidth: 540,
  165. imgHeight: 400,
  166. //总步骤数
  167. totalStep: 2,
  168. sex: "1",
  169. //住户类型
  170. typeLabel: '业主',
  171. typeShow: false,
  172. type: 0,
  173. typeArry: [{
  174. value: '0',
  175. label: '业主'
  176. },
  177. {
  178. value: '1',
  179. label: '家属'
  180. },
  181. {
  182. value: '2',
  183. label: '租户'
  184. }
  185. ],
  186. //国籍
  187. nationalityLabel: '中国大陆',
  188. nationalityShow: false,
  189. nationality: 0,
  190. nationalityName: '身份证',
  191. nationalityArry: [{
  192. value: '0',
  193. label: '中国大陆'
  194. },
  195. {
  196. value: '1',
  197. label: '中国香港/澳门'
  198. },
  199. {
  200. value: '2',
  201. label: '中国台湾'
  202. },
  203. {
  204. value: '3',
  205. label: '海外'
  206. }
  207. ],
  208. //住户名字
  209. name: '',
  210. residentialId: '',
  211. residential_name: "",
  212. //小区名字
  213. community_name: '',
  214. //楼栋名字
  215. buildingId:'',
  216. building_name: '',
  217. //单元名字
  218. unitId:'',
  219. unit_name: '',
  220. //房间名字
  221. room_name: '',
  222. //房间id
  223. room_id: '',
  224. //护照照片
  225. passport_img_uri: null,
  226. //护照照片回显
  227. show_passport_img_uri: null,
  228. //入境证明
  229. entry_img_uri: null,
  230. //入境证明回显
  231. show_entry_img_uri: null,
  232. //人脸图片地址
  233. image_uri: null,
  234. //人脸回显
  235. show_image_uri: null,
  236. //图片的md5
  237. face_code: null,
  238. //身份证
  239. id_card: null,
  240. iconArray: [{
  241. "iconUrl": "https://szsq.nxzhsq.cn/community/miniofile/image/zd.png",
  242. "iconText": '不要遮挡',
  243. "index": 1
  244. }, {
  245. "iconUrl": "https://szsq.nxzhsq.cn/community/miniofile/image/mj.png",
  246. "iconText": '不戴墨镜',
  247. "index": 2
  248. }, {
  249. "iconUrl": "https://szsq.nxzhsq.cn/community/miniofile/image/zl.png",
  250. "iconText": '不能仰头俯拍',
  251. "index": 3
  252. }, {
  253. "iconUrl": "https://szsq.nxzhsq.cn/community/miniofile/image/cz.png",
  254. "iconText": '光线充足',
  255. "index": 4
  256. }, {
  257. "iconUrl": "https://szsq.nxzhsq.cn/community/miniofile/image/bg.png",
  258. "iconText": '浅色背景',
  259. "index": 5
  260. }, {
  261. "iconUrl": "https://szsq.nxzhsq.cn/community/miniofile/image/sh.png",
  262. "iconText": '物业审核生效',
  263. "index": 6
  264. }],
  265. };
  266. },
  267. onLoad: function(options) {
  268. console.log(options,"options");
  269. //显示用户选择的小区+楼栋+房间名字
  270. this.residentialId = options.residentialId
  271. this.residential_name = options.residential_name;
  272. this.buildingId=options.building_id
  273. this.building_name = options.building_name
  274. this.unitId=options.unitId
  275. this.unit_name = options.unit_name;
  276. this.room_name = options.room_name;
  277. this.room_id = options.room_id;
  278. this.name = app.globalData.member.name
  279. },
  280. onShow() {
  281. this.getAppletType()
  282. //总步骤数
  283. //注册的流程总步骤数是3,其他流程总步骤数是2
  284. if (this.$isEmpty(app.globalData.totalStep)) {
  285. this.totalStep = 2
  286. } else {
  287. this.totalStep = app.globalData.totalStep
  288. }
  289. //获取当前页面的对象,获取拍照回显照片
  290. let currPage = this.$util.getPageCtx()
  291. if (!this.$isEmpty(currPage.data.image)) {
  292. this.uploadImage(currPage.data.image)
  293. }
  294. },
  295. computed: {
  296. },
  297. methods: {
  298. getAppletType: function() {
  299. var that = this;
  300. uni.login({
  301. success: res => {
  302. let params = {};
  303. params['js_code'] = res.code;
  304. params['name'] = 'community';
  305. params["app_type"] = 1;
  306. // let operation = 'miniprogram/getOpenid'; //发起请求
  307. this.$http.getOpenid(params).then(res => {
  308. //获取成功
  309. if (res.data.result_code == 1) {
  310. uni.setStorageSync("appletType", res.data.appletType);
  311. that.$u.vuex('vuex_appletType', res.data.appletType)
  312. }
  313. });
  314. }
  315. });
  316. },
  317. //点击模态框选项触发
  318. photoChecked(index) {
  319. if (index == 0) {
  320. //图片上传
  321. this.chooseImage()
  322. } else if (index == 1) {
  323. if (this.operaType == 3) {
  324. //拍照上传,拍照人脸
  325. uni.navigateTo({
  326. url: "../../my-camera/my-camera?type=0"
  327. })
  328. } else {
  329. //拍照上传,拍照证件
  330. uni.navigateTo({
  331. url: "../../my-camera/my-camera?type=1"
  332. })
  333. }
  334. }
  335. },
  336. typeConfirm(e) {
  337. this.type = 0;
  338. e.map((val, index) => {
  339. this.type = val.value
  340. this.typeLabel = val.label
  341. })
  342. },
  343. nationalityConfirm(e) {
  344. this.nationality = 0;
  345. e.map((val, index) => {
  346. this.nationality = val.value
  347. this.nationalityLabel = val.label
  348. if (this.nationality == 0) {
  349. this.nationalityName = '身份证';
  350. } else if (this.nationality == 1) {
  351. this.nationalityName = '港澳居民往来内地通行证';
  352. } else if (this.nationality == 2) {
  353. this.nationalityName = '台湾居民往来大陆通行证';
  354. } else if (this.nationality == 3) {
  355. this.nationalityName = '护照';
  356. }
  357. })
  358. },
  359. //点击上传图片事件
  360. chooseImage: function() {
  361. var that = this;
  362. uni.chooseImage({
  363. count: 1,
  364. //最多可以选择的图片张数,默认9
  365. sourceType: ['album', 'camera'],
  366. sizeType: ['compressed'],
  367. //可选择原图或压缩后的图片
  368. success: res => {
  369. let tempFilePaths = res.tempFilePaths;
  370. that.uploadImage(tempFilePaths[0])
  371. }
  372. });
  373. },
  374. /**上传图片
  375. * @param {Object} imgUrl 图片url
  376. */
  377. uploadImage(imgUrl) {
  378. let that = this
  379. this.$http.uploadFile(imgUrl).then(res => {
  380. if (that.operaType == 1) {
  381. that.setData({
  382. passport_img_uri: res.data,
  383. show_passport_img_uri: imgUrl
  384. });
  385. } else if (that.operaType == 2) {
  386. that.setData({
  387. entry_img_uri: res.data,
  388. show_entry_img_uri: imgUrl
  389. });
  390. } else if (that.operaType == 3) {
  391. that.setData({
  392. image_uri: res.data,
  393. show_image_uri: imgUrl,
  394. });
  395. }
  396. })
  397. },
  398. //提交认证
  399. showDialogBtn: function() {
  400. let params = {};
  401. let that = this;
  402. if (that.name == "") {
  403. app.globalData.autoFailHint("请填写住户姓名");
  404. return;
  405. }
  406. //用户类型
  407. let type = that.type; //['业主','家属','租户'],
  408. params['type'] = type; //0 中国大陆 1 中国香港/澳门 2 中国台湾 3 海外
  409. //国籍
  410. let nationality = that.nationality;
  411. params['nationality'] = nationality;
  412. //身份证
  413. var id_card = this.id_card;
  414. params['idCard'] = id_card; //业主身份证必填
  415. if (type == 0 && !id_card) {
  416. app.globalData.autoFailHint("住户类型是业主时,证件号码必填");
  417. return;
  418. }
  419. if (!this.$isEmpty(id_card)) {
  420. //如果身份证号不为空,就校验身份证号
  421. if (!this.$u.test.idCard(id_card)) {
  422. app.globalData.autoFailHint("请输入正确的身份证号");
  423. return;
  424. }
  425. }
  426. let passport_img_uri = that.passport_img_uri;
  427. let entry_img_uri = that.entry_img_uri;
  428. if (nationality == 3) {
  429. params['passportImgUri'] = that.passport_img_uri;
  430. params['entryImgUri'] = that.entry_img_uri;
  431. if (type == 0) {
  432. if (!passport_img_uri) {
  433. app.globalData.autoFailHint("请上传护照图片");
  434. return;
  435. }
  436. if (!entry_img_uri) {
  437. app.globalData.autoFailHint("请上传入境证明");
  438. return;
  439. }
  440. }
  441. }
  442. let image_uri = that.image_uri;
  443. if (this.$isEmpty(image_uri) && this.vuex_appletType == 1) {
  444. //微信小程序通过审核时,开放人脸模块
  445. this.$u.toast('请上传人脸')
  446. return
  447. }
  448. params['unitId'] = this.unitId
  449. params['buildingId'] = this.buildingId
  450. params['residentialId'] = this.residentialId
  451. params['faceUrl'] = that.image_uri.data.name;
  452. params['sex'] = that.sex;
  453. params['name'] = that.name;
  454. params['phone'] = app.globalData.member.phone
  455. params['roomId'] = that.room_id;
  456. params['createType'] = '0'; //申请来源0-小程序添加 1-后台添加 2-后台导入 3-app添加
  457. params['recordType'] = '0'; //申请的记录类型 0--认证类型 1--新增类型 2--编辑类型
  458. params['memberId'] = app.globalData.member.id; //会员id
  459. that.$http.authentication(params).then(res => {
  460. //提交成功
  461. if (res.data.success) {
  462. app.globalData.oneFailHint("提交成功", function() {
  463. //跳转到首页
  464. uni.reLaunch({
  465. url: '/pages/index/index?isFlush=true'
  466. });
  467. });
  468. } else {
  469. app.globalData.oneFailHint(res.data.result_msg);
  470. }
  471. });
  472. }
  473. }
  474. };
  475. </script>
  476. <style scoped lang="scss">
  477. page {
  478. background-color: #FFFFFF;
  479. }
  480. .form {
  481. padding: 0 60rpx;
  482. background-color: #FFFFFF;
  483. }
  484. .local_city {
  485. padding: 30rpx 0;
  486. position: relative;
  487. background: #fff;
  488. }
  489. .local_city .changeCity {
  490. padding: 20rpx;
  491. position: absolute;
  492. right: 0rpx;
  493. top: 0;
  494. }
  495. .local_city .icon {
  496. padding: 20rpx;
  497. position: absolute;
  498. left: -0;
  499. top: 50%;
  500. transform: translate(0, -50%);
  501. font-size: 40rpx;
  502. }
  503. .local_city .local_city_info {
  504. padding-left: 40rpx;
  505. display: inline-block;
  506. }
  507. .form_group .upload {
  508. padding: 0 28rpx;
  509. font-size: 26rpx;
  510. background: $base-btn-color;
  511. color: #fff;
  512. border: none;
  513. }
  514. .upload_tips {
  515. font-size: 24rpx;
  516. }
  517. .upload_bg {
  518. position: relative;
  519. text-align: center;
  520. }
  521. .mb0 {
  522. padding-top: 40rpx;
  523. font-size: 28rpx;
  524. margin-bottom: 0;
  525. }
  526. .form_group .tips {
  527. margin-left: 50rpx;
  528. }
  529. .upload_bg .upload_bgImg {
  530. width: 540rpx;
  531. height: 400rpx;
  532. }
  533. .upload_bg .upload_btn {
  534. width: 120rpx;
  535. height: 120rpx;
  536. position: absolute;
  537. left: 50%;
  538. top: 50%;
  539. margin-left: -65rpx;
  540. margin-top: -60rpx;
  541. }
  542. .upload_bg .upload_btn image {
  543. width: 100%;
  544. height: 100%;
  545. }
  546. .upload_text {
  547. position: absolute;
  548. top: 70%;
  549. left: 50%;
  550. transform: translate(-50%, 0);
  551. color: $base-btn-color;
  552. }
  553. upload_bg {
  554. position: relative;
  555. }
  556. .upload_bg .upload_btn {
  557. width: 120rpx;
  558. height: 120rpx;
  559. position: absolute;
  560. left: 50%;
  561. top: 40%;
  562. margin-left: -65rpx;
  563. margin-top: -60rpx;
  564. }
  565. .upload_bg .upload_btn image {
  566. width: 100%;
  567. height: 100%;
  568. }
  569. .upload_text {
  570. position: absolute;
  571. top: 55%;
  572. width: 100%;
  573. color: $base-btn-color;
  574. }
  575. .img_content {
  576. margin-top: 20rpx;
  577. position: relative;
  578. text-align: center;
  579. }
  580. .img_content .upload_bgImg {
  581. width: 560rpx;
  582. height: 420rpx;
  583. max-height: 1;
  584. display: inline-block;
  585. border-radius: 20rpx;
  586. }
  587. .reUpload {
  588. height: 60rpx;
  589. line-height: 60rpx;
  590. text-align: right;
  591. color: #333;
  592. padding-right: 100rpx;
  593. font-size: 26rpx;
  594. }
  595. .img_content .img_icon {
  596. width: 40rpx;
  597. height: 40rpx;
  598. vertical-align: text-top;
  599. margin-right: 6rpx;
  600. border-radius: 20rpx;
  601. }
  602. .category {
  603. padding: 20px 20rpx 0;
  604. overflow: auto;
  605. background-color: #FFF;
  606. text-align: center;
  607. }
  608. .category_item {
  609. width: 33.3%;
  610. float: left;
  611. margin-bottom: 40rpx;
  612. }
  613. .icon_wrap {
  614. width: 120rpx;
  615. margin: 0 auto;
  616. margin-bottom: 5px;
  617. }
  618. .index_icon {
  619. width: 60rpx;
  620. height: 60rpx;
  621. }
  622. .category_item_text {
  623. text-align: center;
  624. font-size: 24rpx;
  625. color: #999;
  626. }
  627. </style>