...
|
...
|
@@ -9,7 +9,9 @@ function bind_table_pagination() { |
|
|
const $up = $('.coupon-pagination');
|
|
|
|
|
|
let uploadFn = function() {
|
|
|
let $form = $('#uploadForm')[0];
|
|
|
let id = $(this).data('id');
|
|
|
let $form = $('#uploadForm_' + id)[0];
|
|
|
|
|
|
let formData = new FormData($form);
|
|
|
|
|
|
formData.append('id', $(this).data('id'));
|
...
|
...
|
@@ -22,8 +24,12 @@ function bind_table_pagination() { |
|
|
cache: false,
|
|
|
processData: false,
|
|
|
contentType: false,
|
|
|
success: function() {
|
|
|
alert('导入成功');//eslint-disable line
|
|
|
success: function(data) {
|
|
|
if (!data.result) {
|
|
|
alert(data.message);
|
|
|
} else {
|
|
|
alert('导入成功');// eslint-disable line
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -58,23 +64,23 @@ function bind_table_pagination() { |
|
|
}
|
|
|
html += `
|
|
|
<tr class="even pointer">
|
|
|
<td class="">${item.id}</td>
|
|
|
<td class="">${item.id}</td>1
|
|
|
<td class="">${item.couponName}</td>
|
|
|
<td class="">${item.couponDesc}</td>
|
|
|
<td class="">${item.shopName}</td>
|
|
|
<td class=""><img src="${item.shopLogoUrl}" width="100%"/></td>
|
|
|
<td class=""><img src="${item.shopLogoUrl}" width="100" height="50"/></td>
|
|
|
<td class="">${item.statusText}</td>
|
|
|
<td class="">${item.typeText}</td>
|
|
|
<td class="">${item.sort}</td>
|
|
|
<td class="">${item.createTime}</td>
|
|
|
<td class="">
|
|
|
<form id="uploadForm" enctype="multipart/form-data">
|
|
|
<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">
|
|
|
<button type="button" class="btn btn-danger btn-import" style="display: inline-block;" data-id="${item.id}">导入券码</button>
|
|
|
</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>
|
|
|
<a class="btn btn-danger btn-update" href="/admin/coupon/update?id=${item.id}">修改</a>
|
|
|
<a class="btn btn-danger btn-delete" data-id="${item.id}">删除</a>
|
|
|
</td>
|
|
|
</tr>`;
|
|
|
});
|
...
|
...
|
@@ -98,6 +104,26 @@ function bind_table_pagination() { |
|
|
window.location = '/admin/api/coupon/downloadNo?id=' + id;
|
|
|
});
|
|
|
$('.btn-import').on('click', uploadFn);
|
|
|
|
|
|
$('.btn-delete').click(function() {
|
|
|
let id = $(this).attr('data-id');
|
|
|
|
|
|
console.log(id);
|
|
|
$.ajax({
|
|
|
url: '/admin/api/coupon/delete?id=' + id,
|
|
|
method: 'get',
|
|
|
cache: false,
|
|
|
processData: false,
|
|
|
contentType: false,
|
|
|
success: function(data) {
|
|
|
if (!data.result) {
|
|
|
alert(data.message);
|
|
|
} else {
|
|
|
window.location.reload();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
|