You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
386 lines
16 KiB
Vue
386 lines
16 KiB
Vue
<template>
|
|
<div>
|
|
<Row style="margin-top: 20px;width: 100%;background-color: #F7F8FA;">
|
|
<i-col span="24" style="text-align: left;padding-left: 10px;">
|
|
<Row class="row-style">
|
|
<i-col span="1" style="text-align: right;">
|
|
<p class="region">选择日期</p>
|
|
</i-col>
|
|
<i-col span="3" style="padding-left: 10px;">
|
|
<DatePicker @on-change="onChangeDateLister" :value="selectDate" type="daterange" split-panels placeholder="请选择日期" style="width: 200px"></DatePicker>
|
|
</i-col>
|
|
<i-col span="2" style="text-align: right;">
|
|
<span class="region">零售公司</span>
|
|
</i-col>
|
|
<i-col span="4" style="padding-left: 10px;">
|
|
<Select v-model="selectedCompany" @on-change="storeOfCompany" filterable style="width: 200px;">
|
|
<Option v-for="item in companyList" :value="item.id" :key="item.id">{{ item.name }}</Option>
|
|
</Select>
|
|
</i-col>
|
|
<i-col span="1" style="text-align: right;">
|
|
<span class="region">店铺</span>
|
|
</i-col>
|
|
<i-col span="4" style="padding-left: 10px;">
|
|
<Select v-model="selectedStore" filterable style="width: 200px;" @on-change="sellerOfStore">
|
|
<Option v-for="item in storeList" :value="item.id" :key="item.id">{{ item.name }}</Option>
|
|
</Select>
|
|
</i-col>
|
|
|
|
<i-col span="1" style="text-align: right;">
|
|
<span class="region">导购</span>
|
|
</i-col>
|
|
<i-col span="4" style="padding-left: 10px;">
|
|
<Select v-model="selectedStaff" filterable style="width: 200px;">
|
|
<Option v-for="item in staffList" :value="item.id" :key="item.id">{{ item.name }}</Option>
|
|
</Select>
|
|
</i-col>
|
|
|
|
<i-col span="2">
|
|
<Button type="primary" @click="generalizeOfSeller">查询</Button>
|
|
</i-col>
|
|
|
|
<div style="text-align: right;padding-right: 20px;float: right">
|
|
<Button type="primary" @click="exportData">导出数据</Button>
|
|
</div>
|
|
</Row>
|
|
</i-col>
|
|
</Row>
|
|
|
|
<Table :columns="columns1" :data="data1" style="margin-top: 20px;" ref="table"></Table>
|
|
<Page :total="totalSize" :current="pageNum" :page-size="pageSize" show-elevator show-total
|
|
placement="top" @on-change="handlePage" style="float: right;margin-top: 20px"></Page>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import IncreaseData from "../../services/generalize/IncreaseData";
|
|
export default {
|
|
name: "IncreaseDataStaff",
|
|
data () {
|
|
return {
|
|
selectedCompany: null,
|
|
companyList: [],
|
|
selectedStore: null,
|
|
storeList: [],
|
|
selectedStaff: null,
|
|
staffList: [],
|
|
columns1: [
|
|
{
|
|
title: '序号',
|
|
key: 'index'
|
|
},
|
|
{
|
|
title: '导购名称',
|
|
key: 'sellerName'
|
|
},
|
|
{
|
|
title: '工号',
|
|
key: 'sellerCode'
|
|
},
|
|
{
|
|
title: '所属店铺',
|
|
key: 'shopName'
|
|
},
|
|
{
|
|
title: '店铺编码',
|
|
key: 'shopCode'
|
|
},
|
|
{
|
|
title: '所属零售公司',
|
|
key: 'companyName'
|
|
},
|
|
{
|
|
title: '总好友数',
|
|
key: 'allCustomer'
|
|
},
|
|
{
|
|
title: '总好友数(去重)',
|
|
key: 'effectiveCustomer',
|
|
render: (h, params) => {
|
|
let that = this;
|
|
if(that.data1[params.index].effectiveCustomer != null){
|
|
return h('div', [
|
|
h('span', {}, that.data1[params.index].effectiveCustomer),
|
|
])
|
|
}else {
|
|
return h('div', [
|
|
h('span', {}, '0'),
|
|
])
|
|
}
|
|
|
|
}
|
|
},
|
|
{
|
|
title: '新增好友数',
|
|
key: 'newCustomer'
|
|
},
|
|
{
|
|
title: '新增好友数(去重)',
|
|
key: 'newEffectiveCustomer'
|
|
},
|
|
{
|
|
title: '日增好友平均(去重)',
|
|
key: 'avgNewCustomer'
|
|
}
|
|
],
|
|
data1: [],
|
|
//分页内容
|
|
totalSize: 0,
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
selectDate:[],
|
|
}
|
|
},
|
|
mounted: function () {
|
|
let startDate = this.$moment(new Date()).add(-29,"day").format("YYYY-MM-DD");
|
|
let endDate = this.$moment(new Date()).format("YYYY-MM-DD");
|
|
this.selectDate.push(startDate);
|
|
this.selectDate.push(endDate);
|
|
this.allCompany();
|
|
this.storeInit();
|
|
this.sellerInit();
|
|
this.generalizeOfSeller();
|
|
},
|
|
methods: {
|
|
onChangeDateLister(date) {
|
|
this.selectDate = date;
|
|
},
|
|
allCompany(){
|
|
let that = this;
|
|
let request = {
|
|
userId:JSON.parse(sessionStorage.getItem("loginInfo")).userId
|
|
};
|
|
this.companyList = [];
|
|
IncreaseData.listOfRetailCompany(request,function (data) {
|
|
data = data.data;
|
|
if (data.code === '0001') {
|
|
that.$Message.error("查询零售公司出错!");
|
|
return;
|
|
}
|
|
if (data.code === '0000') {
|
|
that.companyList.push({id:'-1',name:"全部"});
|
|
that.selectedCompany = "-1";
|
|
data.results.forEach(da => {
|
|
that.companyList.push(da);
|
|
})
|
|
}
|
|
})
|
|
},
|
|
storeInit(){
|
|
let that = this;
|
|
let request = {
|
|
userId:JSON.parse(sessionStorage.getItem("loginInfo")).userId
|
|
};
|
|
this.storeList = [];
|
|
IncreaseData.storeInit(request,function (data) {
|
|
data = data.data;
|
|
if (data.code === '0001') {
|
|
that.$Message.error("查询零售公司的店铺出错!");
|
|
return;
|
|
}
|
|
if (data.code === '0000') {
|
|
that.storeList.push({
|
|
id:'-1',
|
|
name:"全部"
|
|
})
|
|
that.selectedStore = '-1';
|
|
data.results.forEach(da => {
|
|
that.storeList.push(da);
|
|
})
|
|
}
|
|
})
|
|
},
|
|
sellerInit(){
|
|
let that = this;
|
|
let request = {
|
|
userId:JSON.parse(sessionStorage.getItem("loginInfo")).userId
|
|
};
|
|
this.staffList = [];
|
|
IncreaseData.sellerInit(request,function (data) {
|
|
data = data.data;
|
|
if (data.code === '0001') {
|
|
that.$Message.error("查询零售公司的店铺出错!");
|
|
return;
|
|
}
|
|
if (data.code === '0000') {
|
|
that.staffList.push({
|
|
id:'-1',
|
|
name:"全部"
|
|
});
|
|
that.selectedStaff = '-1';
|
|
data.results.forEach(da => {
|
|
that.staffList.push(da);
|
|
})
|
|
}
|
|
})
|
|
},
|
|
storeOfCompany(){
|
|
let that = this;
|
|
this.selectedStore = "";
|
|
let orgId = this.selectedCompany;
|
|
if(this.selectedCompany === "-1"){
|
|
orgId = null;
|
|
}
|
|
let request = {
|
|
orgId:orgId
|
|
};
|
|
this.storeList = [];
|
|
IncreaseData.listOfStoreByCompany(request,function (data) {
|
|
data = data.data;
|
|
if (data.code === '0001') {
|
|
that.$Message.error("查询零售公司的店铺出错!");
|
|
return;
|
|
}
|
|
if (data.code === '0000') {
|
|
that.storeList.push({
|
|
id:'-1',
|
|
name:"全部"
|
|
});
|
|
that.selectedStore = '-1';
|
|
data.results.forEach(da => {
|
|
that.storeList.push(da);
|
|
})
|
|
}
|
|
})
|
|
},
|
|
sellerOfStore(){
|
|
let that = this;
|
|
this.selectedStaff = "";
|
|
let shopId = this.selectedStore;
|
|
if(this.selectedStore === '-1'){
|
|
shopId = null;
|
|
}
|
|
let request = {
|
|
shopId:shopId
|
|
};
|
|
this.staffList = [];
|
|
IncreaseData.listOfSellerByStore(request,function (data) {
|
|
data = data.data;
|
|
if (data.code === '0001') {
|
|
that.$Message.error("查询零售公司的店铺出错!");
|
|
return;
|
|
}
|
|
if (data.code === '0000') {
|
|
that.staffList.push({
|
|
id:'-1',
|
|
name:"全部"
|
|
});
|
|
that.selectedStaff = '-1';
|
|
data.results.forEach(da => {
|
|
that.staffList.push(da);
|
|
})
|
|
}
|
|
})
|
|
},
|
|
generalizeOfSeller(){
|
|
if(this.selectDate[0] === ""){
|
|
this.$Message.info("请选择日期");
|
|
return
|
|
}
|
|
let that = this;
|
|
let sellerId = this.selectedStaff;
|
|
if(this.selectedStaff === "-1"){
|
|
sellerId = null;
|
|
}
|
|
let shopId = this.selectedStore;
|
|
if(this.selectedStore === "-1"){
|
|
shopId = null;
|
|
}
|
|
let orgId = this.selectedCompany;
|
|
if(this.selectedCompany === "-1"){
|
|
orgId = null;
|
|
}
|
|
let request = {
|
|
startTime:this.selectDate[0],
|
|
endTime:this.selectDate[1],
|
|
orgId:orgId,
|
|
shopId:shopId,
|
|
sellerId:sellerId,
|
|
pageNum:this.pageNum,
|
|
pageSize:this.pageSize,
|
|
};
|
|
this.data1 = [];
|
|
IncreaseData.generalizeOfSeller(request,function (data) {
|
|
data = data.data;
|
|
if (data.code === '0001') {
|
|
that.$Message.error("查询零售公司的店铺出错!");
|
|
return;
|
|
}
|
|
if (data.code === '0000') {
|
|
that.data1 = data.results.dataVOS;
|
|
for(let i = 0; i < that.data1.length;i++){
|
|
that.data1[i].index = i+1;
|
|
}
|
|
that.totalSize = data.results.sizeNum;
|
|
}
|
|
})
|
|
},
|
|
//切页处理
|
|
handlePage:function (value) {
|
|
this.pageNum = value;
|
|
this.generalizeOfSeller();
|
|
},
|
|
//零推广导出
|
|
exportZeroExtend: function(){
|
|
if(this.selectDate[0] === ""){
|
|
this.$Message.info("请选择日期");
|
|
return
|
|
}
|
|
let that = this;
|
|
let request = {
|
|
startTime:this.selectDate[0],
|
|
endTime:this.selectDate[1],
|
|
orgId:this.selectedCompany,
|
|
shopId:this.selectedStore,
|
|
sellerId:this.selectedStaff,
|
|
pageNum:this.pageNum,
|
|
pageSize:this.pageSize,
|
|
};
|
|
let originAllData = [];
|
|
IncreaseData.generalizeOfSeller(request,function (data) {
|
|
if(data.data.code !== "0000"){
|
|
that.$Message.error("系统异常");
|
|
}
|
|
data = data.data.results.dataVOS;
|
|
if(data && data.length > 0){
|
|
that.totalSize = data[0].totalSize;
|
|
for(let i=0;i<data.length;i++){
|
|
let entity = data[i];
|
|
entity.index = i+1;
|
|
originAllData.push(entity);
|
|
}
|
|
let title = "导购推广数据";
|
|
require.ensure([], () => {
|
|
const { export_json_to_excel } = require('../../excel/Export2Excel');
|
|
const tHeader = ['序号', '导购名称', '工号', '所属店铺', '编码', '所属零售公司','总好友数','总好友数(去重)','新增好友数','新增好友数(去重)','日增好友平均(去重)'];
|
|
// 属性名
|
|
const filterVal = ['index', 'sellerName', 'sellerCode', 'shopName', 'shopCode', 'companyName','allCustomer','effectiveCustomer','newCustomer','newEffectiveCustomer','avgNewCustomer'];
|
|
// 数据
|
|
//把data里的tableData存到list
|
|
const data = that.formatJson(filterVal, originAllData);
|
|
export_json_to_excel(tHeader, data, title);
|
|
});
|
|
}
|
|
if(!data || data.length === 0){
|
|
that.$Message.info("暂无数据");
|
|
}
|
|
});
|
|
},
|
|
formatJson(filterVal, jsonData) {
|
|
return jsonData.map(v => filterVal.map(j => v[j]))
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.region {
|
|
font-size: 14px;
|
|
line-height: 32px;
|
|
}
|
|
.row-style {
|
|
padding-top: 20px;
|
|
padding-bottom: 20px;
|
|
}
|
|
</style>
|