x-statistics.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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: 0,
  37. id: 'detailsil',
  38. title: '全部',
  39. icon: 'icon-cheliangxinxi',
  40. color: '#4bc7fc',
  41. value: null,
  42. }, {
  43. sign: 3,
  44. id: 'truck',
  45. title: '未入库',
  46. icon: 'icon-chukudan',
  47. color: '#fece56',
  48. value: null,
  49. }, {
  50. sign: 5,
  51. id: 'signfor',
  52. title: '已入库',
  53. icon: 'icon-fankudengji',
  54. color: '#9ddd54',
  55. value: null,
  56. }, {
  57. sign: 7,
  58. id: 'add',
  59. title: '已出库',
  60. icon: 'icon-yidaoda',
  61. color: '#1cc723',
  62. value: null,
  63. }],
  64. list2: [{
  65. sign: 2,
  66. id: 'truck',
  67. title: '未装车',
  68. icon: 'icon-xiehuofei',
  69. color: '#fece56',
  70. value: null,
  71. }, {
  72. sign: 4,
  73. id: 'signfor',
  74. title: '已装车',
  75. icon: 'icon-yizhuangche',
  76. color: '#9ddd54',
  77. value: null,
  78. }, {
  79. sign: 6,
  80. id: 'detailsil',
  81. title: '已下车',
  82. icon: 'icon-xiehuo',
  83. color: '#4bc7fc',
  84. value: null,
  85. }, {
  86. sign: 8,
  87. id: 'add',
  88. title: '已签收',
  89. icon: 'icon-qianshou_fill',
  90. color: '#1cc723',
  91. value: null,
  92. }],
  93. list3: [{
  94. sign: [0],
  95. id: 'detailsil',
  96. title: '全部',
  97. icon: 'icon-cheliangxinxi',
  98. color: '#4bc7fc',
  99. value: null,
  100. }, {
  101. sign: [1, 2, 3],
  102. id: 'truck',
  103. title: '未发货',
  104. icon: 'icon-weifahuo',
  105. color: '#fece56',
  106. value: null,
  107. }, {
  108. sign: [4, 5, 6, 7],
  109. id: 'signfor',
  110. title: '已发货',
  111. icon: 'icon-yifahuo',
  112. color: '#9ddd54',
  113. value: null,
  114. }, {
  115. sign: [8],
  116. id: 'add',
  117. title: '已签收',
  118. icon: 'icon-qianshou_fill',
  119. color: '#1cc723',
  120. value: null,
  121. }],
  122. token: '',
  123. }
  124. },
  125. created() {
  126. if (this.userType == 1) {
  127. this.list = this.list1
  128. } else if (this.userType == 2) {
  129. this.list = this.list2
  130. } else if (this.userType == 3) {
  131. this.list = this.list3
  132. }
  133. for (let key in this.orderStatistics) {
  134. this.list.forEach((item, index) => {
  135. if (this.userType == 3) {
  136. if (item.sign.indexOf(Number(key)) == -1) {
  137. // console.log(key, 13)
  138. } else {
  139. item.value += this.orderStatistics[key]
  140. }
  141. } else {
  142. if (key == item.sign) {
  143. item.value = this.orderStatistics[key]
  144. }
  145. }
  146. })
  147. }
  148. },
  149. mounted() {
  150. var token = this.$cache.getToken()
  151. this.token = token
  152. },
  153. methods: {
  154. // 订单页面
  155. goOrder(index) {
  156. let num = index
  157. // console.log(this.userType,123)
  158. if (this.userType == 2) {
  159. num = num + 1
  160. }
  161. if (this.token) {
  162. uni.navigateTo({
  163. url: '/pages/order/index?current=' + num
  164. });
  165. } else {
  166. uni.$u.toast('请先登录')
  167. }
  168. },
  169. }
  170. }
  171. </script>
  172. <style lang="scss">
  173. .home_card {
  174. display: flex;
  175. flex-direction: row;
  176. flex-wrap: wrap;
  177. justify-content: space-evenly;
  178. }
  179. .home_head {
  180. margin-top: 30rpx;
  181. display: flex;
  182. align-items: center;
  183. }
  184. .home_line {
  185. width: 8rpx;
  186. height: 40rpx;
  187. border-top-right-radius: 4rpx;
  188. border-bottom-right-radius: 4rpx;
  189. }
  190. .home_item_title {
  191. margin-left: 20rpx;
  192. font-size: 50rpx;
  193. font-weight: 600;
  194. }
  195. .item_subheading {
  196. margin-left: 20rpx;
  197. font-size: 30rpx;
  198. color: #909399;
  199. }
  200. .card_item_home {
  201. margin-top: 20rpx;
  202. width: calc(50% - 40rpx);
  203. background-color: #fff;
  204. border-radius: 20rpx;
  205. }
  206. .home_bottom_item {
  207. margin: 30rpx;
  208. display: flex;
  209. justify-content: space-between;
  210. align-items: baseline;
  211. }
  212. .home_right_icon {
  213. width: 44rpx;
  214. height: 44rpx;
  215. background-color: #e7e6e4;
  216. border-radius: 50%;
  217. }
  218. .home_icon_image {
  219. font-size: 70rpx;
  220. }
  221. </style>