Commit 3560bfc4 by 朱继来

Merge branch 'zjl_ruler_20200904'

parents adbb3fa9 db5af258
......@@ -301,8 +301,8 @@ class WebController extends Controller
if (!$user_id) return redirect('/web/selfSampleList');
$data['title'] = '自营样片领取和邀约记录';
$data['paths'] = [["title" => '自营订单', "href" => '#'], ["title" => '自营订单领取列表', "href" => '/web/selfSampleList'], ["title" => '自营样片领取和邀约记录', "href" => '#']];
$data['title'] = '领取和邀约记录';
$data['paths'] = [["title" => '自营订单', "href" => '#'], ["title" => '自营订单领取列表', "href" => '/web/selfSampleList'], ["title" => '领取和邀约记录', "href" => '#']];
$data['user_id'] = $user_id;
$UserMainModel = new UserMainModel;
......
......@@ -26,11 +26,12 @@ class UserSampleApplyModel extends Model
{
$page = $request->input('page', 1);
$limit = $request->input('limit', 10);
$field = ['a.apply_id', 'a.user_id', 'a.account', 'a.order_id', 'order_sn', 'a.goods_id', 'a.goods_name', 'a.apply_num', 'a.quota', 'a.create_time'];
$field = ['a.apply_id', 'a.user_id', 'a.account', 'a.order_id', 'order_sn', 'a.goods_id', 'a.goods_name', 'a.apply_num', 'a.quota', 'a.type', 'a.create_time'];
$map['account'] = $request->input('account', ''); // 用户账户
$map['goods_name'] = $request->input('goods_name', ''); // 商品名称
$map['order_sn'] = $request->input('order_sn', ''); // 订单号
$map['type'] = $request->input('type', ''); // 活动名称
$map['begin_time'] = $request->input('begin_time', '') ? strtotime($request->input('begin_time')) : '';
$map['end_time'] = $request->input('end_time', '') ? strtotime($request->input('end_time')) + 86399 : '';
......@@ -55,6 +56,11 @@ class UserSampleApplyModel extends Model
$query->where('a.order_sn', '=', $map['order_sn']);
}
})->where(function($query) use ($map) {
// 活动名称
if ($map['type']) {
$query->where('a.type', '=', $map['type']);
}
})->where(function($query) use ($map) {
// 创建时间
if(!empty($map['begin_time']) && !empty($map['end_time'])) {
$query->whereBetween('a.create_time', [$map['begin_time'], $map['end_time']]);
......@@ -97,8 +103,10 @@ class UserSampleApplyModel extends Model
$UserSampleInviteModel = new UserSampleInviteModel;
$UserInfoModel = new UserInfoModel;
foreach ($data as &$v) {
$v['type_val'] = $v['type'] == 1 ? '样片' : '工具尺';
$v['work_function'] = $UserInfoModel->getWorkFunction($v['user_id']);
$v['invite_count'] = $UserSampleInviteModel->getUserInviteCount($v['user_id']);
$v['sample_invite_count'] = $UserSampleInviteModel->getUserInviteCount($v['user_id']);
$v['ruler_invite_count'] = $UserSampleInviteModel->getUserInviteCount($v['user_id'], 2);
$v['apply_num_total'] = $this->getSampleApplySum($v['user_id']); // 获取指定用户申请的样片总数
$v['quota_total'] = $this->getSampleApplySum($v['user_id'], 'quota'); // 获取指定用户申请的样片消耗总人数
// $v['quota_total'] = $this->getUsedCount($v['user_id']); //
......@@ -126,7 +134,7 @@ class UserSampleApplyModel extends Model
$page = $request->input('page', 1);
$limit = $request->input('limit', 10);
$field = ['apply_id', 'user_id', 'account', 'order_id', 'order_sn', 'goods_id', 'goods_name', 'apply_num', 'quota', 'is_expire', 'create_time'];
$field = ['apply_id', 'user_id', 'account', 'order_id', 'order_sn', 'goods_id', 'goods_name', 'apply_num', 'quota', 'is_expire', 'type', 'create_time'];
$list = $this->where('user_id', $user_id)
->select($field)
......@@ -147,6 +155,8 @@ class UserSampleApplyModel extends Model
$OrderModel = new OrderModel();
foreach ($data as &$v) {
$v['type_val'] = $v['type'] == 1 ? '样片' : '工具尺';
$order = $OrderModel->where('order_id', $v['order_id'])->select('status')->first();
if (!$order) continue;
......
......@@ -28,7 +28,7 @@ class UserSampleInviteModel extends Model
$page = $request->input('page', 1);
$limit = $request->input('limit', 10);
$field = ['invite_id', 'user_id', 'account', 'invitee_uid', 'invitee_mobile', 'is_expire', 'create_time'];
$field = ['invite_id', 'user_id', 'account', 'invitee_uid', 'invitee_mobile', 'is_expire', 'type', 'create_time'];
$list = $this->where('user_id', $user_id)
->select($field)
......@@ -36,13 +36,32 @@ class UserSampleInviteModel extends Model
->orderBy('invite_id', 'asc')
->paginate($limit, ['*'], 'page', $page)->toArray();
$list['data'] = $this->handleData($list['data']);
return [0, '获取成功', $list['data'], $list['total']];
}
public function handleData($data)
{
if (!$data) return false;
$OrderModel = new OrderModel();
foreach ($data as &$v) {
$v['type_val'] = $v['type'] == 1 ? '样片' : '工具尺';
}
return $data;
}
// 获取指定用户邀约人数
public function getUserInviteCount($user_id)
public function getUserInviteCount($user_id, $type=1)
{
return $this->where('user_id', $user_id)->where('is_expire', 1)->count();
$map = [];
$map['user_id'] = $user_id;
$map['type'] = $type;
return $this->where($map)->where('is_expire', 1)->count();
}
// 获取用户邀约列表
......
......@@ -22,8 +22,10 @@ layui.use(['form', 'table', 'laydate'], function(){
{title: '序号', type: 'numbers', fixed: 'left', width: 80}
,{field: 'user_id', title: '用户ID', width: 100}
,{field: 'account', title: '用户账户', width: 150}
,{field: 'work_function', title: '用户职务', width: 150}
,{field: 'invite_count', title: '邀请人数', width: 100}
,{field: 'type_val', title: '活动名称', width: 100}
,{field: 'work_function', title: '用户职务', width: 120}
,{field: 'sample_invite_count', title: '样片邀请人数', width: 130}
,{field: 'ruler_invite_count', title: '工具尺邀请人数', width: 130}
,{field: 'apply_num_total', title: '已申请样片数', width: 120}
,{field: 'apply_count', title: '剩余有效人数', width: 120}
,{field: 'quota_total', title: '总消耗人数', width: 120}
......
......@@ -16,13 +16,14 @@ layui.use(['table'], function(){
{title: '序号', type: 'numbers', fixed: 'left', width: 80}
,{field: 'user_id', title: '用户ID', width: 120}
,{field: 'account', title: '用户账户', width: 200}
,{field: 'type_val', title: '活动名称', width: 100}
,{field: 'order_id', title: '订单ID', width: 120}
,{field: 'order_sn', title: '订单编号', width: 200}
,{field: 'order_status', title: '订单状态', width: 100}
,{field: 'goods_id', title: '样片ID', width: 120}
,{field: 'goods_name', title: '样片名称', width: 300}
,{field: 'goods_id', title: '商品ID', width: 120}
,{field: 'goods_name', title: '商品名称', width: 300}
,{field: 'apply_num', title: '领取数量', width: 120}
,{field: 'quota', title: '样片消耗人数', width: 120}
,{field: 'quota', title: '消耗人数', width: 120}
,{field: 'is_expire', title: '是否过期', templet: '#is_expire', width: 120}
,{field: 'create_time', title: '领取时间', width: 215}
]]
......@@ -45,6 +46,7 @@ layui.use(['table'], function(){
{title: '序号', type: 'numbers', fixed: 'left', width: 80}
,{field: 'user_id', title: '用户ID'}
,{field: 'account', title: '用户账户'}
,{field: 'type_val', title: '活动名称', width: 100}
,{field: 'invitee_uid', title: '受邀人ID'}
,{field: 'invitee_mobile', title: '受邀人手机号码'}
,{field: 'is_expire', title: '是否过期', templet: '#is_expire', width: 120}
......
......@@ -28,15 +28,18 @@
@include('layouts.navigation')
<div id="page-wrapper" class="gray-bg">
@include('layouts.header')
<div class="layui-col-md6 layui-col-space12" style="margin: 10px;width: 100%;height: 100%;padding-right: 20px">
<div class="layui-card">
<div class="layui-card-body" style="padding-top: 20px; padding-bottom: 30px;">
<div class="row">
<div class="col-lg-12">
<div class="ibox float-e-margins ibox-content" style="margin: 15px">
<div class="row mapping-rows" style="overflow:visible;margin: 10px">
@include("web.$id")
</div>
</div>
</div>
</div>
</div>
</div>
@include('table.js')
<script src="/js/layui/layui.js"></script>
<script src="/js/web/common.js"></script>
......
......@@ -22,6 +22,17 @@
</div>
<div class="layui-inline">
<label class="layui-form-label">活动名称</label>
<div class="layui-input-inline">
<select name="type" lay-verify="" lay-search>
<option value=""></option>
<option value="1">样片</option>
<option value="2">工具尺</option>
</select>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">领取时间</label>
<div class="layui-input-inline">
<input type="text" name="begin_time" value="" autocomplete="off" placeholder="选择开始时间" class="layui-input" id="begin_time" readonly>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment