x-statistics.vue 6.5 KB

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