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.
 
 
 
 
 
 

186 lines
7.8 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 class="demo-login-container" id="mdiv">
<div class="form-group" data-id="djdiv">
<!-- <div class="layui-form-item">
<label class="layui-form-label">验证必填项</label>
<div class="layui-input-block">
<input type="text" name="username" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div> -->
<div class="layui-form-item" data-id="djdiv1" data-djdiv="djdiv">
<label class="layui-form-label">礼包ID</label>
<div class="layui-input-inline" >
<div data-id="itemid" class="xm-select-demo" xm-select="item1" id="item1" lay-filter="select2">
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">uid:</label>
<div class="layui-input-inline" >
<input type="number" name="uid" lay-verify="number" data-id="uid" id="uid" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">区服:</label>
<div class="layui-input-inline" >
<input type="text" name="realm"lay-verify="text" data-id="realm" id="realm" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">用户名称:</label>
<div class="layui-input-inline" >
<input type="text" name="owner" lay-verify="owner" data-id="owner" id="owner" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">部门:</label>
<div class="layui-input-inline">
<input type="text" name="dep" lay-verify="dep" data-id="dep" id="dep" autocomplete="off" class="layui-input">
</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_paydiamond",
{ token: cookie.get("token") }
, function (d) {
itemList = d.data;
console.dir(itemList);
AddItemList("item1");
});
}
let xmsw;
function AddItemList(uiId){
var data =new Array();
for (let [key, value] of Object.entries(itemList)) {
data.push({value:key,name:value+"_"+key})
}
xmsw=xmSelect.render({
el: '#'+uiId,
name: 'options',
data: data,
autoRow: true,
filterable: true,
height: '250px',
});
}
function sub_Exchange() {
layui.form.on('submit(formDemo)', function (data) {
console.info(data);
var loadIndex = parent.layer.msg('请稍等', {
icon: 16,
shade: 0.01
});;
data.field.token = cookie.get("token");
debugger;
let ItemId=[];
selectIds=xmsw.getValue();
selectIds.map(function(d){
ItemId.push(d.value)
})
if (ItemId == null || ItemId.length == 0 || ItemId.length > 15) {
parent.layer.msg("奖励配置错误,1-15个")
parent.layer.close(loadIndex);
return;
}
console.dir(ItemId.toString());
var owner=$("#owner").val();
var dep=$("#dep").val();
var realm=$("#realm").val();
var uid=$("#uid").val();
if(uid==""){
parent.layer.msg("uid错误")
parent.layer.close(loadIndex);
return ;
}
debugger;
data.field.itemId = ItemId.toString();
data.field.owner = owner;
data.field.uid = uid;
data.field.dep = dep;
data.field.realm = realm;
$.ajax({
type: "get",
url: Page.SvrIp + "/api/add_payment",
data: data.field,
dataType: "json",
success: function (d) {
parent.layer.msg(d.msg);
parent.layer.close(loadIndex);
if (d.code == 0) {
parent.layer.close(parent.layer.getFrameIndex(window.name));
parent.location.reload();
}
},
error: function (status) {
//alert("保存失败");
console.dir(status)
parent.layer.close(loadIndex);
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>