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.
149 lines
5.5 KiB
149 lines
5.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">
|
|
|
|
<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="number" value="0" lay-verify="number" data-id="number" id="number" autocomplete="off" class="layui-input">
|
|
</div>
|
|
</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 >
|
|
var uid;
|
|
window.addEventListener('message', function(event) {
|
|
// 获取传递的数据
|
|
var data = event.data;
|
|
uid=data.data;
|
|
// 在控制台输出数据
|
|
console.log(data);
|
|
});
|
|
$(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 number=$("#number").val();
|
|
debugger;
|
|
var loadIndex = parent.layer.msg('请稍等', {
|
|
icon: 16,
|
|
shade: 0.01
|
|
});;
|
|
|
|
data.field.uid = uid;
|
|
data.field.itemId = ItemId;
|
|
data.field.value = number;
|
|
|
|
$.ajax({
|
|
type: "get",
|
|
url: Page.SvrIp + "/api/cost_bag_item",
|
|
data: data.field,
|
|
dataType: "json",
|
|
success: function (d) {
|
|
console.dir(d);
|
|
layer.close(loadIndex)
|
|
if (d.code == 0) {
|
|
parent.layer.msg("操作完成,请刷新")
|
|
}else{
|
|
let msg=d.msg;
|
|
if(msg==""||msg==null){
|
|
msg="操作完成"
|
|
}
|
|
parent.layer.msg(d.msg)
|
|
}
|
|
},
|
|
error: function (status) {
|
|
console.dir("11111");
|
|
console.dir(status);
|
|
layer.close(loadIndex)
|
|
parent.layer.msg("操作完成,请刷新")
|
|
}
|
|
});
|
|
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> -->
|