Commit 5384ad1e by mushishixian

fix

parent 46959db6
......@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Filter\SupplierFilter;
use App\Http\Services\AdminUserService;
use App\Http\Services\LogService;
use App\Http\Services\MessageService;
use App\Http\Services\SupplierAuditService;
......@@ -271,6 +272,11 @@ class SupplierApiController extends Controller
if (empty($purchaseUid)) {
$this->response(-1, '渠道开发员不能为空');
}
$adminService = new AdminUserService();
$check = $adminService->checkIsResignedByCodeId($purchaseUid);
if ($check) {
$this->response(-1, '该渠道开发员已经离职,请选择其他人员');
}
$service = new SupplierService();
$result = $service->allocatePurchaseUser($supplierId, $purchaseUid);
if (!$result) {
......
......@@ -47,6 +47,16 @@ class AdminUserService
return $user ? $user->toArray() : [];
}
//判断是否是离职人员
public function checkIsResignedByCodeId($codeId)
{
$userInfoModel = new UserInfoModel();
$count = $userInfoModel->leftJoin('lie_intracode', 'user_info.userId', '=', 'lie_intracode.admin_id')
->where('lie_intracode.code_id',$codeId)
->where('user_info.status', 4)->where('lie_intracode.code_id', '!=', '')->count();
return $count ? true : false;
}
//获取渠道开发员(运营部)的所有用户信息
public function getPurchaseUsers()
......
......@@ -112,12 +112,12 @@ class LogService
$content = '';
foreach ($diffKeys as $key) {
$oldFileName = array_get($oldFileNames, $key);
$oldFileName = $oldFileName == '选择文件上传' ? '' : $oldFileName;
$oldFileName = $oldFileName == '选择文件上传' ? ' ' : $oldFileName;
$newFileName = array_get($newFileNames, $key);
$content .= array_get(config('fixed.FileNameMapping'),
$key) . '由 [' . $oldFileName . '] 修改为 [' . $newFileName . ']; ';
$result[] = $content;
}
$result[] = $content;
}
if ($key == 'extra_fee') {
$oldFee = json_decode($oldSupplier['extra_fee'], true);
......
......@@ -72,7 +72,8 @@ class SupplierService
$channel['qualification_photos'] = $this->getPhotosData($channel['upload_file']);
unset($channel['upload_file']);
$channel['established_time'] = strtotime($channel['established_time']);
$channel['sku_upload_ruler'] = $this->getSkuRulerData($channel['sku_upload_ruler']);
$skuUploadRulerService = new SupplierSkuUploadRulerService();
$channel['sku_upload_ruler'] = $skuUploadRulerService->getSkuUploadRulerForDB($channel['sku_upload_ruler']);
$logService = new LogService();
$model = new SupplierChannelModel();
......@@ -129,6 +130,7 @@ class SupplierService
$extraFaxService->saveSupplierExtraFee($extraFax);
$this->saveRatioToRedis($supplierId);
$this->saveSkuAuditRulerToRedis($supplierId, $channel['sku_audit_ruler']);
$this->saveSkuUploadRulerToRedis($supplierId, $channel['sku_upload_ruler']);
}
//重新生成外部显示的编码
$supplierSn = $this->generateSupplierSn($supplierId, $channel['supplier_group']);
......@@ -215,6 +217,13 @@ class SupplierService
}
public function saveSkuUploadRulerToRedis($supplierId, $ruler)
{
$redis = new RedisModel();
$redis->hset('supplier_sku_upload_ruler', $supplierId, $ruler);
}
public function getAddress($supplierId)
{
$model = new SupplierAddressModel();
......
......@@ -31,6 +31,26 @@ class SupplierSkuUploadRulerService
return config('fixed.SkuUploadDefaultRuler');
}else{
return json_decode($ruler, true);
}
}
//获取需要存储到数据库的数据格式
public function getSkuUploadRulerForDB($uploadRuler)
{
if (empty($uploadRuler)) {
return json_encode(config('fixed.SkuUploadDefaultRuler'));
} else {
$defaultRuler = config('fixed.SkuUploadDefaultRuler');
$rulers = [];
foreach ($defaultRuler as $key => $ruler) {
if (empty($uploadRuler[$key])) {
$rulers[$key] = 0;
} else {
$rulers[$key] = 1;
}
}
return json_encode($rulers);
}
}
}
\ No newline at end of file
......@@ -154,7 +154,7 @@ return [
'SkuUploadDefaultRuler' => [
'allow_stock_lte_0' => 0,
'allow_moq_lte_0' => 0,
// 'allow_stock_lt_moq' => 0,
'allow_stock_lt_moq' => 0,
'allow_price_null' => 0,
],
......
......@@ -22,10 +22,6 @@ layui.config({ // common.js是配置layui扩展模块的目录,每个页面
var layer = layui.layer;
var admin = layui.admin;
// $('.submit-loading').click(function () {
// admin.btnLoading('.submit-loading');
// });
});
/** 获取当前项目的根路径,通过获取layui.js全路径截取assets之前的地址 */
......@@ -58,25 +54,46 @@ function getQueryVariable(variable) {
return '';
}
function ajax(url,data){
function ajax(url, data) {
layer.msg('加载中', {
icon: 16
,shade: 0.01
, shade: 0.01
});
var result=false;
var result = false;
$.ajax({
url:url,
type:'post',
data:data,
url: url,
type: 'post',
data: data,
async: false,
dataType:'json',
timeout:10000,
success:function (resp) {
if(resp){
result=resp;
dataType: 'json',
timeout: 10000,
success: function (resp) {
if (resp) {
result = resp;
}
}
})
layer.closeAll();
return result;
}
//保存需要刷新的页面数据
function saveRefreshData(type,supplierId = 0) {
// if (type === 'detail') {
// let data = admin.getTempData("needFreshDetail");
// if (data) {
// data = JSON.parse(data);
// data.push(supplierId);
// data = JSON.stringify(data);
// admin.putTempData("needFreshDetail",data);
// }else{
// admin.putTempData("needFreshDetail",JSON.stringify([supplierId]));
// console.log(admin.getTempData("needFreshDetail"));
// }
//
// }
//
// if (type === 'list') {
// admin.putTempData("needFreshList",1);
// }
}
\ No newline at end of file
......@@ -30,7 +30,7 @@
, page: {}
});
form.on('submit(auditSupplier)', function (data) {
admin.btnLoading('.submit-loading');
// admin.btnLoading('.submit-loading');
let supplierId = getQueryVariable('supplier_id');
let url = '/api/supplier/AllocatePurchaseUser?supplier_id=' + supplierId;
let res = ajax(url, data.field);
......
......@@ -12,13 +12,6 @@
$('#updateSupplierUrl').click(function () {
layer.load(1);
})
// admin.on('tab', function (d) {
// console.log(d);
// });
{{--console.log("{{$supplier['update_time']}}")--}}
{{--if (admin.getTempData("{{$supplier['supplier_code']}}")!={{$supplier['update_time']}}){--}}
{{-- admin.putTempData('{{$supplier['supplier_code']}}', {{$supplier['update_time']}});--}}
{{--}--}}
{{--index.setTabTitle('供应商详情 - {{$supplier['supplier_code'] or ''}}');--}}
......
......@@ -6,6 +6,7 @@
Split(['#s1', '#s2', '#s3', '#s4', '#s5'], {sizes: [9, 12, 12, 12, 55], minSize: 70});
let table = layui.table;
let form = layui.form;
let admin = layui.admin;
let initCondition = {source_type: 'all'};
let whereCondition = initCondition;
......@@ -58,7 +59,7 @@
}
}
},
{field: 'channel_username', title: '采购员', align: 'center',width: 130},
{field: 'channel_username', title: '采购员', align: 'center', width: 130},
{field: 'purchase_username', title: '渠道开发员', align: 'center', width: 120},
{field: 'create_name', title: '创建人', align: 'center', width: 80},
{field: 'update_time', title: '最近修改时间', align: 'center', width: 160},
......@@ -128,6 +129,7 @@
title: '审核供应商',
end: function () {
table.reload('list');
saveRefreshData('detail',supplierId)
supplierStatistics();
}
});
......@@ -150,6 +152,7 @@
area: ['600px', '70%'],
title: '配置渠道开发员',
end: function () {
saveRefreshData('detail',supplierId)
table.reload('list');
supplierStatistics();
}
......@@ -176,6 +179,7 @@
let supplierId = data[0].supplier_id;
let res = ajax('/api/supplier/DisableSupplier', {supplier_id: supplierId})
if (res.err_code === 0) {
saveRefreshData('detail',supplierId)
table.reload('list')
supplierStatistics();
layer.closeAll();
......@@ -205,6 +209,7 @@
let supplierId = data[0].supplier_id;
let res = ajax('/api/supplier/ChangeSupplierIsType', {supplier_id: supplierId, is_type: 0})
if (res.err_code === 0) {
saveRefreshData('detail',supplierId)
table.reload('list')
supplierStatistics();
layer.closeAll();
......
......@@ -24,6 +24,7 @@
layer.confirm(confirmMessage, function (index) {
let res = ajax('/api/supplier/UpdateSupplier', data.field)
if (res.err_code === 0) {
admin.putTempData("needFreshList",1)
table.reload('receiptList')
location.href = "/supplier/SupplierDetail?view=iframe&supplier_id={{$supplier['supplier_id']}}"
layer.msg(res.err_msg, {icon: 6})
......
......@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>{{config('website.webTitle')}} | {{$title or ''}}</title>
<script src="/js/jquery-2.2.1.js"></script>
{{-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>--}}
{{-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>--}}
<link rel="stylesheet" href="/plugins/assets/libs/layui/css/layui.css"/>
<link rel="stylesheet" href="/plugins/assets/module/admin.css?v=317"/>
<!--[if lt IE 9]>
......@@ -51,12 +51,41 @@
var index = layui.index;
var admin = layui.admin;
if (layui.admin.setter.pageTabs && layui.admin.setter.tabAutoRefresh == true) {
$('.layui-layout-admin>.layui-body>.layui-tab').attr('lay-autoRefresh', 'true');
}
// 默认加载主页
index.loadHome({
menuPath: '/index/Index?view=iframe',
menuName: '<i class="layui-icon layui-icon-home"></i>'
});
admin.on('tab', function (d) {
// $(function () {
// $('#getSupplierListButton').click();
// })
// // d.layId表示当前tab的url
// //判断列表是否需要刷新
// if (d.layId.search('SupplierList') !== -1) {
// let needFreshList = admin.getTempData("needFreshList");
// if (needFreshList) {
// // admin.putTempData("needFreshList",0)
// console.log("刷新列表")
// // $('#getSupplierListButton').click();
// } else {
// console.log("不刷新列表")
// }
// }
// //判断详情是否需要刷新
// if (d.layId.search('SupplierDetail') !== -1) {
// let data = admin.getTempData("needFreshDetail");
// console.log(data)
// if (data) {
// console.log(data)
// }
// }
});
});
</script>
</body>
......
......@@ -10,7 +10,7 @@
@if(checkPerm('AuditSupplier'))
<button type="button" class="layui-btn layui-btn-sm" id="audit_supplier">审核</button>
@endif
@if(checkPerm('AllocatePurchaseUid'))
@if(checkPerm('AllocatePurchaseUser'))
<button type="button" class="layui-btn layui-btn-sm" id="allocate_purchase_user">分配渠道员</button>
@endif
@if(checkPerm('ChangeSupplierIsType'))
......
......@@ -85,7 +85,7 @@
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<div class="layui-row" style="padding: 10px">
<input type="hidden" name="status" value="{{$supplier['status'] or 0}}">
<input type="hidden" name="status" value="{{$supplier['status'] or 0}}">
<div class="layui-row">
@include('web.supplier.SupplierBase')
</div>
......@@ -184,10 +184,17 @@
</div>
</div>
<div class="layui-tab-item">
@include('web.supplier.SupplierContact')
@if(checkPerm('ViewSupplierContact'))
@include('web.supplier.SupplierContact')
@endif
</div>
<div class="layui-tab-item">
@include('web.supplier.SupplierRuler')
<div
@if(!checkPerm('ViewRuler') || !checkPerm('UpdateRuler'))
style="display: none"
@endif>
@include('web.supplier.SupplierRuler')
</div>
</div>
<div class="layui-tab-item">内容4</div>
<div class="layui-tab-item">内容5</div>
......
......@@ -3,11 +3,17 @@
<b>联系人管理</b>
</blockquote>
@if($operate == 'update')
<div class="layui-btn-group demoTable" style="margin-top: 5px">
<button type="button" class="layui-btn layui-btn-sm" id="add_contact">新增</button>
<button type="button" class="layui-btn layui-btn-sm" id="update_contact">修改</button>
<button type="button" class="layui-btn layui-btn-sm" id="batchDelete">删除</button>
</div>
<div class="layui-btn-group demoTable" style="margin-top: 5px">
@if(checkPerm('AddSupplierContact'))
<button type="button" class="layui-btn layui-btn-sm" id="add_contact">新增</button>
@endif
@if(checkPerm('UpdateSupplierContact'))
<button type="button" class="layui-btn layui-btn-sm" id="update_contact">修改</button>
@endif
@if(checkPerm('DeleteSupplierContact'))
<button type="button" class="layui-btn layui-btn-sm" id="batchDelete">删除</button>
@endif
</div>
@endif
<table class="layui-table" lay-filter="contactList" id="contactList"></table>
</div>
......
......@@ -89,59 +89,64 @@
</div>
</div>
<div class="layui-collapse">
@if(checkPerm('ViewFilter'))
<!--通用的筛选-->
<form class="layui-form" style="margin-top: 15px">
<?php
$routerName = explode('/', request()->path())[1];
?>
<div class="layui-row">
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('supplier_group','供应商性质','',
config('fixed.SupplierGroup')) !!}
</div>
<div class="layui-inline">
@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('stockup_type','合作类型','',config('fixed.StockupType')) !!}
</div>
<div class="layui-inline">
@inject('transformableSelectPresenter','App\Presenters\Filter\TransformableSelectPresenter')
{!! $transformableSelectPresenter->render(['channel_uid'=>'采购员','purchase_uid'=>'开发员','create_uid'=>'创建人'],$userCodes) !!}
<form class="layui-form" style="margin-top: 15px">
<?php
$routerName = explode('/', request()->path())[1];
?>
<div class="layui-row">
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('supplier_group','供应商性质','',
config('fixed.SupplierGroup')) !!}
</div>
<div class="layui-inline">
@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('stockup_type','合作类型','',config('fixed.StockupType')) !!}
</div>
<div class="layui-inline">
@inject('transformableSelectPresenter','App\Presenters\Filter\TransformableSelectPresenter')
{!! $transformableSelectPresenter->render(['channel_uid'=>'采购员','purchase_uid'=>'开发员','create_uid'=>'创建人'],$userCodes) !!}
</div>
@if(checkPerm('ViewFakeSupplier'))
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('is_type','正式供应商','',[0=>'是',1=>'否'],['width'=>'100px']) !!}
</div>
@endif
</div>
@if(checkPerm('ViewFakeSupplier'))
<div class="layui-row">
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('is_type','正式供应商','',[0=>'是',1=>'否'],['width'=>'100px']) !!}
{!! $statusPresenter->render('has_sku','SKU上传','',[-1=>'否',1=>'是']) !!}
</div>
<div class="layui-inline" style="width: 600px">
@inject('transformableTimeIntervalPresenter','App\Presenters\Filter\TransformableTimeIntervalPresenter')
{!! $transformableTimeIntervalPresenter->render(['update_time'=>'更新时间','create_time'=>'创建时间']) !!}
</div>
@endif
</div>
<div class="layui-row">
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('has_sku','SKU上传','',[-1=>'否',1=>'是']) !!}
</div>
<div class="layui-inline" style="width: 600px">
@inject('transformableTimeIntervalPresenter','App\Presenters\Filter\TransformableTimeIntervalPresenter')
{!! $transformableTimeIntervalPresenter->render(['update_time'=>'更新时间','create_time'=>'创建时间']) !!}
<div class="layui-row" style="margin-top:10px;margin-bottom: 10px;margin-left: 20px;">
<button class="layui-btn layui-btn-sm layui-btn load" id="getSupplierListButton" lay-submit=""
lay-filter="load">查询
</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn" lay-submit="" lay-filter="reset">重置
</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn hide_filter_type">隐藏罗盘</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn show_filter_type"
style="display: none">显示罗盘
</button>
</div>
</div>
<div class="layui-row" style="margin-top:10px;margin-bottom: 10px;margin-left: 20px;">
<button class="layui-btn layui-btn-sm layui-btn load" lay-submit="" lay-filter="load">查询</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn" lay-submit="" lay-filter="reset">重置</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn hide_filter_type">隐藏罗盘</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn show_filter_type"
style="display: none">显示罗盘
</button>
</div>
</form>
</form>
@endif
</div>
<script>
//一进来就去获取统计数据
......
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