orders.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <view class="container">
  3. <view class="stats-section">
  4. <view class="stat-item">
  5. <text class="stat-value">{{ formatPriceWithSymbol(stats.orderRevenue) }}</text>
  6. <text class="stat-label">订单收入</text>
  7. </view>
  8. <view class="stat-item">
  9. <text class="stat-value">{{ formatPriceWithSymbol(stats.pendingAmount) }}</text>
  10. <text class="stat-label">待到账</text>
  11. </view>
  12. <view class="stat-item">
  13. <text class="stat-value">{{ formatPriceWithSymbol(stats.actualCommission) }}</text>
  14. <text class="stat-label">实际佣金</text>
  15. </view>
  16. </view>
  17. <view class="orders-section">
  18. <text class="section-title">订单记录</text>
  19. <view class="order-list">
  20. <view class="order-item" v-for="order in orders" :key="order.id">
  21. <view class="order-header">
  22. <text class="order-no">{{ order.orderNo }}</text>
  23. <text class="order-status" :class="order.status">{{ order.statusText }}</text>
  24. </view>
  25. <view class="order-body">
  26. <view class="order-info">
  27. <text class="family-name">{{ order.familyName }}</text>
  28. <text class="package-name">{{ order.packageName }}</text>
  29. </view>
  30. <view class="order-amount">
  31. <text class="amount">{{ formatPriceWithSymbol(order.amount) }}</text>
  32. </view>
  33. </view>
  34. <view class="order-footer">
  35. <text class="order-time">{{ order.createdAt }}</text>
  36. </view>
  37. </view>
  38. <view class="empty-tip" v-if="orders.length === 0">
  39. <text>暂无订单</text>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import { getGuideOrders, getOrderStats } from '../../utils/api.js'
  47. export default {
  48. data() {
  49. return {
  50. orders: [],
  51. stats: {
  52. orderRevenue: 0,
  53. pendingAmount: 0,
  54. actualCommission: 0
  55. }
  56. }
  57. },
  58. onLoad() {
  59. this.loadData()
  60. },
  61. methods: {
  62. async loadData() {
  63. try {
  64. const [ordersRes, statsRes] = await Promise.all([
  65. getGuideOrders(),
  66. getOrderStats()
  67. ])
  68. if (ordersRes.data) {
  69. this.orders = ordersRes.data
  70. }
  71. if (statsRes.data) {
  72. this.stats = statsRes.data
  73. }
  74. } catch (e) {
  75. console.error(e)
  76. }
  77. }
  78. }
  79. }
  80. </script>
  81. <style scoped>
  82. .container {
  83. padding: 30rpx;
  84. background: #f5f5f5;
  85. min-height: 100vh;
  86. }
  87. .stats-section {
  88. display: flex;
  89. background: #fff;
  90. border-radius: 16rpx;
  91. padding: 30rpx;
  92. margin-bottom: 30rpx;
  93. }
  94. .stat-item {
  95. flex: 1;
  96. text-align: center;
  97. }
  98. .stat-value {
  99. font-size: 36rpx;
  100. font-weight: bold;
  101. color: #667eea;
  102. display: block;
  103. }
  104. .stat-label {
  105. font-size: 24rpx;
  106. color: #999;
  107. display: block;
  108. margin-top: 8rpx;
  109. }
  110. .orders-section {
  111. background: #fff;
  112. border-radius: 16rpx;
  113. padding: 30rpx;
  114. }
  115. .section-title {
  116. font-size: 30rpx;
  117. font-weight: bold;
  118. color: #333;
  119. display: block;
  120. margin-bottom: 20rpx;
  121. }
  122. .order-item {
  123. padding: 24rpx 0;
  124. border-bottom: 1rpx solid #f0f0f0;
  125. }
  126. .order-item:last-child {
  127. border-bottom: none;
  128. }
  129. .order-header {
  130. display: flex;
  131. justify-content: space-between;
  132. align-items: center;
  133. margin-bottom: 16rpx;
  134. }
  135. .order-no {
  136. font-size: 24rpx;
  137. color: #999;
  138. }
  139. .order-status {
  140. font-size: 24rpx;
  141. padding: 4rpx 16rpx;
  142. border-radius: 8rpx;
  143. }
  144. .order-status.completed {
  145. background: #f0f9eb;
  146. color: #67C23A;
  147. }
  148. .order-status.pending {
  149. background: #fdf6ec;
  150. color: #E6A23C;
  151. }
  152. .order-body {
  153. display: flex;
  154. justify-content: space-between;
  155. align-items: center;
  156. margin-bottom: 12rpx;
  157. }
  158. .family-name {
  159. font-size: 28rpx;
  160. color: #333;
  161. display: block;
  162. }
  163. .package-name {
  164. font-size: 24rpx;
  165. color: #999;
  166. display: block;
  167. margin-top: 4rpx;
  168. }
  169. .amount {
  170. font-size: 32rpx;
  171. font-weight: bold;
  172. color: #333;
  173. }
  174. .order-time {
  175. font-size: 24rpx;
  176. color: #999;
  177. }
  178. .empty-tip {
  179. text-align: center;
  180. color: #999;
  181. padding: 40rpx 0;
  182. }
  183. </style>