/**
* 会员余额记录列表
*/
Vue.component('vip-balance-record', {
template: `
查询
重置
导出
{{ sumData.consumption }}
{{ sumData.recharge_refund }}
`,
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;
})
},
});