householdCert.vue 18 KB

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