x-statistics.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <!-- 首页统计 -->
  3. <view class="home_card">
  4. <view class="card_item_home" v-for="(item,index) in list" :key="index" @click="goOrder(index)">
  5. <view class="home_head">
  6. <view class="home_line" :style="{backgroundColor:item.color,}"></view>
  7. <view class="home_item_title">{{item.value || 0}}</view>
  8. </view>
  9. <view class="item_subheading">{{item.title}}</view>
  10. <view class="home_bottom_item">
  11. <view class="home_right_icon center_in">
  12. <u-icon name="arrow-right" size="15" color="#fff"></u-icon>
  13. </view>
  14. <span :style="{color: item.color}" class="iconfont home_icon_image" :class="item.icon"></span>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. name: 'XStatistics',
  22. props: {
  23. userType: {
  24. type: Number,
  25. default: 1,
  26. },
  27. orderStatistics: {
  28. type: Object,
  29. default: {},
  30. },
  31. },
  32. data() {
  33. return {
  34. list: [],
  35. list1: [{
  36. sign: 'waitDeliveryNum',
  37. id: 'detailsil',
  38. title: '待配送',
  39. icon: 'icon-cancel',
  40. color: '#9ddd54',
  41. value: null,
  42. }, {
  43. sign: 'inDeliveryNum',
  44. id: 'truck',
  45. title: '配送中',
  46. icon: 'icon-delivery',
  47. color: '#4bc7fc',
  48. value: null,
  49. }, {
  50. sign: 'receiptNum',
  51. id: 'signfor',
  52. title: '已送达',
  53. icon: 'icon-yisongda',
  54. color: '#1cc723',
  55. value: null,
  56. }, {
  57. sign: 'rejectionNum',
  58. id: 'add',
  59. title: '已拒收',
  60. icon: 'icon-yiquxiao',
  61. color: '#fe880e',
  62. value: null,
  63. }],
  64. token: '',
  65. }
  66. },
  67. created() {
  68. this.list = this.list1
  69. var token = this.$cache.getToken()
  70. for (let key in this.orderStatistics) {
  71. this.list.forEach((item, index) => {
  72. if (key == item.sign) {
  73. if (token) {
  74. item.value = this.orderStatistics[key]
  75. } else {
  76. item.value = 0
  77. }
  78. }
  79. })
  80. }
  81. },
  82. mounted() {
  83. var token = this.$cache.getToken()
  84. this.token = token
  85. },
  86. methods: {
  87. // 运单页面
  88. goOrder(index) {
  89. let num = index
  90. num = num + 1
  91. if (this.token) {
  92. uni.navigateTo({
  93. url: '/pages/order/index?current=' + num
  94. });
  95. } else {
  96. uni.$u.toast('请先登录')
  97. }
  98. },
  99. }
  100. }
  101. </script>
  102. <style lang="scss">
  103. .home_card {
  104. display: flex;
  105. flex-direction: row;
  106. flex-wrap: wrap;
  107. justify-content: space-evenly;
  108. }
  109. .home_head {
  110. margin-top: 30rpx;
  111. display: flex;
  112. align-items: center;
  113. }
  114. .home_line {
  115. width: 8rpx;
  116. height: 40rpx;
  117. border-top-right-radius: 4rpx;
  118. border-bottom-right-radius: 4rpx;
  119. }
  120. .home_item_title {
  121. margin-left: 20rpx;
  122. font-size: 50rpx;
  123. font-weight: 600;
  124. }
  125. .item_subheading {
  126. margin-left: 20rpx;
  127. font-size: 30rpx;
  128. color: #909399;
  129. }
  130. .card_item_home {
  131. margin-top: 20rpx;
  132. width: calc(50% - 40rpx);
  133. background-color: #fff;
  134. border-radius: 20rpx;
  135. }
  136. .home_bottom_item {
  137. margin: 30rpx;
  138. display: flex;
  139. justify-content: space-between;
  140. align-items: baseline;
  141. }
  142. .home_right_icon {
  143. width: 44rpx;
  144. height: 44rpx;
  145. background-color: #e7e6e4;
  146. border-radius: 50%;
  147. }
  148. .home_icon_image {
  149. font-size: 70rpx;
  150. }
  151. </style>