Commit 76de2e20 by 杨树贤

查询供应商完善

parent cdb6e112
...@@ -735,9 +735,12 @@ class SupplierApiController extends Controller ...@@ -735,9 +735,12 @@ class SupplierApiController extends Controller
//查询供应商 //查询供应商
public function querySupplier($request) public function querySupplier($request)
{ {
$supplierName = $request->input('supplier_name'); $supplierName = trim($request->input('supplier_name'));
if (!$supplierName) {
$this->response(-1,'供应商名称不能为空');
}
$supplier = (new SupplierService())->querySupplier($supplierName); $supplier = (new SupplierService())->querySupplier($supplierName);
$this->response(0, 'ok', $supplier); $this->response(0, '查询成功', $supplier);
} }
} }
...@@ -8,6 +8,7 @@ use App\Http\Transformers\SupplierTransformer; ...@@ -8,6 +8,7 @@ use App\Http\Transformers\SupplierTransformer;
use App\Http\Validators\SupplierValidator; use App\Http\Validators\SupplierValidator;
use App\Model\LogModel; use App\Model\LogModel;
use App\Model\RedisModel; use App\Model\RedisModel;
use App\Model\SupplierAccountModel;
use App\Model\SupplierAddressModel; use App\Model\SupplierAddressModel;
use App\Model\SupplierAttachmentsModel; use App\Model\SupplierAttachmentsModel;
use App\Model\SupplierChannelModel; use App\Model\SupplierChannelModel;
...@@ -738,6 +739,11 @@ class SupplierService ...@@ -738,6 +739,11 @@ class SupplierService
{ {
$supplier = SupplierChannelModel::where('supplier_name',$supplierName)->first(); $supplier = SupplierChannelModel::where('supplier_name',$supplierName)->first();
$supplier = !empty($supplier)?$supplier->toArray():[]; $supplier = !empty($supplier)?$supplier->toArray():[];
if ($supplier) {
//查询是否是云芯商家
$existsYunxinAccount = SupplierAccountModel::where('supplier_id',$supplier['supplier_id'])->exists();
$supplier['is_yunxin_supplier'] = $existsYunxinAccount ? 1 : 0;
}
return $supplier; return $supplier;
} }
......
...@@ -4,37 +4,38 @@ ...@@ -4,37 +4,38 @@
let form = layui.form; let form = layui.form;
let table = layui.table let table = layui.table
let element = layui.element; let element = layui.element;
form.on('submit(auditSupplier)', function (data) {
$('#querySupplier').click(function () {
let supplierName = $('#supplier_name').val();
admin.showLoading({ admin.showLoading({
type: 3 type: 3,
}); });
let supplierIds = getQueryVariable('supplier_ids'); let url = '/api/supplier/querySupplier?supplier_name=' + supplierName;
let url = '/api/supplier/BatchAllocatePurchaseUser?supplier_ids=' + supplierIds; let res = ajax(url);
$.ajax({ if (!res) {
url: url, admin.removeLoading();
type: 'GET', layer.msg('网络错误,请重试', {icon: 6});
async: true, } else {
data: data.field, if (res.err_code === 0) {
dataType: 'json',
timeout: 20000, let exists = res.data.supplier_id?'是':'否';
success: function (res) { $('#exists').text(exists);
let uploadedSku = res.data.uploaded_sku?'是':'否';
$('#uploaded_sku').text(uploadedSku);
let isYunxinSupplier = res.data.is_yunxin_supplier ? '是':'否';
$('#is_yunxin_supplier').text(isYunxinSupplier);
admin.removeLoading(); admin.removeLoading();
if (res.err_code === 0) { if (res.data.length === 0) {
admin.closeThisDialog(); layer.msg('供应商不存在',{icon:5})
parent.layer.msg(res.err_msg, {icon: 6}); }else{
} else { layer.msg(res.err_msg, {icon: 6});
parent.layer.msg(res.err_msg, {icon: 5});
} }
}, } else {
error: function () {
admin.removeLoading(); admin.removeLoading();
parent.layer.msg('网络错误', {icon: 5}); layer.msg(res.err_msg, {icon: 5});
} }
}); }
return false; return false;
}); });
form.on('submit(cancel)', function (data) {
admin.closeThisDialog();
});
}); });
</script> </script>
\ No newline at end of file
...@@ -637,6 +637,18 @@ ...@@ -637,6 +637,18 @@
} }
}) })
//设置SKU采购
$("#query_supplier").click(function () {
layer.open({
type: 2,
content: '/supplier/QuerySupplier?view=iframe',
area: ['70%', '30%'],
title: '查询供应商',
end: function () {
}
});
})
//判断是否要展示有全部离职采购员的供应商,有的话提示 //判断是否要展示有全部离职采购员的供应商,有的话提示
if (!admin.getTempData('has_pop_up_all_channel_user_supplier_tips')) { if (!admin.getTempData('has_pop_up_all_channel_user_supplier_tips')) {
$.ajax({ $.ajax({
......
...@@ -4,55 +4,32 @@ ...@@ -4,55 +4,32 @@
} }
</style> </style>
<div class="layui-card"> <div class="layui-card">
<div class="layui-card-header" style="height: 170px"> <div class="layui-card-header" style="height: 120px">
<blockquote class="layui-elem-quote layui-text">
<b>渠道开发员设置</b>
</blockquote>
<form class="layui-form" action=""> <form class="layui-form" action="">
<input type="hidden" name="supplier_ids" value="{{$supplierIds}}">
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-inline" style="margin-left: -30px"> <div class="layui-col-md9">
@inject('statusPresenter','App\Presenters\StatusPresenter') <label class="layui-form-label"><span class="require">*</span>名称</label>
{!! $statusPresenter->render('purchase_uid','渠道开发员',null, <div class="layui-input-block block-42">
$userCodes,['required'=>true,'width'=>'150px']) !!} <input type="text" name="supplier_name" id="supplier_name"
placeholder="请输入供应商名称" class="layui-input"
value="">
</div>
</div>
<div class="layui-col-md3" style="padding-left: 10px;">
<button class="layui-btn layui-btn-sm layui-btn-info" style="margin-bottom: 13px" id="querySupplier">查询</button>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item" style="padding-left: 70px;">
<div align="center" style="margin-top: 10px;text-align: right"> <div class="layui-col-md4">
<button type="button" class="layui-btn layui-btn-sm layui-btn-info submit-loading" lay-submit 是否建档 : <span id="exists"></span>
lay-filter="auditSupplier">确认 </div>
</button> <div class="layui-col-md4">
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" lay-submit 是否有平台合作 : <span id="uploaded_sku"></span>
lay-filter="cancel">取消 </div>
</button> <div class="layui-col-md4">
是否云芯商家 : <span id="is_yunxin_supplier"></span>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<div class="layui-card-body">
<blockquote class="layui-elem-quote layui-text">
<b>当前选中需要批量修改渠道员的供应商列表</b>
</blockquote>
<table class="layui-table">
<colgroup>
<col width="300">
<col width="100">
<col>
</colgroup>
<thead>
<tr>
<th>供应商名称</th>
<th>当前渠道开发员</th>
</tr>
</thead>
<tbody>
@foreach($suppliers as $supplier)
<tr>
<td>{{$supplier['supplier_name']}}</td>
<td>{{$supplier['purchase_username']}}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div> </div>
...@@ -68,6 +68,9 @@ ...@@ -68,6 +68,9 @@
@if(checkPerm('ExportSupplier')) @if(checkPerm('ExportSupplier'))
<button type="button" class="layui-btn layui-btn-sm" id="export_supplier">导出采购员全离职供应商</button> <button type="button" class="layui-btn layui-btn-sm" id="export_supplier">导出采购员全离职供应商</button>
@endif @endif
@if(checkPerm('QuerySupplier'))
<button type="button" class="layui-btn layui-btn-sm" id="query_supplier">查询供应商</button>
@endif
</div> </div>
<button type="button" id="refreshWindow" style="display: none">刷新页面</button> <button type="button" id="refreshWindow" style="display: none">刷新页面</button>
<table class="layui-table" id="list" lay-filter="list"></table> <table class="layui-table" id="list" lay-filter="list"></table>
......
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