文件

429 行
20 KiB
HTML
可执行文件

<!--[1.8.70]-->
<style>
.more-operate-box {
display: flex;
justify-content: space-between;
background: #ecf5ff;
padding: 8px 10px;
margin-top: 10px;
}
</style>
<div id="vipIndexApp" v-cloak>
<el-form :inline="true" size="small">
<el-form-item>
<el-input placeholder="昵称/手机号/实体卡"
type="text" size="small"
v-model="searchForm.keyword" clearable
@keydown.enter.exact.native.prevent="handleCurrentChange(1)" style="width:200px">
</el-input>
</el-form-item>
<el-form-item>
<select-store :store-id.sync="searchForm.store_id"
:store-status="3"
:show-status="true"
:placeholder="'会员所属门店'"></select-store>
</el-form-item>
<el-form-item>
<el-select size="small" v-model="searchForm.status" placeholder="会员状态" clearable>
<el-option v-for="item in vipStatus"
:key="item.status"
:label="item.name"
:value="item.status">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getSumData();handleCurrentChange(1);">搜索</el-button>
<el-button type="primary" plain @click="showEditMore=!showEditMore">>>更多搜索</el-button>
</el-form-item>
<div v-show="showEditMore" style="display: flex;flex-direction: row;flex-wrap: wrap;">
<el-form-item>
<vip-more-search :section="searchForm.section"></vip-more-search>
</el-form-item>
</div>
</el-form>
<!--统计-->
<div class="table-top-card-box">
<div class="table-top-card">
<div class="table-top-card-header">会员总数</div>
<div class="table-top-card-body">{{sumData.all_count}}</div>
</div>
<div class="table-top-card">
<div class="table-top-card-header">昨日新会员</div>
<div class="table-top-card-body">{{sumData.yesterday_count}}</div>
</div>
<div class="table-top-card">
<div class="table-top-card-header">上周新会员</div>
<div class="table-top-card-body">{{sumData.last_week_count}}</div>
</div>
<div class="table-top-card">
<div class="table-top-card-header">总可用积分</div>
<div class="table-top-card-body">{{sumData.all_integral}}</div>
</div>
<div class="table-top-card">
<div class="table-top-card-header">总可用余额</div>
<div class="table-top-card-body">{{sumData.all_balance}}</div>
</div>
</div>
<el-form :inline="true" size="small" class="more-operate-box">
<el-form-item style="margin-bottom: 0">
<el-button v-if="operate.exportVipInfo" @click="exportVip">导出会员信息
</el-button>
<el-tooltip v-if="operate.resetOpenId"
class="item" effect="dark"
content="该操作需要先选择会员"
placement="top">
<el-button v-if="operate.batchDelete" @click="batchDelete">批量冻结
</el-button>
</el-tooltip>
<el-tooltip v-if="operate.resetOpenId"
class="item" effect="dark"
content="该操作需要先选择会员"
placement="top">
<el-button v-if="operate.batchRecovery" @click="batchRecovery">批量恢复会员
</el-button>
</el-tooltip>
<el-tooltip v-if="operate.resetOpenId"
class="item" effect="dark"
placement="top">
<div slot="content" style="width:200px;">
当您更换了公众号,必须得进行此操作,否则之前在旧公众号注册过的会员进入新公众号无法正常使用,此操作不会影响会员账户资产,但需要会员重新与公众号绑定。
</div>
<el-button @click="resetOpenId">重置会员所属</el-button>
</el-tooltip>
</el-form-item>
</el-form>
<div style="max-width: calc(100vw - 208px);margin-top: 8px;">
<el-table border size="small"
:data="vipList" :header-cell-style="{background:'#F5F7FA',color:'#606266'}"
style="width: calc(100vw - 208px);box-sizing: border-box;"
:max-height="tableHeight"
@selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" fixed="left" width="40"
@selection-change="handleSelectionChange"></el-table-column>
<el-table-column align="center" type="index" label="序号" fixed="left" width="50"></el-table-column>
<el-table-column align="center" label="姓名/昵称" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<span v-if="scope.row.name">{{scope.row.name}}</span><br/>
<span v-if="scope.row.nickname">{{scope.row.nickname}}</span>
</template>
</el-table-column>
<el-table-column align="center" prop="mobile_phone" label="手机号" min-width="100px"
show-overflow-tooltip></el-table-column>
<el-table-column align="center" prop="card_key" label="实体卡号" min-width="70"
show-overflow-tooltip></el-table-column>
<el-table-column align="center" prop="birthday" min-width="100" label="生日"
show-overflow-tooltip></el-table-column>
<el-table-column align="center" prop="grade_name" label="等级" min-width="90"
show-overflow-tooltip></el-table-column>
<el-table-column align="center" prop="discount" label="折扣" min-width="60"
show-overflow-tooltip></el-table-column>
<el-table-column align="center" prop="balance" label="余额" min-width="80"
show-overflow-tooltip></el-table-column>
<el-table-column align="center" prop="integral" label="积分" min-width="60"
show-overflow-tooltip></el-table-column>
<el-table-column align="center" prop="store_name" label="所属门店" min-width="90"
show-overflow-tooltip></el-table-column>
<el-table-column align="center" prop="guide_name" label="所属导购" min-width="90"
show-overflow-tooltip></el-table-column>
<el-table-column align="center" prop="add_time" label="激活时间" min-width="140"
show-overflow-tooltip></el-table-column>
<el-table-column align="center" prop="status_name" label="状态" min-width="70"
show-overflow-tooltip></el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="70">
<template slot-scope="scope">
<el-dropdown>
<el-button plain type="text" size="mini">操作</el-button>
<el-dropdown-menu slot="dropdown">
<div style="display: flex;flex-direction: column;padding: 0 10px">
<el-button v-if="operate.rechargeList" type="text"
@click.native="refund(scope.row.id)"
size="mini">余额退款
</el-button>
<!--冻结-->
<vip-frozen v-if="scope.row.status == 1 && operate.frozenVip"
:vid="scope.row.id" :type="1" @end="getData"></vip-frozen>
<!--挂失-->
<vip-loss v-if="scope.row.status == 1 && operate.lossVip"
:vid="scope.row.id" :type="1" @end="getData"></vip-loss>
<!--恢复-->
<vip-thaw v-if="(scope.row.status == 3 || scope.row.status == 4) && operate.thawVip"
:vid="scope.row.id" :type="1" @end="getData"></vip-thaw>
<el-button v-if="operate.modifyVip" @click.native="modifyVip(scope.row)"
type="text" size="mini">修改信息
</el-button>
<!--密码-->
<vip-password v-if="operate.modifyPassword"
:vid="scope.row.id" :type="1"></vip-password>
</div>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
<div slot="empty" v-if="listLoading"><i class="el-icon-loading"></i></div>
<div slot="empty" v-else>暂无数据</div>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 15, 20, 25, 30, 35, 40, 45, 50]"
:page-size="100"
layout="total, sizes, prev, pager, next, jumper"
:total="currentLen">
</el-pagination>
</div>
<!--编辑会员-->
<edit-vip-info :show="showModifyDialog"
:type="1"
:edit-data="editForm"
@end="editVipEnd"></edit-vip-info>
</div>
<script src="/Public/Retail/common/js/select-store.js"></script>
<script src="/Public/Retail/common/js/select-vip-grade.js?v=1.0.2"></script>
<script src="/Public/Retail/js/vip/common-operate.js"></script>
<script type="text/javascript">
var vipIndexApp = new Vue({
el: '#vipIndexApp',
data: {
tableHeight: (MenuApp.getContainerClientHeight() - 240) + 'px',
operate: {},
vipList: [],
searchForm: {
store_id: '',
keyword: '',
status: '',
section: {
integral: '',
balance: '',
purchase: '',
type: '',
time: '',
}
},
editForm: {},//编辑会员的资料
showModifyDialog: false,//是否显示编辑会员
listLoading: false,
currentPage: 1,
currentLimit: 10,
currentLen: 0,
sumData: {
all_count: 0,
yesterday_count: 0,
last_week_count: 0,
all_integral: 0,
all_balance: 0,
},
vipStatus: [
{name: '正常会员', status: 1},
{name: '已冻结会员', status: 3},
{name: '已挂失会员', status: 4},
],
checkedList: [],
showEditMore: false,
},
methods: {
handleSelectionChange(data) {
var ids = "";
for (var i = 0; i < data.length; i++) {
ids += data[i].id + ',';
}
this.checkedList = [];
this.checkedList = ids;
},
refund(id) {
layer.open({
type: 2,
title: "充值列表",
content: "{:U('rechargeIndex')}?id=" + id,
area: ['calc(100% - 160px)', 'calc(100% - 65px)'],
offset: 'rb',
shade: 0,
})
},
modifyVip(item) {
this.editForm = {...item};
this.showModifyDialog = true;
},
editVipEnd(){
this.showModifyDialog = false;
this.getData();
},
resetOpenId() {
this.$confirm('确定重置会员与公众号的关联吗?请谨慎操作!重置后会员进入公众号将重新绑定手机号,不会影响会员原有资产!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.sendRequest('Retail/Vip/resetOpenId', {
success: (res) => {
if (res.status == 1) {
this.$message.success(res.message);
this.getData();
} else {
this.$message.error(res.message);
}
}
})
}).catch(() => {
});
},
batchRecovery() {
if (this.checkedList.length == 0) {
return this.$message.error('请先选择您要恢复的会员');
} else {
this.$confirm('确认要恢复吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.sendRequest('Retail/Vip/batchRecovery', {
data: {
ids: this.checkedList
},
success: (res) => {
if (res.status == 1) {
this.$message.success(res.message);
this.getData();
} else {
this.$message.error(res.message);
}
}
})
}).catch(() => {
});
}
},
batchDelete() {
if (this.checkedList.length == 0) {
return this.$message.error('请选择要冻结的会员');
} else {
this.$confirm('您确认批量冻结吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.sendRequest('Retail/Vip/batchDelete', {
data: {
ids: this.checkedList
},
success: (res) => {
if (res.status == 1) {
this.$message.success(res.message);
this.getData();
} else {
this.$message.error(res.message);
}
}
})
}).catch(() => {
});
}
},
exportVip() {
this.$confirm('将会根据您的筛选条件导出,您确认导出会员吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let keyword = this.searchForm.keyword;
let store_id = this.searchForm.store_id;
let status = this.searchForm.status;
let section = this.searchForm.section;
window.location.href = '/index.php/Retail/Vip/exportVip?keyword=' + keyword + '&store_id=' + store_id + '&status=' + status + '&section=' + JSON.stringify(section);
}).catch(() => {
});
},
handleSizeChange(val) {
this.currentLimit = val;//切换每页数量
this.currentPage = 1;
this.getData();
},
handleCurrentChange(val) {
this.currentPage = val;
this.getData();//切换页数
},
getData() {
this.listLoading = true;
this.sendRequest('Retail/Vip/vipList', {
data: {
page: this.currentPage,
limit: this.currentLimit,
...this.searchForm,
section: JSON.stringify(this.searchForm.section),
},
success: (res) => {
if (res.status == 1) {
this.vipList = [];
this.vipList = res.data.list;
this.sumData.all_count = res.data.count;
this.currentLen = res.data.count;
} else {
this.$message.error(res.message);
}
this.listLoading = false;
}
})
},
getSumData() {
if ([1, 2, 3].indexOf(this.searchForm.section.type) > -1) {
if (!this.searchForm.section.time) {
return this.$message.warning('请选择时间');
}
}
this.sendRequest('Retail/Vip/getSumData', {
data: {
...this.searchForm,
section: JSON.stringify(this.searchForm.section),
},
success: (res) => {
if (res.status == 1) {
this.sumData.yesterday_count = res.data.yesterday_count;
this.sumData.last_week_count = res.data.last_week_count;
this.sumData.all_integral = res.data.all_integral;
this.sumData.all_balance = res.data.all_balance;
} else {
this.$message.error(res.message);
}
}
})
},
//获取操作权限
getOperate() {
this.checkOperateAuth({
exportVipInfo: '/index.php/Retail/Exporttable/exportVipInfo',
batchDelete: '/index.php/Retail/Vip/batchDelete',
batchRecovery: '/index.php/Retail/Vip/batchRecovery',
resetOpenId: '/index.php/Retail/Vip/resetOpenId',
frozenVip: '/index.php/Retail/Vip/frozenVip',
thawVip: '/index.php/Retail/Vip/thawVip',
lossVip: '/index.php/Retail/Vip/lossVip',
modifyVip: '/index.php/Retail/Vip/modifyVip',
modifyPassword: '/index.php/Retail/Vip/modifyPassword',
rechargeList: '/index.php/Retail/Vip/rechargeList',
}, (data) => {
this.operate = data;
})
},
},
created() {
this.getOperate();
this.handleCurrentChange(1);
this.getSumData();
}
})
</script>