home.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <template>
  2. <div class="tabPage" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='仓储管理' :showback='false' bgColor='transparent'></cus-header>
  4. <image class="topbg" :src="imgBase+'storage/home_bg.png'" mode="widthFix"></image>
  5. <div class="inout" :style="{'backgroundImage':'url('+imgBase+'/storage/home_bgimg1.png)'}">
  6. <div class="pre">
  7. <text>入库总量</text>
  8. <p>{{priceFormat(inNum,0)}}</p>
  9. </div>
  10. <div class="line"></div>
  11. <div class="pre">
  12. <text>出库总量</text>
  13. <p>{{outNum}}</p>
  14. </div>
  15. </div>
  16. <div class="menus">
  17. <div class="item" v-for="(item,index) in menuList" :key="index">
  18. <image :src="item.icon" :class="index<4?'img1':'img2'"></image>
  19. <p :class="index<4?'p1':'p2'">{{item.title}}</p>
  20. </div>
  21. </div>
  22. <div class="chartBox">
  23. <p class="title">库存数量占比</p>
  24. <div class="chart">
  25. <l-echart ref="kcslzbChartRef" @finished="initKcslzb"></l-echart>
  26. </div>
  27. </div>
  28. <div class="chartBox">
  29. <p class="title">入库统计</p>
  30. <div class="chart">
  31. <div class="btns">
  32. <div class="pre" :class="{'active':rkIdx===0}" @tap="changeRkCahrtData(0)">按月</div>
  33. <div class="pre" :class="{'active':rkIdx===1}" @tap="changeRkCahrtData(1)">按年</div>
  34. </div>
  35. <l-echart ref="rktjChartRef" @finished="initRktj"></l-echart>
  36. </div>
  37. </div>
  38. <div class="chartBox">
  39. <p class="title">出库统计</p>
  40. <div class="chart">
  41. <div class="btns">
  42. <div class="pre" :class="{'active':ckIdx===0}" @tap="changeCkCahrtData(0)">按月</div>
  43. <div class="pre" :class="{'active':ckIdx===1}" @tap="changeCkCahrtData(1)">按年</div>
  44. </div>
  45. <l-echart ref="cktjChartRef" @finished="initCktj"></l-echart>
  46. </div>
  47. </div>
  48. </div>
  49. </template>
  50. <script>
  51. import * as echarts from '@/pagesStorage/components/lime-echart/static/echarts.min.js'
  52. import lEchart from '@/pagesStorage/components/lime-echart/components/l-echart/l-echart.vue'
  53. export default {
  54. components:{lEchart},
  55. data(){
  56. return {
  57. inNum:'9879',
  58. outNum:'880',
  59. menuList:[
  60. {
  61. icon:this.$imgBase+'storage/home_icon_rk.png',
  62. title:'入库',
  63. path:''
  64. },
  65. {
  66. icon:this.$imgBase+'storage/home_icon_ck.png',
  67. title:'出库',
  68. path:''
  69. },
  70. {
  71. icon:this.$imgBase+'storage/home_icon_pk.png',
  72. title:'盘库',
  73. path:''
  74. },
  75. {
  76. icon:this.$imgBase+'storage/home_icon_yk.png',
  77. title:'移库',
  78. path:''
  79. },
  80. {
  81. icon:this.$imgBase+'storage/home_icon_kcjl.png',
  82. title:'库存记录',
  83. path:''
  84. },
  85. {
  86. icon:this.$imgBase+'storage/home_icon_kctj.png',
  87. title:'库存统计',
  88. path:''
  89. },
  90. {
  91. icon:this.$imgBase+'storage/home_icon_wldw.png',
  92. title:'往来单位',
  93. path:''
  94. },
  95. {
  96. icon:this.$imgBase+'storage/home_icon_ckgl.png',
  97. title:'仓库管理',
  98. path:''
  99. }
  100. ],
  101. rkIdx:0,
  102. ckIdx:0,
  103. }
  104. },
  105. methods:{
  106. // 库存数量占比
  107. async initKcslzb() {
  108. const chart = await this.$refs.kcslzbChartRef.init(echarts);
  109. let option = {
  110. legend: {
  111. top: 'bottom'
  112. },
  113. tooltip: {
  114. trigger: 'item'
  115. },
  116. series: [
  117. {
  118. name: '库存数量占比',
  119. type: 'pie',
  120. radius: [20, 100],
  121. center: ['50%', '42%'],
  122. roseType: 'area',
  123. itemStyle: {
  124. borderRadius: 5
  125. },
  126. data: [
  127. { value: 40, name: '分类1' },
  128. { value: 38, name: '分类2' },
  129. { value: 32, name: '分类3' },
  130. { value: 30, name: '分类4' },
  131. { value: 28, name: '分类5' },
  132. { value: 26, name: '分类6' },
  133. { value: 22, name: '分类7' }
  134. ]
  135. }
  136. ]
  137. };
  138. chart.setOption(option)
  139. },
  140. //入库统计
  141. async initRktj(){
  142. const chart = await this.$refs.rktjChartRef.init(echarts);
  143. let option = {
  144. title: {
  145. text: '数量',
  146. textStyle:{
  147. fontSize:16,
  148. color:'#86909C'
  149. }
  150. },
  151. xAxis: {
  152. type: 'category',
  153. data: ['12-20', '12-21', '12-22', '12-23', '12-24', '12-25', '12-26']
  154. },
  155. yAxis: {
  156. type: 'value'
  157. },
  158. tooltip: {
  159. trigger: 'axis',
  160. axisPointer: {
  161. type: 'cross',
  162. label: {
  163. backgroundColor: '#6a7985'
  164. }
  165. }
  166. },
  167. grid: {
  168. left: '1%',
  169. right: '1%',
  170. bottom: '10%',
  171. top: '18%',
  172. containLabel: true
  173. },
  174. series: [
  175. {
  176. name:'入库数量',
  177. data: [0, 479, 389, 726, 111, 1000, 0],
  178. type: 'line',
  179. lineStyle:{
  180. color:'#198CFF',
  181. width: 3
  182. },
  183. symbol:'none',
  184. areaStyle: {
  185. color:'rgba(25,140,255,.4)'
  186. },
  187. smooth: true
  188. }
  189. ]
  190. };
  191. chart.setOption(option);
  192. },
  193. changeRkCahrtData(type){
  194. this.rkIdx = type;
  195. },
  196. //出库统计
  197. async initCktj(){
  198. const chart = await this.$refs.cktjChartRef.init(echarts);
  199. let option = {
  200. title: {
  201. text: '数量',
  202. textStyle:{
  203. fontSize:16,
  204. color:'#86909C'
  205. }
  206. },
  207. xAxis: {
  208. type: 'category',
  209. data: ['12-20', '12-21', '12-22', '12-23', '12-24', '12-25', '12-26']
  210. },
  211. yAxis: {
  212. type: 'value'
  213. },
  214. tooltip: {
  215. trigger: 'axis',
  216. axisPointer: {
  217. type: 'cross',
  218. label: {
  219. backgroundColor: '#6a7985'
  220. }
  221. }
  222. },
  223. grid: {
  224. left: '1%',
  225. right: '1%',
  226. bottom: '10%',
  227. top: '18%',
  228. containLabel: true
  229. },
  230. series: [
  231. {
  232. name:'出库数量',
  233. data: [0, 479, 389, 726, 111, 1000, 0],
  234. type: 'line',
  235. lineStyle:{
  236. color:'#198CFF',
  237. width: 3
  238. },
  239. symbol:'none',
  240. areaStyle: {
  241. color:'rgba(25,140,255,.4)'
  242. },
  243. smooth: true
  244. }
  245. ]
  246. };
  247. chart.setOption(option);
  248. },
  249. changeCkCahrtData(type){
  250. this.ckIdx = type;
  251. },
  252. // 金额格式化
  253. priceFormat(number, decimals = 0, decimalPoint = '.', thousandsSeparator = ',') {
  254. number = (`${number}`).replace(/[^0-9+-Ee.]/g, '')
  255. const n = !isFinite(+number) ? 0 : +number
  256. const prec = !isFinite(+decimals) ? 0 : Math.abs(decimals)
  257. const sep = (typeof thousandsSeparator === 'undefined') ? ',' : thousandsSeparator
  258. const dec = (typeof decimalPoint === 'undefined') ? '.' : decimalPoint
  259. let s = ''
  260. s = (prec ? round(n, prec) + '' : `${Math.round(n)}`).split('.')
  261. const re = /(-?\d+)(\d{3})/
  262. while (re.test(s[0])) {
  263. s[0] = s[0].replace(re, `$1${sep}$2`)
  264. }
  265. if ((s[1] || '').length < prec) {
  266. s[1] = s[1] || ''
  267. s[1] += new Array(prec - s[1].length + 1).join('0')
  268. }
  269. return s.join(dec)
  270. },
  271. }
  272. }
  273. </script>
  274. <style scoped lang="less">
  275. .tabPage{
  276. padding: 0 24rpx 194rpx;
  277. background: #F4F8FB;
  278. .topbg{
  279. width: 100%;
  280. position: fixed;
  281. top: 0;
  282. left: 0;
  283. z-index: 0;
  284. }
  285. .inout{
  286. width: 100%;
  287. height: 180rpx;
  288. margin-top: 20rpx;
  289. border-radius: 16rpx;
  290. background-repeat: no-repeat;
  291. background-size: 100% 100%;
  292. position: relative;
  293. display: flex;
  294. align-items: center;
  295. box-sizing: border-box;
  296. .line{
  297. width: 1rpx;
  298. height: 98rpx;
  299. background: rgba(255,255,255,.35);
  300. position: absolute;
  301. left: 50%;
  302. margin-left: -0.5rpx;
  303. top: 50%;
  304. margin-top: -49rpx;
  305. }
  306. .pre{
  307. width: 50%;
  308. padding-left: 30rpx;
  309. text{
  310. font-family: PingFangSC, PingFang SC;
  311. font-weight: 400;
  312. font-size: 28rpx;
  313. color: #FFFFFF;
  314. line-height: 28rpx;
  315. }
  316. p{
  317. font-family: D-DIN, D-DIN;
  318. font-weight: bold;
  319. font-size: 48rpx;
  320. color: #FFFFFF;
  321. line-height: 48rpx;
  322. margin-top: 20rpx;
  323. }
  324. }
  325. }
  326. .menus{
  327. width: 100%;
  328. background: #FFFFFF;
  329. border-radius: 16rpx;
  330. padding: 3rpx 0 33rpx;
  331. box-sizing: border-box;
  332. display: flex;
  333. flex-wrap: wrap;
  334. position: relative;
  335. margin-top: 20rpx;
  336. .item{
  337. width: 25%;
  338. display: flex;
  339. flex-direction: column;
  340. align-items: center;
  341. margin-top: 37rpx;
  342. .img1{
  343. width: 80rpx;
  344. height: 80rpx;
  345. }
  346. .img2{
  347. width: 55rpx;
  348. height: 55rpx;
  349. }
  350. p{
  351. font-family: PingFangSC, PingFang SC;
  352. font-weight: 400;
  353. font-size: 24rpx;
  354. color: #4E5969;
  355. line-height: 33rpx;
  356. text-align: center;
  357. }
  358. .p1{
  359. margin-top: 20rpx;
  360. }
  361. .p2{
  362. margin-top: 14rpx;
  363. }
  364. }
  365. }
  366. .chartBox{
  367. width: 100%;
  368. background: #FFFFFF;
  369. border-radius: 16rpx;
  370. margin-top: 20rpx;
  371. padding: 40rpx 24rpx;
  372. box-sizing: border-box;
  373. position: relative;
  374. .title{
  375. font-family: PingFang-SC, PingFang-SC;
  376. font-weight: bold;
  377. font-size: 36rpx;
  378. color: #1D2129;
  379. line-height: 36rpx;
  380. letter-spacing: 2rpx;
  381. }
  382. .chart{
  383. width: 100%;
  384. position: relative;
  385. .btns{
  386. border: 1rpx solid #ECECEC;
  387. border-radius: 6rpx;
  388. display: flex;
  389. position: absolute;
  390. right: 12rpx;
  391. top: 32rpx;
  392. z-index: 999;
  393. .pre{
  394. padding: 12rpx 16rpx;
  395. font-family: PingFangSC, PingFang SC;
  396. font-weight: 400;
  397. font-size: 24rpx;
  398. color: #86909C;
  399. line-height: 24rpx;
  400. position: relative;
  401. &.active{
  402. color: #198CFF;
  403. }
  404. &:last-child{
  405. border-left: 1rpx solid #ECECEC;
  406. }
  407. }
  408. }
  409. }
  410. }
  411. }
  412. </style>