evaluateStatus.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <view class="container">
  3. <!-- 评价状态区域 -->
  4. <view class="status">
  5. <img v-if="status === '1'" src="../../static/index/success.png" />
  6. <img v-if="status === '2'" src="../../static/index/fail.png" />
  7. <view class="status_msg">{{ msg }}</view>
  8. <view class="status_btn" @click="handleClickBtn">{{ btnMsg }}</view>
  9. </view>
  10. <!-- 民宿信息区域 -->
  11. <view class="info" @click="handleGoDetail">
  12. <img mode="aspectFill" :src="coverImg" />
  13. <view class="info_name">
  14. <view class="top">{{ hotelName }}</view>
  15. <view class="bottom">{{ collectNum }}人收藏</view>
  16. </view>
  17. <view :class="isCollect ? 'info_btn2' : 'info_btn'" @click="changeCollect(isCollect)">{{ isCollect ? '已收藏' : '收藏' }}</view>
  18. </view>
  19. <!-- 订单列表区域 -->
  20. <view class="body">
  21. <!-- 每一个订单区域 -->
  22. <view class="body_box" v-for="(item, index) in list" :key="index">
  23. <!-- 标题区域 -->
  24. <view class="box_header">
  25. <img class="img" src="../../static/my/hotel.png" />
  26. <view class="title">{{ item.hotelName }}</view>
  27. <view class="type">已消费</view>
  28. </view>
  29. <!-- 酒店信息区域 -->
  30. <view class="box_info">
  31. <img class="img" mode="aspectFill" :src="item.url" />
  32. <view class="info_right">
  33. <view class="info_right_item">{{ item.houseOrderNumber }}间,{{ item.houseName }}</view>
  34. <view class="info_right_item">{{ item.liveTime.slice(0, 10) }} - {{ item.checkOutTime.slice(0, 10) }}</view>
  35. <view class="info_right_item">总价:¥{{ item.payAccount }}</view>
  36. </view>
  37. </view>
  38. <!-- 按钮区域 -->
  39. <view class="box_btn">
  40. <view class="btn_item" @click="handleEvaluate(item)">去评价</view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. data() {
  49. return {
  50. // 评价是否成功 1成功 2失败
  51. status: null,
  52. // 评价状态信息
  53. msg: '',
  54. // 按钮文字信息
  55. btnMsg: '',
  56. // 民宿ID
  57. hotelId: '',
  58. // 当前页
  59. page: 1,
  60. // 每页多少条
  61. rows: 6,
  62. // 总条数
  63. total: null,
  64. // 数据列表
  65. list: [],
  66. // 民宿封面图
  67. coverImg: '',
  68. // 民宿名称
  69. hotelName: '',
  70. // 收藏人数
  71. collectNum: 0,
  72. // 是否收藏
  73. isCollect: false
  74. }
  75. },
  76. onLoad(options) {
  77. // console.log(options)
  78. this.status = options.status
  79. this.hotelId = options.hotelId
  80. if (this.status === '1') {
  81. uni.setNavigationBarTitle({
  82. title: '评价成功'
  83. })
  84. this.msg = '评价成功'
  85. this.btnMsg = '查看我的评价'
  86. } else {
  87. uni.setNavigationBarTitle({
  88. title: '评价失败'
  89. })
  90. this.msg = '评价失败'
  91. this.btnMsg = '重新评价'
  92. }
  93. this.getData()
  94. },
  95. onReachBottom() {
  96. if (this.list.length < this.total) {
  97. this.page++
  98. this.getData()
  99. } else {
  100. uni.showToast({
  101. title: '没有更多数据了',
  102. icon: 'none',
  103. mask: true
  104. })
  105. }
  106. },
  107. methods: {
  108. handleGoDetail() {
  109. uni.navigateTo({
  110. url: `/pages/detail/detail?id=${this.hotelId}`
  111. })
  112. },
  113. async getData() {
  114. const res = await this.$myRequest({
  115. url: '/mhotel/abcaunevaluatedOrder.action',
  116. data: {
  117. userId: uni.getStorageSync('userInfo').id,
  118. hotelId: this.hotelId,
  119. page: this.page,
  120. rows: this.rows
  121. }
  122. })
  123. // console.log(res)
  124. if (res.code === 200) {
  125. this.coverImg = res.data.url
  126. this.hotelName = res.data.name
  127. this.collectNum = res.data.count
  128. this.isCollect = res.data.isCollect
  129. this.total = res.data.page.total
  130. this.list = [...this.list, ...res.data.page.pageList]
  131. }
  132. },
  133. async changeCollect(isCollect) {
  134. const res = await this.$myRequest({
  135. url: isCollect ? '/mhotel/ahpdelCollectHotel.action' : '/mhotel/ahpcollectHotel.action',
  136. data: {
  137. userId: uni.getStorageSync('userInfo').id,
  138. hotelId: this.hotelId
  139. }
  140. })
  141. // console.log(res)
  142. if (res.code === 200) {
  143. uni.showToast({
  144. title: isCollect ? '取消收藏成功' : '收藏成功',
  145. icon: 'success',
  146. mask: true
  147. })
  148. this.isCollect = !this.isCollect
  149. this.list = []
  150. this.page = 1
  151. this.getData()
  152. }
  153. },
  154. handleEvaluate(item) {
  155. uni.navigateTo({
  156. url: `/pages/evaluate/evaluate?bookingId=${item.id}&hotelId=${item.hotelId}&houseId=${item.houseId}`
  157. })
  158. },
  159. // 点击按钮回调
  160. handleClickBtn() {
  161. if (this.status === '1') {
  162. uni.reLaunch({
  163. url: '/pages/myEvaluate/myEvaluate'
  164. })
  165. } else {
  166. uni.navigateBack(1)
  167. }
  168. }
  169. }
  170. }
  171. </script>
  172. <style lang="scss" scoped>
  173. .container {
  174. min-height: 100vh;
  175. background-color: #f7f7f7;
  176. .status {
  177. display: flex;
  178. flex-direction: column;
  179. align-items: center;
  180. height: 554rpx;
  181. background-color: #fff;
  182. img {
  183. margin: 80rpx 0 40rpx;
  184. width: 134rpx;
  185. height: 134rpx;
  186. }
  187. .status_msg {
  188. font-size: 32rpx;
  189. }
  190. .status_btn {
  191. display: flex;
  192. justify-content: center;
  193. align-items: center;
  194. margin-top: 87rpx;
  195. width: 330rpx;
  196. height: 84rpx;
  197. color: #fff;
  198. font-size: 28rpx;
  199. border-radius: 22rpx;
  200. background-color: #096562;
  201. }
  202. }
  203. .info {
  204. display: flex;
  205. align-items: center;
  206. margin: 20rpx 0;
  207. padding: 0 30rpx;
  208. height: 144rpx;
  209. background-color: #fff;
  210. img {
  211. width: 80rpx;
  212. height: 80rpx;
  213. border-radius: 9rpx;
  214. }
  215. .info_name {
  216. display: flex;
  217. flex-direction: column;
  218. justify-content: space-between;
  219. margin-left: 24rpx;
  220. height: 80rpx;
  221. .top {
  222. font-weight: bold;
  223. font-size: 32rpx;
  224. }
  225. .bottom {
  226. color: #a6a6a6;
  227. font-size: 24rpx;
  228. }
  229. }
  230. .info_btn {
  231. display: flex;
  232. justify-content: center;
  233. align-items: center;
  234. margin-left: auto;
  235. width: 137rpx;
  236. height: 71rpx;
  237. color: #fff;
  238. font-size: 28rpx;
  239. border-radius: 22rpx;
  240. background-color: #096562;
  241. }
  242. .info_btn2 {
  243. display: flex;
  244. justify-content: center;
  245. align-items: center;
  246. margin-left: auto;
  247. width: 137rpx;
  248. height: 71rpx;
  249. color: #096562;
  250. font-size: 28rpx;
  251. border: 1rpx solid #096562;
  252. border-radius: 22rpx;
  253. background-color: #fff;
  254. }
  255. }
  256. .body {
  257. padding-bottom: 20rpx;
  258. .body_box {
  259. margin-top: 20rpx;
  260. box-sizing: border-box;
  261. padding: 0 40rpx;
  262. background-color: #fff;
  263. .box_header {
  264. display: flex;
  265. align-items: center;
  266. height: 94rpx;
  267. .img {
  268. width: 47rpx;
  269. height: 47rpx;
  270. }
  271. .title {
  272. margin-left: 16rpx;
  273. width: 350rpx;
  274. font-size: 32rpx;
  275. font-weight: bold;
  276. overflow: hidden;
  277. white-space: nowrap;
  278. text-overflow: ellipsis;
  279. }
  280. .type {
  281. display: flex;
  282. justify-content: flex-end;
  283. align-items: center;
  284. margin-left: auto;
  285. margin-right: 25rpx;
  286. width: 285rpx;
  287. color: #808080;
  288. font-size: 28rpx;
  289. }
  290. }
  291. .box_info {
  292. display: flex;
  293. height: 140rpx;
  294. .img {
  295. width: 100rpx;
  296. height: 100rpx;
  297. border-radius: 9rpx;
  298. }
  299. .info_right {
  300. display: flex;
  301. flex-direction: column;
  302. justify-content: space-around;
  303. margin-top: -5rpx;
  304. margin-left: 18rpx;
  305. height: 120rpx;
  306. color: #808080;
  307. font-size: 28rpx;
  308. .info_right_item {
  309. flex: 1;
  310. }
  311. }
  312. }
  313. .box_btn {
  314. display: flex;
  315. justify-content: flex-end;
  316. margin-top: -10rpx;
  317. height: 100rpx;
  318. .btn_item {
  319. display: flex;
  320. justify-content: center;
  321. align-items: center;
  322. margin-left: 20rpx;
  323. width: 178rpx;
  324. height: 68rpx;
  325. border-radius: 64rpx;
  326. color: #808080;
  327. font-size: 28rpx;
  328. border: 1rpx solid #808080;
  329. }
  330. }
  331. }
  332. }
  333. }
  334. </style>