home.vue 10.0 KB

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