2023-01-29 10:26:52 +08:00

83 lines
2.9 KiB
HTML

{extend name="public/base" /}
{block name="body"}
<style>
.clinhei{width:100%;height:20px;}
</style>
<div class="main-box-body clearfix">
<a href="{:url('bookcode/add')}"><button type="button" class="btn btn-primary">添加书币卷</button></a>
<table class="table">
<thead>
<tr>
<th style="text-align: center;">ID</th>
<th style="text-align: center;">书币</th>
<th style="text-align: center;">下载领卷码</th>
<th style="text-align: center;">创建时间</th>
<th style="text-align: center;">操作</th>
</tr>
</thead>
<tbody>
{volist name="data" id="v"}
<tr style="background: #fff;box-shadow: 2px 2px 2px#A0A4A7;">
<td style="text-align: center;font-weight:bold;">{$v.id}</td>
<td style="color: red;text-align: center;">{$v.money}</td>
<td>
<a href="{$v.code}" download="{$v.id}-{$v.money}.png" style="text-decoration: none">
<button type="button" class="btn btn-primary" style="display: block;margin:0 auto;">保存到本地</button>
</a>
</td>
<td style="color: seagreen;text-align: center;">{$v.addtime|date='Y-m-d H:i:s',###}</td>
<td style="text-align: center;"><button type="button" class="btn btn-danger" style="display: block;margin:0 auto;" onclick="del('{$v.id}')">删除</button></td>
</tr>
{/volist}
</tbody>
</table>
</div>
{/block}
{block name="script"}
<script>
function del(id){
swal({
title: '删除?',
text: "",
type: 'warning',
buttons:{
confirm: {
text : '确认',
className : 'btn btn-success'
},
cancel: {
text : '关闭',
visible: true,
className: 'btn btn-danger'
}
}
}).then((Delete) => {
if (Delete) {
$.ajax({
type: "POST",
url:"{:url('bookcode/del')}",
data: {id:id},
dataType:"json",
success: function(data) {
if(data.status==1){
swal('删除成功',"", {icon : "success",buttons:{confirm:{className : 'btn btn-success'}},});
setTimeout(function(){ window.location = ""; }, 1500);
}else{
swal('错误',data.reg, {icon : "error",buttons:{confirm:{className : 'btn btn-danger'}},});
}
}
});
} else {
//关闭执行
swal.close();
}
});
}
</script>
{/block}