<!DOCTYPE html>
|
<html class="x-admin-sm">
|
|
<head>
|
<meta charset="UTF-8">
|
<title>固定红包设置</title>
|
<meta name="renderer" content="webkit">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta name="viewport"
|
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
<link rel="stylesheet" href="./css/font.css">
|
<link rel="stylesheet" href="./css/xadmin.css">
|
<script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
|
<script type="text/javascript" src="./js/xadmin.js"></script>
|
<script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script>
|
<script src="js/http.js" type="text/javascript" charset="utf-8"></script>
|
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
<!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
|
<!--[if lt IE 9]>
|
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
|
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
<script src="js/common.js"></script>
|
<![endif]-->
|
<style>
|
.layui-form-label {
|
width: 150px;
|
padding-top: 0;
|
font-size: 14px;
|
}
|
|
input[type=text] {
|
width: 100px;
|
margin-top: 5px;
|
}
|
|
.desc {
|
color: #999;
|
padding-bottom: 5px;
|
}
|
|
.layui-btn-fluid {
|
max-width: 200px;
|
}
|
|
|
</style>
|
</head>
|
<body>
|
<div class="layui-fluid">
|
<div class="layui-row">
|
<form class="layui-form">
|
|
<div class="layui-form-item">
|
<label class="layui-form-label">
|
当前账户余额:</label>
|
<div class="layui-input-inline">
|
<span style="font-size: 16px;"> {{balance}}元</span>
|
<a style="float: right;" class="layui-btn">充值</a>
|
</div>
|
</div>
|
|
<div class="layui-form-item">
|
<label class="layui-form-label">
|
<span class="x-red">*</span>总金额</label>
|
<div class="layui-input-inline">
|
<label class="desc">可被中奖用户获得的金额总和上限,且需要提前预充值以保障用户权益</label>
|
<input type="text" name="total" required="" lay-verify="number"
|
autocomplete="off" class="layui-input" v-model="total" placeholder="请输入总金额">
|
</div>
|
</div>
|
|
|
<div class="layui-form-item">
|
<label class="layui-form-label">
|
<span class="x-red">*</span>份数</label>
|
<div class="layui-input-inline">
|
<label class="desc">可获得此奖项的最高人数,平均值不能低于0.01元</label>
|
|
<input type="text" name="count" v-model="count" required="" lay-verify="integer"
|
autocomplete="off" class="layui-input" placeholder="请输入正整数">
|
</div>
|
</div>
|
|
|
<div class="layui-form-item">
|
<label for="L_name" class="layui-form-label">
|
中奖金额</label>
|
<div class="layui-input-inline">
|
<label style="font-size: 14px;color: black">
|
{{total}}元÷{{count}}份={{result}}元/份
|
</label>
|
</div>
|
</div>
|
|
<button id="add" style="display: none" class="layui-btn layui-btn-primary layui-btn-fluid" lay-filter="add"
|
lay-submit="">确定
|
</button>
|
</form>
|
</div>
|
</div>
|
<script src="js/common.js"></script>
|
<script src="js/http.js"></script>
|
<script>
|
var listener;
|
|
function submit(callback) {
|
listener = callback;
|
$("#add").click();
|
}
|
|
|
var app = new Vue({
|
el: '.layui-form',
|
data: {
|
total: "",
|
count: "",
|
result: "",
|
balance: 0,
|
},
|
created: function () {
|
var $this = this;
|
var data = JSON.parse(decodeURIComponent(common.getQueryString("data")));
|
this.total = data.total;
|
this.count = data.count;
|
setTimeout(function () {
|
app.render();
|
});
|
|
ksapp.post("/admin/sponsor/getBalance", {}, function (res) {
|
if (res.code == 0) {
|
$this.balance = res.data.balance;
|
}
|
}, null);
|
|
},
|
watch: {
|
total: function (e) {
|
console.log(e);
|
if (app.total && app.count) {
|
app.result = Math.floor(app.total * 100 / app.count) / 100;
|
}
|
},
|
count: function (e) {
|
if (app.total && app.count) {
|
app.result = Math.floor(app.total * 100 / app.count) / 100;
|
}
|
}
|
},
|
methods: {
|
getAppList: function () {
|
ksapp.post("/admin/api/app/list", {page: 1, limit: 100}, function (e) {
|
if (e.code == 0) {
|
app.appList = e.data.data;
|
} else
|
layer.msg(e.msg);
|
}, function (e) {
|
});
|
},
|
render: function () {
|
console.log("render")
|
layui.use(['form', 'layer', 'jquery'], function () {
|
$ = layui.jquery;
|
var form = layui.form,
|
layer = layui.layer;
|
common.initLayuiForm(form);
|
|
//监听提交
|
form.on('submit(add)',
|
function (data) {
|
listener(data.field);
|
return false;
|
});
|
|
});
|
}
|
}
|
});
|
|
|
</script>
|
</body>
|
|
</html>
|