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.
 
 
 
 
 
 

163 lines
6.5 KiB

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<!--#include file="/widget/head.html"-->
<style>
.layui-form-label {
width: 120px !important;
}
#mdiv .layui-form-item {
margin-bottom: 5px !important;
}
.layui-tab-card > .layui-tab-title {
background-color: #009688 !important;
}
.none {
cursor: not-allowed !important;
}
</style>
</head>
<body>
<div id="wrapper">
<!-- <input type="file" id="imgfile" method="post" onchange="ToBase64()" enctype="multipart/form-data" style="display:none;"> -->
<!-- Navigation -->
<form class="layui-form" lay-filter="mform" action="" id="form">
<div id="mdiv">
<div id="djdiv">
<div class="form-group" data-id="djdiv">
<div class="layui-form-item" data-id="djdiv1" data-djdiv="djdiv">
<label class="layui-form-label">道具</label>
<div class="layui-input-inline" style="width:180px;">
<select class="layui-form-se3l" data-id="itemid" id="item1">
<option value="-1">-----请选择-----</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">人名币:</label>
<div class="layui-input-inline" style="width:180px;">
<input type="number" name="CN" value="0" lay-verify="number" data-id="CN" id="CN" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">日元:</label>
<div class="layui-input-inline" style="width:180px;">
<input type="number" name="JP" value="0" lay-verify="number" data-id="JP" id="JP" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">韩元:</label>
<div class="layui-input-inline" style="width:180px;">
<input type="number" name="KR" value="0" lay-verify="number" data-id="KR" id="KR" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">美元:</label>
<div class="layui-input-inline" style="width:180px;">
<input type="number" name="EN" value="0" lay-verify="number" data-id="EN" id="EN" autocomplete="off"
class="layui-input">
</div>
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button type="submit" class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</form>
<script >
$(function () {
sub_Exchange()
Load_ItemList();
});
var itemList;
function Load_ItemList() {
$.get(Page.SvrIp + "/api/select_itemlist",
{ token: cookie.get("token") }
, function (d) {
itemList = d.data;
AddItemList("item1");
});
}
function AddItemList(uiId){
var data =new Array();
$('#'+uiId).html('');
for (let [key, value] of Object.entries(itemList)) {
data.push({id:key,text:value})
$('#'+uiId).append('<option value="'+key+'">'+value+'</option>');
}
layui.form.render('select');
}
function sub_Exchange() {
layui.form.on('submit(formDemo)', function (data) {
console.info(data);
data.field.token = cookie.get("token");
var ItemId=$("#item1").select().val();
var cnCost=$("#CN").val();
var krCost=$("#KR").val();
var jpCost=$("#JP").val();
var enCost=$("#EN").val();
debugger;
data.field.itemId = ItemId;
data.field.cnCost = cnCost;
data.field.krCost = krCost;
data.field.jpCost = jpCost;
data.field.enCost = enCost;
$.ajax({
type: "get",
url: Page.SvrIp + "/api/insert_item_cost",
data: data.field,
dataType: "json",
success: function (d) {
alert(d.msg);
if (d.ret == 0) {
parent.layer.close(parent.layer.getFrameIndex(window.name));
parent.location.reload();
}
},
error: function (status) {
//alert("保存失败");
console.dir(status)
parent.layer.close(parent.layer.getFrameIndex(window.name));
parent.location.reload();
}
});
return false;
})
}
</script>
</body>
</html>
<script type="text/javascript" src="../js/template-web.js"></script>
<script type="text/javascript" src="../js/notice/xm-select.js"></script>
<!-- <link href="../bower_components/select2/select2.min.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../bower_components/select2/select2.min.js"></script> -->