调整
This commit is contained in:
@@ -16,9 +16,14 @@
|
|||||||
</el-option>
|
</el-option>
|
||||||
<el-option
|
<el-option
|
||||||
key="1"
|
key="1"
|
||||||
label="近30天销售"
|
label="近30天销售(按SKU)"
|
||||||
value="1">
|
value="1">
|
||||||
</el-option>
|
</el-option>
|
||||||
|
<el-option
|
||||||
|
key="2"
|
||||||
|
label="近30天销售(按SKC)"
|
||||||
|
value="2">
|
||||||
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -89,19 +94,42 @@
|
|||||||
<template #right>
|
<template #right>
|
||||||
<json-excel
|
<json-excel
|
||||||
v-if="type === '1'"
|
v-if="type === '1'"
|
||||||
:data="last30Daylist"
|
:data="last30DaySkuList"
|
||||||
:fields="last30DaysJsonFields"
|
:fields="last30DaysSkuJsonFields"
|
||||||
:before-generate = "startDownload"
|
:before-generate = "startDownload"
|
||||||
name="近30天销售数据.xls"
|
name="近30天销售数据_按SKU.xls"
|
||||||
worksheet="近30天销售统计">
|
worksheet="近30天销售统计_按SKU">
|
||||||
<el-button type="primary">导出数据</el-button>
|
<el-button type="primary">导出数据</el-button>
|
||||||
</json-excel>
|
</json-excel>
|
||||||
</template>
|
</template>
|
||||||
<ai-table
|
<ai-table
|
||||||
:isShowPagination="false"
|
:isShowPagination="false"
|
||||||
:tableData="last30Daylist"
|
:tableData="last30DaySkuList"
|
||||||
:col-configs="col30DaysConfigs"
|
:col-configs="col30DaysSkuConfigs"
|
||||||
:total="last30Daylist.length"
|
:total="last30DaySkuList.length"
|
||||||
|
style="margin-top: 8px;"
|
||||||
|
@getList="() => {}">
|
||||||
|
</ai-table>
|
||||||
|
</ai-card>
|
||||||
|
</template>
|
||||||
|
<template slot="content" v-if="type === '2'">
|
||||||
|
<ai-card title="数据明细" style="padding-bottom: 40px;">
|
||||||
|
<template #right>
|
||||||
|
<json-excel
|
||||||
|
v-if="type === '2'"
|
||||||
|
:data="last30DaySkcList"
|
||||||
|
:fields="last30DaysSkcJsonFields"
|
||||||
|
:before-generate = "startDownload"
|
||||||
|
name="近30天销售数据_按SKC.xls"
|
||||||
|
worksheet="近30天销售统计_按SKC">
|
||||||
|
<el-button type="primary">导出数据</el-button>
|
||||||
|
</json-excel>
|
||||||
|
</template>
|
||||||
|
<ai-table
|
||||||
|
:isShowPagination="false"
|
||||||
|
:tableData="last30DaySkcList"
|
||||||
|
:col-configs="col30DaysSkcConfigs"
|
||||||
|
:total="last30DaySkcList.length"
|
||||||
style="margin-top: 8px;"
|
style="margin-top: 8px;"
|
||||||
@getList="() => {}">
|
@getList="() => {}">
|
||||||
</ai-table>
|
</ai-table>
|
||||||
@@ -122,7 +150,8 @@ import { Message } from 'element-ui'
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
list: [],
|
list: [],
|
||||||
last30Daylist: [],
|
last30DaySkcList: [],
|
||||||
|
last30DaySkuList: [],
|
||||||
mallId: '',
|
mallId: '',
|
||||||
type: '0',
|
type: '0',
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@@ -264,7 +293,7 @@ import { Message } from 'element-ui'
|
|||||||
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
col30DaysConfigs () {
|
col30DaysSkcConfigs () {
|
||||||
let config = [
|
let config = [
|
||||||
{
|
{
|
||||||
prop: 'productName',
|
prop: 'productName',
|
||||||
@@ -289,8 +318,8 @@ import { Message } from 'element-ui'
|
|||||||
fixed: 'left'
|
fixed: 'left'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'productSkuId',
|
prop: 'skcExtCode',
|
||||||
label: 'SKU ID',
|
label: 'SKC货号',
|
||||||
width: '120px',
|
width: '120px',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
fixed: 'left'
|
fixed: 'left'
|
||||||
@@ -309,19 +338,105 @@ import { Message } from 'element-ui'
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
'sort-method': (a, b) => {
|
'sort-method': (a, b) => {
|
||||||
console.log('1、' + a[dateStr] + ' 2、' + b[dateStr])
|
|
||||||
return new Number(a[dateStr]) - new Number(b[dateStr])
|
return new Number(a[dateStr]) - new Number(b[dateStr])
|
||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
last30DaysJsonFields () {
|
last30DaysSkcJsonFields () {
|
||||||
let jsonFields = {
|
let jsonFields = {
|
||||||
"商品名称": "productName",
|
"商品名称": "productName",
|
||||||
"SPU": "productId",
|
"SPU": "productId",
|
||||||
"SKC": "productSkcId",
|
"SKC": "productSkcId",
|
||||||
"SKU ID": "productSkuId"
|
"SKC货号": "skcExtCode",
|
||||||
|
"图片链接": "productSkcPicture"
|
||||||
|
}
|
||||||
|
|
||||||
|
let date = new Date()
|
||||||
|
date.setDate(date.getDate() )
|
||||||
|
for (let i = 0; i < 30; i++) {
|
||||||
|
date.setDate(date.getDate() - 1)
|
||||||
|
let dateStr = formatDate(date)
|
||||||
|
jsonFields[dateStr] = dateStr
|
||||||
|
}
|
||||||
|
|
||||||
|
return jsonFields
|
||||||
|
},
|
||||||
|
col30DaysSkuConfigs () {
|
||||||
|
let config = [
|
||||||
|
{
|
||||||
|
prop: 'productName',
|
||||||
|
label: '商品名称',
|
||||||
|
"show-overflow-tooltip": true,
|
||||||
|
width: '300px',
|
||||||
|
align: 'left',
|
||||||
|
fixed: 'left'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'productId',
|
||||||
|
label: 'SPU',
|
||||||
|
width: '120px',
|
||||||
|
align: 'center',
|
||||||
|
fixed: 'left'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'productSkcId',
|
||||||
|
label: 'SKC',
|
||||||
|
width: '120px',
|
||||||
|
align: 'center',
|
||||||
|
fixed: 'left'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'skcExtCode',
|
||||||
|
label: 'SKC货号',
|
||||||
|
width: '120px',
|
||||||
|
align: 'center',
|
||||||
|
fixed: 'left'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'productSkuId',
|
||||||
|
label: 'SKU ID',
|
||||||
|
width: '120px',
|
||||||
|
align: 'center',
|
||||||
|
fixed: 'left'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'skuExtCode',
|
||||||
|
label: 'SKU货号',
|
||||||
|
width: '120px',
|
||||||
|
align: 'center',
|
||||||
|
fixed: 'left'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
let date = new Date()
|
||||||
|
date.setDate(date.getDate())
|
||||||
|
for (let i = 0; i < 30; i++) {
|
||||||
|
date.setDate(date.getDate() - 1)
|
||||||
|
let dateStr = formatDate(date)
|
||||||
|
config.push({
|
||||||
|
prop: dateStr,
|
||||||
|
label: dateStr,
|
||||||
|
width: '100px',
|
||||||
|
align: 'center',
|
||||||
|
sortable: true,
|
||||||
|
'sort-method': (a, b) => {
|
||||||
|
return new Number(a[dateStr]) - new Number(b[dateStr])
|
||||||
|
}})
|
||||||
|
}
|
||||||
|
|
||||||
|
return config
|
||||||
|
},
|
||||||
|
last30DaysSkuJsonFields () {
|
||||||
|
let jsonFields = {
|
||||||
|
"商品名称": "productName",
|
||||||
|
"SPU": "productId",
|
||||||
|
"SKC": "productSkcId",
|
||||||
|
"SKC货号": "skcExtCode",
|
||||||
|
"SKU ID": "productSkuId",
|
||||||
|
"SKU货号": "skuExtCode",
|
||||||
|
"图片链接": "productSkcPicture"
|
||||||
}
|
}
|
||||||
|
|
||||||
let date = new Date()
|
let date = new Date()
|
||||||
@@ -369,6 +484,7 @@ import { Message } from 'element-ui'
|
|||||||
}
|
}
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
this.$userCheck(this.mallId).then(() => {
|
this.$userCheck(this.mallId).then(() => {
|
||||||
|
this.last30DaySkcList = []
|
||||||
this.getAllProductList()
|
this.getAllProductList()
|
||||||
this.getList()
|
this.getList()
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
@@ -411,13 +527,24 @@ import { Message } from 'element-ui'
|
|||||||
data.productName = item.productName;
|
data.productName = item.productName;
|
||||||
data.productId = item.productId;
|
data.productId = item.productId;
|
||||||
data.productSkcId = item.productSkcId;
|
data.productSkcId = item.productSkcId;
|
||||||
|
data.skcExtCode = item.skcExtCode;
|
||||||
data.purchaseConfig = item.purchaseConfig;
|
data.purchaseConfig = item.purchaseConfig;
|
||||||
|
data.productSkcPicture = item.productSkcPicture;
|
||||||
|
|
||||||
|
this.last30DaySkcList.push({
|
||||||
|
productName: item.productName,
|
||||||
|
productId: item.productId,
|
||||||
|
productSkcId: item.productSkcId,
|
||||||
|
skcExtCode: item.skcExtCode,
|
||||||
|
productSkcPicture: item.productSkcPicture
|
||||||
|
})
|
||||||
|
|
||||||
if (item.onSalesDurationOffline == 0) {
|
if (item.onSalesDurationOffline == 0) {
|
||||||
data.onSalesDurationOffline = '-天'
|
data.onSalesDurationOffline = '-天'
|
||||||
} else {
|
} else {
|
||||||
data.onSalesDurationOffline = item.onSalesDurationOffline + '天'
|
data.onSalesDurationOffline = item.onSalesDurationOffline + '天'
|
||||||
}
|
}
|
||||||
data.productSkcPicture = item.productSkcPicture;
|
|
||||||
|
|
||||||
for(let j = 0;j < item.skuQuantityDetailList.length; j++) {
|
for(let j = 0;j < item.skuQuantityDetailList.length; j++) {
|
||||||
data = {...data, ...item.skuQuantityDetailList[j],
|
data = {...data, ...item.skuQuantityDetailList[j],
|
||||||
@@ -450,12 +577,28 @@ import { Message } from 'element-ui'
|
|||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
Message.success('销售数据加载完成,可进行导出')
|
Message.success('销售数据加载完成,可进行导出')
|
||||||
|
|
||||||
this.last30Daylist = this.list.map(item => {
|
// 初始化SKC数据列表
|
||||||
|
this.last30DaySkcList = this.last30DaySkcList.map(item => {
|
||||||
|
let date = new Date()
|
||||||
|
date.setDate(date.getDate() - 31)
|
||||||
|
for (let i = 0; i < 30; i++) {
|
||||||
|
date.setDate(date.getDate() + 1)
|
||||||
|
let dateStr = formatDate(date)
|
||||||
|
item[dateStr] = 0
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
|
||||||
|
// 初始化SKU数据列表
|
||||||
|
this.last30DaySkuList = this.list.map(item => {
|
||||||
let temp = {
|
let temp = {
|
||||||
productName: item.productName,
|
productName: item.productName,
|
||||||
productId: item.productId,
|
productId: item.productId,
|
||||||
productSkcId: item.productSkcId,
|
productSkcId: item.productSkcId,
|
||||||
productSkuId: item.productSkuId
|
productSkuId: item.productSkuId,
|
||||||
|
skuExtCode: item.skuExtCode,
|
||||||
|
skcExtCode: item.skcExtCode,
|
||||||
|
productSkcPicture: item.productSkcPicture
|
||||||
}
|
}
|
||||||
let date = new Date()
|
let date = new Date()
|
||||||
date.setDate(date.getDate() - 31)
|
date.setDate(date.getDate() - 31)
|
||||||
@@ -493,13 +636,24 @@ import { Message } from 'element-ui'
|
|||||||
}}).then((res) => {
|
}}).then((res) => {
|
||||||
if (res.errorCode == 1000000) {
|
if (res.errorCode == 1000000) {
|
||||||
for (let i = 0; i < res.result.length; i++) {
|
for (let i = 0; i < res.result.length; i++) {
|
||||||
for (let j = 0; j < this.last30Daylist.length; j++) {
|
for (let j = 0; j < this.last30DaySkuList.length; j++) {
|
||||||
if (this.last30Daylist[j].productSkuId == res.result[i].prodSkuId) {
|
if (this.last30DaySkuList[j].productSkuId == res.result[i].prodSkuId) {
|
||||||
this.last30Daylist[j][res.result[i].date] = res.result[i].salesNumber
|
this.last30DaySkuList[j][res.result[i].date] = res.result[i].salesNumber
|
||||||
|
|
||||||
|
for (let k = 0; k < this.last30DaySkcList.length; k++) {
|
||||||
|
if (this.last30DaySkcList[k].productSkcId == this.last30DaySkuList[j].productSkcId) {
|
||||||
|
this.last30DaySkcList[k][res.result[i].date] = this.last30DaySkcList[k][res.result[i].date] + res.result[i].salesNumber
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.getSkuDetailList()
|
||||||
|
}, 1500)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user