window.parentVue = new Vue({
|
el: '#app0',
|
data() {
|
return {
|
query: {
|
huiMinName: '',
|
huiMinType: '',
|
dateRange: [],
|
status: '',
|
huiMinStatus: '',
|
},
|
loading: false,
|
currentPage: 1,
|
pageSize: 10,
|
total: 800,
|
ids: [],
|
tableData: [
|
]
|
}
|
},
|
methods: {
|
handleSearch() {
|
console.log('搜索条件:', this.query)
|
this.loading = true;
|
const vm = this; // 保留Vue实例引用
|
let ajax = new $ax(Feng.ctxPath + "/tHuiminCard/list",
|
(data) => { // 改用箭头函数
|
console.log('原始数据:', data);
|
this.loading = false;
|
if(data.rows && Array.isArray(data.rows)){
|
vm.tableData = data.rows;
|
vm.total = data.total;
|
}else{
|
vm.tableData = [];
|
vm.total = 0;
|
}
|
},
|
(data) => {
|
this.loading = false;
|
Feng.error("搜索失败: " + (data.responseJSON?.message || '服务器异常')); // 错误提示优化
|
});
|
|
console.log('请求参数222:', this.query.dateRange)
|
// 添加请求参数
|
ajax.set({
|
current: this.currentPage,
|
size: this.pageSize,
|
startTime: this.query.dateRange !=null && this.query.dateRange.length > 0 ? this.query.dateRange[0] : null,
|
endTime: this.query.dateRange !=null && this.query.dateRange.length > 0 ? this.query.dateRange[1] : null,
|
...this.query
|
});
|
ajax.start();
|
},
|
handleAdd() {
|
// 添加逻辑
|
THuiminCard.openAddTHuiminCard();
|
},
|
handleEdit(id) {
|
if (this.ids.length === 0){
|
Feng.info('请选择要操作的数据')
|
return
|
}
|
if (this.ids.length > 1){
|
Feng.info('请选择一条数据')
|
return
|
}
|
THuiminCard.openTHuiminCardDetail(this.ids[0], 'edit')
|
},
|
handleDelete() {
|
// 删除逻辑
|
console.log(this.ids)
|
if (this.ids.length === 0){
|
Feng.info('请选择要操作的数据')
|
return
|
}
|
const mv = this
|
this.ids.forEach(id => {
|
|
const ajax = new $ax(Feng.ctxPath + "/tHuiminCard/delete", function (data) {
|
Feng.success("操作成功!");
|
mv.handleSearch();
|
}, function (data) {
|
Feng.error("操作失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("ids",mv.ids.join(","));
|
ajax.start();
|
})
|
},
|
handleShelves(status) {
|
// 上架逻辑
|
console.log(this.ids)
|
if (this.ids.length === 0){
|
Feng.info('请选择要操作的数据')
|
return
|
}
|
const mv = this
|
this.ids.forEach(id => {
|
|
const ajax = new $ax(Feng.ctxPath + "/tHuiminCard/changeState", function (data) {
|
Feng.success("操作成功!");
|
mv.handleSearch();
|
}, function (data) {
|
Feng.error("操作失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("id",id);
|
ajax.set("status",status);
|
ajax.start();
|
|
|
})
|
|
},
|
handleUnshelve() {
|
// 下架逻辑
|
},
|
handleSizeChange(val) {
|
this.pageSize = val
|
this.handleSearch()
|
},
|
handleCurrentChange(val) {
|
this.currentPage = val
|
this.handleSearch()
|
},
|
handleSelectionChange(selection) {
|
// 多选处理
|
console.log(11)
|
this.ids = selection.map(item => item.id)
|
},
|
handleViewDetail(row) {
|
if (this.ids.length === 0 && !row){
|
Feng.info('请选择要操作的数据')
|
return
|
}
|
if (this.ids.length > 1 && !row){
|
Feng.info('请选择一条数据')
|
return
|
}
|
// 查看详情
|
let id;
|
if (row){
|
id = row.id
|
}else {
|
id = this.ids[0]
|
}
|
THuiminCard.openTHuiminCardDetail(id,'detail')
|
},
|
addOrder() {
|
THuiminCard.addOrder()
|
}
|
},
|
created() {
|
// 初始化逻辑
|
this.handleSearch()
|
}
|
});
|
var THuiminCardInfo = {
|
goodsPicArray: [],
|
tCarInfoData : {},
|
validateFields: {
|
}
|
};
|
THuiminCardInfo.close = function() {
|
parent.layer.close(window.parent.THuiminCard.layerIndex);
|
}
|
THuiminCardInfo.checkUser = function (e) {
|
console.log("用户手机号")
|
console.log(e)
|
var ajax = new $ax(Feng.ctxPath + "/tHuiminCard/checkUser", function(data){
|
if(data==500){
|
$("#userList").empty()
|
Feng.error("操作失败,当前用户未注册")
|
return;
|
}else if (data==501){
|
$("#userList").empty()
|
Feng.error("操作失败,当前用户未添加人员信息")
|
return;
|
}
|
|
else{
|
var content='<option value="">选择人员</option>';
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.id+"'>"+v.name+"</option>";
|
});
|
$("#userList").empty().append(content);
|
$("#shopId").empty();
|
$("#cards").empty();
|
}
|
});
|
ajax.set("phone",phone);
|
ajax.start();
|
}
|
THuiminCardInfo.getStores = function (e) {
|
var operatorId=$(e).val();
|
var ajax = new $ax(Feng.ctxPath + "/tHuiminCard/getStores", function(data){
|
if(data!=null){
|
var content='<option value="">选择门店</option>';
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.id+"'>"+v.name+"</option>";
|
});
|
$("#shopId").empty().append(content);
|
$("#cards").empty()
|
}
|
});
|
ajax.set("operatorId",operatorId);
|
ajax.start();
|
}
|
THuiminCardInfo.getCards = function (e) {
|
var operatorId=$(e).val();
|
var ajax = new $ax(Feng.ctxPath + "/tHuiminCard/getCards", function(data){
|
if(data!=null){
|
var content='<option value="">选择玩湃惠民卡</option>';
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.id+"'>"+v.name+"</option>";
|
});
|
$("#cards").empty().append(content);
|
}
|
});
|
ajax.set("storeId",operatorId);
|
ajax.start();
|
}
|
THuiminCardInfo.addSubmit = function () {
|
let cardId = $("#cards").val()
|
if(cardId==""){
|
Feng.info("请选择惠民卡")
|
return;
|
}
|
let user = $("#user").val()
|
if(user==""){
|
Feng.info("请选择绑定人员信息")
|
return;
|
}
|
var operatorId=$(e).val();
|
var ajax = new $ax(Feng.ctxPath + "/tHuiminCard/addPayHuiMing", function(data){
|
if(data!=null){
|
var content='<option value="">选择玩湃惠民卡</option>';
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.id+"'>"+v.name+"</option>";
|
});
|
$("#cards").empty().append(content);
|
}
|
});
|
ajax.set("studentId",user);
|
ajax.set("cardId",cardId);
|
ajax.start();
|
}
|