coupon-admin/view/manager/config/distribution_proportion_use...

78 lines
3.4 KiB
HTML

{layout name="manager/layout" /}
<div class="layuimini-container location-operate-page">
<div class="layuimini-main">
<div class="layui-form layuimini-form">
<fieldset class="layui-elem-field layui-field-title site-title">
<legend><a name="compatibility">请填写完整整数 总和为100</a></legend>
</fieldset>
<div class="layui-form-itemBox2 between-center">
<div class="layui-form-item">
<label class="layui-form-label">平台占比(%)</label>
<div class="layui-input-block">
<input class="layui-input" type="number" id="admin" name="admin" onblur="jsPrice()" value="{$item.admin ?? 0}"/>
</div>
</div>
</div>
<div class="layui-form-itemBox2 between-center">
<div class="layui-form-item">
<label class="layui-form-label">分销者占比(%)</label>
<div class="layui-input-block">
<input class="layui-input" type="number" id="distribution" onblur="jsPrice()" name="distribution" value="{$item.distribution ?? 0}"/>
</div>
</div>
</div>
<div class="layui-form-itemBox2 between-center">
<div class="layui-form-item">
<label class="layui-form-label">消费者占比(%)</label>
<div class="layui-input-block">
<input class="layui-input" type="number" id="distributed" onblur="jsPrice()" name="distributed" value="{$item.distributed ?? 0}"/>
</div>
</div>
</div>
<fieldset class="layui-elem-field layui-field-title site-title">
<legend>红包金额最小{$minPrice}元 当前比例最小扣除金额 : <span id="price"> </span></legend>
</fieldset>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn layui-btn-normal" data-url="/manager/config/distribution-proportion-user" lay-submit lay-filter="saveConfig">确认保存</button>
</div>
</div>
</div>
</div>
</div>
<script src="__STATIC__/js/jquery-3.3.1.js"></script>
<script>
function jsPrice() {
let distributed = $("#distributed").val() * 1;
let distribution = $("#distribution").val() * 1;
let admin_p = $("#admin").val() * 1;
if((distributed + distribution +admin_p ) != 100 ){
$("#price").text(0);
return false;
}
if(distribution>0 && distributed>0){
if (distribution < distributed) {
$("#price").text( {$minPrice}+"*"+"(100/"+distribution+")" +"="+({$minPrice}*(100/distribution)));
}else{
$("#price").text( {$minPrice}+"*"+"(100/"+distributed+")" +"="+({$minPrice}*(100/distributed)));
}
}else if(distribution>0){
$("#price").text( {$minPrice}+"*"+"(100/"+distribution+")" +"="+({$minPrice}*(100/distribution)));
}
else if(distributed>0){
$("#price").text( {$minPrice}+"*"+"(100/"+distributed+")" +"="+({$minPrice}*(100/distributed)));
}
else{
$("#price").text(0);
}
}
jsPrice();
</script>