orderManage.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <view class="container">
  3. <!-- 每一个订单区域 -->
  4. <uni-swipe-action>
  5. <uni-swipe-action-item v-for="item in orderList" :key="item.id">
  6. <!-- 右侧选项内容区域 -->
  7. <template v-slot:right>
  8. <view class="order_right" @click="handleDelete(item)">
  9. <img class="img" src="../../static/my/delete.png" />
  10. </view>
  11. </template>
  12. <view class="order_box" @click="goPageOrderDetail">
  13. <!-- 标题区域 -->
  14. <view class="box_header">
  15. <img class="img" src="../../static/my/hotel.png" />
  16. <view class="title">{{ item.hotelName }}</view>
  17. <view class="type type2" v-if="item.type === 1">待付款,剩余15:00</view>
  18. <view class="type" v-if="item.type === 2">支付超时</view>
  19. <view class="type" v-if="item.type === 3">已支付</view>
  20. <view class="type" v-if="item.type === 4">已取消</view>
  21. </view>
  22. <!-- 酒店信息区域 -->
  23. <view class="box_info">
  24. <img class="img" :src="item.imgUrl" />
  25. <view class="info_right">
  26. <view class="info_right_item">1间,大床房</view>
  27. <view class="info_right_item">2023-07-26 - 2023-07-27</view>
  28. <view class="info_right_item">总价:¥229.00</view>
  29. </view>
  30. </view>
  31. <!-- 按钮区域 -->
  32. <view class="box_btn" v-if="item.type === 1 || item.type === 2">
  33. <view class="btn_item" v-if="item.type === 1">预定</view>
  34. <view class="btn_item" v-if="item.type === 2">再次预定</view>
  35. </view>
  36. </view>
  37. </uni-swipe-action-item>
  38. </uni-swipe-action>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. // type: 1 为待付款 2 为支付超时,
  46. // 3 为已支付 4 为已取消
  47. orderList: [
  48. {
  49. id: 1,
  50. hotelName: '靖安乡宿',
  51. type: 1,
  52. imgUrl: '../../static/my/test.png'
  53. },
  54. {
  55. id: 2,
  56. hotelName: '开心乡宿',
  57. type: 2,
  58. imgUrl: '../../static/my/test.png'
  59. },
  60. {
  61. id: 3,
  62. hotelName: '健康乡宿',
  63. type: 3,
  64. imgUrl: '../../static/my/test.png'
  65. },
  66. {
  67. id: 4,
  68. hotelName: '幸福乡宿',
  69. type: 4,
  70. imgUrl: '../../static/my/test.png'
  71. }
  72. ]
  73. }
  74. },
  75. methods: {
  76. // 点击每一个订单回调
  77. goPageOrderDetail() {
  78. uni.navigateTo({
  79. url: '/pages/orderDetail/orderDetail'
  80. })
  81. },
  82. // 右侧选项内容删除按钮回调
  83. handleDelete(item) {
  84. console.log(item.name)
  85. uni.showModal({
  86. title: '提示',
  87. content: '确定删除吗?删除后不可恢复',
  88. success: (res) => {
  89. if (res.confirm) {
  90. uni.showToast({
  91. title: '删除成功',
  92. icon: 'success'
  93. })
  94. }
  95. }
  96. })
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. .container {
  103. box-sizing: border-box;
  104. padding: 0 20rpx 40rpx;
  105. min-height: 100vh;
  106. background-color: #f2f3f5;
  107. overflow-y: auto;
  108. .order_right {
  109. display: flex;
  110. justify-content: center;
  111. align-items: center;
  112. margin-top: 20rpx;
  113. width: 126rpx;
  114. background-color: #d43030;
  115. .img {
  116. width: 50rpx;
  117. height: 50rpx;
  118. }
  119. }
  120. .order_box {
  121. margin-top: 20rpx;
  122. box-sizing: border-box;
  123. padding: 0 22rpx;
  124. width: 710rpx;
  125. border-radius: 15rpx;
  126. background-color: #fff;
  127. .box_header {
  128. display: flex;
  129. align-items: center;
  130. height: 94rpx;
  131. .img {
  132. width: 47rpx;
  133. height: 47rpx;
  134. }
  135. .title {
  136. margin-left: 16rpx;
  137. font-size: 32rpx;
  138. font-weight: bold;
  139. }
  140. .type {
  141. margin-left: auto;
  142. color: #808080;
  143. font-size: 28rpx;
  144. }
  145. .type2 {
  146. color: #ff5733;
  147. }
  148. }
  149. .box_info {
  150. display: flex;
  151. height: 140rpx;
  152. .img {
  153. width: 100rpx;
  154. height: 100rpx;
  155. border-radius: 9rpx;
  156. }
  157. .info_right {
  158. display: flex;
  159. flex-direction: column;
  160. justify-content: space-around;
  161. margin-top: -5rpx;
  162. margin-left: 18rpx;
  163. height: 120rpx;
  164. color: #808080;
  165. font-size: 28rpx;
  166. .info_right_item {
  167. flex: 1;
  168. }
  169. }
  170. }
  171. .box_btn {
  172. display: flex;
  173. justify-content: flex-end;
  174. height: 100rpx;
  175. .btn_item {
  176. display: flex;
  177. justify-content: center;
  178. align-items: center;
  179. margin-left: 20rpx;
  180. width: 178rpx;
  181. height: 68rpx;
  182. border-radius: 64rpx;
  183. color: #808080;
  184. font-size: 28rpx;
  185. border: 1rpx solid #808080;
  186. }
  187. }
  188. }
  189. }
  190. </style>