文件
mashangyoujiu/Public/Retail/js/vip/vip-balance-record.js

257 行
12 KiB
JavaScript
可执行文件

/**
* 会员余额记录列表
*/
Vue.component('vip-balance-record', {
template: `<div>
<el-form size="small" :inline="true">
<el-form-item>
<date-picker-range :date-time.sync="req_data.time"></date-picker-range>
</el-form-item>
<el-form-item>
<el-input v-model="req_data.keyword"
placeholder="昵称/姓名/实体卡/手机号" clearable
@keydown.enter.exact.native.prevent="searchData"
style="width: 220px;"></el-input>
</el-form-item>
<el-form-item v-if="userType==1">
<select-store :store-id.sync="req_data.store_id"
:show-status="true"
:placeholder="'产生记录的门店'"></select-store>
</el-form-item>
<el-form-item>
<el-select v-model="req_data.scene_type"
clearable placeholder="选择场景" style="width: 220px;">
<el-option v-for="(val,key) in sceneType"
:label="val.name"
:value="val.type"
:key="key"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-select v-model="req_data.type" size="small" clearable placeholder="选择类型" style="width: 220px;">
<el-option v-for="(val,key) in seekType"
:label="val.name"
:value="val.type"
:key="key"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="searchData" size="small">查询</el-button>
<el-button type="primary" plain @click="reset" size="small">重置</el-button>
<el-button v-if="(userType==1||storeAuth.data_export==1) && operate.export"
@click="exportExcel">导出
</el-button>
</el-form-item>
</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.consumption }}</div>
</div>
<div class="table-top-card">
<div class="table-top-card-header">扣除总金额</div>
<div class="table-top-card-body">{{ sumData.deduct }}</div>
</div>
<div class="table-top-card">
<div class="table-top-card-header">消费退款总金额</div>
<div class="table-top-card-body">{{ sumData.refund }}</div>
</div>
<div class="table-top-card">
<div class="table-top-card-header">充值退款总金额</div>
<div class="table-top-card-body">{{ sumData.recharge_refund }}</div>
</div>
<div class="table-top-card">
<div class="table-top-card-header">充值总金额</div>
<div class="table-top-card-body">{{ sumData.recharge }}</div>
</div>
<div class="table-top-card">
<div class="table-top-card-header">活动赠送总金额</div>
<div class="table-top-card-body">{{ sumData.activity }}</div>
</div>
</div>
<div>
<el-table :data="orderList" :highlight-current-row="true" border size="small"
:header-cell-style="{background:'#F5F7FA',color:'#606266'}"
style="width: calc(100vw - 208px);">
<el-table-column align="center" type="index" label="序号" width="50"></el-table-column>
<el-table-column align="center" prop="name" label="姓名" min-width="80" :show-overflow-tooltip="true"></el-table-column>
<el-table-column align="center" prop="nickname" label="昵称" min-width="100" :show-overflow-tooltip="true"></el-table-column>
<el-table-column align="center" prop="mobile_phone" label="手机" min-width="110" :show-overflow-tooltip="true"></el-table-column>
<el-table-column align="center" prop="card_key" label="实体卡" min-width="80" :show-overflow-tooltip="true"></el-table-column>
<el-table-column align="center" prop="all_money" label="金额" min-width="80" :show-overflow-tooltip="true"></el-table-column>
<el-table-column align="center" prop="scene_name" label="场景" min-width="100"></el-table-column>
<el-table-column align="center" prop="type_name" label="类型" min-width="80"></el-table-column>
<el-table-column align="center" prop="store_name" label="门店" min-width="100" :show-overflow-tooltip="true"></el-table-column>
<el-table-column align="center" prop="add_time" label="时间" :show-overflow-tooltip="true" min-width="140"></el-table-column>
</el-table>
<el-pagination
@size-change="sizeChange"
@current-change="currentChange"
layout="total, sizes, prev, pager, next, jumper"
:current-page="page"
:pager-count="5"
:page-sizes="[10,20,30,40,50,60,70,80,90]"
:page-size="10"
:total="count">
</el-pagination>
</div>
</div>`,
props: {
'userType': {
type: Number,
default: 1,
},//1商户 2门店
},
data() {
return {
operate: {},
req_data: {
time: '', // 时间
keyword: '', // 实体卡、手机号
store_id: '', // 门店
type: '', // 类型
scene_type: '', //场景
},
sumData: {
consumption: 0,
deduct: 0,
refund: 0,
recharge_refund: 0,
recharge: 0,
activity: 0,
},
orderList: [], // 充值记录列表
page: 1, // 分页
limit: 10, // 每页显示条数
count: 0, // 总数 int类型
seekType: [
{type: 1, name: '充值'},
{type: 2, name: '消费'},
{type: 3, name: '编辑增加'},
{type: 4, name: '编辑减少'},
{type: 5, name: '退款增加'},
{type: 6, name: '红包充值'},
{type: 7, name: '大转盘充值'},
{type: 8, name: '礼品卡充值'},
{type: 9, name: '充值退款'}
],// 类型
sceneType: [
{type: 1, name: '收银机'},
{type: 2, name: '商户后台'},
{type: 3, name: '门店后台'},
{type: 4, name: '小程序'},
{type: 5, name: '公众号'},
{type: 6, name: '小助手'},
],// 场景
requestUrl: {
sumData: {
1: 'Retail/Vipbalance/getBalanceTotal',
2: 'Retail/Vipsbalance/getBalanceTotal',
},
getData: {
1: 'Retail/Vipbalance/balanceList',
2: 'Retail/Vipsbalance/balanceList',
},
export: {
1: '/index.php/Retail/Vipbalance/balanceExport',
2: '/index.php/Retail/Vipsbalance/balanceExport',
},
}
};
},
methods: {
searchData() {
this.getSumData();
this.currentChange(1);
},
// 重置搜索项
reset() {
this.req_data = {
time: '',
keyword: '',
store_id: '',
type: '',
mode: '',
};
this.searchData();
},
//获取统计数据
getSumData() {
this.sendRequest(this.requestUrl.sumData[this.userType], {
data: {
req_data: JSON.stringify(this.req_data),
page: this.page,
limit: this.limit,
},
success: (res) => {
if (res.status == 1) {
this.sumData = res.data;
} else {
this.$message.error(res.message);
}
}
})
},
// 获取余额记录
getVipBalanceList() {
this.sendRequest(this.requestUrl.getData[this.userType], {
data: {
req_data: JSON.stringify(this.req_data),
page: this.page,
limit: this.limit,
},
success: (res) => {
if (res.status == 1) {
this.orderList = [];
this.orderList = res.data.list;
this.count = res.data.count;
} else {
this.count = 0;
this.orderList = [];
}
}
})
},
// 分页
currentChange(val) {
this.page = val;
this.getVipBalanceList();
},
// 显示数量
sizeChange(val) {
this.limit = val;
this.page = 1;
this.getVipBalanceList();
},
// 导出
exportExcel() {
if (!this.req_data.time) {
this.$confirm('不选择时间则默认导出当日记录', '确定导出数据吗?', {
confirmButtonText: '导出',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
window.location.href = this.requestUrl.export[this.userType] + '?req_data=' + JSON.stringify(this.req_data);
}).catch(() => {
});
} else {
window.location.href = this.requestUrl.export[this.userType] + '?req_data=' + JSON.stringify(this.req_data);
}
},
},
created() {
this.searchData();
this.checkOperateAuth({
export: this.requestUrl.export[this.userType],
}, (data) => {
this.operate = data;
})
},
});