x-statistics.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <!-- 首页统计 -->
  3. <view class="home_card_statist">
  4. <u-scroll-list :indicator="list.length > 5 ? true : false" style="width: 100%;">
  5. <view :class="list.length > 5 ? 'card_two_lines' : 'card_left_lines'">
  6. <view class="card_item_home"
  7. :style="{width:(list.length > 5? '300rpx' : 'calc(50% - 40rpx)'),margin:(list.length > 5? '0rpx 0rpx 20rpx 20rpx' : '20rpx 20rpx 0rpx 20rpx')}"
  8. v-for="(item,index) in list" :key="index" @click="goOrder(index)">
  9. <view class="home_head">
  10. <view class="home_line" :style="{backgroundColor:item.color,}"></view>
  11. <view class="home_item_title">{{item.value || 0}}</view>
  12. </view>
  13. <view class="item_subheading">{{item.title}}</view>
  14. <view class="home_bottom_item">
  15. <view class="home_right_icon center_in">
  16. <u-icon name="arrow-right" size="15" color="#fff"></u-icon>
  17. </view>
  18. <span :style="{color: item.color}" class="iconfont home_icon_image" :class="item.icon"></span>
  19. </view>
  20. </view>
  21. <view style="width: 20rpx;height: 100%;" v-if="list.length > 5"></view>
  22. </view>
  23. </u-scroll-list>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. name: 'XStatistics',
  29. props: {
  30. userType: {
  31. type: Number,
  32. default: 1,
  33. },
  34. orderStatistics: {
  35. type: Object,
  36. default: {},
  37. },
  38. },
  39. data() {
  40. return {
  41. list: [],
  42. list1: [{
  43. sign: 0,
  44. id: 'detailsil',
  45. title: '全部',
  46. icon: 'icon-cheliangxinxi',
  47. color: '#4bc7fc',
  48. value: null,
  49. }, {
  50. sign: 9,
  51. id: 'truck',
  52. title: '待装箱',
  53. icon: 'icon-bepacked',
  54. color: '#fece56',
  55. value: null,
  56. }, {
  57. sign: 10,
  58. id: 'signfor',
  59. title: '已装箱',
  60. icon: 'icon-boxed',
  61. color: '#9ddd54',
  62. value: null,
  63. }, {
  64. sign: 3,
  65. id: 'truck',
  66. title: '未入库',
  67. icon: 'icon-chukudan',
  68. color: '#fece56',
  69. value: null,
  70. }, {
  71. sign: 5,
  72. id: 'signfor',
  73. title: '已入库',
  74. icon: 'icon-fankudengji',
  75. color: '#9ddd54',
  76. value: null,
  77. }, {
  78. sign: 7,
  79. id: 'add',
  80. title: '已出库',
  81. icon: 'icon-yidaoda',
  82. color: '#1cc723',
  83. value: null,
  84. }],
  85. list2: [{
  86. sign: 9,
  87. id: 'truck',
  88. title: '待装箱',
  89. icon: 'icon-bepacked',
  90. color: '#fece56',
  91. value: null,
  92. }, {
  93. sign: 10,
  94. id: 'signfor',
  95. title: '已装箱',
  96. icon: 'icon-boxed',
  97. color: '#9ddd54',
  98. value: null,
  99. }, {
  100. sign: 2,
  101. id: 'truck',
  102. title: '未装车',
  103. icon: 'icon-xiehuofei',
  104. color: '#fece56',
  105. value: null,
  106. }, {
  107. sign: 4,
  108. id: 'signfor',
  109. title: '已装车',
  110. icon: 'icon-yizhuangche',
  111. color: '#9ddd54',
  112. value: null,
  113. }, {
  114. sign: 6,
  115. id: 'detailsil',
  116. title: '已下车',
  117. icon: 'icon-xiehuo',
  118. color: '#4bc7fc',
  119. value: null,
  120. }, {
  121. sign: 8,
  122. id: 'add',
  123. title: '已签收',
  124. icon: 'icon-qianshou_fill',
  125. color: '#1cc723',
  126. value: null,
  127. }],
  128. list3: [{
  129. sign: [0],
  130. id: 'detailsil',
  131. title: '全部',
  132. icon: 'icon-cheliangxinxi',
  133. color: '#4bc7fc',
  134. value: null,
  135. }, {
  136. sign: [1, 2, 3],
  137. id: 'truck',
  138. title: '未发货',
  139. icon: 'icon-weifahuo',
  140. color: '#fece56',
  141. value: null,
  142. }, {
  143. sign: [4, 5, 6, 7],
  144. id: 'signfor',
  145. title: '已发货',
  146. icon: 'icon-yifahuo',
  147. color: '#9ddd54',
  148. value: null,
  149. }, {
  150. sign: [8],
  151. id: 'add',
  152. title: '已签收',
  153. icon: 'icon-qianshou_fill',
  154. color: '#1cc723',
  155. value: null,
  156. }],
  157. token: '',
  158. }
  159. },
  160. created() {
  161. if (this.userType == 1) {
  162. this.list = this.list1
  163. } else if (this.userType == 2) {
  164. this.list = this.list2
  165. } else if (this.userType == 3) {
  166. this.list = this.list3
  167. }
  168. for (let key in this.orderStatistics) {
  169. this.list.forEach((item, index) => {
  170. if (this.userType == 3) {
  171. if (item.sign.indexOf(Number(key)) == -1) {
  172. // console.log(key, 13)
  173. } else {
  174. item.value += this.orderStatistics[key]
  175. }
  176. } else {
  177. if (key == item.sign) {
  178. item.value = this.orderStatistics[key]
  179. }
  180. }
  181. })
  182. }
  183. },
  184. mounted() {
  185. var token = this.$cache.getToken()
  186. this.token = token
  187. },
  188. methods: {
  189. // 订单页面
  190. goOrder(index) {
  191. let num = index
  192. // console.log(this.userType,123)
  193. if (this.userType == 2) {
  194. num = num + 1
  195. }
  196. if (this.token) {
  197. uni.navigateTo({
  198. url: '/pages/order/index?current=' + num
  199. });
  200. } else {
  201. uni.$u.toast('请先登录')
  202. }
  203. },
  204. }
  205. }
  206. </script>
  207. <style lang="scss">
  208. .home_card_statist {
  209. display: flex;
  210. flex-direction: row;
  211. flex-wrap: wrap;
  212. justify-content: space-evenly;
  213. }
  214. .home_head {
  215. margin-top: 30rpx;
  216. display: flex;
  217. align-items: center;
  218. }
  219. .home_line {
  220. width: 8rpx;
  221. height: 40rpx;
  222. border-top-right-radius: 4rpx;
  223. border-bottom-right-radius: 4rpx;
  224. }
  225. .home_item_title {
  226. margin-left: 20rpx;
  227. font-size: 50rpx;
  228. font-weight: 600;
  229. }
  230. .item_subheading {
  231. margin-left: 20rpx;
  232. font-size: 30rpx;
  233. color: #909399;
  234. }
  235. .card_two_lines {
  236. display: flex;
  237. flex-flow: column wrap;
  238. height: 580rpx;
  239. list-style-type: none;
  240. margin-top: 20rpx;
  241. }
  242. .card_left_lines {
  243. display: flex;
  244. height: 580rpx;
  245. width: 100%;
  246. flex-direction: row;
  247. flex-wrap: wrap;
  248. justify-content: space-evenly;
  249. }
  250. .card_item_home {
  251. flex: none;
  252. // margin: 0rpx 20rpx 20rpx 20rpx;
  253. // width: calc(50% - 40rpx);
  254. // width: 300rpx;
  255. background-color: #fff;
  256. border-radius: 20rpx;
  257. }
  258. .home_bottom_item {
  259. margin: 30rpx;
  260. display: flex;
  261. justify-content: space-between;
  262. align-items: baseline;
  263. }
  264. .home_right_icon {
  265. width: 44rpx;
  266. height: 44rpx;
  267. background-color: #e7e6e4;
  268. border-radius: 50%;
  269. }
  270. .home_icon_image {
  271. font-size: 70rpx;
  272. }
  273. </style>