Commit 76de2e20 by 杨树贤

查询供应商完善

parent cdb6e112
......@@ -735,9 +735,12 @@ class SupplierApiController extends Controller
//查询供应商
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);
$this->response(0, 'ok', $supplier);
$this->response(0, '查询成功', $supplier);
}
}
......@@ -8,6 +8,7 @@ use App\Http\Transformers\SupplierTransformer;
use App\Http\Validators\SupplierValidator;
use App\Model\LogModel;
use App\Model\RedisModel;
use App\Model\SupplierAccountModel;
use App\Model\SupplierAddressModel;
use App\Model\SupplierAttachmentsModel;
use App\Model\SupplierChannelModel;
......@@ -738,6 +739,11 @@ class SupplierService
{
$supplier = SupplierChannelModel::where('supplier_name',$supplierName)->first();
$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;
}
......
......@@ -4,37 +4,38 @@
let form = layui.form;
let table = layui.table
let element = layui.element;
form.on('submit(auditSupplier)', function (data) {
$('#querySupplier').click(function () {
let supplierName = $('#supplier_name').val();
admin.showLoading({
type: 3
type: 3,
});
let supplierIds = getQueryVariable('supplier_ids');
let url = '/api/supplier/BatchAllocatePurchaseUser?supplier_ids=' + supplierIds;
$.ajax({
url: url,
type: 'GET',
async: true,
data: data.field,
dataType: 'json',
timeout: 20000,
success: function (res) {
let url = '/api/supplier/querySupplier?supplier_name=' + supplierName;
let res = ajax(url);
if (!res) {
admin.removeLoading();
layer.msg('网络错误,请重试', {icon: 6});
} else {
if (res.err_code === 0) {
let exists = res.data.supplier_id?'是':'否';
$('#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();
if (res.err_code === 0) {
admin.closeThisDialog();
parent.layer.msg(res.err_msg, {icon: 6});
} else {
parent.layer.msg(res.err_msg, {icon: 5});
if (res.data.length === 0) {
layer.msg('供应商不存在',{icon:5})
}else{
layer.msg(res.err_msg, {icon: 6});
}
},
error: function () {
} else {
admin.removeLoading();
parent.layer.msg('网络错误', {icon: 5});
layer.msg(res.err_msg, {icon: 5});
}
});
}
return false;
});
form.on('submit(cancel)', function (data) {
admin.closeThisDialog();
});
});
</script>
\ No newline at end of file
......@@ -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')) {
$.ajax({
......
......@@ -4,55 +4,32 @@
}
</style>
<div class="layui-card">
<div class="layui-card-header" style="height: 170px">
<blockquote class="layui-elem-quote layui-text">
<b>渠道开发员设置</b>
</blockquote>
<div class="layui-card-header" style="height: 120px">
<form class="layui-form" action="">
<input type="hidden" name="supplier_ids" value="{{$supplierIds}}">
<div class="layui-form-item">
<div class="layui-inline" style="margin-left: -30px">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('purchase_uid','渠道开发员',null,
$userCodes,['required'=>true,'width'=>'150px']) !!}
<div class="layui-col-md9">
<label class="layui-form-label"><span class="require">*</span>名称</label>
<div class="layui-input-block block-42">
<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 class="layui-form-item">
<div align="center" style="margin-top: 10px;text-align: right">
<button type="button" class="layui-btn layui-btn-sm layui-btn-info submit-loading" lay-submit
lay-filter="auditSupplier">确认
</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" lay-submit
lay-filter="cancel">取消
</button>
<div class="layui-form-item" style="padding-left: 70px;">
<div class="layui-col-md4">
是否建档 : <span id="exists"></span>
</div>
<div class="layui-col-md4">
是否有平台合作 : <span id="uploaded_sku"></span>
</div>
<div class="layui-col-md4">
是否云芯商家 : <span id="is_yunxin_supplier"></span>
</div>
</div>
</form>
</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>
......@@ -68,6 +68,9 @@
@if(checkPerm('ExportSupplier'))
<button type="button" class="layui-btn layui-btn-sm" id="export_supplier">导出采购员全离职供应商</button>
@endif
@if(checkPerm('QuerySupplier'))
<button type="button" class="layui-btn layui-btn-sm" id="query_supplier">查询供应商</button>
@endif
</div>
<button type="button" id="refreshWindow" style="display: none">刷新页面</button>
<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