Authored by OF1706

shop report02

@@ -103,17 +103,21 @@ @@ -103,17 +103,21 @@
103 } 103 }
104 104
105 this.dateRange = newDay !== this.curDay ? [newDay, curDay] : [newDay, newDay]; 105 this.dateRange = newDay !== this.curDay ? [newDay, curDay] : [newDay, newDay];
  106 +
106 }, 107 },
107 dateRange(newDate) { 108 dateRange(newDate) {
108 this.beginDate = Array.isArray(newDate) ? newDate[0] : newDate; 109 this.beginDate = Array.isArray(newDate) ? newDate[0] : newDate;
109 this.endDate = Array.isArray(newDate) ? newDate[1] : newDate; 110 this.endDate = Array.isArray(newDate) ? newDate[1] : newDate;
110 this.day = this.beginDate === this.endDate === this.today ? '' : this.beginDate; 111 this.day = this.beginDate === this.endDate === this.today ? '' : this.beginDate;
  112 + this.curTarget = 'uv';
  113 +
  114 + this.getOverviewData();
111 115
112 - if (this.beginDate === this.endDate) { 116 +
  117 +// if (this.beginDate === this.endDate) {
113 this.getDataFlag = true; 118 this.getDataFlag = true;
114 this.getOverviewTrend(); 119 this.getOverviewTrend();
115 - }  
116 - this.getOverviewData(); 120 +// }
117 }, 121 },
118 curTarget(value) { 122 curTarget(value) {
119 123
@@ -123,11 +127,11 @@ @@ -123,11 +127,11 @@
123 return; 127 return;
124 } 128 }
125 129
126 - if (this.beginDate === this.endDate) {  
127 - this.setOverviewParams(this.curTarget);  
128 - } else {  
129 - this.setOverviewParamsRank(this.curTarget);  
130 - } 130 +// if (this.beginDate === this.endDate) {
  131 + this.getOverviewTrend();
  132 +// } else {
  133 +// this.setOverviewParamsRank();
  134 +// }
131 } 135 }
132 }, 136 },
133 mounted() { 137 mounted() {
@@ -137,38 +141,9 @@ @@ -137,38 +141,9 @@
137 loadData() { 141 loadData() {
138 this.getOverviewData(); 142 this.getOverviewData();
139 143
140 - if (this.beginDate === this.endDate) { 144 +// if (this.beginDate === this.endDate) {
141 this.getOverviewTrend(); 145 this.getOverviewTrend();
142 - }  
143 - },  
144 - getOverviewTrend() {  
145 - this.goodService.getOverviewTrend({  
146 - type: this.curTarget,  
147 - begin: this.beginDate,  
148 - end: this.endDate,  
149 - platform: '1,2'  
150 - }).then(ret => {  
151 -  
152 - let result = _.castArray(ret.data);  
153 -  
154 - let item01 = [],  
155 - item02 = [];  
156 -  
157 - _.forEach(result[0], it=>{  
158 - item01.push(it);  
159 - });  
160 - _.forEach(result[1], it=>{  
161 - item02.push(it);  
162 - });  
163 -  
164 - this.overviewChartData.xAxis = _.map(_.flatten(item01), 'hour');  
165 - this.overviewChartData.uv = [_.map(_.flatten(item01), 'value'), _.map(_.flatten(item02), 'value')];  
166 - this.overviewChartData.pv = [_.map(_.flatten(item01), 'value'), _.map(_.flatten(item02), 'value')];  
167 - this.overviewChartData.orderCount = [_.map(_.flatten(item01), 'value'), _.map(_.flatten(item02), 'value')];  
168 - this.overviewChartData.orderAmount = [_.map(_.flatten(item01), 'value'), _.map(_.flatten(item02), 'value')];  
169 -  
170 - this.setOverviewParams();  
171 - }); 146 +// }
172 }, 147 },
173 setOverviewParams() { 148 setOverviewParams() {
174 149
@@ -203,8 +178,62 @@ @@ -203,8 +178,62 @@
203 ] 178 ]
204 }; 179 };
205 }, 180 },
  181 + getOverviewTrend() {
  182 + this.goodService.getOverviewTrend({
  183 + type: this.curTarget,
  184 + begin: this.beginDate,
  185 + end: this.endDate,
  186 + platform: '1,2'
  187 + }).then(ret => {
  188 +
  189 + if (this.beginDate === this.endDate) {
  190 + let result = _.castArray(ret.data);
  191 +
  192 + let item01 = [],
  193 + item02 = [];
  194 +
  195 + _.forEach(result[0], it=>{
  196 + item01.push(it);
  197 + });
  198 + _.forEach(result[1], it=>{
  199 + item02.push(it);
  200 + });
  201 + this.overviewChartData.xAxis = _.map(_.flatten(item01), 'hour');
  202 + this.overviewChartData.uv = [_.map(_.flatten(item01), 'value'), _.map(_.flatten(item02), 'value')];
  203 + this.overviewChartData.pv = [_.map(_.flatten(item01), 'value'), _.map(_.flatten(item02), 'value')];
  204 + this.overviewChartData.orderCount = [_.map(_.flatten(item01), 'value'), _.map(_.flatten(item02), 'value')];
  205 + this.overviewChartData.orderAmount = [_.map(_.flatten(item01), 'value'), _.map(_.flatten(item02), 'value')];
  206 + console.log('进错没有')
  207 + this.setOverviewParams();
  208 +
  209 + } else {
  210 +
  211 + console.log('进来了,大王');
  212 + let data = ret.data;
  213 +
  214 + let sum = [],
  215 + name = [];
206 216
  217 + _.forEach(data, function(value, key) {
207 218
  219 + sum.push(
  220 + _.sum(_.map(value, 'value'))
  221 + );
  222 + name.push(key);
  223 +
  224 + });
  225 +
  226 + this.overviewChartData.xAxis = name;
  227 + this.overviewChartData.uv = sum;
  228 + this.overviewChartData.pv = sum;
  229 + this.overviewChartData.orderCount = sum;
  230 + this.overviewChartData.orderAmount = sum;
  231 +
  232 + this.setOverviewParamsRank();
  233 + }
  234 +
  235 + });
  236 + },
