mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
修改返利记录
This commit is contained in:
parent
240903a8f1
commit
7a67cfe396
@ -13,6 +13,60 @@ use think\admin\Controller;
|
||||
class UserRebate extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 绑定数据表
|
||||
* @var string
|
||||
*/
|
||||
private $table = 'DataUserRebate';
|
||||
|
||||
/**
|
||||
* 用户返利记录
|
||||
* @auth true
|
||||
* @menu true
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->title = '用户返利记录';
|
||||
$query = $this->_query($this->table)->equal('type')->like('order_no,description');
|
||||
// 会员查询
|
||||
$db = $this->_query('DataUser')->like('nickname#order_nickname,phone#order_phone')->db();
|
||||
if ($db->getOptions('where')) $query->whereRaw("order_uid in {$db->field('id')->buildSql()}");
|
||||
// 代理查询
|
||||
$db = $this->_query('DataUser')->like('nickname#agent_nickname,phone#agent_phone')->db();
|
||||
if ($db->getOptions('where')) $query->whereRaw("uid in {$db->field('id')->buildSql()}");
|
||||
// 查询分页
|
||||
$query->dateBetween('create_at')->order('id desc')->page();
|
||||
}
|
||||
|
||||
/**
|
||||
* 商城订单列表处理
|
||||
* @param array $data
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
protected function _index_page_filter(array &$data)
|
||||
{
|
||||
$uids = array_merge(array_column($data, 'uid'), array_column($data, 'order_uid'));
|
||||
$userList = $this->app->db->name('DataUser')->whereIn('id', array_unique($uids))->select();
|
||||
$goodsList = $this->app->db->name('ShopOrderItem')->whereIn('order_no', array_unique(array_column($data, 'order_no')))->select();
|
||||
foreach ($data as &$vo) {
|
||||
[$vo['user'], $vo['agent'], $vo['list']] = [[], [], []];
|
||||
foreach ($goodsList as $goods) if ($goods['order_no'] === $vo['order_no']) {
|
||||
$vo['list'][] = $goods;
|
||||
}
|
||||
foreach ($userList as $user) if ($user['id'] === $vo['order_uid']) {
|
||||
$vo['user'] = $user;
|
||||
}
|
||||
foreach ($userList as $user) if ($user['id'] === $vo['uid']) {
|
||||
$vo['agent'] = $user;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返利奖励配置
|
||||
* @auth true
|
||||
|
68
app/data/view/user_rebate/index.html
Normal file
68
app/data/view/user_rebate/index.html
Normal file
@ -0,0 +1,68 @@
|
||||
{extend name="../../admin/view/main"}
|
||||
|
||||
{block name="content"}
|
||||
<div class="think-box-shadow">
|
||||
{include file='user_rebate/index_search'}
|
||||
<div class="layui-badge layui-bg-blue margin-top-10 margin-bottom-10">
|
||||
已产生总佣金 {$total.total|default=0.00} 元,已提现 {$total.used|default=0.00} 元,未提现 0 元
|
||||
</div>
|
||||
<table class="layui-table" lay-skin="line">
|
||||
{notempty name='list'}
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='list-table-check-td think-checkbox'>
|
||||
<label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
|
||||
</th>
|
||||
<th class="text-left nowrap" style="width:300px">代理会员</th>
|
||||
<th class="text-left nowrap" style="width:300px">交易会员</th>
|
||||
<th class='text-left nowrap'>订单信息</th>
|
||||
<th class='text-left nowrap'>商品信息</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{/notempty}
|
||||
<tbody>
|
||||
{foreach $list as $key=>$vo}
|
||||
<tr>
|
||||
<td class='list-table-check-td think-checkbox'>
|
||||
<label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
|
||||
</td>
|
||||
<td class="text-left nowrap relative">
|
||||
{notempty name='vo.agent.headimg'}
|
||||
<img data-tips-image style="width:auto;height:60px" src="{$vo.agent.headimg|default=''}" class="margin-right-5" alt="img">
|
||||
{/notempty}
|
||||
<div class="inline-block text-middle">
|
||||
代理昵称:{$vo.agent.nickname|default='--'}<br>
|
||||
代理手机:{$vo.agent.phone|default='--'}<br>
|
||||
代理等级:{notempty name='vo.agent.vip_code'}[ <b class="color-red">VIP{$vo.agent.vip_code}</b> ] <b class="color-red">{$vo.agent.vip_name}</b>{else}--{/notempty}
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-left nowrap relative">
|
||||
{notempty name='vo.user.headimg'}
|
||||
<img data-tips-image style="width:auto;height:60px" src="{$vo.user.headimg|default=''}" class="margin-right-5" alt="img">
|
||||
{/notempty}
|
||||
<div class="inline-block text-middle">
|
||||
会员昵称:{$vo.user.nickname|default='--'}<br>
|
||||
会员手机:{$vo.user.phone|default='--'}<br>
|
||||
会员级别:{notempty name='vo.user.vip_code'}[ <b class="color-red">VIP{$vo.user.vip_code}</b> ] <b class="color-red">{$vo.user.vip_name}</b>{else}--{/notempty}
|
||||
</div>
|
||||
</td>
|
||||
<td class='text-left nowrap'>
|
||||
订单单号:<span class="color-blue">{$vo.order_no|default='--'}</span><br>
|
||||
订单交易 <span class="color-blue">{$vo.order_amount+0}</span> 元获得收益 <span class="color-blue">{$vo.amount+0}</span> 元
|
||||
{notempty name='vo.description'}<span class="layui-badge layui-bg-blue margin-left-5">{$vo.description|default=''}</span>{/notempty}<br>
|
||||
返拥时间:<span class="color-blue">{$vo.create_at|format_datetime}</span><br>
|
||||
</td>
|
||||
<td class="text-left nowrap">
|
||||
{foreach $vo.list as $g}
|
||||
<div>{$g.goods_name|default=''} x{$g.stock_sales|default=0}</div>
|
||||
{/foreach}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
|
||||
|
||||
</div>
|
||||
{/block}
|
51
app/data/view/user_rebate/index_search.html
Normal file
51
app/data/view/user_rebate/index_search.html
Normal file
@ -0,0 +1,51 @@
|
||||
<fieldset>
|
||||
<legend>条件搜索</legend>
|
||||
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">代理昵称</label>
|
||||
<label class="layui-input-inline">
|
||||
<input name="agent_nickname" value="{:input('agent_nickname','')}" placeholder="请输入代理昵称" class="layui-input">
|
||||
</label>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">代理手机</label>
|
||||
<label class="layui-input-inline">
|
||||
<input name="agent_phone" value="{:input('agent_phone','')}" placeholder="请输入代理手机" class="layui-input">
|
||||
</label>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">会员昵称</label>
|
||||
<label class="layui-input-inline">
|
||||
<input name="order_nickname" value="{:input('order_nickname','')}" placeholder="请输入会员昵称" class="layui-input">
|
||||
</label>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">会员手机</label>
|
||||
<label class="layui-input-inline">
|
||||
<input name="order_phone" value="{:input('order_phone','')}" placeholder="请输入会员手机" class="layui-input">
|
||||
</label>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">订单单号</label>
|
||||
<label class="layui-input-inline">
|
||||
<input name="order_no" value="{:input('order_no','')}" placeholder="请输入订单单号" class="layui-input">
|
||||
</label>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">返佣描述</label>
|
||||
<label class="layui-input-inline">
|
||||
<input name="description" value="{:input('description','')}" placeholder="请输入返佣描述" class="layui-input">
|
||||
</label>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">返佣时间</label>
|
||||
<div class="layui-input-inline">
|
||||
<input data-date-range name="create_at" value="{:input('create_at','')}" placeholder="请选择返佣时间" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<button class="layui-btn layui-btn-primary"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</form>
|
||||
<script>window.form.render()</script>
|
||||
</fieldset>
|
Loading…
x
Reference in New Issue
Block a user