/**
* 会员充值记录
*/
Vue.component('vip-recharge-record', {
template: `
查询
重置
导出
{{ sumData.pay_coupon_money }}
wifi打印
`,
props: {
'userType': {
type: Number,
default: 1,
},//1商户 2门店
},
data() {
return {
operate: {},
pickerOptions: {
shortcuts: [{
text: '最近一周',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近一个月',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近三个月',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit('pick', [start, end]);
}
}]
},
req_data: {
time: '', // 充值截止时间
keyword: '', // 实体卡、手机号
store_id: '', // 充值门店
scene_type: '', // 充值类型
search_type: '', // 充值类型
mode: '', // 充值方式
},// 搜索数据
rechargeList: [], // 充值记录列表
sumData: {
money: 0, // 充值金额
give_money: 0, // 赠送金额
all_money: 0, // 到账金额
pay_coupon_money: 0,//代金券金额
},
page: 1, // 分页
limit: 10, // 每页显示条数
count: 0, // 总数 int类型
sceneType: [
{type: 1, name: '收银机'},
{type: 2, name: '商户后台'},
{type: 3, name: '门店后台'},
{type: 4, name: '小程序'},
{type: 5, name: '公众号'},
{type: 6, name: '小助手'},
],// 场景
seekMode: [
{mode: 1, name: '现金'},
{mode: 2, name: '微信'},
{mode: 3, name: '支付宝'},
{mode: 4, name: '后台修改'},
],// 充值方式
requestUrl: {
sumData: {
1: 'Retail/Viprecharge/rechargeTotal',
2: 'Retail/Vipsbalance/rechargeTotal',
},
getData: {
1: 'Retail/Viprecharge/vipRechargeList',
2: 'Retail/Vipsbalance/rechargeList',
},
export: {
1: '/index.php/Retail/Viprecharge/rechargeExport',
2: '/index.php/Retail/Vipsbalance/rechargeExport',
},
wifiPrint: '/index.php/Retail/Vipsbalance/wifiPrintRechargeOrder',
},
};
},
methods: {
searchData() {
this.getSumData();
this.currentChange(1);
},
//获取统计数据
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);
}
}
})
},
// 获取充值记录
getVipRechargeList() {
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.rechargeList = res.data.list;
this.count = res.data.count;
} else {
this.rechargeList = [];
this.count = 0;
}
}
})
},
wifiPrint(order_id) {
this.sendRequest(this.requestUrl.wifiPrint, {
data: {order_id: order_id},
success: (res) => {
if (res.status == 1) {
this.$message.success(res.message)
} else {
this.$message.error(res.message)
}
}
})
},
// 重置表单
reset() {
this.req_data = {
time: '', // 充值截止时间
keyword: '', // 实体卡、手机号
store_id: '', // 充值门店
scene_type: '', // 充值类型
mode: '', // 充值方式
};
this.getVipRechargeList();
},
// 分页
currentChange(val) {
this.page = val;
this.getVipRechargeList();
},
// 显示数量
sizeChange(val) {
this.limit = val;
this.searchData();
},
// 导出
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();
let obj = {
export: this.requestUrl.export[this.userType],
};
this.userType == 2 && (obj.wifiPrint = this.requestUrl.wifiPrint);
this.checkOperateAuth(obj, (data) => {
this.operate = data;
})
},
});