Commit cfdd2850 by mushishixian

解决bug

parent e93195ff
......@@ -418,6 +418,9 @@ class SupplierApiController extends Controller
if (empty($blockReason)) {
$this->response(-1, '必须填写拉黑原因');
}
if (mb_strlen($blockReason)>200) {
$this->response(-1, '拉黑原因不能超过200字');
}
$channelModel = new SupplierChannelModel();
$result = $channelModel->where('supplier_id', $supplierId)->update([
'block_reason' => $request->get('block_reason'),
......
......@@ -3,6 +3,7 @@
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Services\DepartmentService;
use App\Http\Services\SupplierShareApplyService;
use App\Model\SupplierChannelModel;
use Illuminate\Http\Request;
......@@ -33,10 +34,16 @@ class SupplierShareApplyApiController extends Controller
$supplierModel = new SupplierChannelModel();
$supplier = $supplierModel->where('supplier_name', $supplierName)->first();
if (empty($supplier)) {
$this->response(-1, '没有匹配到存在的供应商');
$this->response(-1, '该供应商名称不存在,请输入正确供应商名称');
}
$applyService = new SupplierShareApplyService();
$departments = $applyService->getApplyCanUseDepartments($supplier);
//获取当前人的部门id,如果部门列表里面包含自己的部门,则提示该供应商属于自己部门,请找主管分配
$departmentService = new DepartmentService();
$department = $departmentService->getTopDepartmentByUserId($request->user->userId);
if (in_array($department, $departments)) {
$this->response(-1, '该供应商属于自己部门,请找主管分配');
}
if (empty($departments)) {
$this->response(-1, '该供应商不存在相关联的部门');
}
......
......@@ -19,7 +19,7 @@ class SupplierFilter
$query = $this->defaultFilter($query, $map['source_type']);
//判断筛选参数
if (!empty($map['supplier_id'])) {
$query->where('supplier_id', $map['supplier_id']);
$query->where('supplier_channel.supplier_id', $map['supplier_id']);
}
if (!empty($map['supplier_name'])) {
$query->where('supplier_name', 'like', "%{$map['supplier_name']}%");
......@@ -136,9 +136,11 @@ class SupplierFilter
$inUserIdSql = "(" . $inUserIdSql . ")";
if ($subordinateCodeIds) {
if ($canViewFakeSupplier) {
$query->whereRaw(DB::raw("(create_uid in $inUserIdSql or purchase_uid in $inCodeIdSql or channel_uid REGEXP '$likeSqlRaw' or is_type = 1) "));
$query->whereRaw(DB::raw("(create_uid in $inUserIdSql or purchase_uid in $inCodeIdSql
or channel_uid REGEXP '$likeSqlRaw' or is_type = 1) "));
} else {
$query->whereRaw(DB::raw("(create_uid in $inUserIdSql or purchase_uid in $inCodeIdSql or channel_uid REGEXP '$likeSqlRaw') "));
$query->whereRaw(DB::raw("(create_uid in $inUserIdSql or purchase_uid in $inCodeIdSql
or channel_uid REGEXP '$likeSqlRaw') "));
}
} else {
if ($canViewFakeSupplier) {
......@@ -234,21 +236,21 @@ class SupplierFilter
});
break;
//附件里面缺少品质协议的
// case "no_quality_assurance_agreement":
// $query->leftjoin('supplier_attachment', 'supplier_channel.supplier_id', '=',
// 'supplier_attachment.supplier_id')
// ->selectRaw('lie_supplier_channel.*,
// lie_supplier_attachment.quality_assurance_agreement,lie_supplier_attachment.supplier_id')
// ->where(function ($q) {
// $q->where('supplier_attachment.quality_assurance_agreement', '')
// ->orWhereNull('supplier_attachment.supplier_id');
// });
// break;
case "no_quality_assurance_agreement":
$query->whereHas('attachment', function ($q) {
$q->where('quality_assurance_agreement', '')->orWhereNull('supplier_id');
});
$query->leftjoin('supplier_attachment', 'supplier_channel.supplier_id', '=',
'supplier_attachment.supplier_id')
->selectRaw('lie_supplier_channel.*,
lie_supplier_attachment.quality_assurance_agreement,lie_supplier_attachment.supplier_id')
->where(function ($q) {
$q->where('supplier_attachment.quality_assurance_agreement', '')
->orWhereNull('supplier_attachment.supplier_id');
});
break;
// case "no_quality_assurance_agreement":
// $query->whereHas('attachment', function ($q) {
// $q->where('quality_assurance_agreement1', '')->orWhereNull('supplier_id');
// });
// break;
//联系人待完善
case "contact_no_complete":
$query->whereHas('contact', function ($q) {
......
......@@ -40,18 +40,29 @@ class DataService
}
}
unset($file);
$business_license = array_get($files, 'business_license');
$billing_information = array_get($files, 'billing_information');
$registration_certificate = array_get($files, 'registration_certificate');
$incorporation_certificate = array_get($files, 'incorporation_certificate');
$certification_notice = array_get($files, 'certification_notice');
$supplier_survey = array_get($files, 'supplier_survey');
$proxy_certificate = array_get($files, 'proxy_certificate');
$quality_assurance_agreement = array_get($files, 'quality_assurance_agreement');
$confidentiality_agreement = array_get($files, 'confidentiality_agreement');
$cooperation_agreement = array_get($files, 'cooperation_agreement');
$other_attachment = array_get($files, 'other_attachment');
$attachment = [
'business_license' => array_get($files, 'business_license'),
'billing_information' => array_get($files, 'billing_information'),
'registration_certificate' => array_get($files, 'registration_certificate'),
'incorporation_certificate' => array_get($files, 'incorporation_certificate'),
'certification_notice' => array_get($files, 'certification_notice'),
'supplier_survey' => array_get($files, 'supplier_survey'),
'proxy_certificate' => array_get($files, 'proxy_certificate'),
'quality_assurance_agreement' => array_get($files, 'quality_assurance_agreement'),
'confidentiality_agreement' => array_get($files, 'confidentiality_agreement'),
'cooperation_agreement' => array_get($files, 'cooperation_agreement'),
'other_attachment' => array_get($files, 'other_attachment'),
'business_license' => $business_license?[$business_license]:'',
'billing_information' => $billing_information?[$billing_information]:'',
'registration_certificate' => $registration_certificate?[$registration_certificate]:'',
'incorporation_certificate' => $incorporation_certificate?[$incorporation_certificate]:'',
'certification_notice' => $certification_notice?[$certification_notice]:'',
'supplier_survey' => $supplier_survey?[$supplier_survey]:'',
'proxy_certificate' => $proxy_certificate?[$proxy_certificate]:'',
'quality_assurance_agreement' => $quality_assurance_agreement?[$quality_assurance_agreement]:'',
'confidentiality_agreement' => $confidentiality_agreement?[$confidentiality_agreement]:'',
'cooperation_agreement' => $cooperation_agreement?[$cooperation_agreement]:'',
'other_attachment' => $other_attachment?[$other_attachment]:'',
'create_time' => time(),
'update_time' => time(),
'supplier_id' => $supplierId,
......
......@@ -50,4 +50,20 @@ class SupplierAddressService
return $result;
}
//保存发货地址
public function saveShippingAddress($supplierId,$address)
{
$supplierModel = new SupplierChannelModel();
$supplierCode = $supplierModel->where('supplier_id', $supplierId)->value('supplier_code');
//组装成两条数据(鬼知道以前为啥存两条)
$shippingData = [
'supplier_id' => $supplierId,
'supplier_code' => $supplierCode,
'address' => $address,
'address_type' => 1,
];
$addressModel = new SupplierAddressModel();
$addressModel->insert($shippingData);
}
}
\ No newline at end of file
......@@ -73,7 +73,7 @@ class SupplierService
];
$address = array_only($channel,
['supplier_id', 'shipping_address', 'return_address', 'return_consignee', 'return_phone']);
$shippingAddress = array_get($channel, 'shipping_address');
$attachment = $channel['attachment'];
unset($channel['hk'], $channel['cn'], $channel['return_phone'], $channel['return_address'],
$channel['return_consignee'], $channel['shipping_address'], $channel['cn_delivery_time_period'],
......@@ -119,11 +119,16 @@ class SupplierService
$contact['admin_id'] = request()->user->userId;
$contactModel = new SupplierContactModel();
$contactModel->insert($contact);
//保存生成的内部编码
$this->saveSupplierCode($supplierId);
//新增的时候也要去添加地址了
$supplierAddressService = new SupplierAddressService();
$supplierAddressService->saveShippingAddress($supplierId, $shippingAddress);
} else {
$supplierId = $this->newSupplierId = $channel['supplier_id'];
//要做进一步判断,部分字段修改不需要审核
$auditService = new SupplierAuditService();
$needAudit = $auditService->checkNeedAudit($supplierId, $channel,$attachment);
$needAudit = $auditService->checkNeedAudit($supplierId, $channel, $attachment);
if ($needAudit) {
$channel['status'] = SupplierChannelModel::STATUS_IN_REVIEW;
}
......@@ -151,8 +156,6 @@ class SupplierService
//保存附件
$attachmentService = new SupplierAttachmentService();
$attachmentService->saveAttachment($supplierId, $attachment);
//保存生成的内部编码
$this->saveSupplierCode($supplierId);
//重新生成外部显示的编码
$this->generateSupplierSn($supplierId, $channel['supplier_group']);
return true;
......
......@@ -105,7 +105,7 @@ class SupplierShareApplyService
//当要判断申请者申请的部门的时候,要复审人为空,因为复审这一步是被申请部门的人审核的
$q->where('apply_department_id', $departmentId)->where('review_uid', 0)->where('audit_uid', '!=', 0);
})->orderBy('id', 'desc');
$limit = request()->get('limit', 10);
$limit = request()->get('limit', 20);
$list = $query->paginate($limit)->toArray();
$transformer = new SupplierShareApplyTransformer();
$list['data'] = $transformer->transformList($list['data']);
......
......@@ -87,7 +87,7 @@ class SupplierStatisticsService
$model = new SupplierChannelModel();
//显示默认的数据(有权限逻辑)
$filter = new SupplierFilter();
$model = $model->where('supplier_id', '>', 0);
$model = $model->where('supplier_code', '!=', '');
return $filter->defaultFilter($model, $type)->count();
}
}
\ No newline at end of file
......@@ -45,5 +45,5 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
Route::match(['get', 'post'], '/test', function () {
$service = new \App\Http\Services\DataService();
// $service->initSystemTag();
$service->replaceStandardBrandId();
$service->transferFileData();
});
......@@ -41,6 +41,14 @@
.layui-table-click {
background-color: #ddf2e9 !important;
}
.list-href {
color: dodgerblue;
}
.list-href:hover {
color: #1417F4;
}
</style>
<body>
<!-- 正文开始 -->
......
......@@ -6,7 +6,7 @@
, url: '/api/supplier_share_apply/GetAuditSupplierShareApplyList'
, method: 'post'
, size: 'sm'
, limit: 10
, limit: 20
, cellMinWidth: 80 //全局定义常规单元格的最小宽度
, where: {}
, loading: true
......
......@@ -62,7 +62,7 @@
field: 'supplier_code', title: '供应商编码', align: 'center', width: 90, templet: function (data) {
return "<a ew-href='/supplier/SupplierDetail?view=iframe&supplier_id=" + data.supplier_id +
"' style='color: dodgerblue' ew-title='供应商详情 - " + data.supplier_code + "'>" + data.supplier_code + "</a>"
"' class='list-href' ew-title='供应商详情 - " + data.supplier_code + "'>" + data.supplier_code + "</a>"
}
},
{
......@@ -82,9 +82,17 @@
}
},
{
field: 'quality_assurance_agreement', title: '品质协议', align: 'center', width: 80, templet: function (data) {
if (data.attachment) {
return data.attachment.quality_assurance_agreement ? '有' : '无';
}
return '无';
}
},
{
field: 'contact_num', title: '联系人', align: 'center', width: 70, templet: function (data) {
return "<a ew-href='/supplier/SupplierDetail?view=iframe&tab=contact&supplier_id=" + data.supplier_id +
"' style='color: dodgerblue' ew-title='供应商详情 - " + data.supplier_code + "' title='点击跳转查看联系人列表'>" + data.contact_num + "</a>"
"' class='list-href' ew-title='供应商详情 - " + data.supplier_code + "' title='点击跳转查看联系人列表'>" + data.contact_num + "</a>"
}
},
......@@ -133,35 +141,41 @@
, done: function (res, curr, count) {
//得到当前页码
currentPage = curr;
res.data.forEach(function (item, index) {
if (item.status === -3) {
//禁用复选框,设置不可选中标识,将该行设置为阴影色
var tr = $(".layui-table tr[data-index=" + index + "]");
tr.find("input[type='checkbox']").prop('disabled', true);
tr.find("input[type='checkbox']").next().addClass('layui-btn-disabled');
tr.find('.layui-form-checkbox').addClass('layui-hide');
tr.css("color", "#A9A5A5");
tr.addClass('block-class')
}
});
}
});
//点击行checkbox选中
// $(document).on("click", ".layui-table-body table.layui-table tbody tr", function () {
// let index = $(this).attr('data-index');
// let tableBox = $(this).parents('.layui-table-box');
// //存在固定列
// if (tableBox.find(".layui-table-fixed.layui-table-fixed-l").length > 0) {
// tableDiv = tableBox.find(".layui-table-fixed.layui-table-fixed-l");
// } else {
// tableDiv = tableBox.find(".layui-table-body.layui-table-main");
// }
// console.log(tableDiv);
// let checkCell = tableDiv.find("tr[data-index=" + index + "]").find("td div.laytable-cell-checkbox div.layui-form-checkbox I");
// if (checkCell.length > 0) {
// checkCell.click();
// }
// });
// 点击行checkbox选中
$(document).on("click", ".layui-table-body table.layui-table tbody tr", function () {
let index = $(this).attr('data-index');
let tableBox = $(this).parents('.layui-table-box');
let tableDiv = null;
if (tableBox.find(".layui-table-fixed.layui-table-fixed-l").length > 0) {
tableDiv = tableBox.find(".layui-table-fixed.layui-table-fixed-l");
} else {
tableDiv = tableBox.find(".layui-table-body.layui-table-main");
}
let checkCell = tableDiv.find("tr[data-index=" + index + "]").find("td div.laytable-cell-checkbox div.layui-form-checkbox I");
if (checkCell.length > 0) {
checkCell.click();
}
});
// table.on('row(list)', function (obj) {
// console.log(obj.tr.find("td div.laytable-cell-checkbox div.layui-form-checkbox I").click())
// obj.tr.find("td div.laytable-cell-checkbox div.layui-form-checkbox I").click();
// });
//
// $(document).on("click", "td div.laytable-cell-checkbox div.layui-form-checkbox", function (e) {
// e.stopPropagation();
// });
$(document).on("click", "td div.laytable-cell-checkbox div.layui-form-checkbox", function (e) {
e.stopPropagation();
});
//监听复选框事件,被选中的行高亮显示
table.on('checkbox(list)', function (obj) {
......@@ -170,8 +184,10 @@
return
}
if (obj.checked === true && obj.type === 'all') {
//点击全选
$('.layui-table-body table.layui-table tbody tr').addClass('layui-table-click');
//点击全选,拉黑的不用选上
$('.layui-table-body table.layui-table tbody tr:not(.block-class)').addClass('layui-table-click');
$('.layui-table-body table.layui-table tbody').find('.block-class').find('.layui-form-checkbox').remove();
$('.layui-table-body table.layui-table tbody tr .block-class').addClass('layui-table-click');
} else if (obj.checked === false && obj.type === 'all') {
//点击全不选
$('.layui-table-body table.layui-table tbody tr').removeClass('layui-table-click');
......@@ -282,39 +298,6 @@
}
})
//分配渠道员
$("#allocate_purchase_user").click(function () {
let checkStatus = table.checkStatus('list');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
if (data.length > 1) {
layer.msg('该操作不支持多选', {icon: 5})
return;
}
const status = data[0].status;
if ((status === 3 || status === 2 || status === -2)) {
let supplierId = data[0].supplier_id;
layer.open({
type: 2,
content: '/supplier/AllocatePurchaseUser?view=iframe&supplier_id=' + supplierId,
area: ['600px', '70%'],
title: '配置渠道开发员',
end: function () {
saveRefreshData('detail', supplierId)
table.reload('list');
supplierStatistics();
}
});
} else {
layer.msg('只能对已通过/未通过/禁用状态的供应商进行渠道员分配', {icon: 5})
return false;
}
}
})
//批量修改(分配)渠道员
$("#batch_allocate_purchase_user").click(function () {
let checkStatus = table.checkStatus('list');
......@@ -326,8 +309,8 @@
} else {
let status = Array.from(data, ({status}) => status);
//分配采购员的多选操作,需要先去判断是否存在审核中的供应商,存在的话,要提示
if (status.indexOf(1) !== -1 || status.indexOf(-1) !== -1) {
layer.msg('选择的供应商里,存在审核状态的供应商,无法分配渠道员', {icon: 5})
if (status.indexOf(1) !== -1 || status.indexOf(-3) !== -1 || status.indexOf(-1) !== -1) {
layer.msg('选择的供应商里,存在审核中/待复审/黑名单的供应商,无法分配渠道员', {icon: 5})
return
}
layer.open({
......@@ -354,12 +337,11 @@
} else {
let status = Array.from(data, ({status}) => status);
let checkCanApplyInReview = true;
status.every(function (value) {
$.each(status, function (index, value) {
if (value !== 0) {
checkCanApplyInReview = false;
}
})
});
if (!checkCanApplyInReview) {
layer.msg('选择的供应商里,存在非待审核状态的供应商,无法申请审核', {icon: 5})
return false;
......@@ -390,7 +372,7 @@
return;
}
const status = data[0].status;
if ((status === 3 || status === 2 || status === -2)) {
if ((status !== -1 || status !== 1)) {
let supplierId = data[0].supplier_id;
layer.open({
type: 2,
......@@ -404,7 +386,7 @@
}
});
} else {
layer.msg('审核状态的供应商无法分配采购员', {icon: 5})
layer.msg('审核中/待复审状态的供应商无法分配采购员', {icon: 5})
return false;
}
......@@ -429,7 +411,7 @@
layer.msg("该供应商还没有进行复审,不能直接禁用;", {icon: 5})
return;
}
if ((status === 3 || status === 2) && !hasSku) {
if ((status === 3 || status === 2 || status === 0) && !hasSku) {
layer.confirm('确定要禁用该供应商吗?', function (index) {
let supplierId = data[0].supplier_id;
let res = ajax('/api/supplier/DisableSupplier', {supplier_id: supplierId})
......@@ -444,7 +426,7 @@
}
});
} else {
layer.msg('只有已通过或者未通过状态,并且没有sku的供应商才可以禁用', {'icon': 5});
layer.msg('只有待审核,已通过或者未通过状态,并且没有sku的供应商才可以禁用', {'icon': 5});
}
}
......@@ -504,7 +486,7 @@
layer.open({
type: 2,
content: '/supplier/BlockSupplier?view=iframe&supplier_id=' + supplierId,
area: ['650px', '40%'],
area: ['700px', '70%'],
title: '加入黑名单',
end: function () {
saveRefreshData('detail', supplierId)
......
......@@ -168,6 +168,7 @@
parent.layer.msg(res.err_msg, {icon: 6});
} else {
parent.layer.msg(res.err_msg, {icon: 5});
//todo
}
}
return false;
......
......@@ -7,8 +7,11 @@
<div class="layui-card-body">
<form class="layui-form" action="">
<input type="hidden" name="supplier_id" value="{{$supplier['supplier_id']}}">
<blockquote class="layui-elem-quote layui-text">
<b>基本信息</b>
</blockquote>
<div class="layui-form-item">
<label class="layui-form-label">基本信息 : </label>
<label class="layui-form-label">供应商名称 : </label>
<div class="layui-input-block block-42" style="padding-top: 7px">
{{$supplier['supplier_name']}}
<a style="color: dodgerblue;margin-left: 20px"
......@@ -17,8 +20,13 @@
>{{$supplier['supplier_code']}}</a>
</div>
</div>
<blockquote class="layui-elem-quote layui-text">
<b>注意</b>
<br>
对应供应商设为黑名单后,猎芯将无法与其进行交易,如要再次启用,则须再次走审核流程。
</blockquote>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">原因说明 : </label>
<label class="layui-form-label"><span class="require">*</span> 原因说明 : </label>
<div class="layui-input-block">
<textarea name="block_reason" required placeholder="请填写拉黑原因" class="layui-textarea"></textarea>
</div>
......
......@@ -10,6 +10,7 @@
width: 100%;
z-index: 10;
}
.required_field {
color: red;
margin-right: 5px;
......@@ -126,7 +127,7 @@
<div class="layui-col-md6">
<span class="required_field">*</span> 注册地址 :{{$supplier['supplier_address']}}
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md2">
<span class="required_field">*</span> 法人代表 :{{$supplier['legal_representative']}}
......@@ -182,8 +183,8 @@
@endif
{{array_get(config('fixed.FileNameMapping'),$key)}} :
@foreach($item as $k=>$v)
<a href="{{$v['url']}}" style="color: dodgerblue"
target="_blank">{{$v['file_name']}}</a> |
<a href="{{array_get($v,'url')}}" style="color: dodgerblue"
target="_blank">{{array_get($v,'file_name')}}</a> |
@endforeach
</div>
@endif
......
......@@ -66,6 +66,16 @@
value="{{$supplier['supplier_address'] or ''}}">
</div>
</div>
@if($operate=='add')
<div class="layui-col-md12">
<label class="layui-form-label">发货地址 : </label>
<div class="layui-input-block">
<input type="text" name="shipping_address" id="shipping_address"
placeholder="请输入发货地址" class="layui-input"
value="{{$address['shipping_address'] or ''}}">
</div>
</div>
@endif
</div>
</div>
<div class="layui-form-item">
......@@ -80,7 +90,7 @@
</div>
</div>
<div class="layui-col-md8">
<label class="layui-form-label" style="width: 80px">成立时间 :
<label class="layui-form-label" style="width: 80px"><span class="require">*</span>成立时间 :
</label>
<div class="layui-input-block" style="width: 150px">
<input type="text" id="established_time" name="established_time"
......
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