From 88d1b87697755cf246c20139f4af08c41c5f049f Mon Sep 17 00:00:00 2001 From: Caps <452713115@qq.com> Date: Fri, 24 Apr 2020 22:27:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/shop/IncreaseDataCompany.vue | 62 ++++++++++++++++++++--- src/pages/shop/IncreaseDataStaff.vue | 70 +++++++++++++++++++++++--- src/pages/shop/IncreaseDataStore.vue | 59 ++++++++++++++++++++-- 3 files changed, 173 insertions(+), 18 deletions(-) diff --git a/src/pages/shop/IncreaseDataCompany.vue b/src/pages/shop/IncreaseDataCompany.vue index b573b1e..51aaafa 100644 --- a/src/pages/shop/IncreaseDataCompany.vue +++ b/src/pages/shop/IncreaseDataCompany.vue @@ -22,7 +22,7 @@
- +
@@ -149,10 +149,12 @@ } 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; + if(that.data1){ + for(let i = 0; i < that.data1.length;i++){ + that.data1[i].index = i+1; + } + } } }) }, @@ -161,11 +163,57 @@ this.pageNum = value; this.generalizeOfRetail(); }, - exportData(){ - this.$refs.table.exportCsv({ - filename: 'The original data' + //零推广导出 + exportZeroExtend: function(){ + if(this.selectDate[0] === ""){ + this.$Message.info("请选择日期"); + return + } + let orgId = this.selectedCompany; + if(this.selectedCompany === '-1'){ + orgId = null; + } + let request = { + startTime: this.selectDate[0], + endTime: this.selectDate[1], + orgId: orgId, + pageNum: 1, + pageSize: this.totalSize + }; + let that = this; + let originAllData = []; + IncreaseData.generalizeOfRetail(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 { + const { export_json_to_excel } = require('../../excel/Export2Excel'); + const tHeader = ['序号', '零售公司名称', '总好友数', '总好友数(去重)', '新增好友数', '新增好友数(去重)','日增好友平均(去重)','删除/拉黑成员客户数(累计)','拉黑率(累计)']; + // 属性名 + const filterVal = ['index', 'retailCompany', 'allCustomer', 'effectiveCustomer', 'newCustomer', 'newEffectiveCustomer','avgNewCustomer','delCustomer','delRate']; + // 数据 + //把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])) + }, } } diff --git a/src/pages/shop/IncreaseDataStaff.vue b/src/pages/shop/IncreaseDataStaff.vue index 03139ed..30e0768 100644 --- a/src/pages/shop/IncreaseDataStaff.vue +++ b/src/pages/shop/IncreaseDataStaff.vue @@ -82,7 +82,7 @@ key: 'shopName' }, { - title: '编码', + title: '店铺编码', key: 'shopCode' }, { @@ -278,12 +278,24 @@ 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:this.selectedCompany, - shopId:this.selectedStore, - sellerId:this.selectedStaff, + orgId:orgId, + shopId:shopId, + sellerId:sellerId, pageNum:this.pageNum, pageSize:this.pageSize, }; @@ -308,11 +320,55 @@ this.pageNum = value; this.generalizeOfSeller(); }, - exportData(){ - this.$refs.table.exportCsv({ - filename: 'The original data' + //零推广导出 + 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 { + 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])) + }, } } diff --git a/src/pages/shop/IncreaseDataStore.vue b/src/pages/shop/IncreaseDataStore.vue index 92568dc..9ffff03 100644 --- a/src/pages/shop/IncreaseDataStore.vue +++ b/src/pages/shop/IncreaseDataStore.vue @@ -30,7 +30,7 @@
- +
@@ -237,11 +237,62 @@ onChangeDateLister(date) { this.selectDate = date; }, - exportData(){ - this.$refs.table.exportCsv({ - filename: 'The original data' + //零推广导出 + exportZeroExtend: function(){ + if(this.selectDate[0] === ""){ + this.$Message.info("请选择日期"); + return + } + let orgId = this.selectedCompany; + if(this.selectedCompany === "-1"){ + orgId = null; + } + let shopId = this.selectedStore; + if(this.selectedStore === "-1"){ + shopId = null; + } + let request = { + startTime:this.selectDate[0], + endTime:this.selectDate[1], + orgId:orgId, + shopId:shopId, + pageNum:this.pageNum, + pageSize:this.totalSize, + }; + let that = this; + let originAllData = []; + IncreaseData.generalizeOfStore(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 { + const { export_json_to_excel } = require('../../excel/Export2Excel'); + const tHeader = ['序号', '店铺', '所属零售公司', '所属区域', '总好友数', '总好友数(去重)','新增好友数','新增好友数(去重)','日增好友平均(去重)','删除/拉黑成员客户数(累计)','拉黑率(累计)']; + // 属性名 + const filterVal = ['index', 'shopName', 'companyName', 'region', 'allCustomer', 'effectiveCustomer','newCustomer','newEffectiveCustomer','avgNewCustomer','delCustomer','delRate']; + // 数据 + //把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])) + }, } }