Vue.component('credit-stream', {
template: `
`,
props: {
'show': {
type: Boolean,
default: false,
},//是否展示
'store_id': {
type: String,
default: '',
},
'openType': {
type: Number,
default: 2,//打开的用户类型 1商户 2门店
}
},
data() {
return {
start_time: '',
end_time: '',
recordList: [],
searchText: '',
type: '1',
loading: false,
currentPage: 1,
currentLimit: 10,
currentLen: 0,
}
},
methods: {
//打印单据
print(id) {
layer.open({
type: 2,
content: "/index.php/Retail/WebPrint/orderPrint.html?id=" + id,
title: "打印订单",
area: ['calc(100% - 160px)', 'calc(100% - 65px)'],
shade: 0,
offset: 'rb',
})
// MenuApp.pathData.push({
// name: '打印单据',
// path: '/index.php/Retail/WebPrint/orderPrint.html?id=' + id
// })
},
//搜索
searchData: function () {
this.currentPage = 1;
this.getData();
},
handleSizeChange: function (val) {
this.currentLimit = val;//切换每页数量
this.currentPage = 1;
this.getData();
},
handleCurrentChange: function (val) {
this.currentPage = val;
this.getData();//切换页数
},
//查询
getData: function () {
this.loading = true;
switch (this.type) {
case '1':
//赊账
var url = "/index.php/Credit/CreditArrearage/getUserArrearage";
break;
case '2':
//还款
var url = "/index.php/Credit/CreditRepayment/getRepayRecord";
break;
}
$.ajax({
url: url,
type: "post",
data: {
page: this.currentPage,
limit: this.currentLimit,
editor_type: 2, //后台
searchText: this.searchText,
start_time: this.start_time,
end_time: this.end_time,
store_id: this.store_id,
},
success: (res) => {
this.recordList = res.data.list;
this.loading = false;
this.$nextTick(() => {
this.currentLen = parseInt(res.data.total);
})
}
})
},
},
created() {
this.searchData();
},
watch: {
show(n) {
console.log(n);
if (n) this.searchData();
}
}
});