master
wangxinglong 2022-03-16 11:58:34 +08:00
parent 793b5651bd
commit c6227b08d1
3 changed files with 58 additions and 8 deletions

View File

@ -4,6 +4,7 @@
namespace app\controller\manager;
use app\model\CommentRule;
use app\model\CouponMain;
use Exception;
use think\exception\ValidateException;
use think\facade\Config as CConfig;
@ -207,6 +208,7 @@ class Config extends Base
} else {
CConfig::load('extra/distribution_proportion', 'distributionProportion');
$this->data['item'] = config('distributionProportion');
$this->data['minPrice'] = CouponMain::min_redpack_money;
return $this->view();
}
}
@ -234,6 +236,7 @@ class Config extends Base
} else {
CConfig::load('extra/distribution_proportion_user', 'distributionProportionUser');
$this->data['item'] = config('distributionProportionUser');
$this->data['minPrice'] = CouponMain::min_redpack_money;
return $this->view();
}
}

View File

@ -10,7 +10,7 @@
<div class="layui-form-item">
<label class="layui-form-label">渠道商占比(%)</label>
<div class="layui-input-block">
<input class="layui-input" type="number" name="agency" value="{$item.agency ?? 0}"/>
<input class="layui-input" type="number" id="agency" onblur="jsPrice()" name="agency" value="{$item.agency ?? 0}"/>
</div>
</div>
</div>
@ -20,7 +20,7 @@
<div class="layui-form-item">
<label class="layui-form-label">平台占比(%)</label>
<div class="layui-input-block">
<input class="layui-input" type="number" name="admin" value="{$item.admin ?? 0}"/>
<input class="layui-input" type="number" id="admin" onblur="jsPrice()" name="admin" value="{$item.admin ?? 0}"/>
</div>
</div>
</div>
@ -30,11 +30,15 @@
<div class="layui-form-item">
<label class="layui-form-label">消费者占比(%)</label>
<div class="layui-input-block">
<input class="layui-input" type="number" name="consumer" value="{$item.consumer ?? 0}"/>
<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">
@ -44,4 +48,24 @@
</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 < consumer) {
$("#price").text( {$minPrice}+"*"+"(100/"+agency+")" +"="+({$minPrice}*(100/agency)));
}else{
$("#price").text( {$minPrice}+"*"+"(100/"+consumer+")" +"="+({$minPrice}*(100/consumer)));
}
}
jsPrice();
</script>

View File

@ -10,7 +10,7 @@
<div class="layui-form-item">
<label class="layui-form-label">平台占比(%)</label>
<div class="layui-input-block">
<input class="layui-input" type="number" name="admin" value="{$item.admin ?? 0}"/>
<input class="layui-input" type="number" id="admin" name="admin" onblur="jsPrice()" value="{$item.admin ?? 0}"/>
</div>
</div>
</div>
@ -20,7 +20,7 @@
<div class="layui-form-item">
<label class="layui-form-label">(领券)分销者占比(%)</label>
<div class="layui-input-block">
<input class="layui-input" type="number" name="distribution" value="{$item.distribution ?? 0}"/>
<input class="layui-input" type="number" id="distribution" onblur="jsPrice()" name="distribution" value="{$item.distribution ?? 0}"/>
</div>
</div>
</div>
@ -29,10 +29,13 @@
<div class="layui-form-item">
<label class="layui-form-label">(核销)被分销者占比(%)</label>
<div class="layui-input-block">
<input class="layui-input" type="number" name="distributed" value="{$item.distributed ?? 0}"/>
<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>
@ -43,4 +46,24 @@
</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 (distributed < distribution) {
$("#price").text( {$minPrice}+"*"+"(100/"+distributed+")" +"="+({$minPrice}*(100/distributed)));
}else{
$("#price").text( {$minPrice}+"*"+"(100/"+distribution+")" +"="+({$minPrice}*(100/distribution)));
}
}
jsPrice();
</script>