evaluateStatus.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  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. town: ''
  76. }
  77. },
  78. onLoad(options) {
  79. // console.log(options)
  80. this.status = options.status
  81. this.hotelId = options.hotelId
  82. if (this.status === '1') {
  83. uni.setNavigationBarTitle({
  84. title: '评价成功'
  85. })
  86. this.msg = '评价成功'
  87. this.btnMsg = '查看我的评价'
  88. } else {
  89. uni.setNavigationBarTitle({
  90. title: '评价失败'
  91. })
  92. this.msg = '评价失败'
  93. this.btnMsg = '重新评价'
  94. }
  95. this.getData()
  96. },
  97. onReachBottom() {
  98. if (this.list.length < this.total) {
  99. this.page++
  100. this.getData()
  101. } else {
  102. uni.showToast({
  103. title: '没有更多数据了',
  104. icon: 'none',
  105. mask: true
  106. })
  107. }
  108. },
  109. methods: {
  110. handleGoDetail() {
  111. uni.navigateTo({
  112. url: `/pages/detail/detail?id=${this.hotelId}&town=${this.town}`
  113. })
  114. },
  115. async getData() {
  116. const res = await this.$myRequest({
  117. url: '/mhotel/abcaunevaluatedOrder.action',
  118. data: {
  119. userId: uni.getStorageSync('userInfo').id,
  120. hotelId: this.hotelId,
  121. page: this.page,
  122. rows: this.rows
  123. }
  124. })
  125. // console.log(res)
  126. if (res.code === 200) {
  127. this.coverImg = res.data.url
  128. this.hotelName = res.data.name
  129. this.collectNum = res.data.count
  130. this.isCollect = res.data.isCollect
  131. this.total = res.data.page.total
  132. this.town = res.data.town
  133. this.list = [...this.list, ...res.data.page.pageList]
  134. }
  135. },
  136. async changeCollect(isCollect) {
  137. const res = await this.$myRequest({
  138. url: isCollect ? '/mhotel/ahpdelCollectHotel.action' : '/mhotel/ahpcollectHotel.action',
  139. data: {
  140. userId: uni.getStorageSync('userInfo').id,
  141. hotelId: this.hotelId
  142. }
  143. })
  144. // console.log(res)
  145. if (res.code === 200) {
  146. uni.showToast({
  147. title: isCollect ? '取消收藏成功' : '收藏成功',
  148. icon: 'success',
  149. mask: true
  150. })
  151. this.isCollect = !this.isCollect
  152. this.list = []
  153. this.page = 1
  154. this.getData()
  155. }
  156. },
  157. handleEvaluate(item) {
  158. uni.navigateTo({
  159. url: `/pagesSub/evaluate/evaluate?bookingId=${item.id}&hotelId=${item.hotelId}&houseId=${item.houseId}`
  160. })
  161. },
  162. // 点击按钮回调
  163. handleClickBtn() {
  164. if (this.status === '1') {
  165. uni.reLaunch({
  166. url: '/pagesSub/myEvaluate/myEvaluate'
  167. })
  168. } else {
  169. uni.navigateBack(1)
  170. }
  171. }
  172. }
  173. }
  174. </script>
  175. <style lang="scss" scoped>
  176. .container {
  177. min-height: 100vh;
  178. background-color: #f7f7f7;
  179. .status {
  180. display: flex;
  181. flex-direction: column;
  182. align-items: center;
  183. height: 554rpx;
  184. background-color: #fff;
  185. img {
  186. margin: 80rpx 0 40rpx;
  187. width: 134rpx;
  188. height: 134rpx;
  189. }
  190. .status_msg {
  191. font-size: 32rpx;
  192. }
  193. .status_btn {
  194. display: flex;
  195. justify-content: center;
  196. align-items: center;
  197. margin-top: 87rpx;
  198. width: 330rpx;
  199. height: 84rpx;
  200. color: #fff;
  201. font-size: 28rpx;
  202. border-radius: 22rpx;
  203. background-color: #096562;
  204. }
  205. }
  206. .info {
  207. display: flex;
  208. align-items: center;
  209. margin: 20rpx 0;
  210. padding: 0 30rpx;
  211. height: 144rpx;
  212. background-color: #fff;
  213. img {
  214. width: 80rpx;
  215. height: 80rpx;
  216. border-radius: 9rpx;
  217. }
  218. .info_name {
  219. display: flex;
  220. flex-direction: column;
  221. justify-content: space-between;
  222. margin-left: 24rpx;
  223. height: 80rpx;
  224. .top {
  225. font-weight: bold;
  226. font-size: 32rpx;
  227. }
  228. .bottom {
  229. color: #a6a6a6;
  230. font-size: 24rpx;
  231. }
  232. }
  233. .info_btn {
  234. display: flex;
  235. justify-content: center;
  236. align-items: center;
  237. margin-left: auto;
  238. width: 137rpx;
  239. height: 71rpx;
  240. color: #fff;
  241. font-size: 28rpx;
  242. border-radius: 22rpx;
  243. background-color: #096562;
  244. }
  245. .info_btn2 {
  246. display: flex;
  247. justify-content: center;
  248. align-items: center;
  249. margin-left: auto;
  250. width: 137rpx;
  251. height: 71rpx;
  252. color: #096562;
  253. font-size: 28rpx;
  254. border: 1rpx solid #096562;
  255. border-radius: 22rpx;
  256. background-color: #fff;
  257. }
  258. }
  259. .body {
  260. padding-bottom: 20rpx;
  261. .body_box {
  262. margin-top: 20rpx;
  263. box-sizing: border-box;
  264. padding: 0 40rpx;
  265. background-color: #fff;
  266. .box_header {
  267. display: flex;
  268. align-items: center;
  269. height: 94rpx;
  270. .img {
  271. width: 47rpx;
  272. height: 47rpx;
  273. }
  274. .title {
  275. margin-left: 16rpx;
  276. width: 350rpx;
  277. font-size: 32rpx;
  278. font-weight: bold;
  279. overflow: hidden;
  280. white-space: nowrap;
  281. text-overflow: ellipsis;
  282. }
  283. .type {
  284. display: flex;
  285. justify-content: flex-end;
  286. align-items: center;
  287. margin-left: auto;
  288. margin-right: 25rpx;
  289. width: 285rpx;
  290. color: #808080;
  291. font-size: 28rpx;
  292. }
  293. }
  294. .box_info {
  295. display: flex;
  296. height: 140rpx;
  297. .img {
  298. width: 100rpx;
  299. height: 100rpx;
  300. border-radius: 9rpx;
  301. }
  302. .info_right {
  303. display: flex;
  304. flex-direction: column;
  305. justify-content: space-around;
  306. margin-top: -5rpx;
  307. margin-left: 18rpx;
  308. height: 120rpx;
  309. color: #808080;
  310. font-size: 28rpx;
  311. .info_right_item {
  312. flex: 1;
  313. }
  314. }
  315. }
  316. .box_btn {
  317. display: flex;
  318. justify-content: flex-end;
  319. margin-top: -10rpx;
  320. height: 100rpx;
  321. .btn_item {
  322. display: flex;
  323. justify-content: center;
  324. align-items: center;
  325. margin-left: 20rpx;
  326. width: 178rpx;
  327. height: 68rpx;
  328. border-radius: 64rpx;
  329. color: #808080;
  330. font-size: 28rpx;
  331. border: 1rpx solid #808080;
  332. }
  333. }
  334. }
  335. }
  336. }
  337. </style>