修团队返利

This commit is contained in:
邹景立 2021-04-15 15:58:38 +08:00
parent 396e3f0ef9
commit 689facfb98
2 changed files with 36 additions and 12 deletions

View File

@ -262,11 +262,16 @@ class RebateService extends Service
$key = "{$this->user['vip_code']}";
$map = ['type' => self::PRIZE_03, 'order_no' => $this->order['order_no'], 'order_uid' => $this->order['uid']];
if ($this->config("direct_state_vip_{$key}") && $this->app->db->name($this->table)->where($map)->count() < 1) {
$rate = $this->config("direct_value_vip_{$key}");
$name = "{$this->name(self::PRIZE_03)},订单 {$rate}%";
$amount = floatval($rate * $this->order['rebate_amount'] / 100);
$value = $this->config("direct_value_vip_{$key}");
if ($this->config("direct_type_vip_{$key}") == 1) {
$val = floatval($value ?: '0.00');
$name = "{$this->name(self::PRIZE_03)},每人 {$val}";
} else {
$val = floatval($value * $this->order['rebate_amount'] / 100);
$name = "{$this->name(self::PRIZE_03)},订单 {$value}%";
}
// 写入返利记录
$this->writeRabate($this->from1['id'], $map, $name, $amount);
$this->writeRabate($this->from1['id'], $map, $name, $val);
}
return true;
}
@ -285,11 +290,16 @@ class RebateService extends Service
$key = "{$this->user['vip_code']}";
$map = ['type' => self::PRIZE_04, 'order_no' => $this->order['order_no'], 'order_uid' => $this->order['uid']];
if ($this->config("indirect_state_vip_{$key}") && $this->app->db->name($this->table)->where($map)->count() < 1) {
$rate = $this->config("indirect_value_vip_{$key}");
$name = "{$this->name(self::PRIZE_04)},订单 {$rate}%";
$amount = floatval($rate * $this->order['rebate_amount'] / 100);
$value = $this->config("indirect_value_vip_{$key}");
if ($this->config("indirect_type_vip_{$key}") == 1) {
$val = floatval($value ?: '0.00');
$name = "{$this->name(self::PRIZE_03)},每人 {$val}";
} else {
$val = floatval($value * $this->order['rebate_amount'] / 100);
$name = "{$this->name(self::PRIZE_03)},订单 {$value}%";
}
// 写入返利记录
$this->writeRabate($this->from2['id'], $map, $name, $amount);
$this->writeRabate($this->from2['id'], $map, $name, $val);
}
return true;
}

View File

@ -183,10 +183,17 @@
{/if}
</legend>
<div class="layui-form-item">
{php} $key = 'direct_type_vip_'.$level['number']; {/php}
{php} $data[$key] = $data[$key] ?? 1; {/php}
{foreach [1 => '奖励固定金额 / 每单',2 => '按订单参与的返利金额比例'] as $k => $v}
{if isset($data[$key]) and $data[$key] eq $k}
<input checked class="layui-input" name="{$key}" title="{$v}" type="radio" value="{$k}">
{else}
<input class="layui-input" name="{$key}" title="{$v}" type="radio" value="{$k}">
{/if}{/foreach}
{php} $key = 'direct_value_vip_'.$level['number']; {/php}
<input class="layui-input" name="direct_type_vip_{$level.number}" type="hidden" value="2">
<label class="block nowrap">
<span class="color-blue"><b>请输入团队业绩金额比例</b> 如:比例填写 10.00 表示 10.00% </span>
<span class="color-blue"><b>请输入奖励金额或返利金额比例</b> 如:比例填写 10.00 表示 10.00% 10.00 </span>
<input class="layui-input" data-blur-number="4" name="{$key}" placeholder="请输入奖励金额或返利金额比例" type="text" value="{$data[$key]??'0.0000'}">
</label>
</div>
@ -205,10 +212,17 @@
{/if}
</legend>
<div class="layui-form-item nowrap">
{php} $key = 'indirect_type_vip_'.$level['number']; {/php}
{php} $data[$key] = $data[$key] ?? 1; {/php}
{foreach [1 => '奖励固定金额 / 每单',2 => '按订单参与的返利金额比例'] as $k => $v}
{if isset($data[$key]) and $data[$key] eq $k}
<input checked class="layui-input" name="{$key}" title="{$v}" type="radio" value="{$k}">
{else}
<input class="layui-input" name="{$key}" title="{$v}" type="radio" value="{$k}">
{/if}{/foreach}
{php} $key = 'indirect_value_vip_'.$level['number']; {/php}
<input class="layui-input" name="indirect_type_vip_{$level.number}" type="hidden" value="2">
<label class="block">
<span class="color-blue"><b>请输入团队业绩金额比例</b> 如:比例填写 10.00 表示 10.00% </span>
<span class="color-blue"><b>请输入奖励金额或返利金额比例</b> 如:比例填写 10.00 表示 10.00% 10.00 </span>
<input class="layui-input" data-blur-number="4" name="{$key}" placeholder="请输入奖励金额或返利金额比例" type="text" value="{$data[$key]??'0.0000'}">
</label>
</div>