Commit 21c84a8c by 朱继来

Merge branch 'zjl_domestic_20201110'

parents a861541b 8a0bf5df
...@@ -200,6 +200,13 @@ class ApiController extends Controller ...@@ -200,6 +200,13 @@ class ApiController extends Controller
$this->ExportLayui($UserSampleInviteModel->lists($request)); $this->ExportLayui($UserSampleInviteModel->lists($request));
} }
// 获取国产替代样片领取列表
public function ApiDomesticSampleList($request)
{
$UserSampleApplyModel = new UserSampleApplyModel;
$this->ExportLayui($UserSampleApplyModel->domesticLists($request));
}
/* /*
修改订单详情 修改订单详情
*/ */
......
...@@ -290,7 +290,7 @@ class WebController extends Controller ...@@ -290,7 +290,7 @@ class WebController extends Controller
// 自营样片领取列表 // 自营样片领取列表
public function selfSampleList($request, $data, $id) public function selfSampleList($request, $data, $id)
{ {
$data['title'] = '自营样片领取列表'; $data['title'] = '邀约领取样片';
return view('web', $data); return view('web', $data);
} }
...@@ -302,7 +302,7 @@ class WebController extends Controller ...@@ -302,7 +302,7 @@ 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;
...@@ -316,6 +316,13 @@ class WebController extends Controller ...@@ -316,6 +316,13 @@ class WebController extends Controller
return view('web', $data); return view('web', $data);
} }
// 国产替代样片领取列表
public function domesticSampleList($request, $data, $id)
{
$data['title'] = '国产替代样片';
return view('web', $data);
}
// 团购列表 // 团购列表
public function groupList($request, $data, $id) public function groupList($request, $data, $id)
{ {
......
...@@ -35,13 +35,13 @@ class UserSampleApplyModel extends Model ...@@ -35,13 +35,13 @@ class UserSampleApplyModel extends Model
$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 : '';
$sub = UserSampleApplyModel::select(DB::raw('max(apply_id) as apply_id'))->groupBy('user_id'); $sub = UserSampleApplyModel::whereIn('type', [1, 2])->select(DB::raw('max(apply_id) as apply_id'))->groupBy('user_id');
$list = $this->from('lie_user_sample_apply as a') $list = $this->from('lie_user_sample_apply as a')
->join(DB::raw("({$sub->toSql()}) as b"), function($join) { ->join(DB::raw("({$sub->toSql()}) as b"), function($join) {
$join->on('a.apply_id', '=', 'b.apply_id'); $join->on('a.apply_id', '=', 'b.apply_id');
})->where(function($query) use ($map) { })->mergeBindings($sub->getQuery())->where(function($query) use ($map) {
// 客服名称 // 用户账户
if ($map['account']) { if ($map['account']) {
$query->where('a.account', '=', $map['account']); $query->where('a.account', '=', $map['account']);
} }
...@@ -51,7 +51,7 @@ class UserSampleApplyModel extends Model ...@@ -51,7 +51,7 @@ class UserSampleApplyModel extends Model
$query->where('a.goods_name', 'like', $map['goods_name'].'%'); $query->where('a.goods_name', 'like', $map['goods_name'].'%');
} }
})->where(function($query) use ($map) { })->where(function($query) use ($map) {
// 客服名称 // 订单号
if ($map['order_sn']) { if ($map['order_sn']) {
$query->where('a.order_sn', '=', $map['order_sn']); $query->where('a.order_sn', '=', $map['order_sn']);
} }
...@@ -75,10 +75,11 @@ class UserSampleApplyModel extends Model ...@@ -75,10 +75,11 @@ class UserSampleApplyModel extends Model
->select($field) ->select($field)
->orderBy('a.create_time', 'desc') ->orderBy('a.create_time', 'desc')
->orderBy('a.apply_id', 'asc'); ->orderBy('a.apply_id', 'asc');
// $tmp = str_replace('?', '"'.'%s'.'"', $list->toSql());
// $tmp = vsprintf($tmp, $list->getBindings());
// echo $tmp;exit;
if ($export) { if ($export) {
$list = $list->get()->toArray(); $list = $list->get()->toArray();
$list = $this->handle($list); $list = $this->handle($list);
if (empty($list)) { if (empty($list)) {
...@@ -88,7 +89,6 @@ class UserSampleApplyModel extends Model ...@@ -88,7 +89,6 @@ class UserSampleApplyModel extends Model
return $list; return $list;
} else { } else {
$list = $list->paginate($limit, ['*'], 'page', $page)->toArray(); $list = $list->paginate($limit, ['*'], 'page', $page)->toArray();
$data = $this->handle($list['data']); $data = $this->handle($list['data']);
return [0, '获取成功', $data, $list['total']]; return [0, '获取成功', $data, $list['total']];
...@@ -103,7 +103,7 @@ class UserSampleApplyModel extends Model ...@@ -103,7 +103,7 @@ 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['type_val'] = $v['type'] == 1 ? '样片' : '工具尺'; $v['type_val'] = array_get(Config('params.sample_type'), $v['type'], '');
$v['work_function'] = $UserInfoModel->getWorkFunction($v['user_id']); $v['work_function'] = $UserInfoModel->getWorkFunction($v['user_id']);
$v['sample_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['ruler_invite_count'] = $UserSampleInviteModel->getUserInviteCount($v['user_id'], 2);
...@@ -124,6 +124,7 @@ class UserSampleApplyModel extends Model ...@@ -124,6 +124,7 @@ class UserSampleApplyModel extends Model
->where('s.user_id', '=', $user_id) ->where('s.user_id', '=', $user_id)
->where('s.is_expire', '=', 1) ->where('s.is_expire', '=', 1)
->where('o.status', '<>', '-1') ->where('o.status', '<>', '-1')
->whereIn('type', [1, 2])
->sum($field); ->sum($field);
} }
...@@ -137,6 +138,7 @@ class UserSampleApplyModel extends Model ...@@ -137,6 +138,7 @@ class UserSampleApplyModel extends Model
$field = ['apply_id', 'user_id', 'account', 'order_id', 'order_sn', 'goods_id', 'goods_name', 'apply_num', 'quota', 'is_expire', 'type', '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)
->whereIn('type', [1, 2])
->select($field) ->select($field)
->orderBy('create_time', 'desc') ->orderBy('create_time', 'desc')
->orderBy('apply_id', 'asc') ->orderBy('apply_id', 'asc')
...@@ -155,7 +157,7 @@ class UserSampleApplyModel extends Model ...@@ -155,7 +157,7 @@ class UserSampleApplyModel extends Model
$OrderModel = new OrderModel(); $OrderModel = new OrderModel();
foreach ($data as &$v) { foreach ($data as &$v) {
$v['type_val'] = $v['type'] == 1 ? '样片' : '工具尺'; $v['type_val'] = array_get(Config('params.sample_type'), $v['type'], '');
$order = $OrderModel->where('order_id', $v['order_id'])->select('status')->first(); $order = $OrderModel->where('order_id', $v['order_id'])->select('status')->first();
...@@ -167,5 +169,54 @@ class UserSampleApplyModel extends Model ...@@ -167,5 +169,54 @@ class UserSampleApplyModel extends Model
return $data; return $data;
} }
// 国产替代领取记录
public function domesticLists($request)
{
$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', 'type', 'create_time'];
$map['account'] = $request->input('account', ''); // 用户账户
$map['goods_name'] = $request->input('goods_name', ''); // 商品名称
$map['order_sn'] = $request->input('order_sn', ''); // 订单号
$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 : '';
$list = $this->where(function($query) use ($map) {
// 用户账户
if ($map['account']) {
$query->where('account', '=', $map['account']);
}
})->where(function($query) use ($map) {
// 邮箱
if ($map['goods_name']) {
$query->where('goods_name', 'like', $map['goods_name'].'%');
}
})->where(function($query) use ($map) {
// 订单号
if ($map['order_sn']) {
$query->where('order_sn', '=', $map['order_sn']);
}
})->where(function($query) use ($map) {
// 创建时间
if(!empty($map['begin_time']) && !empty($map['end_time'])) {
$query->whereBetween('create_time', [$map['begin_time'], $map['end_time']]);
}
else if(!empty($map['begin_time'])) {
$query->where('create_time', '>=', $map['begin_time']);
}
else if(!empty($map['end_time'])) {
$query->where('create_time', '<=', $map['end_time']);
}
})
->where('type', 3)
->select($field)
->orderBy('create_time', 'desc')
->orderBy('apply_id', 'asc')
->paginate($limit, ['*'], 'page', $page)->toArray();
return [0, '获取成功', $list['data'], $list['total']];
}
} }
\ No newline at end of file
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
], ],
//公司类别 //公司类别
'company_type'=>array( 'company_type' => [
0 => '个人', 0 => '个人',
1 => '终端采购商', 1 => '终端采购商',
2 => '代工厂', 2 => '代工厂',
...@@ -126,7 +126,12 @@ ...@@ -126,7 +126,12 @@
4 => '学校/科研机构', 4 => '学校/科研机构',
5 => '贸易商', 5 => '贸易商',
6 => '其他', 6 => '其他',
), ],
'sample_type' => [ // 样片类型
1 => '普通样片',
2 => '工具尺',
3 => '国产替代',
],
]; ];
\ No newline at end of file
layui.use(['form', 'table', 'laydate'], function(){
var form = layui.form;
var table = layui.table;
var laydate = layui.laydate;
laydate.render({
elem: '#begin_time' //指定元素
});
laydate.render({
elem: '#end_time' //指定元素
});
table.render({
id: 'list'
,elem: '#domesticSample'
,url: '/api/ApiDomesticSampleList' //数据接口
,method:'post'
,cellMinWidth: 80 //全局定义常规单元格的最小宽度
,page: true //开启分页
,cols: [[ //表头
{title: '序号', type: 'numbers', fixed: 'left', width: 80}
,{field: 'user_id', title: '用户ID', width: 100}
,{field: 'account', title: '用户账户', width: 180}
,{field: 'apply_num', title: '申请样片数', width: 120}
,{field: 'order_id', title: '订单ID', width: 100}
,{field: 'order_sn', title: '订单编号', width: 180}
,{field: 'goods_id', title: '样片ID', width: 200}
,{field: 'goods_name', title: '样片名称', width: 300}
,{field: 'create_time', title: '最近一次领取时间'}
]]
,limit: 10
,limits: [10, 20, 50,]
});
form.on('submit(load)', function(data) {
//执行重载
table.reload('list', {
page: {
curr: 1
}
,where: data.field
});
return false;
});
});
\ No newline at end of file
...@@ -18,9 +18,9 @@ layui.use(['table'], function(){ ...@@ -18,9 +18,9 @@ layui.use(['table'], function(){
,{field: 'account', title: '用户账户', width: 200} ,{field: 'account', title: '用户账户', width: 200}
,{field: 'type_val', title: '活动名称', width: 100} ,{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: 150}
,{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: 200}
,{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}
......
...@@ -162,21 +162,36 @@ ...@@ -162,21 +162,36 @@
<?php if ($order_info['order_remark']) { ?> <?php if ($order_info['order_remark']) { ?>
<tr> <tr>
<td>订单备注信息:</td> <td>订单备注信息:</td>
<td colspan="18"><?= $order_info['order_remark'] ?></td> <td colspan="19"><?= $order_info['order_remark'] ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<?php if ($order_temp_info['kefu_remark']) { ?> <?php if ($order_temp_info['kefu_remark']) { ?>
<tr> <tr>
<td>客服备注信息:</td> <td>客服备注信息:</td>
<td colspan="18"><?= $order_temp_info['kefu_remark'] ?></td> <td colspan="19"><?= $order_temp_info['kefu_remark'] ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<?php if ($order_info['order_goods_type'] == 2 && $order_temp_info['business_type'] == 1) { ?> <?php if ($order_info['order_goods_type'] == 2 && $order_temp_info['business_type'] == 1) { ?>
<tr> <tr>
<td>项目需求描述:</td> <td>项目需求描述:</td>
<td colspan="18"><?= $order_temp_info['sample_demand_desc'] ?></td> <td colspan="19"><?= $order_temp_info['sample_demand_desc'] ?></td>
</tr>
<?php } ?>
<?php if ($order_info['order_goods_type'] == 1 && $order_temp_info['business_type'] == 1) { ?>
<tr>
<td>项目名称:</td>
<td colspan="19"><?= $order_temp_info['sample_project_name'] ?></td>
</tr>
<tr>
<td>项目阶段:</td>
<td colspan="19"><?= $order_temp_info['sample_project_stage'] ?></td>
</tr>
<tr>
<td>申请理由:</td>
<td colspan="19"><?= $order_temp_info['sample_project_reason'] ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
</tfoot> </tfoot>
......
<form class="layui-form layui-box" method="post">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">用户账户</label>
<div class="layui-input-inline">
<input type="text" name="account" placeholder="填写用户账户" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">商品名称</label>
<div class="layui-input-inline">
<input type="text" name="goods_name" placeholder="填写商品名称" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">订单编号</label>
<div class="layui-input-inline">
<input type="text" name="order_sn" placeholder="填写订单编号" autocomplete="off" class="layui-input">
</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>
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" name="end_time" value="" autocomplete="off" placeholder="选择结束时间" class="layui-input" id="end_time" readonly>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-btn-container" style="text-align: center; margin-top: 10px;">
<button lay-submit lay-filter="load" class="layui-btn" data-type="search">搜索</button>
<!-- <button type="button" class="layui-btn layui-btn-normal export">导出</button> -->
</div>
</div>
</form>
<table id="domesticSample" lay-filter="list"></table>
\ No newline at end of file
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<div class="layui-input-inline"> <div class="layui-input-inline">
<select name="type" lay-verify="" lay-search> <select name="type" lay-verify="" lay-search>
<option value=""></option> <option value=""></option>
<option value="1">样片</option> <option value="1">普通样片</option>
<option value="2">工具尺</option> <option value="2">工具尺</option>
</select> </select>
</div> </div>
......
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