From 080c197b57b61acb1752e4d1d13a81e0366368b3 Mon Sep 17 00:00:00 2001
From: wangweijia <495720349@qq.com>
Date: Thu, 23 Apr 2020 18:26:13 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E6=98=8E=E7=BB=86=E5=AF=BC?=
=?UTF-8?q?=E5=87=BAexcel?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages/CustomerDetail.vue | 131 ++++++++++++++++++++++++++---------
1 file changed, 97 insertions(+), 34 deletions(-)
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 = [];