Commit 1af7f9a1 by mushishixian

审核申请

parent 64cb897c
...@@ -461,4 +461,14 @@ class SupplierApiController extends Controller ...@@ -461,4 +461,14 @@ class SupplierApiController extends Controller
$this->response(-1, '取消禁用操作失败'); $this->response(-1, '取消禁用操作失败');
} }
} }
//批量申请审核供应商
public function BatchApplyInReviewSupplier($request)
{
$supplierIds = $request->get('supplier_ids');
$supplierIds = explode(',', $supplierIds);
$supplierService = new SupplierService();
$supplierService->batchApplyInReviewSupplier($supplierIds);
$this->response(0, '批量申请审核成功');
}
} }
...@@ -289,9 +289,22 @@ class SupplierController extends Controller ...@@ -289,9 +289,22 @@ class SupplierController extends Controller
$supplierService = new SupplierService(); $supplierService = new SupplierService();
$supplierId = $request->get('supplier_id'); $supplierId = $request->get('supplier_id');
$printData = $supplierService->getSupplierPrintData($supplierId); $printData = $supplierService->getSupplierPrintData($supplierId);
// dd($printData);
$this->data['printData'] = $printData; $this->data['printData'] = $printData;
return $this->view('打印供应商详情'); return $this->view('打印供应商详情');
} }
//批量申请审批供应商
public function BatchApplyInReviewSupplier($request)
{
$supplierIds = $request->get('supplier_ids');
$this->data['supplierIds'] = $supplierIds;
$supplierIds = explode(',', $supplierIds);
$model = new SupplierChannelModel();
$suppliers = $model->whereIn('supplier_id', $supplierIds)->get()->toArray();
$transformer = new SupplierTransformer();
$suppliers = $transformer->transformList($suppliers);
$this->data['suppliers'] = $suppliers;
return $this->view('批量分配渠道开发员');
}
} }
\ No newline at end of file
...@@ -439,4 +439,20 @@ class SupplierService ...@@ -439,4 +439,20 @@ class SupplierService
$printData['department_name'] = $user['department_name']; $printData['department_name'] = $user['department_name'];
return $printData; return $printData;
} }
//批量申请审核供应商
public function batchApplyInReviewSupplier($supplierIds)
{
$model = new SupplierChannelModel();
foreach ($supplierIds as $supplierId) {
$result = $model->where('supplier_id', $supplierId)->update([
'update_time' => time(),
'status' => 1
]);
if (!$result) {
return $result;
}
}
return true;
}
} }
\ No newline at end of file
...@@ -87,6 +87,7 @@ return [ ...@@ -87,6 +87,7 @@ return [
'SupplierStatus' => [ 'SupplierStatus' => [
0 => '待审核',
-1 => '待复审', -1 => '待复审',
1 => '审核中', 1 => '审核中',
3 => '未通过', 3 => '未通过',
......
<script>
layui.use(['table', 'form', 'element', 'table', 'layer', 'admin'], function () {
let admin = layui.admin;
let form = layui.form;
let table = layui.table
let element = layui.element;
$('#batch_apply_in_review_supplier').click(function () {
admin.btnLoading('.submit-loading');
let supplierIds = getQueryVariable('supplier_ids');
let url = '/api/supplier/BatchApplyInReviewSupplier?supplier_ids=' + supplierIds;
let res = ajax(url);
if (!res) {
layer.msg('网络错误,请重试', {icon: 6});
} else {
if (res.err_code === 0) {
admin.closeThisDialog();
parent.layer.msg(res.err_msg, {icon: 6});
} else {
admin.btnLoading('.submit-loading', false);
parent.layer.msg(res.err_msg, {icon: 5});
}
}
});
form.on('submit(cancel)', function (data) {
admin.closeThisDialog();
});
});
</script>
\ No newline at end of file
...@@ -325,6 +325,40 @@ ...@@ -325,6 +325,40 @@
} }
}) })
//申请进入审核中的状态
$("#batch_apply_in_review_supplier").click(function () {
let checkStatus = table.checkStatus('list');
let data = checkStatus.data;
let supplierIds = Array.from(data, ({supplier_id}) => supplier_id);
supplierIds = supplierIds.join(',');
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
let status = Array.from(data, ({status}) => status);
let checkCanApplyInReview = true;
status.every(function (value) {
if (value !== 0) {
checkCanApplyInReview = false;
}
})
if (!checkCanApplyInReview) {
layer.msg('选择的供应商里,存在非待审核状态的供应商,无法申请审核', {icon: 5})
return false;
}
layer.open({
type: 2,
content: '/supplier/BatchApplyInReviewSupplier?view=iframe&supplier_ids=' + supplierIds,
area: ['600px', '70%'],
title: '批量申请审核供应商',
end: function () {
table.reload('list');
supplierStatistics();
}
});
}
})
//分配采购员 //分配采购员
$("#allocate_channel_user").click(function () { $("#allocate_channel_user").click(function () {
......
<style>
.layui-form-item {
margin-bottom: 5px;
}
</style>
<div class="layui-card">
<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 align="center" style="margin-top: 20px;text-align: right">
<button type="button" class="layui-btn layui-btn-sm layui-btn-info submit-loading" id="batch_apply_in_review_supplier">确认
</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" id="cancel">取消
</button>
</div>
</div>
...@@ -25,8 +25,11 @@ ...@@ -25,8 +25,11 @@
转正供应商 转正供应商
</button> </button>
@endif @endif
<button type="button" class="layui-btn layui-btn-sm" title="点击确定审核后会进入审核中状态" id="batch_apply_in_review_supplier">
申请审核
</button>
@if(checkPerm('ChangeSupplierIsType')) @if(checkPerm('ChangeSupplierIsType'))
{{-- @if(checkPerm('BlockSupplier'))--}} {{-- @if(checkPerm('BlockSupplier'))--}}
<button type="button" class="layui-btn layui-btn-sm" id="block_supplier"> <button type="button" class="layui-btn layui-btn-sm" id="block_supplier">
拉黑 拉黑
</button> </button>
...@@ -36,6 +39,7 @@ ...@@ -36,6 +39,7 @@
金蝶同步 金蝶同步
</button> </button>
@endif @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