diff --git a/src/pages/CustomerDetail.vue b/src/pages/CustomerDetail.vue index f4ee347..998e1df 100644 --- a/src/pages/CustomerDetail.vue +++ b/src/pages/CustomerDetail.vue @@ -37,10 +37,13 @@ + + + -
+
@@ -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 { + 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; //把data里的tableData存到list + 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 = [];