mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
获取用户折扣
This commit is contained in:
parent
e186a8dcfa
commit
00470fe6cd
@ -194,6 +194,21 @@ class Order extends Auth
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户折扣
|
||||
*/
|
||||
public function discount()
|
||||
{
|
||||
$data = $this->_vali(['discount_id.require' => '折扣编号不能为空!']);
|
||||
[$map, $rate] = [['status' => 1, 'deleted' => 0, 'id' => $data['discount_id']], 100.00];
|
||||
if ($discount = $this->app->db->name('DataUserDiscount')->where($map)->value('items')) {
|
||||
foreach (json_decode($discount, true) as $vo) if ($vo['level'] == $this->user['vip_code']) {
|
||||
$rate = round($vo['discount']);
|
||||
}
|
||||
}
|
||||
$this->success('获取用户折扣', ['rate' => $rate]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟计算订单运费
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
|
@ -120,7 +120,7 @@
|
||||
{if $g.vip_entry > 0 and $g.vip_upgrade > $g.vip_code}
|
||||
[ <b class="color-red">VIP{$g.vip_code}</b> <span class="layui-icon font-s10 color-blue"></span> <b class="color-red">VIP{$g.vip_upgrade}</b> ]
|
||||
{else}
|
||||
[ <b class="color-blue">VIP{$g.vip_code}</b> ]
|
||||
[ <b class="color-text">VIP{$g.vip_code}</b> ]
|
||||
{/if}
|
||||
{if $g.discount_rate < 100.00}
|
||||
<b class="color-blue">享{$g.discount_rate+0}%折扣</b><span class="color-red"> x </span>
|
||||
|
Loading…
x
Reference in New Issue
Block a user