myEvaluate.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view class="container">
  3. <!-- 分段器区域 -->
  4. <view class="segmented">
  5. <uni-segmented-control :current="activeCurrent" :values="headerList" style-type="text" active-color="#096562" @clickItem="onClickItem" />
  6. </view>
  7. <!-- 列表区域 -->
  8. <scroll-view class="body" scroll-y @scrolltolower="handlePull">
  9. <!-- 每一个盒子区域 -->
  10. <view class="box" v-for="item in list" :key="item.bookingCommentId" @click="handleGoDetail(item)">
  11. <!-- 头部区域 -->
  12. <view class="box_top">
  13. <img mode="aspectFill" src="../../static/my/hotel.png" />
  14. <view class="top_name">{{ item.hotelName }}</view>
  15. <view class="box_type">已消费</view>
  16. </view>
  17. <!-- 房间信息区域 -->
  18. <view class="box_center">
  19. <img mode="aspectFill" :src="item.url" />
  20. <view class="center_info">
  21. <view>{{ item.houseOrderNumber }}间,{{ item.houseName }}</view>
  22. <view>{{ item.checkOutTime.slice(0, 10) }} - {{ item.checkOutTime.slice(0, 10) }}</view>
  23. <view>总价:¥{{ item.payAccount }}</view>
  24. </view>
  25. </view>
  26. <!-- 按钮区域 -->
  27. <view class="box_btn" v-if="activeCurrent === 0">
  28. <view class="btn_eva" @click.stop="handleGoPage">去评价</view>
  29. </view>
  30. </view>
  31. <view class="noData" v-if="list.length === 0">
  32. <img lazy-load :lazy-load-margin="0" src="../../static/images/noData.png" />
  33. {{ noDataMsg }}
  34. </view>
  35. </scroll-view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. // 分段器当前激活索引
  43. activeCurrent: 0,
  44. // 分段器数组
  45. headerList: ['待评价', '已评价'],
  46. // 列表数据
  47. list: [],
  48. noDataMsg: '暂无待评价数据',
  49. // 当前页
  50. page: 1,
  51. // 每页多少条
  52. rows: 6,
  53. // 总条数
  54. total: null
  55. }
  56. },
  57. onLoad() {
  58. this.getData()
  59. },
  60. methods: {
  61. async getData() {
  62. const res = await this.$myRequest({
  63. url: '/mhotel/abcapersonageComment.action',
  64. data: {
  65. usersId: uni.getStorageSync('userInfo').id,
  66. status: this.activeCurrent,
  67. page: this.page,
  68. rows: this.rows
  69. }
  70. })
  71. // console.log(res)
  72. if (res.code === 200 && res.page.pageList) {
  73. this.list = [...this.list, ...res.page.pageList]
  74. this.total = res.total
  75. }
  76. },
  77. // 切换分段器回调
  78. onClickItem(e) {
  79. this.activeCurrent = e.currentIndex
  80. if (this.activeCurrent === 0) {
  81. this.noDataMsg = '暂无待评价数据'
  82. } else {
  83. this.noDataMsg = '暂无已评价数据'
  84. }
  85. this.list = []
  86. this.page = 1
  87. this.getData()
  88. },
  89. // 列表下拉到底部回调
  90. handlePull() {
  91. if (this.list.length < this.total) {
  92. this.page++
  93. this.getData()
  94. } else {
  95. uni.showToast({
  96. title: '没有更多数据了',
  97. icon: 'none'
  98. })
  99. }
  100. },
  101. //去评价按钮回调
  102. handleGoPage() {
  103. uni.navigateTo({
  104. url: '/pages/evaluate/evaluate'
  105. })
  106. },
  107. // 点击每一个评价订单的回调
  108. handleGoDetail(item) {
  109. if (this.activeCurrent === 1) {
  110. uni.navigateTo({
  111. url: `/pages/appraiseDetail/appraiseDetail?id=${item.bookingCommentId}`
  112. })
  113. }
  114. }
  115. }
  116. }
  117. </script>
  118. <style lang="scss" scoped>
  119. .container {
  120. height: 100vh;
  121. background-color: #f2f3f5;
  122. overflow: hidden;
  123. .segmented {
  124. box-sizing: border-box;
  125. padding-bottom: 28rpx;
  126. height: 100rpx;
  127. background-color: #fff;
  128. }
  129. .body {
  130. box-sizing: border-box;
  131. padding: 20rpx 0;
  132. height: calc(100vh - 100rpx);
  133. overflow-y: auto;
  134. .box {
  135. padding: 0 20rpx 20rpx;
  136. margin-bottom: 20rpx;
  137. background-color: #fff;
  138. .box_top {
  139. display: flex;
  140. align-items: center;
  141. height: 94rpx;
  142. img {
  143. width: 47rpx;
  144. height: 47rpx;
  145. border-radius: 50%;
  146. }
  147. .top_name {
  148. margin-left: 18rpx;
  149. font-size: 32rpx;
  150. font-weight: bold;
  151. }
  152. .box_type {
  153. margin-left: auto;
  154. color: #808080;
  155. font-size: 28rpx;
  156. }
  157. }
  158. .box_center {
  159. display: flex;
  160. img {
  161. width: 100rpx;
  162. height: 100rpx;
  163. border-radius: 10rpx;
  164. }
  165. .center_info {
  166. margin-top: -5rpx;
  167. margin-left: 18rpx;
  168. color: #808080;
  169. font-size: 28rpx;
  170. }
  171. }
  172. .box_btn {
  173. display: flex;
  174. justify-content: flex-end;
  175. margin-top: 35rpx;
  176. .btn_eva {
  177. display: flex;
  178. justify-content: center;
  179. align-items: center;
  180. margin-left: 20rpx;
  181. width: 178rpx;
  182. height: 68rpx;
  183. color: #808080;
  184. font-size: 28rpx;
  185. border-radius: 64rpx;
  186. border: 1rpx solid #808080;
  187. }
  188. }
  189. }
  190. .noData {
  191. display: flex;
  192. flex-direction: column;
  193. justify-content: center;
  194. align-items: center;
  195. padding-bottom: 20rpx;
  196. img {
  197. margin-top: 160rpx;
  198. width: 600rpx;
  199. height: 600rpx;
  200. }
  201. }
  202. }
  203. }
  204. </style>