客户明细导出excel

master
wangweijia 6 years ago
parent 8f3a81b68d
commit 080c197b57

@ -37,10 +37,13 @@
<Select filterable placeholder="请选择导购" v-model="sellerId" class="left-15 txt-font-a" style="width:190px" size="small">
<Option v-for="item in sellerList" :value="item.id" :key="item.id">{{ item.name }}</Option>
</Select>
<Button type="primary" style="width: 70px;margin-left: 20px" @click="searchCustomerDataBtnClick" size="small" class="txt-font-a">查询</Button>
<Button type="primary" style="width: 70px;margin-left: 20px" @click="exportData" size="small" class="txt-font-a">导出数据</Button>
</row>
<row>
<Table :columns="columns1" :data="data1" style="margin-top: 20px;" size="small" no-data-text="--"></Table>
<Table ref="table" :columns="columns1" :data="data1" style="margin-top: 20px;" size="small" no-data-text="--"></Table>
</row>
<Modal v-model="modal12" draggable scrollable title="客户信息" :width="vipModalWidth+'px'" height="651px" >
<row style="padding: 10px 0">
@ -185,40 +188,42 @@
{
title: '会员生日',
key: 'birthday'
}/*,
{
title: '消费次数',
key: 'salesNum'
},
{
title: '消费金额',
key: 'salesAmt'
},
{
title: '操作',
key: 'operation',
render: (h, params) => {
let that = this;
return h('a', {
on: {
'click': () => {
that.customerData = that.data1[params.index];
that.ifVip();
that.customerName = null;
that.modal12 = true
}
}
},[
h('span', {
domProps: {
innerHTML: '查看详情'
}
})
]
}
);
}
}*/
/*,
{
title: '消费次数',
key: 'salesNum'
},
{
title: '消费金额',
key: 'salesAmt'
},
{
title: '操作',
key: 'operation',
render: (h, params) => {
let that = this;
return h('a', {
on: {
'click': () => {
that.customerData = that.data1[params.index];
that.ifVip();
that.customerName = null;
that.modal12 = true
}
}
},[
h('span', {
domProps: {
innerHTML: '查看详情'
}
})
]
);
}
}*/
],
data1: [
{
@ -263,6 +268,64 @@
this.getCustomerData();
},
exportData(){
let that = this;
let title = "客户明细数据";
let stdate = null;
let eddate = null;
if(that.dateRange[0]){
stdate = this.$moment(that.dateRange[0]).format("YYYY-MM-DD");
eddate = this.$moment(that.dateRange[1]).format("YYYY-MM-DD");
}
let csvdata = [];
let request =
{ userId: that.accUserId,
startDate: stdate,
endDate: eddate,
regionId: that.changeData(that.regionId),
shopId: that.changeData(that.shopId),
sellerId: that.changeData(that.sellerId),
pageNum : 1,
pageSize : that.totalSize};
customerDetail.dataDetail(request, function (data) {
data = data.data.results;
if(data){
for(let i=0;i<data.length;i++){
let entity = data[i];
if(entity){
if(i === 0) that.totalSize = entity.totalSize;
let birthday = entity.birthday;
let createTime = entity.createTime;
if(birthday){
entity.birthday = that.$moment(birthday).format("MM-DD")
}
if(createTime){
entity.createTime = that.$moment(createTime).format("YYYY-MM-DD")
}
that.checkParamBlank(entity);
csvdata.push(entity);
}
}
require.ensure([], () => {
const { export_json_to_excel } = require('../excel/Export2Excel');
const tHeader = ['序号', '客户名称', '所属门店', '店铺编号', '所属导购', '工号', '创建时间','客户手机号','关联会员','会员等级','会员生日'];
//
const filterVal = ['number', 'name', 'shopName', 'shopCode', 'sellerName', 'sellerCode', 'createTime','phone','vipName','vipLevel','birthday'];
//
const list = csvdata; //datatableDatalist
const data = that.formatJson(filterVal, list);
export_json_to_excel(tHeader, data, title);
});
}
})
},
formatJson(filterVal, jsonData) {
return jsonData.map(v => filterVal.map(j => v[j]))
},
getCustomerData: function () {
let that = this;
that.data1 = [];

Loading…
Cancel
Save