You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

221 lines
7.2 KiB

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<!--#include file="/widget/head.html"-->
<script type="text/javascript" src="../js/template-web.js"></script>
</head>
<body class="layui-layout-body" layadmin-themealias="default">
<div id="wrapper">
<!--#include file="/widget/nav.html"-->
<div id="page-wrapper" class="layui-body layadmin-tabsbody-item layui-show layui-fluid layui-row layui-col-space15" >
<div class="layui-card" id="card-page-wrapper">
<div class="row">
<div class="container" style="margin-right: 500px">
<div class="col-md-2">
<button type="button" class="layui-btn" id="add">添加</button>
</div>
</div>
</div>
<div class="row table-responsive" id="form" style="width:90%">
<table class="table table-striped table-bordered table-hover inline" id="hero_table">
</table>
<div id="test1"></div>
</div>
</div>
<label style="color:blue;">关闭</label>
</div>
</div>
<script id="btn" type="text/template">
<div style="width:80px;">
{{if Status==2}}
<input type="button" class="layui-btn layui-btn-xs" style="background-color:red;" value="开启" onclick="delnotice({{Id}},'{{ExchangeCode}}',1)" />
{{else}}
<input type="button" class="layui-btn layui-btn-xs" style="background-color:green;" value="禁用" onclick="delnotice({{Id}},'{{ExchangeCode}}',2)" />
{{/if}}
</div>
</script>
<!--#include file="/widget/tail.html"-->
<script type="text/javascript">
var m_limit = 0;
function FilterData() {
console.info(exchange_data);
var State = Number($('input[name="State"]:checked').val());
var Status = Number($('input[name="Status"]:checked').val());
var _exchange_data = exchange_data.concat();
if (State == 0 && Status == 0) {
_exchange_data = _exchange_data.filter(f => 1 == 1);
}
else {
if (State != 0) {
_exchange_data = _exchange_data.filter(f => f.State == State);
}
if (Status != 0) {
_exchange_data = _exchange_data.filter(f => f.Status == Status);
}
}
console.info(_exchange_data);
inihero_table(_exchange_data, m_limit);
}
function delnotice(id, text, status) {
var dotext = status == 2 ? "关闭" : "启用";
if (confirm("确定" + dotext + "《" + text + "》兑换码吗?")) {
$.get(Page.SvrIp + "/api/DoDisable_exchange", {
token: cookie.get("token"),
Id: id,
Status: status
}, function (data) {
if (data.ret == 0) {
alert(dotext + "成功!");
location.reload();
}
});
}
}
$("#add").click(function () {
opennotice(0);
});
function opennotice(id) {
var title = "";
if (id == 0) {
title = "添加";
} else {
title = "编辑";
}
layer.open({
content: `/pages/EditItemCost.html?id=${id}`,
type: 2,
title: title,
area: ['500px', '450px']
});
}
var herotable;
var exchange_data;
function ini_page(data) {
layui.laypage.render({
elem: 'test1',
count: data.count,
limits: [10, 20, 30, 40, 50, 80, 100],
limit: 20,
layout: ["count", "prev", "page", "next", "limit", "skip"],
jump: function (obj, first) {
if (!first) {
Select_data(obj.curr, obj.limit, 0);
}
}
});
}
function inihero_table(data, limit) {
m_limit = limit;
console.info(data);
herotable = layui.table.render({
elem: '#hero_table',
page: false,
data: data,
width: 1500,
height: 1200,
autoSort: true,
limit: limit,
cols: [[
{ field: 'itemId', title: 'itemId', sort: true, width: 120 },
{ field: 'name', title: 'name', sort: true, width: 280 },
{ field: 'jp', title: '日元', sort: true, width: 100 },
{ field: 'kr', title: '韩元', sort: true, width: 100 },
{ field: 'cn', title: '人名币', sort: true, width: 120 },
{ field: 'en', title: '美元', sort: true, width: 120 },
{
field: '*', title: '编辑', width: 120, templet: function (d) {
return template("btn", d);
}
}
]]
});
}
function getLocalTime(nS) {
return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/, ' ');
}
function Select_data(page, limit, first) {
$.ajax({
type: "GET",
url: Page.SvrIp + "/api/select_item_cost",
data: {
token: cookie.get("token"),
page: page,
limit: limit
},
dataType: "json",
beforeSend: function () {
layer.load(1, { shade: [0.8, '#393D49'] });
},
complete: function () {
layer.closeAll('loading');
},
success: function (d) {
console.dir(d);
debugger;
exchange_data =d.data; //JSON.parse(d.data);
inihero_table(exchange_data, limit);
if (first === 1) {
ini_page(d);
}
}
});
}
$(function () {
initPage('道具价值信息');
Select_data(1, 20, 1);
Load_ItemList();
});
var itemList;
function Load_ItemList() {
$.get(Page.SvrIp + "/api/select_itemlist",
{ token: cookie.get("token") }
, function (d) {
itemList = d.data;
});
}
$(window).load(function () {
var c = document.getElementById("exchange");
c.parentNode.setAttribute("class", "gray");
c.parentNode.parentNode.parentNode.setAttribute("class", "active")
c.parentNode.parentNode.setAttribute("class", "nav nav-second-level collapse in")
var b = c.parentNode.parentNode.parentNode.children[0].children[1];
})
</script>
<script src="../js/coupon.js"></script>
</body>
</html>