orders.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <view class="container">
  3. <view class="title">我的订单</view>
  4. <view class="order-tabs">
  5. <view class="tab-item active">全部</view>
  6. <view class="tab-item">待支付</view>
  7. <view class="tab-item">已完成</view>
  8. <view class="tab-item">退款/售后</view>
  9. </view>
  10. <view class="order-list">
  11. <view class="order-item">
  12. <view class="order-header">
  13. <view class="order-time">2026-01-23 10:30:00</view>
  14. <view class="order-status">已完成</view>
  15. </view>
  16. <view class="order-products">
  17. <view class="product-item">
  18. <view class="product-name">可口可乐</view>
  19. <view class="product-price">¥3.50</view>
  20. <view class="product-quantity">×2</view>
  21. </view>
  22. </view>
  23. <view class="order-footer">
  24. <view class="order-total">共2件商品 合计:¥7.00</view>
  25. <button class="order-button">查看详情</button>
  26. </view>
  27. </view>
  28. <view class="order-item">
  29. <view class="order-header">
  30. <view class="order-time">2026-01-23 09:15:00</view>
  31. <view class="order-status">待支付</view>
  32. </view>
  33. <view class="order-products">
  34. <view class="product-item">
  35. <view class="product-name">雪碧</view>
  36. <view class="product-price">¥3.50</view>
  37. <view class="product-quantity">×1</view>
  38. </view>
  39. </view>
  40. <view class="order-footer">
  41. <view class="order-total">共1件商品 合计:¥3.50</view>
  42. <button class="order-button">立即支付</button>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script setup lang="ts">
  49. import { ref, onMounted } from 'vue';
  50. import { mockApi } from '../../utils/mock';
  51. const orders = ref<any[]>([]);
  52. onMounted(async () => {
  53. const response = await mockApi.getOrders();
  54. if (response.success) {
  55. orders.value = response.data;
  56. }
  57. });
  58. </script>
  59. <style>
  60. .container {
  61. min-height: 100vh;
  62. background-color: #f5f5f5;
  63. }
  64. .title {
  65. font-size: 36rpx;
  66. font-weight: bold;
  67. padding: 30rpx;
  68. background-color: #fff;
  69. border-bottom: 1rpx solid #eee;
  70. }
  71. .order-tabs {
  72. display: flex;
  73. background-color: #fff;
  74. margin: 20rpx 0;
  75. padding: 0 30rpx;
  76. }
  77. .tab-item {
  78. flex: 1;
  79. text-align: center;
  80. padding: 20rpx 0;
  81. font-size: 28rpx;
  82. color: #666;
  83. position: relative;
  84. }
  85. .tab-item.active {
  86. color: #FFD700;
  87. font-weight: bold;
  88. }
  89. .tab-item.active::after {
  90. content: '';
  91. position: absolute;
  92. bottom: 0;
  93. left: 25%;
  94. width: 50%;
  95. height: 4rpx;
  96. background-color: #FFD700;
  97. }
  98. .order-list {
  99. padding: 0 30rpx 30rpx;
  100. }
  101. .order-item {
  102. background-color: #fff;
  103. border-radius: 10rpx;
  104. margin-bottom: 20rpx;
  105. overflow: hidden;
  106. }
  107. .order-header {
  108. display: flex;
  109. justify-content: space-between;
  110. padding: 20rpx;
  111. border-bottom: 1rpx solid #f0f0f0;
  112. }
  113. .order-time {
  114. font-size: 24rpx;
  115. color: #999;
  116. }
  117. .order-status {
  118. font-size: 24rpx;
  119. color: #FF6B6B;
  120. }
  121. .order-products {
  122. padding: 20rpx;
  123. }
  124. .product-item {
  125. display: flex;
  126. justify-content: space-between;
  127. align-items: center;
  128. padding: 10rpx 0;
  129. }
  130. .product-name {
  131. font-size: 28rpx;
  132. color: #333;
  133. flex: 1;
  134. }
  135. .product-price {
  136. font-size: 28rpx;
  137. color: #333;
  138. margin: 0 20rpx;
  139. }
  140. .product-quantity {
  141. font-size: 28rpx;
  142. color: #666;
  143. }
  144. .order-footer {
  145. display: flex;
  146. justify-content: space-between;
  147. align-items: center;
  148. padding: 20rpx;
  149. border-top: 1rpx solid #f0f0f0;
  150. background-color: #f9f9f9;
  151. }
  152. .order-total {
  153. font-size: 28rpx;
  154. color: #333;
  155. }
  156. .order-button {
  157. background-color: #FFD700;
  158. color: #333;
  159. border: none;
  160. padding: 10rpx 30rpx;
  161. border-radius: 20rpx;
  162. font-size: 24rpx;
  163. }
  164. </style>