Commit de7ae637 by mushishixian

完善

parent 1e52baeb
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Foundation\Inspiring;
//设置供应商是否需要跟进
class SetSupplierFollowUp extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'set_supplier_follow_up';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Display an inspiring quote';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->comment(PHP_EOL."111111111111".PHP_EOL);
}
}
......@@ -14,6 +14,7 @@ class Kernel extends ConsoleKernel
*/
protected $commands = [
// Commands\Inspire::class,
Commands\SetSupplierFollowUp::class,
];
/**
......
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Services\SupplierContactService;
use App\Http\Services\SupplierStatisticsService;
use App\Http\Transformers\SupplierContactTransformer;
use App\Http\Validators\SupplierContactValidator;
use App\Model\SupplierContactModel;
use Illuminate\Http\Request;
//通用API,比如获取品牌列表,分类列表等
class SupplierStatisticsApiController extends Controller
{
public function Entrance(Request $request, $id)
{
$this->$id($request, $id);
}
public function GetSupplierStatistics($request)
{
$service = new SupplierStatisticsService();
$statistics = $service->getSupplierListStatistics();
$data = [];
foreach ($statistics as $name => $count) {
$data[$name] = array_get(config('fixed.CompassMenuMap'), $name) . "(${count})";
}
$this->response(0, 'ok', $data);
}
}
......@@ -12,15 +12,61 @@ use RedisDB;
class SupplierAuditService
{
public function auditSupplier($supplierId,$status,$rejectReason)
public function auditSupplier($supplierId, $status, $rejectReason)
{
$model = new SupplierChannelModel();
$result = $model->where('supplier_id',$supplierId)->update([
'update_time'=>time(),
'status'=> $status,
$result = $model->where('supplier_id', $supplierId)->update([
'update_time' => time(),
'status' => $status,
'reject_reason' => $rejectReason,
]);
return $result;
}
//判断是否为待跟进供应商
public function checkIsNeedToFollowUpSupplier($supplierId)
{
$model = new SupplierChannelModel();
$supplier = $model->where('supplier_id', $supplierId)->first();
//针对非禁止交易状态的供应商重新分配渠道员,且必填信息不完整
if (!empty($supplier) && ($supplier['status'] != SupplierChannelModel::STATUS_DISABLE)) {
//开始检查
return $this->checkHasAllRequireField($supplier);
}
//或者单纯只是禁用状态的供应商重新分配渠道员,也是要处理待跟进状态
if (!empty($supplier) && ($supplier['status'] == SupplierChannelModel::STATUS_DISABLE)) {
//开始检查
return true;
}
return false;
}
//检查必填字段,false缺少必填字段
public function checkHasAllRequireField($supplier)
{
//先检查基础字段
if (empty($supplier['supplier_name']) || empty($supplier['register_company_name'] || empty($supplier['region']))) {
return false;
}
if (empty($supplier['stockup_type']) || empty($supplier['supplier_group']) || empty($supplier['qualification_photos'])) {
return false;
}
//再检查营业执照是否有
if (isset($supplier['qualification_photos']['business_license']) && empty($supplier['qualification_photos']['business_license'])) {
return false;
}
//检查是否有联系方式
$contactModel = new SupplierContactModel();
$count = $contactModel->where('supplier_id', $supplier['supplier_id'])->count();
//没有联系方式,就需要去跟进
if (!$count) {
return false;
}
//联系方式和当前采购数量对不上,也要跟进
$channelUserNumber = count(explode(',', $supplier['channel_uid']));
if ($channelUserNumber != $count) {
return false;
}
return true;
}
}
\ No newline at end of file
......@@ -204,10 +204,27 @@ class SupplierService
public function allocatePurchaseUser($supplierId, $purchaseUid)
{
$model = new SupplierChannelModel();
return $model->where('supplier_id', $supplierId)->update([
$supplier = $model->where('supplier_id', $supplierId)->first();
$supplier = $supplier ? $supplier->toArray() : [];
$result = $model->where('supplier_id', $supplierId)->update([
'update_time' => time(),
'purchase_uid' => $purchaseUid,
]);
$toFollowUp = false;
if ($result) {
//重新分配渠道开发并且开发人员有变更的时候,就去检查是否需要跟进
if ($supplier['purchase_uid']!=$purchaseUid) {
$auditService = new SupplierAuditService();
//还要判断是否为待跟进供应商
if (!$auditService->checkIsNeedToFollowUpSupplier($supplierId)) {
$toFollowUp = true;
$model->where('supplier_id', $supplierId)->update([
'to_follow_up' => 1,
]);
}
}
}
return $toFollowUp;
}
}
\ No newline at end of file
......@@ -34,6 +34,7 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
Route::match(['get', 'post'], '/api/common/{key}', 'CommonApiController@Entrance');
Route::match(['get', 'post'], '/api/supplier_log/{key}', 'SupplierLogApiController@Entrance');
Route::match(['get', 'post'], '/api/supplier_contact/{key}', 'SupplierContactApiController@Entrance');
Route::match(['get', 'post'], '/api/supplier_statistics/{key}', 'SupplierStatisticsApiController@Entrance');
Route::match(['get', 'post'], '/api/supplier/{key}', 'SupplierApiController@Entrance');
Route::match(['get', 'post'], '/api/log/{key}', 'LogApiController@Entrance');
Route::match(['get', 'post'], '/api/supplier_receipt/{key}', 'SupplierReceiptApiController@Entrance');
......
......@@ -34,7 +34,7 @@ class TransformableTimeIntervalPresenter
</div>
<div class="layui-col-md6">
<div style="margin-top: 5px;">
<div class="layui-col-md2" style="margin-left: 5px">
<div class="layui-col-md2" style="margin-left: 17px">
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm day_type_button"
dateInterval="$todayTimeInterval"
id="${unique}_today">今日</button>
......@@ -72,6 +72,9 @@ class TransformableTimeIntervalPresenter
,type: 'date'
,trigger:'click'
,range: '~' //或 range: '~' 来自定义分割字符
,change: function (value, date, endDate) {
alert(123)
}
});
$('.day_type_button').click(function() {
$('.day_type_button').attr('class','layui-btn layui-btn-primary layui-btn-sm day_type_button');
......
......@@ -63,12 +63,7 @@ return [
//2 => 'FTP',
3 => '云芯',
],
'SupplierStockupType' => [
1 => '猎芯联营',
// 1 => '猎芯自采',
// 2 => '商家寄售',
// 3 => '猎芯自采+商家寄售'
],
'StockupType' => [
1 => '联营',
2 => '自营',
......@@ -77,18 +72,6 @@ return [
5 => '云芯',
],
'UploadLogType' => [
'建立任务',
'处理中',
'处理成功',
'处理失败',
],
'SupplierCode' => [
1 => 'ZC',
2 => 'JS',
3 => 'ZJ'
],
'SupplierPayType' => [
1 => '账期-周期结算',
2 => '账期-定期结算',
......@@ -101,12 +84,6 @@ return [
3 => '云芯',
],
'SupplierPayTypeAB' => [
1 => ['MonthLy ', 'th,st,nd,rd'],
2 => ['NET ', ' Days'],
3 => 'T/T in advanced',
4 => ['DEposti ', '%']
],
'SupplierStatus' => [
-3 => '已拉黑',
......@@ -144,151 +121,13 @@ return [
6 => '瑞士法郎'
],
'CurrencySyb' => [
1 => '¥',
2 => '$',
3 => 'HK$',
4 => '€',
5 => '£',
6 => 'CHF'
],
'ReceiptType' => [
1 => '大陆',
2 => '港澳台和国外'
],
'PurchaseStatus' => [
-10 => '作废',
-2 => '创建中',
-1 => '草稿',
1 => '待审核',
4 => '待收货',
6 => '部分收货',
10 => '完全收货',
11 => '强制完成',
],
'PurchaseAuthStatus' => [
-1 => '草稿',
1 => '待审核',
],
'DeliveryUnit' => [
1 => '天',
2 => '工作日',
3 => '周',
4 => '月'
],
'DeliveryUnitAB' => [
1 => ' days',
2 => ' Working days',
3 => ' weeks',
4 => ' months'
],
'clause' => [
0 => 'EXW',
1 => 'FCA',
2 => 'CPT',
3 => 'CIP',
4 => 'DAT',
5 => 'DAP',
6 => 'DDP',
7 => 'FAS',
8 => 'FOB',
9 => 'CFR',
10 => 'CIF'
],
'ExcelSet' => [
'values' => [
'A' => [
[24, 'picking_info', 'address'],
[25, 'Requirement'],
[5, 'picking_sn']
],
'B' => [
[8, 'UserInfo', 'name'],
[9, 'picking_info', 'tel'],
[10, 'picking_info', 'fax']
],
'G' => [
[7, 'supplier_name'],
[8, 'supplier_info', 'channel', 'supplier_consignee'],
[9, 'supplier_info', 'channel', 'supplier_mobile'],
[10, 'supplier_info', 'channel', 'supplier_fax'],
[11, 'supplier_info', 'channel', 'supplier_address']
],
'C' => [
[16, 'picking_amount'],
[17, 'picking_amount_s']
],
],
'abvales' => [
'B' => [
[5, 'data'],
[8, 'UserInfo', 'email'],
[10, 'supplier_name'],
[11, 'supplier_info', 'channel', 'supplier_mobile'],
[12, 'supplier_info', 'channel', 'supplier_fax'],
[13, 'supplier_info', 'channel', 'supplier_email'],
[14, 'supplier_info', 'channel', 'supplier_consignee']
],
'H' => [
[5, 'picking_sn'],
[6, 'picking_info', 'clause'],
[8, 'Requirement']
],
'J' => [
[17, 'picking_amount']
]
]
],
'ProductStatus' => [
'1' => '上架',
'3' => '下架',
'0' => '待入库',
],
//v3订单状态
'ORDER_STATUS' => [
'-1' => '已取消',
'-2' => '审核不通过',
'1' => '待审核',
'2' => '待付款',
'3' => '待付尾款',
'4' => '待发货',
'7' => '部分发货',
'8' => '待收货',
'10' => '交易成功',
],
// 订单类型
'ORDER_TYPE' => [
'1' => '平台',
'2' => 'ERP',
// '3' => '京东',
],
'SEARCH_TYPE' => [
'1' => '会员账号',
'2' => '订单编号',
'3' => '型号名称',
],
//订单付款方式
'ORDER_PAY_TYPE_NAME' => [
'1' => '全款订单',
'2' => '预付订单',
'3' => '账期订单',
],
'SafeStockStatus' => [
'1' => '库存数量<安全库存',
'2' => '安全库存=库存数量',
'3' => '安全库存=0',
],
'SUPPLIER_REDIS_PRE' => 'supp_extend_fee',
'SUPPLIER_INFO_REDIS_PRE' => 'supp_info_',
'SUPPLIER_ID' => '17', // 供应商id
......@@ -329,5 +168,19 @@ return [
'confidentiality_agreement' => '保密协议',
'cooperation_agreement' => '合作协议',
'other_attachment' => '其它附件',
]
],
//罗盘菜单对应id
'CompassMenuMap'=> [
'total' => '全部',
'pending' => '待审核',
'in_review' => '审核中',
'passed' => '已通过',
'rejected' => '未通过',
'disable' => '禁止交易',
'no_purchase_uid' => '渠道未分配',
'invalid_channel_uid' => '无效采购员',
'invalid_purchase_uid' => '无效渠道员',
'to_follow_up' => '待跟进',
'no_sku' => '无sku',
],
];
<?php
//验证相关字段
return [
//供应商必填信息
'SupplierRequireField' => [
'supplier_name' => '供应商名称',
'register_company_name' => '注册公司名',
'region' => '所在区域',
'stockup_type' => '合作类型',
'supplier_group' => '公司性质',
'business_license' => '营业执照',
'contact' => '联系方式',
]
];
\ No newline at end of file
......@@ -12,6 +12,7 @@
} else {
if (res.err_code === 0) {
admin.closeThisDialog();
//修改罗盘显示数量(cao)
parent.layer.msg(res.err_msg, {icon: 6});
} else {
parent.layer.msg(res.err_msg, {icon: 5});
......
......@@ -7,7 +7,8 @@
let table = layui.table;
let form = layui.form;
let whereCondition = {source_type: 'all'};
let initCondition = {source_type: 'all'};
let whereCondition = initCondition;
let type = 'all';
//点击罗盘筛选
......@@ -87,7 +88,8 @@
title: '新增供应商',
offset: ['10px'],
end: function () {
// table.reload('list');
table.reload('list');
supplierStatistics();
}
});
})
......@@ -112,6 +114,7 @@
title: '审核供应商',
end: function () {
table.reload('list');
supplierStatistics();
}
});
}
......@@ -134,6 +137,7 @@
title: '配置渠道开发员',
end: function () {
table.reload('list');
supplierStatistics();
}
});
} else {
......@@ -158,6 +162,7 @@
let res = ajax('/api/supplier/DisableSupplier', {supplier_id: supplierId})
if (res.err_code === 0) {
table.reload('list')
supplierStatistics();
layer.closeAll();
layer.msg(res.err_msg, {icon: 6})
} else {
......@@ -172,14 +177,15 @@
});
form.on('submit(load)', function (data) {
let whereData = $.extend(false, whereCondition, data.field);
whereCondition = $.extend(false, initCondition, data.field);
//执行重载
table.reload('list', {
page: {
curr: 1
}
, where: whereData
, where: whereCondition
});
supplierStatistics();
return false;
});
......
@include('web.supplier.SupplierListCommon')
<div class="layui-btn-group demoTable" style="margin-bottom: 15px;margin-top: 15px">
@if(checkPerm('AddSupplier'))
<button type="button" class="layui-btn layui-btn-sm" id="add_supplier">新增</button>
@endif
@if(checkPerm('DisableSupplier'))
<button type="button" class="layui-btn layui-btn-sm" id="disable_supplier">禁用</button>
@endif
@if(checkPerm('AuditSupplier'))
<button type="button" class="layui-btn layui-btn-sm" id="audit_supplier">审核</button>
@endif
@if(checkPerm('AllocatePurchaseUid'))
<button type="button" class="layui-btn layui-btn-sm" id="allocate_purchase_user">分配渠道员</button>
@endif
</div>
<table class="layui-table" id="list" lay-filter="list"></table>
......
......@@ -6,51 +6,71 @@
<a class="main_filter layui-badge layui-bg-green" id="all">全部({{$statistics['total']}})</a>
</div>
<div class="split-item" id="s2" style="text-align: center">
@if(checkPerm('SupplierPendingList'))
<div class="layui-row">
<a class="main_filter" id="pending">
待审核({{$statistics['pending']}})</a>
</a>
</div>
@endif
@if(checkPerm('SupplierPendingList'))
<div class="layui-row">
<a class="main_filter" id="in_review">
审核中({{$statistics['in_review']}})</a>
</a>
</div>
@endif
@if(checkPerm('SupplierPendingList'))
<div class="layui-row">
<a class="main_filter" id="passed">
已通过({{$statistics['passed']}})</a>
</a>
</div>
@endif
@if(checkPerm('SupplierPendingList'))
<div class="layui-row">
<a class="main_filter" id="rejected">
未通过({{$statistics['rejected']}})</a>
</a>
</div>
@endif
@if(checkPerm('SupplierPendingList'))
<div class="layui-row">
<a class="main_filter" id="disable">
禁止交易({{$statistics['disable']}})</a>
</a>
</div>
@endif
</div>
<div class="split-item" id="s3" style="text-align: center">
@if(checkPerm('SupplierPendingList'))
<div class="layui-row">
<a class="main_filter" id="no_purchase_uid">
渠道未分配({{$statistics['no_purchase_uid']}})</a>
</a>
</div>
@endif
@if(checkPerm('SupplierPendingList'))
<div class="layui-row">
<a class="main_filter" id="invalid_channel_uid">
无效采购员({{$statistics['invalid_channel_uid']}})</a>
</a>
</div>
@endif
@if(checkPerm('SupplierPendingList'))
<div class="layui-row">
<a class="main_filter" id="invalid_purchase_uid"> 无效渠道员({{$statistics['invalid_purchase_uid']}}
</a>
<a class="main_filter" id="invalid_purchase_uid">
</a>
</div>
@endif
</div>
<div class="split-item" id="s4" style="text-align: center">
@if(checkPerm('SupplierPendingList'))
<div class="layui-row">
<a class="main_filter" id="to_follow_up">
待跟进({{$statistics['to_follow_up']}})</a>
</a>
</div>
@endif
@if(checkPerm('SupplierPendingList'))
<div class="layui-row">
<a class="main_filter" id="no_sku">
无sku({{$statistics['no_sku']}})</a>
</a>
</div>
@endif
</div>
<div class="split-item" id="s5">
</div>
......@@ -74,10 +94,10 @@
@inject('transformableInputPresenter','App\Presenters\Filter\TransformableInputPresenter')
{!! $transformableInputPresenter->render(['supplier_name'=>'供应商名称','supplier_code'=>'供应商编码','supplier_id'=>'供应商ID']) !!}
</div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('status','供应商状态','',config('fixed.SupplierStatus')) !!}
</div>
{{-- <div class="layui-inline">--}}
{{-- @inject('statusPresenter','App\Presenters\StatusPresenter')--}}
{{-- {!! $statusPresenter->render('status','供应商状态','',config('fixed.SupplierStatus')) !!}--}}
{{-- </div>--}}
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('stockup_type','合作类型','',config('fixed.StockupType')) !!}
......@@ -109,6 +129,18 @@
</form>
</div>
<script>
//一进来就去获取统计数据
function supplierStatistics() {
let res = ajax('/api/supplier_statistics/GetSupplierStatistics');
if (res.err_code === 0) {
$.each(res.data, function (index, value) {
let menuObj = $('#' + index);
menuObj.text('');
menuObj.append(value);
});
}
}
supplierStatistics();
//罗盘隐藏
$('.hide_filter_type').click(function () {
$(this).hide();
......
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