householdCert.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. <template>
  2. <view class="bg-white">
  3. <view class="" v-if="appletType==1">
  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}} {{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="住户类型是业主时,必填" :trim="true" maxlength="18" v-model="id_card" type="number"></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. <view style="background-color: #FFFFFF;">
  89. <view class="form_group mb0" style="padding-left: 60rpx;">
  90. <view>
  91. <text class="sex">人脸:</text>
  92. <text class="tips">(人脸用于开门,请上传正脸图片)</text>
  93. </view>
  94. </view>
  95. <view @click="show=true;operaType=3" style="margin: 30rpx 0 10rpx 0;display: flex;align-items: center;flex-direction: column;">
  96. <upload-img
  97. :width="$isEmpty(show_image_uri)?bgWidth:imgWidth"
  98. :height="$isEmpty(show_image_uri)?bgHeight:imgHeight"
  99. :currentImage="show_image_uri"
  100. :bgsrc="bgsrc"
  101. >
  102. </upload-img>
  103. <view class="" style="color: #59a5f0;">
  104. <text class="cuIcon-camera padding-right-sm" style="font-size: 30rpx;"></text>
  105. <text v-if="$isEmpty(show_image_uri)">点击上传人面</text>
  106. <text style="margin-top: 40rpx;display: inline-block;" v-else>点击重新上传</text>
  107. </view>
  108. </view>
  109. <view class="category" style="padding-bottom: 140rpx;">
  110. <view v-for="(item, index) in iconArray" :key="index" class="category_item">
  111. <view class="category_item_wrap" @tap="top" :data-index="item.index">
  112. <view class="icon_wrap">
  113. <image :src="item.iconUrl" class="index_icon"></image>
  114. </view>
  115. <view class="category_item_text">
  116. <text>{{item.iconText}}</text>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  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"></u-select>
  124. <u-select z-index="999999" mode="single-column" :list="nationalityArry" v-model="nationalityShow" @confirm="nationalityConfirm"></u-select>
  125. <view @click="showDialogBtn" class=" footer-fixed" >
  126. <view class="cu-btn flex text-lg bg-red-btn" style="padding: 46rpx 0;">
  127. 提交认证
  128. </view>
  129. </view>
  130. </view>
  131. <view v-else >
  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. unit_name: '',
  214. //房间名字
  215. room_name: '',
  216. //房间id
  217. room_id: '',
  218. //护照照片
  219. passport_img_uri: null,
  220. //护照照片回显
  221. show_passport_img_uri: null,
  222. //入境证明
  223. entry_img_uri: null,
  224. //入境证明回显
  225. show_entry_img_uri: null,
  226. //人脸图片地址
  227. image_uri: null,
  228. //人脸回显
  229. show_image_uri: null,
  230. //图片的md5
  231. face_code: null,
  232. //身份证
  233. id_card: null,
  234. iconArray: [{
  235. "iconUrl": "http://139.9.103.171:1888/img/image/zd.png",
  236. "iconText": '不要遮挡',
  237. "index": 1
  238. }, {
  239. "iconUrl": "http://139.9.103.171:1888/img/image/mj.png",
  240. "iconText": '不戴墨镜',
  241. "index": 2
  242. }, {
  243. "iconUrl": "http://139.9.103.171:1888/img/image/zl.png",
  244. "iconText": '不能仰头俯拍',
  245. "index": 3
  246. }, {
  247. "iconUrl": "http://139.9.103.171:1888/img/image/cz.png",
  248. "iconText": '光线充足',
  249. "index": 4
  250. }, {
  251. "iconUrl": "http://139.9.103.171:1888/img/image/bg.png",
  252. "iconText": '浅色背景',
  253. "index": 5
  254. }, {
  255. "iconUrl": "http://139.9.103.171:1888/img/image/sh.png",
  256. "iconText": '物业审核生效',
  257. "index": 6
  258. }],
  259. };
  260. },
  261. onLoad: function (options) {
  262. this.appletType=uni.getStorageSync('appletType')
  263. //显示用户选择的小区+楼栋+房间名字
  264. this.residential_name = options.residential_name;
  265. this.unit_name = options.unit_name;
  266. this.room_name = options.room_name;
  267. this.room_id = options.room_id;
  268. this.name=app.globalData.member.name
  269. },
  270. onShow() {
  271. if (this.appletType==0) {
  272. uni.setNavigationBarTitle({
  273. title:"功能待开发"
  274. })
  275. }else{
  276. uni.setNavigationBarTitle({
  277. title:"用户认证"
  278. })
  279. }
  280. //总步骤数
  281. //注册的流程总步骤数是3,其他流程总步骤数是2
  282. if(this.$isEmpty(app.globalData.totalStep)){
  283. this.totalStep=2
  284. }else{
  285. this.totalStep=app.globalData.totalStep
  286. }
  287. //获取当前页面的对象,获取拍照回显照片
  288. let currPage=this.$util.getPageCtx()
  289. if(!this.$isEmpty(currPage.data.image)){
  290. this.uploadImage(currPage.data.image)
  291. }
  292. },
  293. computed: {
  294. },
  295. methods: {
  296. //点击模态框选项触发
  297. photoChecked(index){
  298. if (index==0) {
  299. //图片上传
  300. this.chooseImage()
  301. } else if(index==1){
  302. if(this.operaType==3){
  303. //拍照上传,拍照人面
  304. uni.navigateTo({
  305. url:"../../my-camera/my-camera?type=0"
  306. })
  307. }else{
  308. //拍照上传,拍照证件
  309. uni.navigateTo({
  310. url:"../../my-camera/my-camera?type=1"
  311. })
  312. }
  313. }
  314. },
  315. typeConfirm(e) {
  316. this.type = 0;
  317. e.map((val, index) => {
  318. this.type=val.value
  319. this.typeLabel=val.label
  320. })
  321. },
  322. nationalityConfirm(e) {
  323. this.nationality = 0;
  324. e.map((val, index) => {
  325. this.nationality=val.value
  326. this.nationalityLabel=val.label
  327. if (this.nationality == 0) {
  328. this.nationalityName = '身份证';
  329. } else if (this.nationality == 1) {
  330. this.nationalityName = '港澳居民往来内地通行证';
  331. } else if (this.nationality == 2) {
  332. this.nationalityName = '台湾居民往来大陆通行证';
  333. } else if (this.nationality == 3) {
  334. this.nationalityName = '护照';
  335. }
  336. })
  337. },
  338. //点击上传图片事件
  339. chooseImage: function () {
  340. var that = this;
  341. uni.chooseImage({
  342. count: 1,
  343. //最多可以选择的图片张数,默认9
  344. sourceType: ['album', 'camera'],
  345. sizeType: ['compressed'],
  346. //可选择原图或压缩后的图片
  347. success: res => {
  348. let tempFilePaths = res.tempFilePaths;
  349. that.uploadImage(tempFilePaths[0])
  350. }
  351. });
  352. },
  353. /**上传图片
  354. * @param {Object} imgUrl 图片url
  355. */
  356. uploadImage(imgUrl){
  357. console.log("operatype: ",this.operaType);
  358. console.log("imgUrl",imgUrl)
  359. var that = this;
  360. //是否需要md5加密上传人面照
  361. let is_need_md5 = false;
  362. if (this.operaType == 3) {
  363. is_need_md5 = true;
  364. }
  365. uni.getFileSystemManager().readFile({
  366. filePath: imgUrl,
  367. //选择图片返回的相对路径
  368. encoding: 'base64',
  369. //编码格式
  370. success: res => {
  371. //成功的回调
  372. app.globalData.uploadBase64('data:image/jpeg;base64,' + res.data, is_need_md5, function (result) {
  373. if (that.operaType == 1) {
  374. that.setData({
  375. passport_img_uri: result.data.uri,
  376. show_passport_img_uri: imgUrl
  377. });
  378. } else if (that.operaType == 2) {
  379. that.setData({
  380. entry_img_uri: result.data.uri,
  381. show_entry_img_uri: imgUrl
  382. });
  383. } else if (that.operaType == 3) {
  384. that.setData({
  385. image_uri: result.data.uri,
  386. show_image_uri: imgUrl,
  387. face_code: result.data.md5Hex
  388. });
  389. }
  390. });
  391. }
  392. });
  393. },
  394. //提交认证
  395. showDialogBtn: function () {
  396. let params = {};
  397. let that = this;
  398. if (that.name == "") {
  399. app.globalData.autoFailHint("请填写住户姓名");
  400. return;
  401. }
  402. //用户类型
  403. let type = that.type; //['业主','成员','租户'],
  404. params['type'] = type; //0 中国大陆 1 中国香港/澳门 2 中国台湾 3 海外
  405. //国籍
  406. let nationality = that.nationality;
  407. params['nationality'] = nationality;
  408. //身份证
  409. var id_card = this.id_card;
  410. params['id_card'] = id_card; //业主身份证必填
  411. if (type == 0 && !id_card) {
  412. app.globalData.autoFailHint("住户类型是业主时,证件号码必填");
  413. return;
  414. }
  415. let passport_img_uri = that.passport_img_uri;
  416. let entry_img_uri = that.entry_img_uri;
  417. if (nationality == 3) {
  418. params['passport_img_uri'] = that.passport_img_uri;
  419. params['entry_img_uri'] = that.entry_img_uri;
  420. if (type == 0) {
  421. if (!passport_img_uri) {
  422. app.globalData.autoFailHint("请上传护照图片");
  423. return;
  424. }
  425. if (!entry_img_uri) {
  426. app.globalData.autoFailHint("请上传入境证明");
  427. return;
  428. }
  429. }
  430. }
  431. console.log(that.image_uri);
  432. let image_uri = that.image_uri;
  433. params['image_uri'] = that.image_uri;
  434. let face_code = that.face_code;
  435. params['face_code'] = that.face_code; //性别
  436. params['sex'] = that.sex;
  437. params['name'] = that.name;
  438. params['tel'] = app.globalData.member.tel;
  439. params['room_id'] = that.room_id; //申请来源0-小程序添加 1-后台添加 2-后台导入 3-app添加
  440. params['create_type'] = '0'; //申请的记录类型 0--认证类型 1--新增类型 2--编辑类型
  441. params['record_type'] = '0'; //会员id
  442. params['member_id'] = app.globalData.member.id;
  443. let operation = 'member/authentication';
  444. app.globalData.postRequest(params, operation, function (res) {
  445. //提交成功
  446. if (res.data.result_code == 1) {
  447. app.globalData.oneFailHint(res.data.result_msg, function () {
  448. //跳转到首页
  449. uni.reLaunch({
  450. url: '/pages/index/index?isFlush=true'
  451. });
  452. });
  453. } else {
  454. app.globalData.oneFailHint(res.data.result_msg);
  455. }
  456. });
  457. }
  458. }
  459. };
  460. </script>
  461. <style scoped lang="scss">
  462. .form {
  463. padding:0 60rpx;
  464. background-color: #FFFFFF;
  465. }
  466. .local_city{
  467. padding: 30rpx 0;
  468. position:relative;
  469. background: #fff;
  470. }
  471. .local_city .changeCity{
  472. padding: 20rpx;
  473. position: absolute;
  474. right: 0rpx;
  475. top: 0;
  476. }
  477. .local_city .icon{
  478. padding: 20rpx;
  479. position: absolute;
  480. left: -0;
  481. top: 50%;
  482. transform: translate(0,-50%);
  483. font-size: 40rpx;
  484. }
  485. .local_city .local_city_info{
  486. padding-left: 40rpx;
  487. display:inline-block;
  488. }
  489. .form_group .upload {
  490. padding: 0 28rpx;
  491. font-size: 26rpx;
  492. background: $base-btn-color;
  493. color: #fff;
  494. border: none;
  495. }
  496. .upload_tips {
  497. font-size: 24rpx;
  498. }
  499. .upload_bg {
  500. position: relative;
  501. text-align: center;
  502. }
  503. .mb0 {
  504. padding-top: 40rpx;
  505. font-size: 28rpx;
  506. margin-bottom: 0;
  507. }
  508. .form_group .tips {
  509. margin-left: 50rpx;
  510. }
  511. .upload_bg .upload_bgImg {
  512. width: 540rpx;
  513. height: 400rpx;
  514. }
  515. .upload_bg .upload_btn {
  516. width: 120rpx;
  517. height: 120rpx;
  518. position: absolute;
  519. left: 50%;
  520. top: 50%;
  521. margin-left: -65rpx;
  522. margin-top: -60rpx;
  523. }
  524. .upload_bg .upload_btn image {
  525. width: 100%;
  526. height: 100%;
  527. }
  528. .upload_text {
  529. position: absolute;
  530. top: 70%;
  531. left: 50%;
  532. transform: translate(-50%, 0);
  533. color: $base-btn-color;
  534. }
  535. upload_bg {
  536. position: relative;
  537. }
  538. .upload_bg .upload_btn {
  539. width: 120rpx;
  540. height: 120rpx;
  541. position: absolute;
  542. left: 50%;
  543. top: 40%;
  544. margin-left: -65rpx;
  545. margin-top: -60rpx;
  546. }
  547. .upload_bg .upload_btn image {
  548. width: 100%;
  549. height: 100%;
  550. }
  551. .upload_text {
  552. position: absolute;
  553. top: 55%;
  554. width: 100%;
  555. color: $base-btn-color;
  556. }
  557. .img_content {
  558. margin-top: 20rpx;
  559. position: relative;
  560. text-align: center;
  561. }
  562. .img_content .upload_bgImg {
  563. width: 560rpx;
  564. height: 420rpx;
  565. max-height: 1;
  566. display: inline-block;
  567. border-radius: 20rpx;
  568. }
  569. .reUpload {
  570. height: 60rpx;
  571. line-height: 60rpx;
  572. text-align: right;
  573. color: #333;
  574. padding-right: 100rpx;
  575. font-size: 26rpx;
  576. }
  577. .img_content .img_icon {
  578. width: 40rpx;
  579. height: 40rpx;
  580. vertical-align: text-top;
  581. margin-right: 6rpx;
  582. border-radius: 20rpx;
  583. }
  584. .category {
  585. padding:20px 20rpx 0;
  586. overflow: auto;
  587. background-color: #FFF;
  588. text-align:center;
  589. }
  590. .category_item {
  591. width: 33.3%;
  592. float: left;
  593. margin-bottom: 40rpx;
  594. }
  595. .icon_wrap {
  596. width: 120rpx;
  597. margin: 0 auto;
  598. margin-bottom: 5px;
  599. }
  600. .index_icon {
  601. width: 60rpx;
  602. height: 60rpx;
  603. }
  604. .category_item_text {
  605. text-align: center;
  606. font-size: 24rpx;
  607. color: #999;
  608. }
  609. </style>