myEvaluate.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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, index) in list" :key="index" @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 v-if="item.checkOutTime">{{ 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(item)">去评价</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. this.headerList = [`待评价(${res.data.waitingCount})`, `已评价(${res.data.ratedCount})`]
  76. }
  77. },
  78. // 切换分段器回调
  79. onClickItem(e) {
  80. this.activeCurrent = e.currentIndex
  81. if (this.activeCurrent === 0) {
  82. this.noDataMsg = '暂无待评价数据'
  83. } else {
  84. this.noDataMsg = '暂无已评价数据'
  85. }
  86. this.list = []
  87. this.page = 1
  88. this.getData()
  89. },
  90. // 列表下拉到底部回调
  91. handlePull() {
  92. if (this.list.length < this.total) {
  93. this.page++
  94. this.getData()
  95. } else {
  96. uni.showToast({
  97. title: '没有更多数据了',
  98. icon: 'none'
  99. })
  100. }
  101. },
  102. //去评价按钮回调
  103. handleGoPage(item) {
  104. uni.navigateTo({
  105. url: `/pages/evaluate/evaluate?bookingId=${item.id}&hotelId=${item.hotelId}&houseId=${item.houseId}`
  106. })
  107. },
  108. // 点击每一个评价订单的回调
  109. handleGoDetail(item) {
  110. if (this.activeCurrent === 1) {
  111. uni.navigateTo({
  112. url: `/pages/appraiseDetail/appraiseDetail?id=${item.bookingCommentId}`
  113. })
  114. } else {
  115. uni.navigateTo({
  116. url: `/pages/orderDetail/orderDetail?id=${item.id}`
  117. })
  118. }
  119. }
  120. }
  121. }
  122. </script>
  123. <style lang="scss" scoped>
  124. .container {
  125. height: 100vh;
  126. background-color: #f2f3f5;
  127. overflow: hidden;
  128. .segmented {
  129. box-sizing: border-box;
  130. padding-bottom: 28rpx;
  131. height: 100rpx;
  132. background-color: #fff;
  133. }
  134. .body {
  135. box-sizing: border-box;
  136. padding: 20rpx 0;
  137. height: calc(100vh - 100rpx);
  138. overflow-y: auto;
  139. .box {
  140. padding: 0 20rpx 20rpx;
  141. margin-bottom: 20rpx;
  142. background-color: #fff;
  143. .box_top {
  144. display: flex;
  145. align-items: center;
  146. height: 94rpx;
  147. img {
  148. width: 47rpx;
  149. height: 47rpx;
  150. border-radius: 50%;
  151. }
  152. .top_name {
  153. margin-left: 18rpx;
  154. font-size: 32rpx;
  155. font-weight: bold;
  156. }
  157. .box_type {
  158. margin-left: auto;
  159. color: #808080;
  160. font-size: 28rpx;
  161. }
  162. }
  163. .box_center {
  164. display: flex;
  165. img {
  166. width: 100rpx;
  167. height: 100rpx;
  168. border-radius: 10rpx;
  169. }
  170. .center_info {
  171. margin-top: -5rpx;
  172. margin-left: 18rpx;
  173. color: #808080;
  174. font-size: 28rpx;
  175. }
  176. }
  177. .box_btn {
  178. display: flex;
  179. justify-content: flex-end;
  180. margin-top: 35rpx;
  181. .btn_eva {
  182. display: flex;
  183. justify-content: center;
  184. align-items: center;
  185. margin-left: 20rpx;
  186. width: 178rpx;
  187. height: 68rpx;
  188. color: #808080;
  189. font-size: 28rpx;
  190. border-radius: 64rpx;
  191. border: 1rpx solid #808080;
  192. }
  193. }
  194. }
  195. .noData {
  196. display: flex;
  197. flex-direction: column;
  198. justify-content: center;
  199. align-items: center;
  200. padding-bottom: 20rpx;
  201. img {
  202. margin-top: 160rpx;
  203. width: 600rpx;
  204. height: 600rpx;
  205. }
  206. }
  207. }
  208. }
  209. </style>