myEvaluate.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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.id">
  11. <!-- 头部区域 -->
  12. <view class="box_top">
  13. <img mode="aspectFill" src="../../static/my/hotel.png" />
  14. <view class="top_name">{{ item.name }}</view>
  15. <view class="box_type">{{ item.type }}</view>
  16. </view>
  17. <!-- 房间信息区域 -->
  18. <view class="box_center">
  19. <img mode="aspectFill" :src="item.imgUrl" />
  20. <view class="center_info">
  21. <view>{{ item.count }}间,{{ item.roomType }}</view>
  22. <view>{{ item.time }}</view>
  23. <view>总价:¥{{ item.total }}</view>
  24. </view>
  25. </view>
  26. <!-- 按钮区域 -->
  27. <view class="box_btn">
  28. <view class="btn_eva" @click="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. // {
  49. // id: 1,
  50. // name: '民宿名称',
  51. // type: '已消费',
  52. // imgUrl: 'https://img1.baidu.com/it/u=4085584268,3308739054&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=375',
  53. // count: 1,
  54. // roomType: '大床房',
  55. // time: '2023-07-26 - 2023-07-27',
  56. // total: 229
  57. // },
  58. // {
  59. // id: 2,
  60. // name: '开心民宿',
  61. // type: '已消费',
  62. // imgUrl: 'https://img1.baidu.com/it/u=4085584268,3308739054&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=375',
  63. // count: 2,
  64. // roomType: '双人房',
  65. // time: '2023-07-27 - 2023-07-27',
  66. // total: 299
  67. // },
  68. // {
  69. // id: 3,
  70. // name: '开心民宿',
  71. // type: '已消费',
  72. // imgUrl: 'https://img1.baidu.com/it/u=4085584268,3308739054&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=375',
  73. // count: 2,
  74. // roomType: '双人房',
  75. // time: '2023-07-27 - 2023-07-27',
  76. // total: 299
  77. // },
  78. // {
  79. // id: 4,
  80. // name: '开心民宿',
  81. // type: '已消费',
  82. // imgUrl: 'https://img1.baidu.com/it/u=4085584268,3308739054&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=375',
  83. // count: 2,
  84. // roomType: '双人房',
  85. // time: '2023-07-27 - 2023-07-27',
  86. // total: 299
  87. // }
  88. ],
  89. noDataMsg: '暂无待评价数据',
  90. // 当前页
  91. page: 1,
  92. // 每页多少条
  93. rows: 6,
  94. // 总条数
  95. total: null
  96. }
  97. },
  98. onLoad() {
  99. this.getData()
  100. },
  101. methods: {
  102. getData() {
  103. uni.request({
  104. url: 'http://192.168.161.224:8088/mhotel/abcapersonageComment.action',
  105. method: 'get',
  106. data: {
  107. usersId: uni.getStorageSync('userInfo').id,
  108. status: 1,
  109. page: this.page,
  110. rows: this.rows
  111. },
  112. success: (res) => {
  113. console.log(res.data)
  114. }
  115. })
  116. },
  117. // 切换分段器回调
  118. onClickItem(e) {
  119. if (this.current !== e.currentIndex) {
  120. this.current = e.currentIndex
  121. if (this.current === 0) {
  122. this.noDataMsg = '暂无待评价数据'
  123. } else {
  124. this.noDataMsg = '暂无已评价数据'
  125. }
  126. }
  127. },
  128. // 列表下拉到底部回调
  129. handlePull() {
  130. console.log(111)
  131. },
  132. handleGoPage() {
  133. uni.navigateTo({
  134. url: '/pages/evaluate/evaluate'
  135. })
  136. }
  137. }
  138. }
  139. </script>
  140. <style lang="scss" scoped>
  141. .container {
  142. height: 100vh;
  143. background-color: #f2f3f5;
  144. overflow: hidden;
  145. .segmented {
  146. box-sizing: border-box;
  147. padding-bottom: 28rpx;
  148. height: 100rpx;
  149. background-color: #fff;
  150. }
  151. .body {
  152. box-sizing: border-box;
  153. padding: 20rpx 0;
  154. height: calc(100vh - 100rpx);
  155. overflow-y: auto;
  156. .box {
  157. padding: 0 20rpx;
  158. margin-bottom: 20rpx;
  159. height: 341rpx;
  160. background-color: #fff;
  161. .box_top {
  162. display: flex;
  163. align-items: center;
  164. height: 94rpx;
  165. img {
  166. width: 47rpx;
  167. height: 47rpx;
  168. border-radius: 50%;
  169. }
  170. .top_name {
  171. margin-left: 18rpx;
  172. font-size: 32rpx;
  173. font-weight: bold;
  174. }
  175. .box_type {
  176. margin-left: auto;
  177. color: #808080;
  178. font-size: 28rpx;
  179. }
  180. }
  181. .box_center {
  182. display: flex;
  183. img {
  184. width: 100rpx;
  185. height: 100rpx;
  186. border-radius: 10rpx;
  187. }
  188. .center_info {
  189. margin-top: -5rpx;
  190. margin-left: 18rpx;
  191. color: #808080;
  192. font-size: 28rpx;
  193. }
  194. }
  195. .box_btn {
  196. display: flex;
  197. justify-content: flex-end;
  198. margin-top: 35rpx;
  199. .btn_eva {
  200. display: flex;
  201. justify-content: center;
  202. align-items: center;
  203. margin-left: 20rpx;
  204. width: 178rpx;
  205. height: 68rpx;
  206. color: #808080;
  207. font-size: 28rpx;
  208. border-radius: 64rpx;
  209. border: 1rpx solid #808080;
  210. }
  211. }
  212. }
  213. .noData {
  214. display: flex;
  215. flex-direction: column;
  216. justify-content: center;
  217. align-items: center;
  218. padding-bottom: 20rpx;
  219. img {
  220. margin-top: 160rpx;
  221. width: 600rpx;
  222. height: 600rpx;
  223. }
  224. }
  225. }
  226. }
  227. </style>