index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. <template>
  2. <view style="background:rgba(245,245,245,1);opacity:1;">
  3. <view class="topBox">
  4. <!-- <image :src="photoData[swiperIndex].photo"></image> -->
  5. <view class="topBg" :style="{paddingTop:phoneHeight + 'px'}"></view>
  6. <!-- 当前绑定房屋信息 -->
  7. <view class="topBoxInfo">
  8. <view class="topInfo" :style="{marginTop:phoneHeight + 'px'}" @tap="selectHouse">
  9. <view v-if="adress">
  10. {{adress}}
  11. </view>
  12. <view v-else>
  13. <!-- <text>xx小区</text> <text>111楼</text> <text>2单元 801</text> -->
  14. <text>还没认证房屋</text>
  15. </view>
  16. <view class="topIcon">
  17. <image src="../../static/home_combo_more@2x.png" style="width: 100%;height: 100%;margin-bottom: 5rpx;"></image>
  18. </view>
  19. </view>
  20. <!-- 轮播图 -->
  21. <view class="swiperBox">
  22. <swiper @change="changeImg" :current="swiperIndex" :indicator-dots="true" :autoplay="true" :interval="2000"
  23. :duration="1000" style="width: 100%;height: 100%;" indicator-active-color="#298AFD" indicator-color="#fff">
  24. <swiper-item v-for="(item,index) in photoData" :key="index">
  25. <view class="swiper-item">
  26. <view style="">
  27. <image :src="item.photo" style="width: 100%;height:342px;"></image>
  28. </view>
  29. </view>
  30. </swiper-item>
  31. </swiper>
  32. </view>
  33. <!--功能栏 -->
  34. <view class="meau">
  35. <view style="width: 116rpx;height: 100%; text-align: center;line-height: 90rpx;" @tap="visitorPass">
  36. <view class="meauIcon">
  37. <image src="../../static/home_icon_password@2x.png" style="width: 100%;height: 100%;"></image>
  38. </view>
  39. <view class="meauText">访客密码</view>
  40. </view>
  41. <view style="width: 116rpx;height: 100%;text-align: center;line-height: 90rpx;" @tap="openDoor">
  42. <view class="meauIcon" style="margin-left: 35rpx;">
  43. <image src="../../static/home_icon_open@2x.png" style="width: 100%;height: 100%;"></image>
  44. </view>
  45. <view class="meauText">一键开门</view>
  46. </view>
  47. <view style="width: 116rpx;height: 100%;text-align: center;line-height: 90rpx;" @tap="onlineRepairs">
  48. <view class="meauIcon">
  49. <image src="../../static/home_icon_guarantee@2x.png" style="width: 100%;height: 100%;"></image>
  50. </view>
  51. <view class="meauText">在线报修</view>
  52. </view>
  53. <view style="width: 116rpx;height: 100%; text-align: center;line-height: 90rpx;" @tap="onlineComplain">
  54. <view class="meauIcon">
  55. <image src="../../static/home_icon_complain@2x.png" style="width: 100%;height: 100%;"></image>
  56. </view>
  57. <view class="meauText">在线投诉</view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <!-- 物业公告 -->
  63. <view class="main">
  64. <view class="mainTitle">
  65. <view class="mainIcon">
  66. <image src="../../static/home_icon@2x.png" style="width: 100%;height: 100%;"></image>
  67. </view>
  68. <view class="mainText">物业公告</view>
  69. <view class="moreBtn" @tap="moreBtn">
  70. 更多
  71. </view>
  72. </view>
  73. <!-- 公告信息 -->
  74. <view class="item">
  75. <!-- <view class="notInfo" v-show="visible">暂无公告信息</view> -->
  76. <view style="width:300rpx;margin: 0 auto;margin-top: 10rpx;" v-show="visible">
  77. <image src="../../static/notData.png" style="width:300rpx ;height: 300rpx;"></image>
  78. <view style="width:144rpx;height:50rpx;font-size:36rpx;margin: 0 auto;margin-top: 10rpx;">暂无数据</view>
  79. </view>
  80. <view class="mainInfo" v-for="(item,index) in list" :key="index" @tap="seeDetail(item.id)" v-show="!visible">
  81. <view class="left">
  82. <view style="width: 100%;height: 42rpx;ont-size:30rx;font-family:PingFang SC;font-weight:bold;color:rgba(51,51,51,1);margin-top: 40rpx;">
  83. {{item.title}}
  84. </view>
  85. <view class="leftInfo">{{item.content}}</view>
  86. <view class="leftDate">
  87. <!-- v-if="item.status==1" -->
  88. <view class="leftTag">最新</view>
  89. <view style="width:230rpx;height:34rpx;font-size:24rpx;font-family:PingFang SC;font-weight:400;line-height:34rpx;color:rgba(204,204,204,1);position: absolute;right: 0;">{{(item.createDate).substr(0,16)}}</view>
  90. </view>
  91. </view>
  92. <view class="right">
  93. <image :src="item.img" style="width: 100%;height: 100%;"></image>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. <!-- 认证房屋是否通过提示 -->
  99. <uniPopup ref='popup' type="center">
  100. <view style="width: 600rpx;height: 522rpx;background-color: #fff;border-radius: 10rpx;" class="popupBox">
  101. <image src="../../static/auditing_popup.png" style="width:85%;height: 100%;margin-top: -50rpx;margin-left: 30rpx;"></image>
  102. <view class="popupTitle" v-if="status==1">当前认证房屋正在审核中</view>
  103. <view class="popupTitle" v-else-if="status==4">当前暂无房屋绑定,请重新认证</view>
  104. <button class="popupBtn" @tap="popupClose" v-if="status==1">我知道了</button>
  105. <button class="popupBtn" @tap="goTapHouse" v-else-if="status==4">去认证</button>
  106. </view>
  107. </uniPopup>
  108. </view>
  109. </template>
  110. <script>
  111. export default {
  112. data() {
  113. return {
  114. phoneHeight: 0, //手机状态栏的高度
  115. swiperIndex: 0, //当前显示轮播图的索引
  116. photoData: ["../../static/empower_image@2x.png", "../../static/login_bgground@2x.png"], //轮播图数据
  117. list: [], //物业公告数据
  118. adress: '',
  119. visible: true,
  120. status: ''
  121. }
  122. },
  123. created() {
  124. // 获取状态栏的高度
  125. this.phoneHeight = uni.getSystemInfoSync().statusBarHeight
  126. this.getBannerData()
  127. // this.getUserInfo()
  128. },
  129. onTabItemTap(e) {
  130. uni.pageScrollTo({
  131. scrollTop: 0,
  132. duration: 300
  133. });
  134. this.getNoticeList()
  135. this.getStatus()
  136. },
  137. onPullDownRefresh() {
  138. this.getNoticeList()
  139. this.getStatus()
  140. },
  141. onLoad() {
  142. this.getStatus()
  143. this.status = uni.getStorageSync('houseStatus')
  144. },
  145. onShow() {
  146. this.getStatus()
  147. this.status = uni.getStorageSync('houseStatus')
  148. this.adress = uni.getStorageSync('homeAdress')
  149. this.getNoticeList()
  150. },
  151. mounted() {
  152. },
  153. methods: {
  154. //重新认证房屋
  155. goTapHouse() {
  156. uni.navigateTo({
  157. url: '../authentication/city'
  158. })
  159. this.$refs.popup.close()
  160. },
  161. // 关闭弹窗
  162. popupClose() {
  163. this.$refs.popup.close()
  164. },
  165. // 获取当前房屋认证状态
  166. getStatus() {
  167. this.http.httpRequest('/wxapplet/ownersid/getHouseState', 'get', {
  168. cardNo: uni.getStorageSync('idNumber'),
  169. comtyId: uni.getStorageSync('comtyId'),
  170. houseId: uni.getStorageSync('homeId'),
  171. }, true).then((res) => {
  172. if (res.code == 0) {
  173. // 判断当前用户是否存在
  174. if (res.data.userList[0].userId) {
  175. this.status = res.data.houseStatus
  176. uni.setStorageSync('createBy', res.data.userList[0].createBy),
  177. uni.setStorageSync('houseStatus', res.data.houseStatus)
  178. uni.setStorageSync('userName', res.data.userList[0].loginName)
  179. uni.setStorageSync('userPhone', res.data.userList[0].phoneNumBer)
  180. if (res.data.userList[0].avatar.indexOf('https://') == -1) {
  181. uni.setStorageSync('headImg', this.getBase64ImageUrl(res.data.userList[0].avatar))
  182. } else {
  183. uni.setStorageSync('headImg', res.data.userList[0].avatar)
  184. }
  185. }else{
  186. uni.showToast({
  187. title:'当前用户已不存在,请重新注册',
  188. 'icon':'none'
  189. })
  190. uni.navigateTo({
  191. url:'../register/register'
  192. })
  193. }
  194. }
  195. })
  196. },
  197. //把base64转换成图片
  198. getBase64ImageUrl(data) {
  199. /// 获取到base64Data
  200. var base64Data = data;
  201. /// 通过微信小程序自带方法将base64转为二进制去除特殊符号,再转回base64
  202. base64Data = uni.arrayBufferToBase64(uni.base64ToArrayBuffer(base64Data))
  203. /// 拼接请求头,data格式可以为image/png或者image/jpeg等,看需求
  204. const base64ImgUrl = "data:image/png;base64," + base64Data;
  205. // 刷新数据
  206. return base64ImgUrl
  207. },
  208. // 获取轮播图数据
  209. getBannerData() {
  210. this.http.httpRequest('/wxapplet/owner/AdvertPhoto/list', 'get', {}, true).then((res) => {
  211. console.log(res)
  212. if (res.code == 0) {
  213. this.photoData = res.data.rows
  214. } else {
  215. uni.showToast({
  216. title: res.msg,
  217. 'icon': 'none'
  218. })
  219. }
  220. })
  221. },
  222. // 获取公告数据
  223. getNoticeList() {
  224. uni.showLoading({
  225. mask: true,
  226. title: '加载中'
  227. })
  228. this.http.httpRequest('/wxapplet/owner/notice/list', 'get', {
  229. comtyId: uni.getStorageSync('comtyId')
  230. }, true).then((res) => {
  231. console.log(res)
  232. if (res.code == 0) {
  233. // 判断当前数据是否大于三条数据
  234. if (res.data.rows.length == 0) {
  235. this.visible = true
  236. } else if (res.data.rows.length > 3) {
  237. this.list = res.data.rows.splice(0, 3)
  238. this.visible = false
  239. } else {
  240. this.list = res.data.rows
  241. }
  242. setTimeout(() => {
  243. uni.hideLoading()
  244. uni.stopPullDownRefresh()
  245. }, 1000)
  246. } else {
  247. uni.hideLoading()
  248. uni.showToast({
  249. title: res.msg,
  250. 'icon': 'none'
  251. })
  252. }
  253. }).catch(() => {
  254. uni.hideLoading()
  255. })
  256. },
  257. // 查看物业公告详情
  258. seeDetail(id) {
  259. //判断当前房屋是否认证成功
  260. if (this.status == 1 || this.status == 4) {
  261. this.$refs.popup.open()
  262. return
  263. }
  264. uni.navigateTo({
  265. url: './detail?id=' + id
  266. })
  267. },
  268. // 监听轮播图当前索引
  269. changeImg(e) {
  270. this.swiperIndex = e.detail.current
  271. },
  272. // 访客密码
  273. visitorPass() {
  274. //判断当前房屋是否认证成功
  275. if (this.status == 1 || this.status == 4) {
  276. this.$refs.popup.open()
  277. return
  278. }
  279. uni.navigateTo({
  280. url: "./visitorPass"
  281. })
  282. },
  283. // 一键开门
  284. openDoor() {
  285. //判断当前房屋是否认证成功
  286. if (this.status == 1 || this.status == 4) {
  287. this.$refs.popup.open()
  288. return
  289. }
  290. uni.navigateTo({
  291. url: "../openDoor/openDoor"
  292. })
  293. },
  294. // 在线保修
  295. onlineRepairs() {
  296. //判断当前房屋是否认证成功
  297. if (this.status == 1 || this.status == 4) {
  298. this.$refs.popup.open()
  299. return
  300. }
  301. uni.navigateTo({
  302. url: "../onlineRpair/index"
  303. })
  304. },
  305. // 在线投诉
  306. onlineComplain() {
  307. //判断当前房屋是否认证成功
  308. if (this.status == 1 || this.status == 4) {
  309. this.$refs.popup.open()
  310. return
  311. }
  312. uni.navigateTo({
  313. url: "../complain/index"
  314. })
  315. },
  316. // 更多跳转
  317. moreBtn() {
  318. //判断当前房屋是否认证成功
  319. if (this.status == 1 || this.status == 4) {
  320. this.$refs.popup.open()
  321. return
  322. }
  323. uni.navigateTo({
  324. url: './more'
  325. })
  326. },
  327. // 选择房屋认证
  328. selectHouse() {
  329. //判断当前房屋是否认证成功
  330. if (this.status == 4) {
  331. this.$refs.popup.open()
  332. return
  333. }
  334. uni.navigateTo({
  335. url: "./changeHouse"
  336. })
  337. }
  338. }
  339. }
  340. </script>
  341. <style lang="scss">
  342. .popupClose {
  343. width: 44rpx;
  344. height: 44rpx;
  345. position: absolute;
  346. right: 20rpx;
  347. top: 20rpx;
  348. }
  349. .topBg {
  350. width: 100%;
  351. height: 110rpx;
  352. background: rgba(41, 138, 253, 1);
  353. }
  354. .popupBtn {
  355. width: 342rpx;
  356. height: 80rpx;
  357. position: absolute;
  358. bottom: 80rpx;
  359. left: 128rpx;
  360. background: rgba(41, 138, 253, 1);
  361. color: #FFFFFF;
  362. font-size: 32rpx;
  363. }
  364. .popupTitle {
  365. width: 400rpx;
  366. height: 40rpx;
  367. font-size: 28rpx;
  368. color: #999999;
  369. position: absolute;
  370. bottom: 232rpx;
  371. left: 145rpx;
  372. }
  373. .popupImage {
  374. width: 100%;
  375. height: 300rpx;
  376. /* background-image: url(../../static/success_popup@2x.png);
  377. position: absolute;
  378. top: -64rpx; */
  379. }
  380. .item {
  381. .notInfo {
  382. width: 100%;
  383. height: 50rpx;
  384. font-size: 36rpx;
  385. font-family: PingFang SC;
  386. font-weight: 400;
  387. line-height: 50rpx;
  388. color: rgba(36, 36, 36, 1);
  389. margin: 0 auto;
  390. margin-top: 100rpx;
  391. text-align: center;
  392. }
  393. }
  394. .topIcon {
  395. width: 14rpx;
  396. height: 9rpx;
  397. margin-left: 6rpx;
  398. }
  399. .leftTag {
  400. width: 56rpx;
  401. height: 28rpx;
  402. background: rgba(84, 162, 255, 1);
  403. opacity: 1;
  404. border-radius: 6rpx;
  405. font-size: 20rpx;
  406. font-family: PingFang SC;
  407. font-weight: 400;
  408. color: rgba(255, 255, 255, 1);
  409. text-align: center;
  410. line-height: 26rpx;
  411. margin-top: 6rpx;
  412. margin-right: 120rpx;
  413. }
  414. .leftDate {
  415. width: 100%;
  416. height: 34rpx;
  417. margin-top: 38rpx;
  418. display: flex;
  419. position: relative;
  420. }
  421. .left {
  422. width: 442rpx;
  423. height: 204rpx;
  424. }
  425. .leftInfo {
  426. width: 100%;
  427. height: 34rpx;
  428. font-size: 24rpx;
  429. font-family: PingFang SC;
  430. font-weight: 400;
  431. color: rgba(153, 153, 153, 1);
  432. overflow: hidden;
  433. text-overflow: ellipsis;
  434. white-space: nowrap;
  435. margin-top: 16rpx;
  436. }
  437. .right {
  438. width: 207rpx;
  439. height: 204rpx;
  440. border-radius: 10px;
  441. }
  442. .mainInfo {
  443. width: 688rpx;
  444. height: 222rpx;
  445. display: flex;
  446. justify-content: space-between;
  447. border-bottom: 2px solid rgba(247, 247, 247, 1);
  448. }
  449. .item {
  450. width: 688rpx;
  451. margin: 0 auto;
  452. margin-top: 20rpx;
  453. }
  454. .main {
  455. width: 100%;
  456. margin-top: 20rpx;
  457. background: rgba(255, 255, 255, 1);
  458. opacity: 1;
  459. overflow: hidden;
  460. }
  461. .mainIcon {
  462. width: 30rpx;
  463. height: 30rpx;
  464. /* border: 1rpx solid #333333; */
  465. margin-top: 6rpx;
  466. margin-right: 10rpx;
  467. }
  468. .mainText {
  469. width: 132rpx;
  470. height: 44rpx;
  471. font-size: 32rpx;
  472. font-family: PingFang SC;
  473. font-weight: bold;
  474. color: rgba(51, 51, 51, 1);
  475. }
  476. .moreBtn {
  477. width: 100rpx;
  478. height: 50rpx;
  479. background: rgba(255, 255, 255, 1);
  480. border: 2rpx solid rgba(238, 238, 238, 1);
  481. opacity: 1;
  482. border-radius: 26rpx;
  483. text-align: center;
  484. font-size: 24rpx;
  485. font-family: PingFang SC;
  486. font-weight: 400;
  487. line-height: 50rpx;
  488. position: absolute;
  489. right: 0;
  490. top: 2rpx;
  491. color: #999999;
  492. }
  493. .mainTitle {
  494. position: relative;
  495. width: 688rpx;
  496. /* height: 44rpx; */
  497. margin: 0 auto;
  498. display: flex;
  499. margin-top: 40rpx;
  500. }
  501. .meauText {
  502. width: 100%;
  503. height: 40rpx;
  504. font-size: 28rpx;
  505. font-family: PingFang SC;
  506. font-weight: bold;
  507. color: rgba(51, 51, 51, 1);
  508. /* color: rgba(255, 255, 255, 1); */
  509. /* margin-top: 40rpx; */
  510. }
  511. .meauIcon {
  512. width: 60rpx;
  513. height: 60rpx;
  514. /* border: 1rpx solid #4CD964; */
  515. margin-left: 28rpx;
  516. }
  517. .meau {
  518. width: 590rpx;
  519. height: 124rpx;
  520. margin: 0 auto;
  521. margin-top: 40rpx;
  522. /* border: 1rpx solid #FFFFFF; */
  523. display: flex;
  524. justify-content: space-between;
  525. }
  526. .swiperBox {
  527. width: 666rpx;
  528. height: 342rpx;
  529. border-radius: 14rpx;
  530. margin: 0 auto;
  531. /* border: 1rpx solid #333333; */
  532. margin-top: 55rpx;
  533. overflow: hidden;
  534. }
  535. .topBox {
  536. width: 100%;
  537. height: 718rpx;
  538. background-color: #FFFFFF;
  539. }
  540. .topBoxInfo {
  541. width: 100%;
  542. /* height: 688rpx; */
  543. position: absolute;
  544. top: 0;
  545. margin-top: 30rpx;
  546. // background:rgba(41,138,253,1);
  547. }
  548. .topInfo {
  549. width: 505rpx;
  550. height: 36rpx;
  551. margin-left: 50rpx;
  552. font-size: 26rpx;
  553. font-family: PingFang SC;
  554. font-weight: 400;
  555. line-height: 36rpx;
  556. color: rgba(255, 255, 255, 1);
  557. display: flex;
  558. }
  559. .swiperBox .swiperHeight {
  560. height: 100% !important;
  561. }
  562. </style>