orders.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <view class="container" :style="{ '--font-scale': fontScale }">
  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. import fontScaleMixin from '@/mixins/font-scale.js'
  48. export default {
  49. mixins: [fontScaleMixin],
  50. data() {
  51. return {
  52. orders: [],
  53. stats: {
  54. orderRevenue: 0,
  55. pendingAmount: 0,
  56. actualCommission: 0
  57. }
  58. }
  59. },
  60. onLoad() {
  61. this.loadData()
  62. },
  63. methods: {
  64. async loadData() {
  65. try {
  66. const [ordersRes, statsRes] = await Promise.all([
  67. getGuideOrders(),
  68. getOrderStats()
  69. ])
  70. if (ordersRes.data) {
  71. this.orders = ordersRes.data
  72. }
  73. if (statsRes.data) {
  74. this.stats = statsRes.data
  75. }
  76. } catch (e) {
  77. console.error(e)
  78. }
  79. }
  80. }
  81. }
  82. </script>
  83. <style scoped lang="scss">
  84. .container {
  85. padding: $uni-space-page;
  86. background: $facade-fill-2;
  87. min-height: 100vh;
  88. }
  89. .stats-section {
  90. display: flex;
  91. background: $app-surface;
  92. border-radius: 16rpx;
  93. padding: $uni-space-page;
  94. margin-bottom: $uni-space-lg;
  95. }
  96. .stat-item {
  97. flex: 1;
  98. text-align: center;
  99. }
  100. .stat-value {
  101. font-size: calc(36rpx * var(--font-scale, 1));
  102. font-weight: bold;
  103. color: $accent-indigo;
  104. display: block;
  105. }
  106. .stat-label {
  107. font-size: calc(24rpx * var(--font-scale, 1));
  108. color: $facade-text-muted;
  109. display: block;
  110. margin-top: 8rpx;
  111. }
  112. .orders-section {
  113. background: $app-surface;
  114. border-radius: 16rpx;
  115. padding: $uni-space-page;
  116. }
  117. .section-title {
  118. font-size: calc(30rpx * var(--font-scale, 1));
  119. font-weight: bold;
  120. color: $facade-text-strong;
  121. display: block;
  122. margin-bottom: 20rpx;
  123. }
  124. .order-item {
  125. padding: 24rpx 0;
  126. border-bottom: 1rpx solid $facade-fill;
  127. }
  128. .order-item:last-child {
  129. border-bottom: none;
  130. }
  131. .order-header {
  132. display: flex;
  133. justify-content: space-between;
  134. align-items: center;
  135. margin-bottom: 16rpx;
  136. }
  137. .order-no {
  138. font-size: calc(24rpx * var(--font-scale, 1));
  139. color: $facade-text-muted;
  140. }
  141. .order-status {
  142. font-size: calc(24rpx * var(--font-scale, 1));
  143. padding: 4rpx 16rpx;
  144. border-radius: 8rpx;
  145. }
  146. .order-status.completed {
  147. background: $tint-green-ghost;
  148. color: $el-success;
  149. }
  150. .order-status.pending {
  151. background: #fdf6ec;
  152. color: $status-warning-4;
  153. }
  154. .order-body {
  155. display: flex;
  156. justify-content: space-between;
  157. align-items: center;
  158. margin-bottom: 12rpx;
  159. }
  160. .family-name {
  161. font-size: calc(28rpx * var(--font-scale, 1));
  162. color: $facade-text-strong;
  163. display: block;
  164. }
  165. .package-name {
  166. font-size: calc(24rpx * var(--font-scale, 1));
  167. color: $facade-text-muted;
  168. display: block;
  169. margin-top: 4rpx;
  170. }
  171. .amount {
  172. font-size: calc(32rpx * var(--font-scale, 1));
  173. font-weight: bold;
  174. color: $facade-text-strong;
  175. }
  176. .order-time {
  177. font-size: calc(24rpx * var(--font-scale, 1));
  178. color: $facade-text-muted;
  179. }
  180. .empty-tip {
  181. text-align: center;
  182. color: $facade-text-muted;
  183. padding: 40rpx 0;
  184. }
  185. </style>