123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478 |
- <template>
- <div class="tabPage" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
- <cus-header title='仓储管理' :showback='false' bgColor='transparent'></cus-header>
- <image class="topbg" :src="imgBase+'storage/home_bg.png'" mode="widthFix"></image>
- <div class="inout" :style="{'backgroundImage':'url('+imgBase+'/storage/home_bgimg1.png)'}">
- <div class="pre">
- <text>入库总量</text>
- <p>{{priceFormat(inNum,0)}}</p>
- </div>
- <div class="line"></div>
- <div class="pre">
- <text>出库总量</text>
- <p>{{outNum}}</p>
- </div>
- </div>
- <div class="menus">
- <div class="item" v-for="(item,index) in menuList" :key="index" @tap="toTurn(item.path)">
- <image :src="item.icon" :class="index<4?'img1':'img2'"></image>
- <p :class="index<4?'p1':'p2'">{{item.title}}</p>
- </div>
- </div>
- <div class="chartBox">
- <p class="title">库存数量占比</p>
- <div class="chart">
- <l-echart ref="kcslzbChartRef" :canvas2d="true" @finished="initKcslzb"></l-echart>
- </div>
- </div>
- <div class="chartBox">
- <p class="title">入库统计</p>
- <div class="chart">
- <div class="btns">
- <div class="pre" :class="{'active':rkIdx===0}" @tap="changeRkCahrtData(0)">按月</div>
- <div class="pre" :class="{'active':rkIdx===1}" @tap="changeRkCahrtData(1)">按年</div>
- </div>
- <l-echart ref="rktjChartRef" :canvas2d="true" @finished="initRktj"></l-echart>
- </div>
- </div>
- <div class="chartBox">
- <p class="title">出库统计</p>
- <div class="chart">
- <div class="btns">
- <div class="pre" :class="{'active':ckIdx===0}" @tap="changeCkCahrtData(0)">按月</div>
- <div class="pre" :class="{'active':ckIdx===1}" @tap="changeCkCahrtData(1)">按年</div>
- </div>
- <l-echart ref="cktjChartRef" :canvas2d="true" @finished="initCktj"></l-echart>
- </div>
- </div>
- <Tabbar :tabbarIndex="2"></Tabbar>
- </div>
- </template>
- <script>
- import * as echarts from '@/pagesStorage/components/lime-echart/static/echarts.min.js'
- import lEchart from '@/pagesStorage/components/lime-echart/components/l-echart/l-echart.vue'
- import Tabbar from '@/components/CusTabbar/index.vue'
- export default {
- components:{
- lEchart,
- Tabbar
- },
- data(){
- return {
- inNum:0,
- outNum:0,
- menuList:[
- {
- icon:this.$imgBase+'storage/home_icon_rk.png',
- title:'入库',
- path:'/pagesStorage/inStorage/index'
- },
- {
- icon:this.$imgBase+'storage/home_icon_ck.png',
- title:'出库',
- path:'/pagesStorage/outStorage/index'
- },
- {
- icon:this.$imgBase+'storage/home_icon_pk.png',
- title:'盘库',
- path:'/pagesStorage/checkStorage/index'
- },
- {
- icon:this.$imgBase+'storage/home_icon_yk.png',
- title:'移库',
- path:'/pagesStorage/moveStorage/index'
- },
- {
- icon:this.$imgBase+'storage/home_icon_kcjl.png',
- title:'库存记录',
- path:'/pagesStorage/storageRecord/index'
- },
- {
- icon:this.$imgBase+'storage/home_icon_kctj.png',
- title:'库存统计',
- path:'/pagesStorage/inventoryStatistics/index'
- },
- {
- icon:this.$imgBase+'storage/home_icon_wldw.png',
- title:'往来单位',
- path:'/pagesStorage/units/index'
- },
- {
- icon:this.$imgBase+'storage/home_icon_ckgl.png',
- title:'仓库管理',
- path:'/pagesStorage/storage/index'
- }
- ],
- rkIdx:0,
- ckIdx:0,
- }
- },
- onLoad() {
- this.getHeaderInfo();
- },
- methods:{
- toTurn(url){
- if(!url) return;
- uni.navigateTo({ url })
- },
- //头部统计信息
- getHeaderInfo(){
- this.$api.post('/wms/home/getAppHomeHeadGather').then(res=>{
- if(res.data.code===0){
- this.inNum = res.data.data.find(d=>d.orderType==1).total||0;
- this.outNum = res.data.data.find(d=>d.orderType==2).total||0;
- }else this.$showToast(res.data.msg)
- })
- },
- // 库存数量占比
- async getKcslzbData(){
- let res = await this.$api.post('/wms/home/getWarehouseCargoRatio');
- if(res.data.code===0){
- let data = res.data.data.map(d=>{
- return {
- value:d.quantity,
- name:d.warehouseName
- }
- })
- return data;
- }else{
- this.$showToast(res.data.msg);
- return [];
- }
- },
- async initKcslzb() {
- let data = await this.getKcslzbData();
- const chart = await this.$refs.kcslzbChartRef.init(echarts);
- let option = {
- legend: {
- top: 'bottom'
- },
- tooltip: {
- trigger: 'item'
- },
- series: [
- {
- name: '库存数量占比',
- type: 'pie',
- radius: [20, 100],
- center: ['50%', '42%'],
- itemStyle: {
- borderRadius: 5
- },
- data
- }
- ]
- };
- chart.setOption(option)
- },
-
- //入库统计
- async getRktjData(){
- let res = await this.$api.get('/wms/home/getReceiptTrend/'+(this.rkIdx+1));
- if(res.data.code===0){
- let xData = res.data.data.map(d=>d.optTime);
- let yData = res.data.data.map(d=>d.quantity);
- return {xData,yData}
- }else{
- this.$showToast(res.data.msg);
- return {xData:[],yData:[]};
- }
- },
- async initRktj(){
- let {xData,yData} = await this.getRktjData();
- const chart = await this.$refs.rktjChartRef.init(echarts);
- let option = {
- title: {
- text: '数量',
- textStyle:{
- fontSize:16,
- color:'#86909C'
- }
- },
- xAxis: {
- type: 'category',
- data: xData
- },
- yAxis: {
- type: 'value'
- },
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'cross',
- label: {
- backgroundColor: '#6a7985'
- }
- }
- },
- grid: {
- left: '1%',
- right: '1%',
- bottom: '10%',
- top: '18%',
- containLabel: true
- },
- series: [
- {
- name:'入库数量',
- data: yData,
- type: 'line',
- lineStyle:{
- color:'#198CFF',
- width: 3
- },
- symbol:'none',
- areaStyle: {
- color:'rgba(25,140,255,.4)'
- },
- smooth: true
- }
- ]
- };
- chart.setOption(option);
- },
- changeRkCahrtData(type){
- this.rkIdx = type;
- this.initRktj();
- },
-
- //出库统计
- async getCktjData(){
- let res = await this.$api.get('/wms/home/getShipmentTrend/'+(this.ckIdx+1));
- if(res.data.code===0){
- let xData = res.data.data.map(d=>d.optTime);
- let yData = res.data.data.map(d=>d.quantity);
- return {xData,yData}
- }else{
- this.$showToast(res.data.msg);
- return {xData:[],yData:[]};
- }
- },
- async initCktj(){
- let {xData,yData} = await this.getCktjData();
- const chart = await this.$refs.cktjChartRef.init(echarts);
- let option = {
- title: {
- text: '数量',
- textStyle:{
- fontSize:16,
- color:'#86909C'
- }
- },
- xAxis: {
- type: 'category',
- data: xData
- },
- yAxis: {
- type: 'value'
- },
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'cross',
- label: {
- backgroundColor: '#6a7985'
- }
- }
- },
- grid: {
- left: '1%',
- right: '1%',
- bottom: '10%',
- top: '18%',
- containLabel: true
- },
- series: [
- {
- name:'出库数量',
- data: yData,
- type: 'line',
- lineStyle:{
- color:'#198CFF',
- width: 3
- },
- symbol:'none',
- areaStyle: {
- color:'rgba(25,140,255,.4)'
- },
- smooth: true
- }
- ]
- };
- chart.setOption(option);
- },
- changeCkCahrtData(type){
- this.ckIdx = type;
- this.initCktj();
- },
-
- // 金额格式化
- priceFormat(number, decimals = 0, decimalPoint = '.', thousandsSeparator = ',') {
- number = (`${number}`).replace(/[^0-9+-Ee.]/g, '')
- const n = !isFinite(+number) ? 0 : +number
- const prec = !isFinite(+decimals) ? 0 : Math.abs(decimals)
- const sep = (typeof thousandsSeparator === 'undefined') ? ',' : thousandsSeparator
- const dec = (typeof decimalPoint === 'undefined') ? '.' : decimalPoint
- let s = ''
-
- s = (prec ? round(n, prec) + '' : `${Math.round(n)}`).split('.')
- const re = /(-?\d+)(\d{3})/
- while (re.test(s[0])) {
- s[0] = s[0].replace(re, `$1${sep}$2`)
- }
-
- if ((s[1] || '').length < prec) {
- s[1] = s[1] || ''
- s[1] += new Array(prec - s[1].length + 1).join('0')
- }
- return s.join(dec)
- },
- }
- }
- </script>
- <style scoped lang="less">
- .tabPage{
- padding: 0 24rpx 188rpx;
- background: #F4F8FB;
-
- .topbg{
- width: 100%;
- position: fixed;
- top: 0;
- left: 0;
- z-index: 0;
- }
-
- .inout{
- width: 100%;
- height: 180rpx;
- margin-top: 20rpx;
- border-radius: 16rpx;
- background-repeat: no-repeat;
- background-size: 100% 100%;
- position: relative;
- display: flex;
- align-items: center;
- box-sizing: border-box;
- .line{
- width: 1rpx;
- height: 98rpx;
- background: rgba(255,255,255,.35);
- position: absolute;
- left: 50%;
- margin-left: -0.5rpx;
- top: 50%;
- margin-top: -49rpx;
- }
- .pre{
- width: 50%;
- padding-left: 30rpx;
- text{
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 28rpx;
- color: #FFFFFF;
- line-height: 28rpx;
- }
- p{
- font-family: D-DIN, D-DIN;
- font-weight: bold;
- font-size: 48rpx;
- color: #FFFFFF;
- line-height: 48rpx;
- margin-top: 20rpx;
- }
- }
- }
-
- .menus{
- width: 100%;
- background: #FFFFFF;
- border-radius: 16rpx;
- padding: 3rpx 0 33rpx;
- box-sizing: border-box;
- display: flex;
- flex-wrap: wrap;
- position: relative;
- margin-top: 20rpx;
- .item{
- width: 25%;
- display: flex;
- flex-direction: column;
- align-items: center;
- margin-top: 37rpx;
- .img1{
- width: 80rpx;
- height: 80rpx;
- }
- .img2{
- width: 55rpx;
- height: 55rpx;
- }
- p{
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #4E5969;
- line-height: 33rpx;
- text-align: center;
- }
- .p1{
- margin-top: 20rpx;
- }
- .p2{
- margin-top: 14rpx;
- }
- }
- }
-
- .chartBox{
- width: 100%;
- background: #FFFFFF;
- border-radius: 16rpx;
- margin-top: 20rpx;
- padding: 40rpx 24rpx;
- box-sizing: border-box;
- position: relative;
- .title{
- font-family: PingFang-SC, PingFang-SC;
- font-weight: bold;
- font-size: 36rpx;
- color: #1D2129;
- line-height: 36rpx;
- letter-spacing: 2rpx;
- }
- .chart{
- width: 100%;
- position: relative;
-
- .btns{
- border: 1rpx solid #ECECEC;
- border-radius: 6rpx;
- display: flex;
- position: absolute;
- right: 12rpx;
- top: 32rpx;
- z-index: 999;
- .pre{
- padding: 12rpx 16rpx;
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #86909C;
- line-height: 24rpx;
- position: relative;
- &.active{
- color: #198CFF;
- }
- &:last-child{
- border-left: 1rpx solid #ECECEC;
- }
- }
- }
- }
- }
- }
- </style>
|