Commit 4dd740d8 by xiaohai

会员分组表和详情页部分开发

parent 09b2c636
......@@ -3,7 +3,7 @@
<nav-crumb :navpath="navpath"></nav-crumb>
<div class="right-content">
<div class="right-box">
<div class="memberGroupDetail-wrap__head">
<!-- <div class="memberGroupDetail-wrap__head">
<p class="m-b-20"><span class="group-name">{{groupName}}</span><span class="font-10 real-time inline-block m-l-8">{{!!groupIsRealTime? '实时':''}}</span></p>
<div>
<span>筛选标签</span>
......@@ -17,9 +17,9 @@
</template>
</div>
</div>
</div>
</div> -->
<div class="memberGroupDetail-wrap__info">
<span>覆盖人数 </span>
<span>覆盖人数{{total}}</span>
<span class="fr inline-block middle"><el-button type="primary" icon="el-icon-setting " @click="showDefined"></el-button></span>
</div>
<div class="memberGroupDetail-wrap__table">
......@@ -241,6 +241,7 @@
import errMsg from '@/common/js/error';
import { _debounce } from "@/common/js/public";
import { getRequest, postRequest, postJson, postForm } from '@/api/api';
import qs from 'qs';
export default {
name: "memberGroupDetail",
data() {
......@@ -301,42 +302,7 @@
// memberGroupDetailData 表格
sortableFlag: false, // 表格可排序
memberGroupDetailData:[
{
memberId: "ff80808166c4dc700166c4e1b6fa0000",
memberName: "谭向",
gradeName: "普卡",
thirdImgUrl: "http://thirdwx.qlogo.cn/mmopen/3eCPhvaTxDmXCOLwiaeLskRMeNLyq3azIXFyM8ib8QvLXxbicevPuP9ZzX6m1X9YDbZc9XW8mfJZhJrJTCFL6nTCvDTXuoCUD6A/0",
wxStatus: 1, // 状态
channelTaobao: 0, // 淘宝
channelJd: 1, // 京东
channelWei: 0, // 唯品会
birthdayMD: '09-19',
costFee: 3333, // 消费总额
costTimes: 0, // 消费次数
lastCost: 0, // 最近消费
lastCostTime: '2018-05-01',
crateCardDateString: '2018-06-21 14:44:29', // 开卡时间
createTime: '2018-05-01 17:33:12',
attentionTime: '2018-05-01 17:33:12',
frozenStatus: 1,
},
{
memberId: "ff80808166c4dc700166c4e1b6fa0000",
memberName: "谭向",
gradeName: "普卡",
thirdImgUrl: "",
birthdayMD: '',
wxStatus: 1, // 状态
channelTaobao: 0, // 淘宝
costFee: 3338, // 消费总额
costTimes: 99, // 消费次数
lastCost: 666, // 最近消费
lastCostTime: '2018-06-01',
createTime: '2018-07-01 17:33:12',
frozenStatus: 0,
}
],
memberGroupDetailData:[],
// 分页参数
currentPage: 1,
pageSize: 20,
......@@ -359,7 +325,7 @@
phoneStatus: 0,
authStatus: 0
},
baseUrl: ""
}
},
computed: {
......@@ -367,11 +333,28 @@
},
filters: {
formatTimeYMD(data) {
return data != '--' ? data.split(' ')[0] : '--';
formatTimeYMD(time) {
if (time) {
let arr = time.toString().split('');
const y = arr.splice(0, 4).join('');
const m = arr.splice(0, 2).join('');
const d = arr.splice(0, 2).join('');
return y + '-' + m + '-' + d;
} else {
return '--';
}
},
formatTimeHMS(data) {
return data != '--' ? data.split(' ')[1] : '--';
formatTimeHMS(time) {
if (time) {
let arr = time.toString().split('');
arr.splice(0, 8);
const h = arr.splice(0, 2).join('');
const m = arr.splice(0, 2).join('');
const s = arr.splice(0, 2).join('');
return h + ':' + m + ':' + s;
} else {
return '--';
}
},
},
......@@ -424,6 +407,27 @@
},
/**
* 获取分组详情
*/
getGroupDetail() {
const that = this;
let memberTagGroupId = that.$route.query.memberTagGroupId;
let params = {
memberTagGroupId,
pageNum: that.currentPage,
pageSize: that.pageSize
};
getRequest('/member-tag-member/findMemberList.json', params)
.then(res => {
console.log(res, 'groupDetail');
that.total = res.data.result.page.totalCount;
that.memberGroupDetailData = res.data.result.page.result;
})
.catch(e => {
console.log(e, 'error of get group detail');
});
},
/**
* 点击信息跳转分组详情
*/
linkDetail(memberId) {
......@@ -477,13 +481,13 @@
getFieldsList() {
const that = this
const para = {
pageName: "wxMember"
}
pageName: "wxMember",
};
that.selectedUserDefined = [];
that.selectedFields = [];
postJson('/api-member/find-member-fields',para)
that.axios.post(`${that.baseUrl}/api-member/find-member-fields?requestProject='memberTag'`, para)
.then((res) => {
console.log(res,res.data,res.data.errorCode)
console.log(res, '自定义列表字段');
const resData = res.data
if (resData.errorCode == 0) {
// showMsg.showmsg('保存成功','success')
......@@ -511,11 +515,18 @@
},
},
beforeMount() {
var that = this;
var host = window.location.origin;
if (host.indexOf("localhost") != "-1") {
that.baseUrl = "http://gicdev.demogic.com";
} else {
that.baseUrl = host;
}
},
mounted() {
// 获取自定义字段
this.getFieldsList()
this.getGroupDetail();
this.getFieldsList();
},
components: {
navCrumb,
......
......@@ -5,7 +5,7 @@
<div class="right-box">
<div class="common-wrap__opt">
<el-input
class="w-184"
class="w-220"
placeholder="请输入关键字搜索人群"
prefix-icon="el-icon-search"
v-model="tagSearch"
......@@ -101,11 +101,11 @@
<el-table-column
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" class="" @click="toInvalid(scope.row.memberTagGroupId,scope.row)">失效</el-button>
<router-link :to="{path:'/memberGroupDetail',query:{memberTagGroupId:scope.row.memberTagGroupId}}" class="edit-btn el-button--text p-l-20">详情</router-link>
<el-button type="text" size="small" class="p-r-20" v-if="scope.row.effectiveStatus == 1" @click="toInvalid(scope.row)">失效</el-button>
<router-link :to="{path:'/memberGroupDetail',query:{memberTagGroupId:scope.row.memberTagGroupId}}" class="edit-btn el-button--text p-r-20">详情</router-link>
<router-link :to="{path:'/memberGroupEdit',query:{memberTagGroupId:scope.row.memberTagGroupId}}" class="edit-btn el-button--text p-l-20">编辑</router-link>
<el-popover
<router-link :to="{path:'/memberGroupEdit',query:{memberTagGroupId:scope.row.memberTagGroupId}}" class="edit-btn el-button--text p-r-20">编辑</router-link>
<!-- <el-popover
placement="top"
width="160"
v-model="scope.row.popVisible">
......@@ -114,10 +114,11 @@
<el-button size="mini" type="text" @click="cancelDelTag(scope.$index,scope.row)">取消</el-button>
<el-button type="primary" size="mini" @click="toDelTag(scope.$index,scope.row)">确定</el-button>
</div>
<el-button slot="reference" class="p-l-20" type="text">
<el-button slot="reference" type="text">
删除
</el-button>
</el-popover>
</el-popover> -->
<el-button type="text" size="small" @click="toDelTag(scope.row, scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
......@@ -190,11 +191,10 @@
},
filters: {
formatTimeYMD(data) {
console.log(data,data != '--' ? data.split(' ')[0] : '--')
return data != '--' ? data.split(' ')[0] : '--';
return data && data != '- -' ? data.split(' ')[0] : '--';
},
formatTimeHMS(data) {
return data != '--' ? data.split(' ')[1] : '--';
return data && data != '- -' ? data.split(' ')[1] : '--';
},
formatNum(data){
const reg=/\d{1,3}(?=(\d{3})+$)/g;
......@@ -256,38 +256,38 @@
/**
* 点击失效
*/
toInvalid(id) {
toInvalid(info) {
console.log(info, "thisGroup");
const that = this
that.$confirm('该分组失效后,不再更新数据,确认要失效吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
}).catch(() => {
});
that.$confirm('该分组正在被活动使用,无法删除!', '提示', {
confirmButtonText: '确定',
type: 'warning'
}).then(() => {
let pramas = {
effectiveStatus: '0',
memberTagGroupId: info.memberTagGroupId
}
that.updateGroup(pramas, info);
}).catch(() => {
});
that.$confirm('该分组覆盖XX人,一旦删除无法恢复,确认要删除吗?', '提示', {
confirmButtonText: '确定',
type: 'warning'
}).then(() => {
}).catch(() => {
},
/**
* 简单更新当前分组 -- 失效/更改人数
*/
updateGroup(pramas, info) {
const that = this;
getRequest('/member-tag-group/simpleUpdate.json', pramas)
.then(res => {
console.log(res, 'updateResult');
info.effectiveStatus = pramas.effectiveStatus || info.effectiveStatus;
info.memberCount = pramas.memberCount || info.memberCount;
})
.catch(e => {
console.log(e, 'error');
});
},
/**
* 删除当前分组 -- 取消
*/
......@@ -299,44 +299,38 @@
/**
* 删除当前分组 -- 确定
*/
toDelTag(index,row) {
const that = this
that.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
toDelTag(obj, index) {
const that = this;
that.$confirm(`该分组覆盖${that.$options.filters['formatNum'](obj.memberCount)}人,一旦删除无法恢复,确认要删除吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
that.groupTableData.splice(index,1)
}).catch(() => {
});
// that.groupTableData.splice(index,1)
that.delGroup(obj.memberTagGroupId, index);
}).catch(() => {});
},
/**
* 删除当前分组 -- API
*/
delGroup(id) {
const that = this
delGroup(id, index) {
const that = this;
const para = {
memberTagGroupId: id, // 搜索字段
}
};
getRequest('/member-tag-group/delete.json',para)
.then((res) => {
// console.log(res,res.data,res.data.errorCode)
console.log(res, "delResult");
var resData = res.data
if (resData.errorCode == 1) {
// showMsg.showmsg('保存成功','success')
that.groupTableData.splice(index,1);
return;
}
errMsg.errorMsg(resData)
errMsg.errorMsg(resData);
})
.catch(function (error) {
console.log(error);
that.$message.error({
duration: 1000,
message: error.message
......@@ -348,16 +342,15 @@
* 获取列表数据
*/
getGroupList() {
const that = this
const that = this;
const para = {
groupName: that.tagSearch, // 搜索字段
pageSize: that.pageSize,
pageNum: that.currentPage
}
};
getRequest('/member-tag-group/findList.json',para)
.then((res) => {
// console.log(res,res.data,res.data.errorCode)
console.log(res, "groupList");
var resData = res.data
if (resData.errorCode == 1) {
that.total = resData.result.totalCount;
......@@ -381,14 +374,12 @@
})
.catch(function (error) {
console.log(error);
that.$message.error({
duration: 1000,
message: error.message
})
});
}
},
mounted() {
const that = this
......
......@@ -410,6 +410,9 @@ input:focus {
padding-right: 8px;
}
.p-r-20 {
padding-right: 20px;
}
.w-86 {
width: 86px;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment