orderManage.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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">
  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. handleDelete(item) {
  78. console.log(item.name)
  79. uni.showModal({
  80. title: '提示',
  81. content: '确定删除吗?删除后不可恢复',
  82. success: (res) => {
  83. if (res.confirm) {
  84. uni.showToast({
  85. title: '删除成功',
  86. icon: 'success'
  87. })
  88. }
  89. }
  90. })
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="scss" scoped>
  96. .container {
  97. box-sizing: border-box;
  98. padding: 0 20rpx 40rpx;
  99. min-height: 100vh;
  100. background-color: #f2f3f5;
  101. overflow-y: auto;
  102. .order_right {
  103. display: flex;
  104. justify-content: center;
  105. align-items: center;
  106. margin-top: 20rpx;
  107. width: 126rpx;
  108. background-color: #d43030;
  109. .img {
  110. width: 50rpx;
  111. height: 50rpx;
  112. }
  113. }
  114. .order_box {
  115. margin-top: 20rpx;
  116. box-sizing: border-box;
  117. padding: 0 22rpx;
  118. width: 710rpx;
  119. border-radius: 15rpx;
  120. background-color: #fff;
  121. .box_header {
  122. display: flex;
  123. align-items: center;
  124. height: 94rpx;
  125. .img {
  126. width: 47rpx;
  127. height: 47rpx;
  128. }
  129. .title {
  130. margin-left: 16rpx;
  131. font-size: 32rpx;
  132. font-weight: bold;
  133. }
  134. .type {
  135. margin-left: auto;
  136. color: #808080;
  137. font-size: 28rpx;
  138. }
  139. .type2 {
  140. color: #ff5733;
  141. }
  142. }
  143. .box_info {
  144. display: flex;
  145. height: 140rpx;
  146. .img {
  147. width: 100rpx;
  148. height: 100rpx;
  149. border-radius: 9rpx;
  150. }
  151. .info_right {
  152. display: flex;
  153. flex-direction: column;
  154. justify-content: space-around;
  155. margin-top: -5rpx;
  156. margin-left: 18rpx;
  157. height: 120rpx;
  158. color: #808080;
  159. font-size: 28rpx;
  160. .info_right_item {
  161. flex: 1;
  162. }
  163. }
  164. }
  165. .box_btn {
  166. display: flex;
  167. justify-content: flex-end;
  168. height: 100rpx;
  169. .btn_item {
  170. display: flex;
  171. justify-content: center;
  172. align-items: center;
  173. margin-left: 20rpx;
  174. width: 178rpx;
  175. height: 68rpx;
  176. border-radius: 64rpx;
  177. color: #808080;
  178. font-size: 28rpx;
  179. border: 1rpx solid #808080;
  180. }
  181. }
  182. }
  183. }
  184. </style>