app.vue
6.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<template>
<com-pageheader :title="'报表管理'" :sub-title="'库存管理'"></com-pageheader>
<div class="contentpanel shopsReport">
<div class="panel">
<div class="panel-heading">
<h1>库存统计</h1>
</div>
<div class="panel-body">
<div class="row">
<uc-filter :params.sync="params"></uc-filter>
<div class="panel-col">
<a href="javascript:;" class="btn btn-info" @click="reload">搜索</a>
</div>
</div>
<uc-card :rows="cards"></uc-card>
</div>
</div>
<div class="panel">
<div class="panel-heading">
<h2>——{{dateId}}库存报表——</h2>
</div>
<div class="panel-body nopadding">
<com-grid :columns="grid.columns" :url="grid.url"></com-grid>
</div>
</div>
</div>
</template>
<script>
import pageheader from '../../../../components/pageheader/index';
import grid from '../../../../components/grid/index';
import calendar from '../../../../components/calendar/index';
import card from './card';
import filer from './filter';
export default {
components: {
comPageheader: pageheader,
comGrid: grid,
ucCard: card,
ucFilter: filer
},
data() {
return {
dateId: "",
cards: [
{name: "库存总数量", value: "0"},
{name: "库存总金额(元)", value: "0"},
{name: "已上架商品数", value: "0"},
{name: "待上架商品数", value: "0"},
{name: "已下架商品数", value: "0"}
],
params: {
productSkn: "",
factory_code: "",
productSku: "",
maxSortId: "",
middleSortId: "",
smallSortId: "",
sortList: []
},
grid: {
url: '/bigdata/getStorageStatisticsList',
columns: [
{
display: '图片', render(item){
return item.imageUrl ? '<img src="' + item.imageUrl + '?imageView/0/w/78/h/78">' : "";
}
},
{
display: 'SKN/SKU', render(item){
return '<p>SKN:' + item.productSkn + '</p><p>SKU:' + item.productSku + '</p>';
}
},
{display: '厂家编号', name: 'factoryCode'},
{display: '商品名称', name: 'goodsName'},
{display: '进货价', name: 'purchasePrice'},
{
display: '颜色/尺码', render(item){
return [item.colorName, item.sizeName].join('/');
}
},
{
display: '商品分类', render(item){
return [item.maxSortName, item.middleSortName, item.smallSortName].join('-');
}
},
{display: '库存数量', name: 'storeNums'},
{display: '库存金额(元)', name: 'storageAmount'}
]
}
}
},
ready() {
this.reload();
},
methods: {
reload()
{
if (this.params.sortList.length > 0) {
this.params.maxSortId = this.params.sortList[0] ? this.params.sortList[0].id : "";
this.params.middleSortId = this.params.sortList[1] ? this.params.sortList[1].id : "";
this.params.smallSortId = this.params.sortList[2] ? this.params.sortList[2].id : "";
}else{
this.params.maxSortId = "";
this.params.middleSortId = "";
this.params.smallSortId = "";
}
this.$broadcast('grid-reload', this.params);
}
},
events: {
complete(data)
{
let result = data.additionInfo;
if (result) {
if(result.storageTotalNum){
this.cards[0].value = result.storageTotalNum;
}else{
if(result.storageTotalNum == 0){
this.cards[0].value = 0;
}else{
this.cards[0].value = '--';
}
}
if(result.storageTotalMoney){
this.cards[1].value = result.storageTotalMoney;
}else{
if(result.storageTotalMoney == 0){
this.cards[1].value = 0;
}else{
this.cards[1].value = '--';
}
}
if(result.onSaleTotalNum){
this.cards[2].value = result.onSaleTotalNum;
}else{
if(result.onSaleTotalNum == 0){
this.cards[2].value = 0;
}else{
this.cards[2].value = '--';
}
}
if(result.preSaleTotalNum){
this.cards[3].value = result.preSaleTotalNum;
}else{
if(result.preSaleTotalNum == 0){
this.cards[3].value = 0;
}else{
this.cards[3].value = '--';
}
}
if(result.outSaleTotalNum){
this.cards[4].value = result.outSaleTotalNum;
}else{
if(result.outSaleTotalNum == 0){
this.cards[4].value = 0;
}else{
this.cards[4].value = '--';
}
}
result.dateId = result.dateId + "";
let month = result.dateId.substr(4, 2);
let date = result.dateId.substr(6, 2);
this.dateId = month + "月" + date + "日";
}
}
}
}
</script>