index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <view class="order-statistics">
  3. <!-- 顶部统计卡片 -->
  4. <view class="overview-card">
  5. <view class="overview-grid">
  6. <view class="grid-item">
  7. <text class="item-label">今日订单</text>
  8. <text class="item-value">{{
  9. orderStatData.todayOrderNum || 0
  10. }}</text>
  11. </view>
  12. <view class="grid-item">
  13. <text class="item-label">昨日订单</text>
  14. <text class="item-value">{{
  15. orderStatData.yesterdayOrderNum || 0
  16. }}</text>
  17. </view>
  18. <view class="grid-item">
  19. <text class="item-label">本月订单</text>
  20. <text class="item-value"
  21. >{{ formatOrderNum(orderStatData.monthOrderNum) || 0
  22. }}<text
  23. class="unit"
  24. v-if="orderStatData.monthOrderNum > 10000"
  25. >万</text
  26. ></text
  27. >
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 订单状态网格 -->
  32. <view class="status-grid">
  33. <view
  34. v-for="(item, index) in statusList"
  35. :key="index"
  36. class="status-item"
  37. @tap="navigateToDetail(item.path)"
  38. >
  39. <view class="status-content">
  40. <text class="status-label">{{ item.label }}</text>
  41. <view class="status-value-wrap">
  42. <text class="status-value">{{
  43. orderStatData[item.key] || 0
  44. }}</text>
  45. <u-icon
  46. name="arrow-right"
  47. color="#999"
  48. size="14"
  49. ></u-icon>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 底部操作项 -->
  55. <view class="bottom-actions">
  56. <u-cell-group :border="false">
  57. <u-cell
  58. title="收货统计"
  59. isLink
  60. @click="navigateToDetail('/pages/order/stat/receive-stat')"
  61. ></u-cell>
  62. <u-cell
  63. title="全部订单"
  64. isLink
  65. @click="navigateToDetail('/pages/order/stat/all')"
  66. :border="false"
  67. ></u-cell>
  68. </u-cell-group>
  69. </view>
  70. </view>
  71. </template>
  72. <script setup>
  73. import { ref, onMounted, computed } from "vue";
  74. // 订单统计数据
  75. const orderStatData = ref({});
  76. // 订单状态数据
  77. const statusList = computed(() => [
  78. {
  79. label: "待初审",
  80. value: 0,
  81. key: "waitFirstOrderNum",
  82. path: "/pages/order/stat/pending-review",
  83. },
  84. {
  85. label: "待拣件",
  86. value: 0,
  87. key: "waitOrderNum",
  88. path: "/pages/order/stat/pending-pick",
  89. },
  90. {
  91. label: "已拣件待签收",
  92. value: 0,
  93. key: "waitSignOrderNum",
  94. path: "/pages/order/stat/pending-sign",
  95. },
  96. {
  97. label: "待确认收货",
  98. value: 0,
  99. key: "waitConfirmOrderNum",
  100. path: "/pages/order/stat/pending-confirm",
  101. },
  102. {
  103. label: "已到货待审核",
  104. value: 0,
  105. key: "waitCheckOrderNum",
  106. path: "/pages/order/stat/pending-audit",
  107. },
  108. {
  109. label: "待付款",
  110. value: 0,
  111. key: "waitPayOrderNum",
  112. path: "/pages/order/stat/pending-payment",
  113. },
  114. ]);
  115. // 格式化订单数量(超过万的显示为X.XX万)
  116. const formatOrderNum = (num) => {
  117. if (!num) return 0;
  118. if (num >= 10000) {
  119. return (num / 10000).toFixed(2);
  120. }
  121. return num;
  122. };
  123. // 获取订单统计数据
  124. const getOrderStatData = async () => {
  125. uni.showLoading({
  126. title: "加载中...",
  127. });
  128. uni.$u.http
  129. .get("/app/ordersignstat/getPdaOrderStat")
  130. .then((res) => {
  131. if (res.code === 200) {
  132. orderStatData.value = res.data;
  133. }
  134. })
  135. .finally(() => {
  136. uni.hideLoading();
  137. });
  138. };
  139. // 页面跳转
  140. const navigateToDetail = (path) => {
  141. if(path!='/pages/order/stat/receive-stat'){
  142. return;
  143. }
  144. uni.navigateTo({
  145. url: path,
  146. });
  147. };
  148. // 页面加载时获取数据
  149. onMounted(() => {
  150. getOrderStatData();
  151. });
  152. </script>
  153. <style>
  154. page {
  155. background: #f5f6fa;
  156. }
  157. </style>
  158. <style lang="scss" scoped>
  159. .order-statistics {
  160. padding: 20rpx;
  161. .overview-card {
  162. background: #ffffff;
  163. border-radius: 16rpx;
  164. padding: 30rpx 20rpx;
  165. margin-bottom: 20rpx;
  166. .overview-grid {
  167. display: flex;
  168. justify-content: space-between;
  169. .grid-item {
  170. flex: 1;
  171. text-align: center;
  172. position: relative;
  173. &:not(:last-child)::after {
  174. content: "";
  175. position: absolute;
  176. right: 0;
  177. top: 50%;
  178. transform: translateY(-50%);
  179. height: 60%;
  180. width: 2rpx;
  181. background: #eeeeee;
  182. }
  183. .item-label {
  184. font-size: 32rpx;
  185. color: #666666;
  186. margin-bottom: 12rpx;
  187. display: block;
  188. }
  189. .item-value {
  190. font-size: 44rpx;
  191. color: #333333;
  192. font-weight: 500;
  193. .unit {
  194. font-size: 24rpx;
  195. margin-left: 4rpx;
  196. }
  197. }
  198. }
  199. }
  200. }
  201. :deep(.u-cell) {
  202. .u-cell__body {
  203. padding: 15px;
  204. }
  205. }
  206. .status-grid {
  207. display: grid;
  208. grid-template-columns: repeat(3, 1fr);
  209. gap: 20rpx;
  210. margin-bottom: 20rpx;
  211. .status-item {
  212. background: #ffffff;
  213. border-radius: 16rpx;
  214. padding: 24rpx 12rpx;
  215. .status-content {
  216. .status-label {
  217. font-size: 32rpx;
  218. color: #666666;
  219. margin-bottom: 16rpx;
  220. display: block;
  221. }
  222. .status-value-wrap {
  223. display: flex;
  224. align-items: center;
  225. justify-content: space-between;
  226. .status-value {
  227. font-size: 44rpx;
  228. color: #333333;
  229. font-weight: 500;
  230. }
  231. }
  232. }
  233. &:active {
  234. opacity: 0.8;
  235. }
  236. }
  237. }
  238. .bottom-actions {
  239. background: #ffffff;
  240. border-radius: 16rpx;
  241. overflow: hidden;
  242. }
  243. }
  244. </style>