208 getOverviewData() { 237 getOverviewData() {
209 this.goodService.getData({ 238 this.goodService.getData({
210 begin: this.beginDate, 239 begin: this.beginDate,
@@ -232,12 +261,21 @@ @@ -232,12 +261,21 @@
232 this.overviewChartData.orderAmount = _.get(ret, 'orderAmount'); 261 this.overviewChartData.orderAmount = _.get(ret, 'orderAmount');
233 this.overviewChartData.xAxis = _.map(formatData, 'hour'); 262 this.overviewChartData.xAxis = _.map(formatData, 'hour');
234 263
235 - this.setOverviewParamsRank(); 264 +// this.setOverviewParamsRank();
236 } 265 }
237 }); 266 });
238 }, 267 },
239 exportFile() { 268 exportFile() {
  269 + let param = {};
  270 +
  271 + param.begin = this.beginDate;
  272 + param.end = this.endDate;
  273 + param.platform = '1,2';
  274 +
  275 + const href = '/Api/platform/exportOneShopOverview?queryConf=' +
  276 + JSON.stringify(param);
240 277
  278 + window.open(href, '_blank');
241 }, 279 },
242 }, 280 },
243 components: { 281 components: {
@@ -18,7 +18,6 @@ class ProductService extends Service { @@ -18,7 +18,6 @@ class ProductService extends Service {
18 getOverviewTrend(params) { 18 getOverviewTrend(params) {
19 return this.post(apiUrl.queryOneShopHourTrend, params); 19 return this.post(apiUrl.queryOneShopHourTrend, params);
20 } 20 }
21 -  
22 } 21 }
23 22
24 export default ProductService; 23 export default ProductService;
@@ -98,7 +98,8 @@ let domainApis = { @@ -98,7 +98,8 @@ let domainApis = {
98 getShareOrderList: '/seller/shareOrder/shareOrderList', 98 getShareOrderList: '/seller/shareOrder/shareOrderList',
99 sensitiveWordValidate: '/sensitiveWord/validate', 99 sensitiveWordValidate: '/sensitiveWord/validate',
100 queryOneShopOverview: '/merchant/queryOneShopOverview', 100 queryOneShopOverview: '/merchant/queryOneShopOverview',
101 - queryOneShopHourTrend: '/merchant/queryOneShopHourTrend' 101 + queryOneShopHourTrend: '/merchant/queryOneShopHourTrend',
  102 + exportOneShopOverview: '/merchant/exportOneShopOverview'
102 }, 103 },
103 shop: { 104 shop: {
104 login: '/loginInter', 105 login: '/loginInter',