TodayOrder.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="data-box">
  3. <view class="headline">今日订单对比</view>
  4. <view class="today-order">
  5. <view class="today-order-item">
  6. <text class="today-order-label">在线买单</text>
  7. <view class="today-order-value">
  8. <text class="value-label">订单数:</text>
  9. <view class="value-content">
  10. <text>{{ Vo.todayOnlineOrderNum || 0 }}</text>
  11. <text :class="(Vo.onlineOrderOnDay || 0) * 1 >= 0 ? 'green-color' : 'red-color'">{{(Vo.onlineOrderOnDay || 0) * 1 > 0 ? '+' : ''}}{{ Vo.onlineOrderOnDay || 0 }}%</text>
  12. </view>
  13. </view>
  14. <view class="today-order-value">
  15. <text class="value-label">交易额:</text>
  16. <view class="value-content value-money">¥{{ Vo.todayOnlineOrderAmount || 0 }}</view>
  17. </view>
  18. </view>
  19. <view class="today-order-item">
  20. <text class="today-order-label">线上商城</text>
  21. <view class="today-order-value">
  22. <text class="value-label">订单数:</text>
  23. <view class="value-content">
  24. <text>{{ Vo.todayShopOrderNum || 0 }}</text>
  25. <text :class="(Vo.shopOrderOnDay || 0) * 1 >= 0 ? 'green-color' : 'red-color'">{{(Vo.shopOrderOnDay || 0) * 1 > 0 ? '+' : ''}}{{ Vo.shopOrderOnDay || 0 }}%</text>
  26. </view>
  27. </view>
  28. <view class="today-order-value">
  29. <text class="value-label">交易额:</text>
  30. <view class="value-content value-money">¥{{ Vo.todayShopOrderAmount || 0 }}</view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script lang="ts" setup>
  37. import { onMounted, ref, unref, watch } from "vue";
  38. import { getTodayStatisticsApi } from "@/api/ShopContent.ts";
  39. const $Props = defineProps({
  40. businessId: {
  41. type: Number,
  42. default: null
  43. }
  44. });
  45. const Vo = ref({})
  46. const getStatistics = async () => {
  47. if (!$Props.businessId) {
  48. Vo.value = {}
  49. return {}
  50. }
  51. try {
  52. const Parmas = {
  53. businessId: $Props.businessId
  54. };
  55. const { data } = await getTodayStatisticsApi(Parmas);
  56. Vo.value = data || {}
  57. } catch (error) {
  58. Vo.value = {}
  59. }
  60. };
  61. watch(() => $Props.businessId, () => {
  62. getStatistics();
  63. });
  64. onMounted(() => {
  65. getStatistics();
  66. })
  67. </script>
  68. <style lang="scss" scoped>
  69. @import url("./index.scss");
  70. .today-order {
  71. width: 100%;
  72. display: flex;
  73. align-items: center;
  74. justify-content: space-between;
  75. .today-order-item {
  76. width: calc((100% - 28rpx) / 2);
  77. box-sizing: border-box;
  78. background: linear-gradient(180deg, #fbe8eb, #ffffff);
  79. border-radius: 20rpx;
  80. padding: 25rpx;
  81. .today-order-label {
  82. width: 100%;
  83. display: inline-block;
  84. font-size: 28rpx;
  85. font-family: PingFang SC, PingFang SC-Bold;
  86. font-weight: 700;
  87. text-align: center;
  88. color: #1a1a1a;
  89. }
  90. .today-order-value {
  91. display: flex;
  92. align-items: center;
  93. padding-top: 15rpx;
  94. font-size: 23rpx;
  95. font-family: PingFang SC, PingFang SC-Regular;
  96. font-weight: 400;
  97. color: #1a1a1a;
  98. &+.today-order-value {
  99. padding-top: 20rpx;
  100. }
  101. .value-label {
  102. flex-shrink: 0;
  103. }
  104. .value-content {
  105. flex: 1 0;
  106. display: flex;
  107. justify-content: space-between;
  108. .green-color {
  109. color: #08BE5D;
  110. }
  111. .red-color {
  112. color: #FF0000;
  113. }
  114. }
  115. .value-money {
  116. font-size: 23rpx;
  117. font-family: PingFang SC, PingFang SC-Regular;
  118. font-weight: 400;
  119. color: #eb5153;
  120. }
  121. }
  122. }
  123. }
  124. </style>