manage-order.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <view class="manage-order">
  3. <custom-nav ref="ltm" :title="title" />
  4. <view class="content">
  5. <view class="chart">
  6. <view class="switch">
  7. <text :class="{ active: active === 7 }" @tap="switchChart(7)">7日</text>
  8. <text :class="{ active: active === 15 }" @tap="switchChart(15)">15日</text>
  9. <text :class="{ active: active === 30 }" @tap="switchChart(30)">30日</text>
  10. </view>
  11. <view class="chart-line">
  12. <chart-line :chartData="chartData" color="#078EC6" background="#E4F4FA" unit="单" />
  13. </view>
  14. </view>
  15. <view class="kingkong">
  16. <navigator v-for="(item, index) in operationList" :url="item.url" :key="index">
  17. <image :src="item.image"></image>
  18. <text>{{ item.name }}</text>
  19. </navigator>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import { _API_OrderChart } from '@/apis/order.js'
  26. import chartLine from '@/components/charts/chart-line.vue'
  27. export default {
  28. components: {
  29. chartLine
  30. },
  31. data() {
  32. return {
  33. title: '订单管理',
  34. chartData: {},
  35. active: 15,
  36. operationList: [
  37. {
  38. name: '订货下单',
  39. url: '../../pages/place-order/place-order',
  40. image: '../../static/index/index/place-order.png'
  41. },
  42. {
  43. name: '我的订单',
  44. url: '../../pages/my-order/my-order',
  45. image: '../../static/index/index/my-order.png'
  46. },
  47. {
  48. name: '下级订单',
  49. url: '../../pages/down-order/down-order',
  50. image: '../../static/index/index/down-order.png'
  51. },
  52. {
  53. name: '我的库存',
  54. url: '../../pages/my-storage/my-storage',
  55. image: '../../static/index/index/my-stock.png'
  56. }
  57. ]
  58. }
  59. },
  60. created() {
  61. uni.startPullDownRefresh()
  62. },
  63. onPullDownRefresh() {
  64. this.request()
  65. },
  66. methods: {
  67. switchChart(active) {
  68. this.active = active
  69. this.request()
  70. },
  71. request() { // 网络请求方法
  72. this.$refs.ltm.loading()
  73. uni.startPullDownRefresh()
  74. _API_OrderChart({ day: this.active }).then(res => {
  75. const data = { categories: [], series: [{ data: [] }] }
  76. data.categories = res.data.date
  77. data.series[0].data = res.data.data
  78. this.chartData = data
  79. }).catch(() => {
  80. this.$refs.ltm.toast('网络崩溃了,请下拉刷试试')
  81. }).finally(() => uni.stopPullDownRefresh())
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss">
  87. .manage-order{
  88. @include page();
  89. .content {
  90. background: #FFFFFF;
  91. .chart {
  92. @include flex(column);
  93. height: 720rpx;
  94. background: #E4F4FA;
  95. .switch {
  96. @include flex();
  97. width: 100%;
  98. height: 110rpx;
  99. text {
  100. @include flex();
  101. height: 46rpx;
  102. width: 100rpx;
  103. font-size: 28rpx;
  104. border-radius: 23rpx;
  105. color: $app-base-color;
  106. border: 2rpx solid $app-base-color;
  107. &.active {
  108. color: #FFFFFF;
  109. background: $app-base-color;
  110. }
  111. }
  112. text:nth-child(2) {
  113. margin: 0 55rpx;
  114. }
  115. }
  116. .chart-line {
  117. flex: 1;
  118. width: 100%;
  119. box-sizing: border-box;
  120. padding: 0 10rpx;
  121. }
  122. }
  123. }
  124. }
  125. </style>