me.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <view class="sign-page">
  3. <!-- 导航 -->
  4. <NavBar :navOpacity="navOp"></NavBar>
  5. <view class="views-wrap">
  6. <!-- 我的 -->
  7. <view class="head-wrap">
  8. <view class="head-content">
  9. <view class="avatar">
  10. <image v-if="!isLogin" style="width: 100%;height: 100%;border-radius: 50%;overflow: hidden;" src="/static/app/unlogin.png" mode="aspectFit"></image>
  11. <image v-if="isLogin" style="width: 100%;height: 100%;border-radius: 50%;overflow: hidden;" :src="userInfo.avatarUrl || userInfo.headimgUrl" mode="aspectFit"></image>
  12. </view>
  13. <view class="name" v-if="isLogin">{{userInfo.nickName || '微信用户'}}</view>
  14. <view class="phone" v-if="isLogin">{{userInfo.phone | phoneSafe}}</view>
  15. <view class="login-btn" v-if="!isLogin" @click="loginHandle">登录</view>
  16. </view>
  17. <view class="head-bg">
  18. <image class="image-inner" src="/static/app/page2/head_bg.png" mode="widthFix"></image>
  19. </view>
  20. </view>
  21. </view>
  22. <!-- 预约记录 -->
  23. <view class="records-wrap">
  24. <!-- 我的头 -->
  25. <view class="box-head">
  26. <view class="name">预约记录</view>
  27. </view>
  28. <view class="records-body">
  29. <!-- <scroll-view style="height: 100%;width: 100%;" :scroll-y="true"> -->
  30. <view class="record-item" v-for="(item,index) in list" :key="item.id" @click="navToDetail(item)">
  31. <view class="title-wrap">
  32. <view class="date">{{item.yuyueTime}}</view>
  33. <view class="status" :class="{'over': item.statusName == '已超时', 'waiting': item.statusName == '预约' , 'end': item.statusName == '已到访'}">{{item.statusName}}</view>
  34. </view>
  35. <view class="divide"></view>
  36. <view class="content-wrap">
  37. <view class="row">
  38. <view class="label">预约人数:</view>
  39. <view class="text">{{item.num}}人</view>
  40. </view>
  41. <view class="row">
  42. <view class="label">预约阁位:</view>
  43. <view class="text">{{item.cabinetAreaName}}-{{item.cabinetPositionName}}阁位</view>
  44. </view>
  45. <view class="row" v-if="item.updateTime">
  46. <view class="label">到访时间:</view>
  47. <view class="text">{{item.daofangTime}}</view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="empty-wrap" v-if="list.length == 0">
  52. <image class="inner-img" src="/static/app/data_empty.png" mode="widthFix"></image>
  53. <view class="text">暂无预约</view>
  54. </view>
  55. <!-- </scroll-view> -->
  56. </view>
  57. </view>
  58. <view style="height: 60rpx;"></view>
  59. <!-- 授权 -->
  60. <c-pop-auth ref="modelAuth"></c-pop-auth>
  61. <!-- 手机号 -->
  62. <c-pop-phone ref="modelPhone"></c-pop-phone>
  63. <!-- 年龄询问 -->
  64. <!-- <c-pop-adulthood ref="modelAdulthood"></c-pop-adulthood> -->
  65. <!-- 默认loading -->
  66. <u-toast ref="uToast"></u-toast>
  67. <!-- 客户 -->
  68. <!-- <c-service></c-service> -->
  69. </view>
  70. </template>
  71. <script>
  72. import NavBar from './nav-bar/nav-bar.vue'
  73. import store from '@/store'
  74. import dayjs from '@/common/dayjs/dayjs.min.js'
  75. import { mapActions, mapState, mapGetters } from 'vuex';
  76. export default {
  77. components: { NavBar },
  78. data() {
  79. return {
  80. first: false,
  81. list: [],
  82. navOp: 0
  83. };
  84. },
  85. computed:{
  86. ...mapGetters(['isLogin', 'userInfo']),
  87. },
  88. filters:{
  89. phoneSafe(value){
  90. if(value && value.length == 11){
  91. var tel = "" + value;
  92. return tel.replace(tel.substring(3,7), "****")
  93. }else{
  94. return '未授权'
  95. }
  96. }
  97. },
  98. onPageScroll(e) {
  99. let limitH = 200;
  100. if(e.scrollTop > limitH){
  101. this.navOp = 1;
  102. }else{
  103. this.navOp = e.scrollTop / limitH;
  104. }
  105. },
  106. methods: {
  107. ...mapActions({
  108. 'getLikeP': 'getLikeP',
  109. 'getLikeS': 'getLikeS',
  110. }),
  111. loginHandle() {
  112. this.$refs.modelAuth.$confirm({}).then(res => {
  113. this.loadData()
  114. })
  115. },
  116. navToDetail(item) {
  117. const {code ,visitDate, visitTime} = item
  118. this.$st(() => {
  119. this.$u.route({
  120. url: '/pages/signs/invitation/invitation',
  121. type: "navigateTo",
  122. params: {
  123. code: code,
  124. visitDate: visitDate,
  125. visitTime: visitTime,
  126. }
  127. })
  128. })
  129. },
  130. async loadData() {
  131. const res = await this.$api('signs.getOpenidVisitList', {...this.form})
  132. this.$refs.uToast.hide()
  133. if(res.code == 200){
  134. // 预约列表
  135. this.list = res.data.map(item => {
  136. return {...item, daofangTime: item.updateTime && dayjs(item.updateTime).format('YYYY年MM月DD日 HH:mm'), yuyueTime: dayjs(item.visitDate + ' ' + item.visitTime).format('YYYY年MM月DD日 HH:mm')}
  137. });
  138. }else{
  139. this.$refs.uToast.show({type: 'error', message: res.msg, position: 'top'})
  140. }
  141. }
  142. },
  143. onLoad() {
  144. // this.loadData()
  145. },
  146. onShow() {
  147. this.loadData()
  148. }
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. @import "./index.scss";
  153. </style>