home.vue 9.8 KB

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