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.
bsdgy-front/src/pages/shop/IncreaseDataCompany.vue

184 lines
6.8 KiB
Vue

6 years ago
<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;">
6 years ago
<DatePicker :value="selectDate" type="daterange" split-panels placeholder="请选择日期" @on-change="onChangeDateLister"
style="width: 200px"></DatePicker>
6 years ago
</i-col>
<i-col span="2" style="text-align: right;">
6 years ago
<span class="region">零售公司</span>
6 years ago
</i-col>
<i-col span="4" style="padding-left: 10px;">
<Select v-model="selectedCompany" 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="4">
<Button type="primary" @click="generalizeOfRetail"></Button>
</i-col>
6 years ago
<div style="text-align: right;padding-right: 20px;float: right">
<Button type="primary" @click="exportData"></Button>
</div>
6 years ago
</Row>
</i-col>
</Row>
6 years ago
<Table ref="table" :columns="columns1" :data="data1" style="margin-top: 20px;"></Table>
6 years ago
<Page :total="totalSize" :current="pageNum" :page-size="pageSize" show-elevator show-total
6 years ago
placement="top" @on-change="handlePage" style="float: right;margin-top: 20px"></Page>
6 years ago
</div>
</template>
<script>
import IncreaseData from "../../services/generalize/IncreaseData";
6 years ago
6 years ago
export default {
name: "IncreaseDataCompany",
data() {
return {
selectedCompany: null,
companyList: [],
columns1: [
{
title: '序号',
6 years ago
key: 'index'
6 years ago
},
{
title: '零售公司名称',
key: 'retailCompany'
},
{
6 years ago
title: '总好友数',
6 years ago
key: 'allCustomer'
},
{
6 years ago
title: '总好友数(去重)',
6 years ago
key: 'effectiveCustomer'
},
{
6 years ago
title: '新增好友数',
6 years ago
key: 'newCustomer'
},
{
6 years ago
title: '新增好友数(去重)',
6 years ago
key: 'newEffectiveCustomer'
},
{
6 years ago
title: '日增好友平均(去重)',
6 years ago
key: 'avgNewCustomer'
},
{
6 years ago
title: '删除/拉黑成员客户数(累计)',
6 years ago
key: 'delCustomer'
},
{
title: '拉黑率(累计)',
key: 'delRate'
}
],
data1: [],
//分页内容
totalSize: 0,
pageNum: 1,
6 years ago
pageSize: 10,
selectDate: [],
6 years ago
}
},
mounted: function () {
6 years ago
let startDate = this.$moment(new Date()).add(-29,"day").format("YYYY-MM-DD");
6 years ago
let endDate = this.$moment(new Date()).format("YYYY-MM-DD");
this.selectDate.push(startDate);
this.selectDate.push(endDate);
6 years ago
this.allCompany();
this.generalizeOfRetail();
},
methods: {
onChangeDateLister(date) {
6 years ago
this.selectDate = date;
6 years ago
},
6 years ago
allCompany() {
6 years ago
let that = this;
let request = {
6 years ago
userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId
6 years ago
};
this.companyList = [];
6 years ago
IncreaseData.listOfRetailCompany(request, function (data) {
6 years ago
data = data.data;
if (data.code === '0001') {
that.$Message.error("查询零售公司出错!");
return;
}
if (data.code === '0000') {
6 years ago
that.companyList.push({id:'-1',name:"全部"});
6 years ago
that.selectedCompany = "-1";
6 years ago
data.results.forEach(da => {
that.companyList.push(da);
})
6 years ago
}
})
},
6 years ago
generalizeOfRetail() {
if(this.selectDate[0] === ""){
this.$Message.info("请选择日期");
return
}
6 years ago
let orgId = this.selectedCompany;
if(this.selectedCompany === '-1'){
orgId = null;
}
6 years ago
let request = {
6 years ago
startTime: this.selectDate[0],
endTime: this.selectDate[1],
6 years ago
orgId: orgId,
6 years ago
pageNum: this.pageNum,
pageSize: this.pageSize
6 years ago
};
let that = this;
that.data1 = [];
6 years ago
IncreaseData.generalizeOfRetail(request, function (data) {
6 years ago
data = data.data;
6 years ago
if (data.code === '0001') {
6 years ago
that.$Message.info("查询推广数据失败!");
return;
}
6 years ago
if (data.code === '0000') {
that.data1 = data.results.dataVOS;
6 years ago
for(let i = 0; i < that.data1.length;i++){
that.data1[i].index = i+1;
}
6 years ago
that.totalSize = data.results.sizeNum;
6 years ago
}
})
},
6 years ago
//切页处理
handlePage: function (value) {
this.pageNum = value;
this.generalizeOfRetail();
},
exportData(){
this.$refs.table.exportCsv({
filename: 'The original data'
});
},
6 years ago
}
}
</script>
<style scoped>
.region {
font-size: 14px;
line-height: 32px;
}
6 years ago
6 years ago
.row-style {
padding-top: 20px;
padding-bottom: 20px;
}
</style>