x-statistics.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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: 0,
  66. id: 'detailsil',
  67. title: '全部',
  68. icon: 'icon-cheliangxinxi',
  69. color: '#4bc7fc',
  70. value: null,
  71. }, {
  72. sign: 2,
  73. id: 'truck',
  74. title: '未装车',
  75. icon: 'icon-fankudengji',
  76. color: '#fece56',
  77. value: null,
  78. }, {
  79. sign: 4,
  80. id: 'signfor',
  81. title: '已装车',
  82. icon: 'icon-yidaoda',
  83. color: '#9ddd54',
  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,
  102. id: 'truck',
  103. title: '未发货',
  104. icon: 'icon-weifahuo',
  105. color: '#fece56',
  106. value: null,
  107. }, {
  108. sign: 2,
  109. id: 'signfor',
  110. title: '已发货',
  111. icon: 'icon-yifahuo',
  112. color: '#9ddd54',
  113. value: null,
  114. }, {
  115. sign: 3,
  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 (key == item.sign) {
  136. item.value = this.orderStatistics[key]
  137. }
  138. })
  139. }
  140. },
  141. mounted() {
  142. var token = this.$cache.getToken()
  143. this.token = token
  144. },
  145. methods: {
  146. // 订单页面
  147. goOrder(index) {
  148. if (this.token) {
  149. uni.navigateTo({
  150. url: '/pages/order/index?current=' + index
  151. });
  152. } else {
  153. uni.$u.toast('请先登录')
  154. }
  155. },
  156. }
  157. }
  158. </script>
  159. <style lang="scss">
  160. .home_card {
  161. display: flex;
  162. flex-direction: row;
  163. flex-wrap: wrap;
  164. justify-content: space-evenly;
  165. }
  166. .home_head {
  167. margin-top: 30rpx;
  168. display: flex;
  169. align-items: center;
  170. }
  171. .home_line {
  172. width: 8rpx;
  173. height: 40rpx;
  174. border-top-right-radius: 4rpx;
  175. border-bottom-right-radius: 4rpx;
  176. }
  177. .home_item_title {
  178. margin-left: 20rpx;
  179. font-size: 50rpx;
  180. font-weight: 600;
  181. }
  182. .item_subheading {
  183. margin-left: 20rpx;
  184. font-size: 30rpx;
  185. color: #909399;
  186. }
  187. .card_item_home {
  188. margin-top: 20rpx;
  189. width: calc(50% - 40rpx);
  190. background-color: #fff;
  191. border-radius: 20rpx;
  192. }
  193. .home_bottom_item {
  194. margin: 30rpx;
  195. display: flex;
  196. justify-content: space-between;
  197. align-items: baseline;
  198. }
  199. .home_right_icon {
  200. width: 44rpx;
  201. height: 44rpx;
  202. background-color: #e7e6e4;
  203. border-radius: 50%;
  204. }
  205. .home_icon_image {
  206. font-size: 70rpx;
  207. }
  208. </style>