myEvaluate.vue 4.8 KB

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