coupon-admin/view/manager/config/distribution_proportion.html

81 lines
3.3 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="agency" onblur="jsPrice()" name="agency" value="{$item.agency ?? 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="admin" onblur="jsPrice()" name="admin" 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="consumer" onblur="jsPrice()" name="consumer" value="{$item.consumer ?? 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" 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 agency = $("#agency").val() * 1;
let consumer = $("#consumer").val() * 1;
let admin_p = $("#admin").val() * 1;
if((admin_p + consumer +agency ) !=100){
$("#price").text(0);
return false;
}
if(agency>0 && consumer>0){
if (agency < consumer) {
$("#price").text( {$minPrice}+"*"+"(100/"+agency+")" +"="+({$minPrice}*(100/agency)));
}else{
$("#price").text( {$minPrice}+"*"+"(100/"+consumer+")" +"="+({$minPrice}*(100/consumer)));
}
}else if(agency>0){
$("#price").text( {$minPrice}+"*"+"(100/"+agency+")" +"="+({$minPrice}*(100/agency)));
}
else if(consumer>0){
$("#price").text( {$minPrice}+"*"+"(100/"+consumer+")" +"="+({$minPrice}*(100/consumer)));
}
else{
$("#price").text(0);
}
}
jsPrice();
</script>