manage-order.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view class="manage-order">
  3. <custom-nav noback="noback" transparent="transparent" ref="ltm" 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. mounted() {
  61. // uni.startPullDownRefresh()
  62. uni.navigateBack()
  63. setTimeout(() => uni.$emit('noopening'))
  64. return
  65. this.request()
  66. },
  67. onPullDownRefresh() {
  68. this.request()
  69. },
  70. methods: {
  71. switchChart(active) {
  72. this.active = active
  73. this.request()
  74. },
  75. request() { // 网络请求方法
  76. uni.showLoading({ mask: true })
  77. // uni.startPullDownRefresh()
  78. _API_OrderChart({ day: this.active }).then(res => {
  79. const data = { categories: [], series: [{ data: [] }] }
  80. data.categories = res.data.date
  81. data.series[0].data = res.data.data
  82. this.chartData = data
  83. })
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss">
  89. .manage-order{
  90. @include page();
  91. .content {
  92. background: #FFFFFF;
  93. .chart {
  94. @include flex(column);
  95. height: 720rpx;
  96. background: #E4F4FA;
  97. .switch {
  98. @include flex();
  99. width: 100%;
  100. height: 110rpx;
  101. text {
  102. @include flex();
  103. height: 46rpx;
  104. width: 100rpx;
  105. font-size: 28rpx;
  106. border-radius: 23rpx;
  107. color: $app-base-color;
  108. border: 2rpx solid $app-base-color;
  109. &.active {
  110. color: #FFFFFF;
  111. background: $app-base-color;
  112. }
  113. }
  114. text:nth-child(2) {
  115. margin: 0 55rpx;
  116. }
  117. }
  118. .chart-line {
  119. flex: 1;
  120. width: 100%;
  121. box-sizing: border-box;
  122. padding: 0 10rpx;
  123. }
  124. }
  125. }
  126. }
  127. </style>