householdCert.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  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 class="local_city_info">{{residential_name}},{{building_name}},{{unit_name}},{{room_name}}</text>
  17. </view>
  18. </view>
  19. <view class="form">
  20. <u-form :border="true" ref="uForm" >
  21. <u-form-item :required="true" label="住户姓名:" prop="name" label-width="150">
  22. <u-input :border="true" placeholder="住户姓名,必填" v-model="name" type="text"></u-input>
  23. </u-form-item>
  24. <u-form-item :required="true" label="住户类型:" prop="type" label-width="150">
  25. <u-input :border="true" type="select" :select-open="typeShow" v-model="typeLabel" placeholder="请选择住户类型" @click="typeShow = true"></u-input>
  26. </u-form-item>
  27. <u-form-item :required="true" label="国籍:" prop="nationality" label-width="150">
  28. <u-input :border="true" type="select" :select-open="nationalityShow" v-model="nationalityLabel" @click="nationalityShow = true"></u-input>
  29. </u-form-item>
  30. <u-form-item label="证件类型:" prop="nationalityName" label-width="150">
  31. <u-input :disabled="true" :border="true" type="text" v-model="nationalityName"></u-input>
  32. </u-form-item>
  33. <u-form-item :required="type==0?true:false" label="证件号码" prop="id_card" label-width="150">
  34. <u-input :border="true" placeholder="住户类型是业主时,必填" type="text" :trim="true" maxlength="18" v-model="id_card"></u-input>
  35. </u-form-item>
  36. <u-form-item :required="true" label="性别" prop="sex" label-width="150">
  37. <u-radio-group v-model="sex" >
  38. <u-radio shape="circle" name="1">男</u-radio>
  39. <u-radio shape="circle" name="2">女</u-radio>
  40. </u-radio-group>
  41. </u-form-item>
  42. </u-form>
  43. </view>
  44. <view v-if="nationality==3" style="background-color: #FFFFFF;">
  45. <view class="form_group mb0" style="padding-left: 60rpx;">
  46. <view>
  47. <text class="sex">护照图片:</text>
  48. <text class="tips">(基本身份信息页)</text>
  49. </view>
  50. </view>
  51. <view @click="show=true;operaType=1" style="margin: 30rpx 0 10rpx 0;display: flex;align-items: center;flex-direction: column;">
  52. <upload-img
  53. :width="$isEmpty(show_passport_img_uri)?bgWidth:imgWidth"
  54. :height="$isEmpty(show_passport_img_uri)?bgHeight:imgHeight"
  55. :currentImage="show_passport_img_uri"
  56. :bgsrc="bgsrc"
  57. >
  58. </upload-img>
  59. <view class="" style="color: #59a5f0;">
  60. <text class="cuIcon-camera padding-right-sm" style="font-size: 30rpx;"></text>
  61. <text v-if="$isEmpty(show_passport_img_uri)">点击上传护照</text>
  62. <text style="margin-top: 40rpx;display: inline-block;" v-else>点击重新上传</text>
  63. </view>
  64. </view>
  65. </view>
  66. <view v-if="nationality==3" style="background-color: #FFFFFF;">
  67. <view class="form_group mb0" style="padding-left: 60rpx;">
  68. <view>
  69. <text class="sex">入境证明:</text>
  70. <text class="tips">(入镜盖章页)</text>
  71. </view>
  72. </view>
  73. <view @click="show=true;operaType=2" style="margin: 30rpx 0 10rpx 0;display: flex;align-items: center;flex-direction: column;">
  74. <upload-img
  75. :width="$isEmpty(show_entry_img_uri)?bgWidth:imgWidth"
  76. :height="$isEmpty(show_entry_img_uri)?bgHeight:imgHeight"
  77. :currentImage="show_entry_img_uri"
  78. :bgsrc="bgsrc"
  79. >
  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" style="margin: 30rpx 0 10rpx 0;display: flex;align-items: center;flex-direction: column;">
  97. <upload-img
  98. :width="$isEmpty(show_image_uri)?bgWidth:imgWidth"
  99. :height="$isEmpty(show_image_uri)?bgHeight:imgHeight"
  100. :currentImage="show_image_uri"
  101. :bgsrc="bgsrc"
  102. >
  103. </upload-img>
  104. <view class="" style="color: #59a5f0;">
  105. <text class="cuIcon-camera padding-right-sm" style="font-size: 30rpx;"></text>
  106. <text v-if="$isEmpty(show_image_uri)">点击上传人脸</text>
  107. <text style="margin-top: 40rpx;display: inline-block;" v-else>点击重新上传</text>
  108. </view>
  109. </view>
  110. <view class="category" style="padding-bottom: 140rpx;">
  111. <view v-for="(item, index) in iconArray" :key="index" class="category_item">
  112. <view class="category_item_wrap" @tap="top" :data-index="item.index">
  113. <view class="icon_wrap">
  114. <image :src="item.iconUrl" class="index_icon"></image>
  115. </view>
  116. <view class="category_item_text">
  117. <text>{{item.iconText}}</text>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. <!-- 人脸 end -->
  124. <u-action-sheet @click="photoChecked" z-index="999999" :list="list" v-model="show"></u-action-sheet>
  125. <u-select z-index="999999" mode="single-column" :list="typeArry" v-model="typeShow" @confirm="typeConfirm"></u-select>
  126. <u-select z-index="999999" mode="single-column" :list="nationalityArry" v-model="nationalityShow" @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:'http://139.9.103.171:1888/img/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. {
  172. value: '0',
  173. label: '业主'
  174. },
  175. {
  176. value: '1',
  177. label: '家属'
  178. },
  179. {
  180. value: '2',
  181. label: '租户'
  182. }
  183. ],
  184. //国籍
  185. nationalityLabel:'中国大陆',
  186. nationalityShow: false,
  187. nationality: 0,
  188. nationalityName:'身份证',
  189. nationalityArry: [
  190. {
  191. value: '0',
  192. label: '中国大陆'
  193. },
  194. {
  195. value: '1',
  196. label: '中国香港/澳门'
  197. },
  198. {
  199. value: '2',
  200. label: '中国台湾'
  201. },
  202. {
  203. value: '3',
  204. label: '海外'
  205. }
  206. ],
  207. //住户名字
  208. name: '',
  209. residential_name: "",
  210. //小区名字
  211. community_name: '',
  212. //楼栋名字
  213. building_name:'',
  214. //单元名字
  215. unit_name: '',
  216. //房间名字
  217. room_name: '',
  218. //房间id
  219. room_id: '',
  220. //护照照片
  221. passport_img_uri: null,
  222. //护照照片回显
  223. show_passport_img_uri: null,
  224. //入境证明
  225. entry_img_uri: null,
  226. //入境证明回显
  227. show_entry_img_uri: null,
  228. //人脸图片地址
  229. image_uri: null,
  230. //人脸回显
  231. show_image_uri: null,
  232. //图片的md5
  233. face_code: null,
  234. //身份证
  235. id_card: null,
  236. iconArray: [{
  237. "iconUrl": "http://139.9.103.171:1888/img/image/zd.png",
  238. "iconText": '不要遮挡',
  239. "index": 1
  240. }, {
  241. "iconUrl": "http://139.9.103.171:1888/img/image/mj.png",
  242. "iconText": '不戴墨镜',
  243. "index": 2
  244. }, {
  245. "iconUrl": "http://139.9.103.171:1888/img/image/zl.png",
  246. "iconText": '不能仰头俯拍',
  247. "index": 3
  248. }, {
  249. "iconUrl": "http://139.9.103.171:1888/img/image/cz.png",
  250. "iconText": '光线充足',
  251. "index": 4
  252. }, {
  253. "iconUrl": "http://139.9.103.171:1888/img/image/bg.png",
  254. "iconText": '浅色背景',
  255. "index": 5
  256. }, {
  257. "iconUrl": "http://139.9.103.171:1888/img/image/sh.png",
  258. "iconText": '物业审核生效',
  259. "index": 6
  260. }],
  261. };
  262. },
  263. onLoad: function (options) {
  264. //显示用户选择的小区+楼栋+房间名字
  265. this.residential_name = options.residential_name;
  266. this.building_name=options.building_name
  267. this.unit_name = options.unit_name;
  268. this.room_name = options.room_name;
  269. this.room_id = options.room_id;
  270. this.name=app.globalData.member.name
  271. },
  272. onShow() {
  273. this.getAppletType()
  274. //总步骤数
  275. //注册的流程总步骤数是3,其他流程总步骤数是2
  276. if(this.$isEmpty(app.globalData.totalStep)){
  277. this.totalStep=2
  278. }else{
  279. this.totalStep=app.globalData.totalStep
  280. }
  281. //获取当前页面的对象,获取拍照回显照片
  282. let currPage=this.$util.getPageCtx()
  283. if(!this.$isEmpty(currPage.data.image)){
  284. this.uploadImage(currPage.data.image)
  285. }
  286. },
  287. computed: {
  288. },
  289. methods: {
  290. getAppletType: function () {
  291. var that = this;
  292. uni.login({
  293. success: res => {
  294. let params = {};
  295. params['js_code'] = res.code;
  296. params['name'] = 'community';
  297. let operation = 'miniprogram/getOpenid'; //发起请求
  298. app.globalData.postRequest(params, operation, function (res) {
  299. //获取成功
  300. if (res.data.result_code == 1) {
  301. uni.setStorageSync("appletType", res.data.appletType);
  302. that.$u.vuex('vuex_appletType',res.data.appletType)
  303. }
  304. });
  305. }
  306. });
  307. },
  308. //点击模态框选项触发
  309. photoChecked(index){
  310. if (index==0) {
  311. //图片上传
  312. this.chooseImage()
  313. } else if(index==1){
  314. if(this.operaType==3){
  315. //拍照上传,拍照人脸
  316. uni.navigateTo({
  317. url:"../../my-camera/my-camera?type=0"
  318. })
  319. }else{
  320. //拍照上传,拍照证件
  321. uni.navigateTo({
  322. url:"../../my-camera/my-camera?type=1"
  323. })
  324. }
  325. }
  326. },
  327. typeConfirm(e) {
  328. this.type = 0;
  329. e.map((val, index) => {
  330. this.type=val.value
  331. this.typeLabel=val.label
  332. })
  333. },
  334. nationalityConfirm(e) {
  335. this.nationality = 0;
  336. e.map((val, index) => {
  337. this.nationality=val.value
  338. this.nationalityLabel=val.label
  339. if (this.nationality == 0) {
  340. this.nationalityName = '身份证';
  341. } else if (this.nationality == 1) {
  342. this.nationalityName = '港澳居民往来内地通行证';
  343. } else if (this.nationality == 2) {
  344. this.nationalityName = '台湾居民往来大陆通行证';
  345. } else if (this.nationality == 3) {
  346. this.nationalityName = '护照';
  347. }
  348. })
  349. },
  350. //点击上传图片事件
  351. chooseImage: function () {
  352. var that = this;
  353. uni.chooseImage({
  354. count: 1,
  355. //最多可以选择的图片张数,默认9
  356. sourceType: ['album', 'camera'],
  357. sizeType: ['compressed'],
  358. //可选择原图或压缩后的图片
  359. success: res => {
  360. let tempFilePaths = res.tempFilePaths;
  361. that.uploadImage(tempFilePaths[0])
  362. }
  363. });
  364. },
  365. /**上传图片
  366. * @param {Object} imgUrl 图片url
  367. */
  368. uploadImage(imgUrl){
  369. console.log("operatype: ",this.operaType);
  370. console.log("imgUrl",imgUrl)
  371. var that = this;
  372. //是否需要md5加密上传人脸照
  373. let is_need_md5 = false;
  374. if (this.operaType == 3) {
  375. is_need_md5 = true;
  376. }
  377. uni.getFileSystemManager().readFile({
  378. filePath: imgUrl,
  379. //选择图片返回的相对路径
  380. encoding: 'base64',
  381. //编码格式
  382. success: res => {
  383. //成功的回调
  384. app.globalData.uploadBase64('data:image/jpeg;base64,' + res.data, is_need_md5, function (result) {
  385. if (that.operaType == 1) {
  386. that.setData({
  387. passport_img_uri: result.data.uri,
  388. show_passport_img_uri: imgUrl
  389. });
  390. } else if (that.operaType == 2) {
  391. that.setData({
  392. entry_img_uri: result.data.uri,
  393. show_entry_img_uri: imgUrl
  394. });
  395. } else if (that.operaType == 3) {
  396. that.setData({
  397. image_uri: result.data.uri,
  398. show_image_uri: imgUrl,
  399. face_code: result.data.md5Hex
  400. });
  401. }
  402. });
  403. }
  404. });
  405. },
  406. //提交认证
  407. showDialogBtn: function () {
  408. let params = {};
  409. let that = this;
  410. if (that.name == "") {
  411. app.globalData.autoFailHint("请填写住户姓名");
  412. return;
  413. }
  414. //用户类型
  415. let type = that.type; //['业主','家属','租户'],
  416. params['type'] = type; //0 中国大陆 1 中国香港/澳门 2 中国台湾 3 海外
  417. //国籍
  418. let nationality = that.nationality;
  419. params['nationality'] = nationality;
  420. //身份证
  421. var id_card = this.id_card;
  422. params['id_card'] = id_card; //业主身份证必填
  423. if (type == 0 && !id_card) {
  424. app.globalData.autoFailHint("住户类型是业主时,证件号码必填");
  425. return;
  426. }
  427. let passport_img_uri = that.passport_img_uri;
  428. let entry_img_uri = that.entry_img_uri;
  429. if (nationality == 3) {
  430. params['passport_img_uri'] = that.passport_img_uri;
  431. params['entry_img_uri'] = that.entry_img_uri;
  432. if (type == 0) {
  433. if (!passport_img_uri) {
  434. app.globalData.autoFailHint("请上传护照图片");
  435. return;
  436. }
  437. if (!entry_img_uri) {
  438. app.globalData.autoFailHint("请上传入境证明");
  439. return;
  440. }
  441. }
  442. }
  443. console.log(that.image_uri);
  444. let image_uri = that.image_uri;
  445. if (this.$isEmpty(image_uri)&&this.vuex_appletType==1) {
  446. //微信小程序通过审核时,开放人脸模块
  447. this.$u.toast('请上传人脸')
  448. return
  449. }
  450. params['image_uri'] = that.image_uri;
  451. let face_code = that.face_code;
  452. params['face_code'] = that.face_code; //性别
  453. params['sex'] = that.sex;
  454. params['name'] = that.name;
  455. params['tel'] = app.globalData.member.tel;
  456. params['room_id'] = that.room_id;
  457. params['create_type'] = '0'; //申请来源0-小程序添加 1-后台添加 2-后台导入 3-app添加
  458. params['record_type'] = '0'; //申请的记录类型 0--认证类型 1--新增类型 2--编辑类型
  459. params['member_id'] = app.globalData.member.id;//会员id
  460. let operation = 'member/authentication';
  461. app.globalData.postRequest(params, operation, function (res) {
  462. //提交成功
  463. if (res.data.result_code == 1) {
  464. app.globalData.oneFailHint(res.data.result_msg, 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>