From 7a67cfe3967ca025cb07f21751d9fe7cd479587a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Fri, 12 Mar 2021 18:31:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=94=E5=88=A9=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/data/controller/UserRebate.php | 54 ++++++++++++++++ app/data/view/user_rebate/index.html | 68 +++++++++++++++++++++ app/data/view/user_rebate/index_search.html | 51 ++++++++++++++++ 3 files changed, 173 insertions(+) create mode 100644 app/data/view/user_rebate/index.html create mode 100644 app/data/view/user_rebate/index_search.html diff --git a/app/data/controller/UserRebate.php b/app/data/controller/UserRebate.php index f7b5837ce..3589443ba 100644 --- a/app/data/controller/UserRebate.php +++ b/app/data/controller/UserRebate.php @@ -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 diff --git a/app/data/view/user_rebate/index.html b/app/data/view/user_rebate/index.html new file mode 100644 index 000000000..b219a8018 --- /dev/null +++ b/app/data/view/user_rebate/index.html @@ -0,0 +1,68 @@ +{extend name="../../admin/view/main"} + +{block name="content"} +
+ {include file='user_rebate/index_search'} +
+ 已产生总佣金 {$total.total|default=0.00} 元,已提现 {$total.used|default=0.00} 元,未提现 0 元 +
+ + {notempty name='list'} + + + + + + + + + + {/notempty} + + {foreach $list as $key=>$vo} + + + + + + + + {/foreach} + +
+ + 代理会员交易会员订单信息商品信息
+ + + {notempty name='vo.agent.headimg'} + img + {/notempty} +
+ 代理昵称:{$vo.agent.nickname|default='--'}
+ 代理手机:{$vo.agent.phone|default='--'}
+ 代理等级:{notempty name='vo.agent.vip_code'}[ VIP{$vo.agent.vip_code} ] {$vo.agent.vip_name}{else}--{/notempty} +
+
+ {notempty name='vo.user.headimg'} + img + {/notempty} +
+ 会员昵称:{$vo.user.nickname|default='--'}
+ 会员手机:{$vo.user.phone|default='--'}
+ 会员级别:{notempty name='vo.user.vip_code'}[ VIP{$vo.user.vip_code} ] {$vo.user.vip_name}{else}--{/notempty} +
+
+ 订单单号:{$vo.order_no|default='--'}
+ 订单交易 {$vo.order_amount+0} 元获得收益 {$vo.amount+0} 元 + {notempty name='vo.description'}{$vo.description|default=''}{/notempty}
+ 返拥时间:{$vo.create_at|format_datetime}
+
+ {foreach $vo.list as $g} +
{$g.goods_name|default=''} x{$g.stock_sales|default=0}
+ {/foreach} +
+ + {empty name='list'}没有记录哦{else}{$pagehtml|raw|default=''}{/empty} + +
+{/block} \ No newline at end of file diff --git a/app/data/view/user_rebate/index_search.html b/app/data/view/user_rebate/index_search.html new file mode 100644 index 000000000..307d0008b --- /dev/null +++ b/app/data/view/user_rebate/index_search.html @@ -0,0 +1,51 @@ +
+ 条件搜索 + + +