householdCert.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  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-location 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="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. this.appletType=uni.getStorageSync('appletType')
  265. //显示用户选择的小区+楼栋+房间名字
  266. this.residential_name = options.residential_name;
  267. this.building_name=options.building_name
  268. this.unit_name = options.unit_name;
  269. this.room_name = options.room_name;
  270. this.room_id = options.room_id;
  271. this.name=app.globalData.member.name
  272. },
  273. onShow() {
  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. //点击模态框选项触发
  291. photoChecked(index){
  292. if (index==0) {
  293. //图片上传
  294. this.chooseImage()
  295. } else if(index==1){
  296. if(this.operaType==3){
  297. //拍照上传,拍照人脸
  298. uni.navigateTo({
  299. url:"../../my-camera/my-camera?type=0"
  300. })
  301. }else{
  302. //拍照上传,拍照证件
  303. uni.navigateTo({
  304. url:"../../my-camera/my-camera?type=1"
  305. })
  306. }
  307. }
  308. },
  309. typeConfirm(e) {
  310. this.type = 0;
  311. e.map((val, index) => {
  312. this.type=val.value
  313. this.typeLabel=val.label
  314. })
  315. },
  316. nationalityConfirm(e) {
  317. this.nationality = 0;
  318. e.map((val, index) => {
  319. this.nationality=val.value
  320. this.nationalityLabel=val.label
  321. if (this.nationality == 0) {
  322. this.nationalityName = '身份证';
  323. } else if (this.nationality == 1) {
  324. this.nationalityName = '港澳居民往来内地通行证';
  325. } else if (this.nationality == 2) {
  326. this.nationalityName = '台湾居民往来大陆通行证';
  327. } else if (this.nationality == 3) {
  328. this.nationalityName = '护照';
  329. }
  330. })
  331. },
  332. //点击上传图片事件
  333. chooseImage: function () {
  334. var that = this;
  335. uni.chooseImage({
  336. count: 1,
  337. //最多可以选择的图片张数,默认9
  338. sourceType: ['album', 'camera'],
  339. sizeType: ['compressed'],
  340. //可选择原图或压缩后的图片
  341. success: res => {
  342. let tempFilePaths = res.tempFilePaths;
  343. that.uploadImage(tempFilePaths[0])
  344. }
  345. });
  346. },
  347. /**上传图片
  348. * @param {Object} imgUrl 图片url
  349. */
  350. uploadImage(imgUrl){
  351. console.log("operatype: ",this.operaType);
  352. console.log("imgUrl",imgUrl)
  353. var that = this;
  354. //是否需要md5加密上传人脸照
  355. let is_need_md5 = false;
  356. if (this.operaType == 3) {
  357. is_need_md5 = true;
  358. }
  359. uni.getFileSystemManager().readFile({
  360. filePath: imgUrl,
  361. //选择图片返回的相对路径
  362. encoding: 'base64',
  363. //编码格式
  364. success: res => {
  365. //成功的回调
  366. app.globalData.uploadBase64('data:image/jpeg;base64,' + res.data, is_need_md5, function (result) {
  367. if (that.operaType == 1) {
  368. that.setData({
  369. passport_img_uri: result.data.uri,
  370. show_passport_img_uri: imgUrl
  371. });
  372. } else if (that.operaType == 2) {
  373. that.setData({
  374. entry_img_uri: result.data.uri,
  375. show_entry_img_uri: imgUrl
  376. });
  377. } else if (that.operaType == 3) {
  378. that.setData({
  379. image_uri: result.data.uri,
  380. show_image_uri: imgUrl,
  381. face_code: result.data.md5Hex
  382. });
  383. }
  384. });
  385. }
  386. });
  387. },
  388. //提交认证
  389. showDialogBtn: function () {
  390. let params = {};
  391. let that = this;
  392. if (that.name == "") {
  393. app.globalData.autoFailHint("请填写住户姓名");
  394. return;
  395. }
  396. //用户类型
  397. let type = that.type; //['业主','家属','租户'],
  398. params['type'] = type; //0 中国大陆 1 中国香港/澳门 2 中国台湾 3 海外
  399. //国籍
  400. let nationality = that.nationality;
  401. params['nationality'] = nationality;
  402. //身份证
  403. var id_card = this.id_card;
  404. params['id_card'] = id_card; //业主身份证必填
  405. if (type == 0 && !id_card) {
  406. app.globalData.autoFailHint("住户类型是业主时,证件号码必填");
  407. return;
  408. }
  409. let passport_img_uri = that.passport_img_uri;
  410. let entry_img_uri = that.entry_img_uri;
  411. if (nationality == 3) {
  412. params['passport_img_uri'] = that.passport_img_uri;
  413. params['entry_img_uri'] = that.entry_img_uri;
  414. if (type == 0) {
  415. if (!passport_img_uri) {
  416. app.globalData.autoFailHint("请上传护照图片");
  417. return;
  418. }
  419. if (!entry_img_uri) {
  420. app.globalData.autoFailHint("请上传入境证明");
  421. return;
  422. }
  423. }
  424. }
  425. console.log(that.image_uri);
  426. let image_uri = that.image_uri;
  427. params['image_uri'] = that.image_uri;
  428. let face_code = that.face_code;
  429. params['face_code'] = that.face_code; //性别
  430. params['sex'] = that.sex;
  431. params['name'] = that.name;
  432. params['tel'] = app.globalData.member.tel;
  433. params['room_id'] = that.room_id;
  434. params['create_type'] = '0'; //申请来源0-小程序添加 1-后台添加 2-后台导入 3-app添加
  435. params['record_type'] = '0'; //申请的记录类型 0--认证类型 1--新增类型 2--编辑类型
  436. params['member_id'] = app.globalData.member.id;//会员id
  437. let operation = 'member/authentication';
  438. app.globalData.postRequest(params, operation, function (res) {
  439. //提交成功
  440. if (res.data.result_code == 1) {
  441. app.globalData.oneFailHint(res.data.result_msg, function () {
  442. //跳转到首页
  443. uni.reLaunch({
  444. url: '/pages/index/index?isFlush=true'
  445. });
  446. });
  447. } else {
  448. app.globalData.oneFailHint(res.data.result_msg);
  449. }
  450. });
  451. }
  452. }
  453. };
  454. </script>
  455. <style scoped lang="scss">
  456. page{
  457. background-color: #FFFFFF;
  458. }
  459. .form {
  460. padding:0 60rpx;
  461. background-color: #FFFFFF;
  462. }
  463. .local_city{
  464. padding: 30rpx 0;
  465. position:relative;
  466. background: #fff;
  467. }
  468. .local_city .changeCity{
  469. padding: 20rpx;
  470. position: absolute;
  471. right: 0rpx;
  472. top: 0;
  473. }
  474. .local_city .icon{
  475. padding: 20rpx;
  476. position: absolute;
  477. left: -0;
  478. top: 50%;
  479. transform: translate(0,-50%);
  480. font-size: 40rpx;
  481. }
  482. .local_city .local_city_info{
  483. padding-left: 40rpx;
  484. display:inline-block;
  485. }
  486. .form_group .upload {
  487. padding: 0 28rpx;
  488. font-size: 26rpx;
  489. background: $base-btn-color;
  490. color: #fff;
  491. border: none;
  492. }
  493. .upload_tips {
  494. font-size: 24rpx;
  495. }
  496. .upload_bg {
  497. position: relative;
  498. text-align: center;
  499. }
  500. .mb0 {
  501. padding-top: 40rpx;
  502. font-size: 28rpx;
  503. margin-bottom: 0;
  504. }
  505. .form_group .tips {
  506. margin-left: 50rpx;
  507. }
  508. .upload_bg .upload_bgImg {
  509. width: 540rpx;
  510. height: 400rpx;
  511. }
  512. .upload_bg .upload_btn {
  513. width: 120rpx;
  514. height: 120rpx;
  515. position: absolute;
  516. left: 50%;
  517. top: 50%;
  518. margin-left: -65rpx;
  519. margin-top: -60rpx;
  520. }
  521. .upload_bg .upload_btn image {
  522. width: 100%;
  523. height: 100%;
  524. }
  525. .upload_text {
  526. position: absolute;
  527. top: 70%;
  528. left: 50%;
  529. transform: translate(-50%, 0);
  530. color: $base-btn-color;
  531. }
  532. upload_bg {
  533. position: relative;
  534. }
  535. .upload_bg .upload_btn {
  536. width: 120rpx;
  537. height: 120rpx;
  538. position: absolute;
  539. left: 50%;
  540. top: 40%;
  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: 55%;
  551. width: 100%;
  552. color: $base-btn-color;
  553. }
  554. .img_content {
  555. margin-top: 20rpx;
  556. position: relative;
  557. text-align: center;
  558. }
  559. .img_content .upload_bgImg {
  560. width: 560rpx;
  561. height: 420rpx;
  562. max-height: 1;
  563. display: inline-block;
  564. border-radius: 20rpx;
  565. }
  566. .reUpload {
  567. height: 60rpx;
  568. line-height: 60rpx;
  569. text-align: right;
  570. color: #333;
  571. padding-right: 100rpx;
  572. font-size: 26rpx;
  573. }
  574. .img_content .img_icon {
  575. width: 40rpx;
  576. height: 40rpx;
  577. vertical-align: text-top;
  578. margin-right: 6rpx;
  579. border-radius: 20rpx;
  580. }
  581. .category {
  582. padding:20px 20rpx 0;
  583. overflow: auto;
  584. background-color: #FFF;
  585. text-align:center;
  586. }
  587. .category_item {
  588. width: 33.3%;
  589. float: left;
  590. margin-bottom: 40rpx;
  591. }
  592. .icon_wrap {
  593. width: 120rpx;
  594. margin: 0 auto;
  595. margin-bottom: 5px;
  596. }
  597. .index_icon {
  598. width: 60rpx;
  599. height: 60rpx;
  600. }
  601. .category_item_text {
  602. text-align: center;
  603. font-size: 24rpx;
  604. color: #999;
  605. }
  606. </style>