Commit aefb76fe by 杨树贤

完善时间需求

parent e1030a14
......@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Services\SupplierStatisticsService;
class BaseController extends Controller
{
......@@ -16,4 +17,6 @@ class BaseController extends Controller
return $this->apiReturn(0,'切换成功');
}
}
......@@ -27,7 +27,7 @@ class Controller extends BaseController
protected function view($title = '')
{
$this->data['title'] = $title;
$view =request('view', 'web');
$view = request('view', 'web');
return view($view, $this->data);
}
......
......@@ -155,6 +155,18 @@ class SupplierFilter
$query->where('is_entity', $map['is_entity']);
}
if ((isset($map['is_sku_expire']) && $map['is_sku_expire'] === "0") || !empty($map['is_sku_expire'])) {
if ($map['is_sku_expire'] == 1) {
$query->where('sku_expired_in_days', '>', 0)->where('uploaded_sku', 1);
} else {
$query->where('sku_expired_in_days', 0);
}
}
if (!empty($map['sku_expired_in_days']) && is_numeric($map['sku_expired_in_days'])) {
$query->where('sku_expired_in_days', '>=', $map['sku_expired_in_days']);
}
if (!empty($map['create_time'])) {
$times = explode('~', $map['create_time']);
$startTime = strtotime($times[0]);
......@@ -531,6 +543,9 @@ class SupplierFilter
$query->select('supplier_id')->from(with(new SupplierAttachmentsModel())->getTable())->where('field_name', 'cooperation_agreement');
})->where('uploaded_sku', 1);
break;
case "sku_expired":
$query->where('sku_expired_in_days', '>', 0);
break;
}
return $query;
}
......
......@@ -63,50 +63,24 @@ class SupplierStatisticsService
$result = [
'total' => $total,
'need_review' => $needReview,
// 'pending' => $pending,
// 'in_review' => $inReview,
// 'passed' => $passed,
// 'rejected' => $rejected,
// 'disable' => $disable,
'block' => $block,
// 'no_purchase_uid' => $noPurchaseUid,
// 'no_channel_uid' => $noChannelUid,
// 'invalid_channel_uid' => $invalidChannelUid,
// 'invalid_purchase_uid' => $invalidPurchaseUid,
// 'to_follow_up' => $toFollowUp,
// 'no_sku' => $noSku,
// 'no_quality_assurance_agreement' => $noQualityAssuranceAgreement,
// 'has_supplier_tag' => $hasTagSupplier,
// 'contact_no_complete' => $concatNoComplete,
// 'history_abnormal' => $historyAbnormal,
'pay_type_term' => $payTypeTerm,
'level_a' => $levelA,
//所有采购员离职
'all_channel_user_resigned' => null,
//历史平台合作供应商
'uploaded_sku' => null,
// 非芯链供应商
'not_yunxin' => null,
//已上架(非芯链)供应商
'not_yunxin_and_has_sku' => null,
//已下架(非芯链)供应商
'not_yunxin_and_has_no_sku' => null,
//芯链供应商
'yunxin' => null,
//已上架(芯链)供应商
'yunxin_and_has_sku' => null,
//已下架(芯链)供应商
'yunxin_and_has_no_sku' => null,
//3天内到期(芯链)供应商
'yunxin_expired_at_days' => null,
//3天内到期(非芯链)供应商
'not_yunxin_expired_at_days' => null,
//已过期(芯链)供应商
'yunxin_expired' => null,
//已过期(非芯链)供应商
'not_yunxin_expired' => null,
//缺少平台合作协议(线上)
'no_cooperation_agreement' => null,
'no_quality_assurance_agreement_all' => null,
'sku_expired' => null,
];
$result = array_map(function ($value) {
if ($value > 999) {
......
......@@ -16,6 +16,25 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot()
{
// 共享全局模板变量:SKU过期数量
View::composer('*', function ($view) {
$skuExpiredCount = 0;
if (request()->user) {
$cacheKey = 'sku_expired_count_' . request()->user->userId;
$redis = new \App\Model\RedisModel();
$count = $redis->get($cacheKey);
if ($count !== false && $count !== null) {
$skuExpiredCount = (int)$count;
} else {
$count = (new \App\Http\Services\SupplierStatisticsService())->getStatisticsCount('sku_expired');
$redis->set($cacheKey, $count);
$redis->expire($cacheKey, 60);
$skuExpiredCount = $count;
}
}
$view->with('skuExpiredCount', $skuExpiredCount);
});
// // 只在本地环境生效
// if ($this->app->environment('local')) {
// // 自定义一个新的 Handler
......
......@@ -3,9 +3,9 @@
<dl class="layui-nav-child">
@foreach($v['childs'] as $k=>$v)
<dd>
<a class="layui-icon {{$v['class'] or ''}}" @if(!empty($v['href'])) lay-href="{{iframeUrl($v['href'])}}" @endif>{{$v['title']}}</a>
@include("layouts.menu")
<a class="layui-icon {{$v['class'] or ''}}" ew-title="{{$v['title']}}" @if(!empty($v['href'])) lay-href="{{iframeUrl($v['href'])}}" @endif>{{$v['title']}} @if($v['title'] == '供应商列表' && !empty($skuExpiredCount) && $skuExpiredCount > 0) <span class="layui-badge layui-bg-red" style="margin-left: 5px;">{{ $skuExpiredCount > 99 ? '99+' : $skuExpiredCount }}</span> @endif</a>
{{-- @include("layouts.menu") --}}
</dd>
@endforeach
</dl>
@endif
\ No newline at end of file
@endif
......@@ -10,6 +10,7 @@
<i class="layui-icon {{$v['class'] or ''}}"></i>&emsp;<cite>{{$v['title'] or ''}}</cite>
</a>
@else
<a @if(!empty($v['href'])) lay-href="{{iframeUrl($v['href'])}}" @endif>
<i class="layui-icon {{$v['class'] or ''}}"></i>&emsp;<cite>{{$v['title'] or ''}}</cite>
</a>
......@@ -22,4 +23,4 @@
@endif
</ul>
</div>
</div>
\ No newline at end of file
</div>
......@@ -343,6 +343,19 @@
},
{field: 'average_sku_num', title: '日均上架数', align: 'center', width: 100},
{
field: 'is_sku_expire', title: '商品是否过期', align: 'center', width: 130, templet: function (data) {
return data.is_sku_expire == 1 ? '<span style="color: red;"></span>' : '否';
}
},
{
field: 'sku_expired_in_days', title: '商品过期天数', align: 'center', width: 130, templet: function (data) {
if (data.sku_expired_in_days > 0) {
return '<span style="color: red;">' + data.sku_expired_in_days + '</span>';
}
return data.sku_expired_in_days || 0;
}
},
{
field: 'cp_time_day', title: '有效期最高天数', align: 'center', width: 180, templet: function (data) {
let cpTime = data.cp_time_day == -1 ? '无限制' : data.cp_time_day + '天';
let futuresCpTime = data.futures_cp_time_day == -1 ? '无限制' : data.futures_cp_time_day + '天';
......
......@@ -141,6 +141,10 @@
</div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('is_expire','是否过期',request()->get('is_expire'),[-1=>'否',1=>'是']) !!}
</div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('source/eq','接入方式',request()->get('source/eq'),config('field.SkuSource')) !!}
</div>
<div class="layui-inline">
......
......@@ -10,6 +10,7 @@
<i class="layui-icon <?php echo e(isset($v['class']) ? $v['class'] : ''); ?>"></i>&emsp;<cite><?php echo e(isset($v['title']) ? $v['title'] : ''); ?></cite>
</a>
<?php else: ?>
<a <?php if(!empty($v['href'])): ?> lay-href="<?php echo e(iframeUrl($v['href'])); ?>" <?php endif; ?>>
<i class="layui-icon <?php echo e(isset($v['class']) ? $v['class'] : ''); ?>"></i>&emsp;<cite><?php echo e(isset($v['title']) ? $v['title'] : ''); ?></cite>
</a>
......@@ -22,4 +23,4 @@
<?php endif; ?>
</ul>
</div>
</div>
\ No newline at end of file
</div>
......@@ -3,9 +3,9 @@
<dl class="layui-nav-child">
<?php foreach($v['childs'] as $k=>$v): ?>
<dd>
<a class="layui-icon <?php echo e(isset($v['class']) ? $v['class'] : ''); ?>" <?php if(!empty($v['href'])): ?> lay-href="<?php echo e(iframeUrl($v['href'])); ?>" <?php endif; ?>><?php echo e($v['title']); ?></a>
<?php echo $__env->make("layouts.menu", array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<a class="layui-icon <?php echo e(isset($v['class']) ? $v['class'] : ''); ?>" ew-title="<?php echo e($v['title']); ?>" <?php if(!empty($v['href'])): ?> lay-href="<?php echo e(iframeUrl($v['href'])); ?>" <?php endif; ?>><?php echo e($v['title']); ?> <?php if($v['title'] == '供应商列表' && !empty($skuExpiredCount) && $skuExpiredCount > 0): ?> <span class="layui-badge layui-bg-red" style="margin-left: 5px;"><?php echo e($skuExpiredCount > 99 ? '99+' : $skuExpiredCount); ?></span> <?php endif; ?></a>
<?php /* <?php echo $__env->make("layouts.menu", array_except(get_defined_vars(), array('__data', '__path')))->render(); ?> */ ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif; ?>
\ No newline at end of file
<?php endif; ?>
......@@ -343,6 +343,19 @@
},
{field: 'average_sku_num', title: '日均上架数', align: 'center', width: 100},
{
field: 'is_sku_expire', title: '商品是否过期', align: 'center', width: 130, templet: function (data) {
return data.is_sku_expire == 1 ? '<span style="color: red;"></span>' : '否';
}
},
{
field: 'sku_expired_in_days', title: '商品过期天数', align: 'center', width: 130, templet: function (data) {
if (data.sku_expired_in_days > 0) {
return '<span style="color: red;">' + data.sku_expired_in_days + '</span>';
}
return data.sku_expired_in_days || 0;
}
},
{
field: 'cp_time_day', title: '有效期最高天数', align: 'center', width: 180, templet: function (data) {
let cpTime = data.cp_time_day == -1 ? '无限制' : data.cp_time_day + '天';
let futuresCpTime = data.futures_cp_time_day == -1 ? '无限制' : data.futures_cp_time_day + '天';
......
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