...
|
...
|
@@ -34,14 +34,18 @@ function bind_table_pagination() { |
|
|
});
|
|
|
}
|
|
|
};
|
|
|
let statusParam = null;
|
|
|
|
|
|
const fetchRender = (pageNo, pageSize) => {
|
|
|
let param = {pageNo, pageSize};
|
|
|
|
|
|
if (statusParam != null) {
|
|
|
param.status = statusParam;
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
url: '/admin/api/coupon/list',
|
|
|
data: {
|
|
|
pageNo,
|
|
|
pageSize
|
|
|
}
|
|
|
data: param
|
|
|
})
|
|
|
.then(result => {
|
|
|
const list = result.data;
|
...
|
...
|
@@ -62,9 +66,11 @@ function bind_table_pagination() { |
|
|
} else if (item.type == 3) {
|
|
|
item.typeText = '不用码';
|
|
|
}
|
|
|
let status = item.status ? `<a class="btn btn-danger btn-status" data-id="${item.id}" data-status="0">下架</a>` : `<a class="btn btn-success btn-status" data-id="${item.id}" data-status="1">上架</a>`;
|
|
|
|
|
|
html += `
|
|
|
<tr class="even pointer">
|
|
|
<td class="">${item.id}</td>1
|
|
|
<td class="">${item.id}</td>
|
|
|
<td class="">${item.couponName}</td>
|
|
|
<td class="">${item.shopName}</td>
|
|
|
<td class=""><img src="${item.shopLogoUrl}" width="100" height="50"/></td>
|
...
|
...
|
@@ -76,10 +82,11 @@ function bind_table_pagination() { |
|
|
<form id="uploadForm_${item.id}" enctype="multipart/form-data">
|
|
|
<input id="up_excel" name="up_excel" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" style="display: inline-block; width: 80%;" type="file">
|
|
|
</form>
|
|
|
<button type="button" class="btn btn-danger btn-import" style="display: inline-block;" data-id="${item.id}">导入券码</button>
|
|
|
<button class="btn btn-danger btn-export-no" data-id="${item.id}">导出券码
|
|
|
<button type="button" class="btn btn-primary btn-import" style="display: inline-block;" data-id="${item.id}">导入券码</button>
|
|
|
<button class="btn btn-primary btn-export-no" data-id="${item.id}">导出领取信息
|
|
|
</button>
|
|
|
<a class="btn btn-danger btn-update" href="/admin/coupon/update?id=${item.id}">修改</a>
|
|
|
<a class="btn btn-info btn-update" href="/admin/coupon/update?id=${item.id}">修改</a>
|
|
|
` + status + `
|
|
|
<a class="btn btn-danger btn-delete" data-id="${item.id}">删除</a>
|
|
|
</td>
|
|
|
</tr>`;
|
...
|
...
|
@@ -108,7 +115,6 @@ function bind_table_pagination() { |
|
|
$('.btn-delete').click(function() {
|
|
|
let id = $(this).attr('data-id');
|
|
|
|
|
|
console.log(id);
|
|
|
$.ajax({
|
|
|
url: '/admin/api/coupon/delete?id=' + id,
|
|
|
method: 'get',
|
...
|
...
|
@@ -124,9 +130,34 @@ function bind_table_pagination() { |
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$('.btn-status').click(function() {
|
|
|
$.ajax({
|
|
|
url: '/admin/api/coupon/modify',
|
|
|
method: 'post',
|
|
|
data: {
|
|
|
id: $(this).attr('data-id'),
|
|
|
status: parseInt($(this).attr('data-status'))
|
|
|
},
|
|
|
success: function() {
|
|
|
window.location.reload();
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
};
|
|
|
|
|
|
$('.dropdown-menu li').click(function() {
|
|
|
let status = $(this).attr('data-status');
|
|
|
|
|
|
if (status) {
|
|
|
statusParam = parseInt(status);
|
|
|
} else {
|
|
|
statusParam = null;
|
|
|
}
|
|
|
$('#dropdown-toggle-txt').text($(this).text() + ' ');
|
|
|
fetchRender(1, 20);
|
|
|
});
|
|
|
|
|
|
fetchRender(1, 20);
|
|
|
}
|
...
|
...
|
|