Commit 3560bfc4 by 朱继来

Merge branch 'zjl_ruler_20200904'

parents adbb3fa9 db5af258
...@@ -301,8 +301,8 @@ class WebController extends Controller ...@@ -301,8 +301,8 @@ class WebController extends Controller
if (!$user_id) return redirect('/web/selfSampleList'); if (!$user_id) return redirect('/web/selfSampleList');
$data['title'] = '自营样片领取和邀约记录'; $data['title'] = '领取和邀约记录';
$data['paths'] = [["title" => '自营订单', "href" => '#'], ["title" => '自营订单领取列表', "href" => '/web/selfSampleList'], ["title" => '自营样片领取和邀约记录', "href" => '#']]; $data['paths'] = [["title" => '自营订单', "href" => '#'], ["title" => '自营订单领取列表', "href" => '/web/selfSampleList'], ["title" => '领取和邀约记录', "href" => '#']];
$data['user_id'] = $user_id; $data['user_id'] = $user_id;
$UserMainModel = new UserMainModel; $UserMainModel = new UserMainModel;
......
...@@ -26,11 +26,12 @@ class UserSampleApplyModel extends Model ...@@ -26,11 +26,12 @@ class UserSampleApplyModel extends Model
{ {
$page = $request->input('page', 1); $page = $request->input('page', 1);
$limit = $request->input('limit', 10); $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['account'] = $request->input('account', ''); // 用户账户
$map['goods_name'] = $request->input('goods_name', ''); // 商品名称 $map['goods_name'] = $request->input('goods_name', ''); // 商品名称
$map['order_sn'] = $request->input('order_sn', ''); // 订单号 $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['begin_time'] = $request->input('begin_time', '') ? strtotime($request->input('begin_time')) : '';
$map['end_time'] = $request->input('end_time', '') ? strtotime($request->input('end_time')) + 86399 : ''; $map['end_time'] = $request->input('end_time', '') ? strtotime($request->input('end_time')) + 86399 : '';
...@@ -55,6 +56,11 @@ class UserSampleApplyModel extends Model ...@@ -55,6 +56,11 @@ class UserSampleApplyModel extends Model
$query->where('a.order_sn', '=', $map['order_sn']); $query->where('a.order_sn', '=', $map['order_sn']);
} }
})->where(function($query) use ($map) { })->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'])) { if(!empty($map['begin_time']) && !empty($map['end_time'])) {
$query->whereBetween('a.create_time', [$map['begin_time'], $map['end_time']]); $query->whereBetween('a.create_time', [$map['begin_time'], $map['end_time']]);
...@@ -97,12 +103,14 @@ class UserSampleApplyModel extends Model ...@@ -97,12 +103,14 @@ class UserSampleApplyModel extends Model
$UserSampleInviteModel = new UserSampleInviteModel; $UserSampleInviteModel = new UserSampleInviteModel;
$UserInfoModel = new UserInfoModel; $UserInfoModel = new UserInfoModel;
foreach ($data as &$v) { foreach ($data as &$v) {
$v['work_function'] = $UserInfoModel->getWorkFunction($v['user_id']); $v['type_val'] = $v['type'] == 1 ? '样片' : '工具尺';
$v['invite_count'] = $UserSampleInviteModel->getUserInviteCount($v['user_id']); $v['work_function'] = $UserInfoModel->getWorkFunction($v['user_id']);
$v['apply_num_total'] = $this->getSampleApplySum($v['user_id']); // 获取指定用户申请的样片总数 $v['sample_invite_count'] = $UserSampleInviteModel->getUserInviteCount($v['user_id']);
$v['quota_total'] = $this->getSampleApplySum($v['user_id'], 'quota'); // 获取指定用户申请的样片消耗总人数 $v['ruler_invite_count'] = $UserSampleInviteModel->getUserInviteCount($v['user_id'], 2);
// $v['quota_total'] = $this->getUsedCount($v['user_id']); // $v['apply_num_total'] = $this->getSampleApplySum($v['user_id']); // 获取指定用户申请的样片总数
$v['apply_count'] = $UserInfoModel->getUserApplyCount($v['user_id']); $v['quota_total'] = $this->getSampleApplySum($v['user_id'], 'quota'); // 获取指定用户申请的样片消耗总人数
// $v['quota_total'] = $this->getUsedCount($v['user_id']); //
$v['apply_count'] = $UserInfoModel->getUserApplyCount($v['user_id']);
} }
return $data; return $data;
...@@ -126,7 +134,7 @@ class UserSampleApplyModel extends Model ...@@ -126,7 +134,7 @@ class UserSampleApplyModel extends Model
$page = $request->input('page', 1); $page = $request->input('page', 1);
$limit = $request->input('limit', 10); $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) $list = $this->where('user_id', $user_id)
->select($field) ->select($field)
...@@ -147,6 +155,8 @@ class UserSampleApplyModel extends Model ...@@ -147,6 +155,8 @@ class UserSampleApplyModel extends Model
$OrderModel = new OrderModel(); $OrderModel = new OrderModel();
foreach ($data as &$v) { foreach ($data as &$v) {
$v['type_val'] = $v['type'] == 1 ? '样片' : '工具尺';
$order = $OrderModel->where('order_id', $v['order_id'])->select('status')->first(); $order = $OrderModel->where('order_id', $v['order_id'])->select('status')->first();
if (!$order) continue; if (!$order) continue;
......
...@@ -28,7 +28,7 @@ class UserSampleInviteModel extends Model ...@@ -28,7 +28,7 @@ class UserSampleInviteModel extends Model
$page = $request->input('page', 1); $page = $request->input('page', 1);
$limit = $request->input('limit', 10); $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) $list = $this->where('user_id', $user_id)
->select($field) ->select($field)
...@@ -36,13 +36,32 @@ class UserSampleInviteModel extends Model ...@@ -36,13 +36,32 @@ class UserSampleInviteModel extends Model
->orderBy('invite_id', 'asc') ->orderBy('invite_id', 'asc')
->paginate($limit, ['*'], 'page', $page)->toArray(); ->paginate($limit, ['*'], 'page', $page)->toArray();
$list['data'] = $this->handleData($list['data']);
return [0, '获取成功', $list['data'], $list['total']]; 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(){ ...@@ -22,8 +22,10 @@ layui.use(['form', 'table', 'laydate'], function(){
{title: '序号', type: 'numbers', fixed: 'left', width: 80} {title: '序号', type: 'numbers', fixed: 'left', width: 80}
,{field: 'user_id', title: '用户ID', width: 100} ,{field: 'user_id', title: '用户ID', width: 100}
,{field: 'account', title: '用户账户', width: 150} ,{field: 'account', title: '用户账户', width: 150}
,{field: 'work_function', title: '用户职务', width: 150} ,{field: 'type_val', title: '活动名称', width: 100}
,{field: 'invite_count', 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_num_total', title: '已申请样片数', width: 120}
,{field: 'apply_count', title: '剩余有效人数', width: 120} ,{field: 'apply_count', title: '剩余有效人数', width: 120}
,{field: 'quota_total', title: '总消耗人数', width: 120} ,{field: 'quota_total', title: '总消耗人数', width: 120}
......
...@@ -16,13 +16,14 @@ layui.use(['table'], function(){ ...@@ -16,13 +16,14 @@ layui.use(['table'], function(){
{title: '序号', type: 'numbers', fixed: 'left', width: 80} {title: '序号', type: 'numbers', fixed: 'left', width: 80}
,{field: 'user_id', title: '用户ID', width: 120} ,{field: 'user_id', title: '用户ID', width: 120}
,{field: 'account', title: '用户账户', width: 200} ,{field: 'account', title: '用户账户', width: 200}
,{field: 'type_val', title: '活动名称', width: 100}
,{field: 'order_id', title: '订单ID', width: 120} ,{field: 'order_id', title: '订单ID', width: 120}
,{field: 'order_sn', title: '订单编号', width: 200} ,{field: 'order_sn', title: '订单编号', width: 200}
,{field: 'order_status', title: '订单状态', width: 100} ,{field: 'order_status', title: '订单状态', width: 100}
,{field: 'goods_id', title: '样片ID', width: 120} ,{field: 'goods_id', title: '商品ID', width: 120}
,{field: 'goods_name', title: '样片名称', width: 300} ,{field: 'goods_name', title: '商品名称', width: 300}
,{field: 'apply_num', title: '领取数量', width: 120} ,{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: 'is_expire', title: '是否过期', templet: '#is_expire', width: 120}
,{field: 'create_time', title: '领取时间', width: 215} ,{field: 'create_time', title: '领取时间', width: 215}
]] ]]
...@@ -45,6 +46,7 @@ layui.use(['table'], function(){ ...@@ -45,6 +46,7 @@ layui.use(['table'], function(){
{title: '序号', type: 'numbers', fixed: 'left', width: 80} {title: '序号', type: 'numbers', fixed: 'left', width: 80}
,{field: 'user_id', title: '用户ID'} ,{field: 'user_id', title: '用户ID'}
,{field: 'account', title: '用户账户'} ,{field: 'account', title: '用户账户'}
,{field: 'type_val', title: '活动名称', width: 100}
,{field: 'invitee_uid', title: '受邀人ID'} ,{field: 'invitee_uid', title: '受邀人ID'}
,{field: 'invitee_mobile', title: '受邀人手机号码'} ,{field: 'invitee_mobile', title: '受邀人手机号码'}
,{field: 'is_expire', title: '是否过期', templet: '#is_expire', width: 120} ,{field: 'is_expire', title: '是否过期', templet: '#is_expire', width: 120}
......
...@@ -28,10 +28,13 @@ ...@@ -28,10 +28,13 @@
@include('layouts.navigation') @include('layouts.navigation')
<div id="page-wrapper" class="gray-bg"> <div id="page-wrapper" class="gray-bg">
@include('layouts.header') @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="row">
<div class="layui-card-body" style="padding-top: 20px; padding-bottom: 30px;"> <div class="col-lg-12">
@include("web.$id") <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> </div>
......
...@@ -22,6 +22,17 @@ ...@@ -22,6 +22,17 @@
</div> </div>
<div class="layui-inline"> <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> <label class="layui-form-label">领取时间</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" name="begin_time" value="" autocomplete="off" placeholder="选择开始时间" class="layui-input" id="begin_time" readonly> <input type="text" name="begin_time" value="" autocomplete="off" placeholder="选择开始时间" class="layui-input" id="begin_time" readonly>
...@@ -30,7 +41,7 @@ ...@@ -30,7 +41,7 @@
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" name="end_time" value="" autocomplete="off" placeholder="选择结束时间" class="layui-input" id="end_time" readonly> <input type="text" name="end_time" value="" autocomplete="off" placeholder="选择结束时间" class="layui-input" id="end_time" readonly>
</div> </div>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
......
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