Commit 96c5013b by mushishixian

云芯采购员

parent 1780df75
......@@ -306,4 +306,29 @@ class SupplierApiController extends Controller
$this->response(0, '已发送同步请求');
}
public function SetYunxinChannelUid($request)
{
$supplierId = $request->get('supplier_id');
$channelUid = $request->get('yunxin_channel_uid');
$model = new SupplierChannelModel();
$result = $model->where('supplier_id', $supplierId)->update([
'yunxin_channel_uid' => $channelUid,
]);
if ($result) {
//修改供应商状态
$model->where('supplier_id', $supplierId)->update([
'update_time' => time(),
'status' => SupplierChannelModel::STATUS_IN_REVIEW,
]);
$adminService = new AdminUserService();
$user = $adminService->getAdminUserInfoByCodeId($channelUid);
$logService = new LogService();
$logService->AddLog($supplierId,LogModel::UPDATE_OPERATE,'设置云芯采购员','设置云芯采购员为 : '.$user['name']);
$this->response(0, '设置云芯采购成功');
} else {
$this->response(-1, '设置云芯采购失败');
}
}
}
......@@ -141,7 +141,7 @@ class SupplierContactApiController extends Controller
$supplierModel = new SupplierChannelModel();
$supplierModel->where('supplier_id', $contact['supplier_id'])->update([
'update_time' => time(),
'status' => 1,
'status' => SupplierChannelModel::STATUS_IN_REVIEW,
]);
}
$logService = new LogService();
......
......@@ -207,15 +207,17 @@ class SupplierController extends Controller
$model = new SupplierChannelModel();
$supplier = $model->where('supplier_id', $supplierId)->first();
$supplier = $supplier ? $supplier->toArray() : [];
$transformer = new SupplierTransformer();
$supplier = $transformer->transformInfo($supplier);
$this->data['supplier'] = $supplier;
$intracodeModel = new IntracodeModel();
$this->data['userCodes'] = $intracodeModel->getPurchaseUserCodes();
$logModel = new LogModel();
$this->data['logs'] = $logModel->where('supplier_id', $supplierId)
->where('action', '分配渠道开发员')->orderBy('id', 'desc')
->limit(10)->get();
$userCodes = $intracodeModel->getSampleEncode();
//去除非当前供应商所拥有的采购的人员,只能从当前供应商设置的采购里面选择云芯采购员
$channelUids = explode(',', $supplier['channel_uid']);
foreach ($userCodes as $codeId =>$value) {
if (!in_array($codeId, $channelUids)) {
unset($userCodes[$codeId]);
}
}
$this->data['userCodes'] = $userCodes;
return $this->view('审核供应商');
}
......
......@@ -106,6 +106,7 @@ class SupplierTransformer
$supplier['create_time'] = $supplier['create_time'] ? date('Y-m-d H:i:s', $supplier['create_time']) : '';
$supplier['channel_username'] = $this->getChannelUserNames($supplier['channel_uid']);
$supplier['purchase_username'] = array_get($users, $supplier['purchase_uid']);
$supplier['yunxin_channel_username'] = array_get($users, array_get($supplier,'yunxin_channel_uid'));
$supplier['qualification_photos'] = $this->getPhotosDataForForm($supplier['qualification_photos']);
$uploadRulerService = new SupplierSkuUploadRulerService();
$supplier['sku_upload_ruler'] = $uploadRulerService->getSkuUploadRuler($supplier['sku_upload_ruler']);
......
......@@ -4,35 +4,10 @@
let form = layui.form;
let table = layui.table
let element = layui.element;
table.render({
elem: '#logList'
, url: '/api/log/GetLogList'
, method: 'post'
, size: 'sm'
, limit: 10
, cellMinWidth: 80 //全局定义常规单元格的最小宽度
, where: {
supplier_id:{{$supplier['supplier_id']}},
action: '分配云芯采购员',
}
, loading: true
, first: true //不显示首页
, last: false //不显示尾页
, cols: [[
{field: 'add_time', title: '日志时间', width: 150, align: 'center'},
{
field: 'content', title: '日志内容', align: 'center', templet: function (data) {
return data.admin_name + data.content;
}
},
]]
, id: 'logList'
, page: {}
});
form.on('submit(auditSupplier)', function (data) {
form.on('submit(setYunxinChannelUid)', function (data) {
admin.btnLoading('.submit-loading');
let supplierId = getQueryVariable('supplier_id');
let url = '/api/supplier/AllocatePurchaseUser?supplier_id=' + supplierId;
let url = '/api/supplier/SetYunxinChannelUid?supplier_id=' + supplierId;
let res = ajax(url, data.field);
if (!res) {
layer.msg('网络错误,请重试', {icon: 6});
......
......@@ -78,7 +78,7 @@
type: 2,
content: '/supplier_account/AddSupplierAccount?view=iframe',
area: ['800px', '600px'],
title: '批量下架SKU',
title: '添加供应商账号',
end: function () {
table.reload('supplierAccountList');
// supplierStatistics();
......
......@@ -50,6 +50,20 @@
});
})
//设置云芯采购
$("#set_yunxin_channel_user").click(function () {
let supplierId = getQueryVariable('supplier_id');
layer.open({
type: 2,
content: '/supplier/SetYunxinChannelUser?view=iframe&supplier_id=' + supplierId,
area: ['600px', '525px'],
title: '配置云芯采购员',
end: function () { // 监听弹窗关闭
table.reload('contactList');
}
});
})
//更新
$(document).on('click', '#update_contact', function () {
let checkStatus = table.checkStatus('contactList');
......
......@@ -32,7 +32,7 @@
<div class="layui-form-item">
<label class="layui-form-label"><span class="require">*</span>账号类型 : </label>
<div class="layui-input-block">
<input type="checkbox" name="" title="云芯商家" lay-skin="primary" @if(!empty($account['a_type'])&&$account['a_type']==1) checked @endif>
<input type="checkbox" name="a_type" title="云芯商家" lay-skin="primary" checked>
</div>
</div>
<div class="layui-form-item">
......
......@@ -4,37 +4,20 @@
}
</style>
<div class="layui-card">
<div class="layui-card-header" style="height: 90px">
<div class="layui-row">
<div class="layui-col-xs6">
供应商名称 : <b>{{$supplier['supplier_name']}}</b>
</div>
<div class="layui-col-xs6">
状态 : {{$supplier['status_name']}}
</div>
<div class="layui-col-xs6">
公司性质 : {{$supplier['supplier_group_name']}}
</div>
<div class="layui-col-xs6">
合作类型 : {{$supplier['stockup_type']}}
</div>
</div>
</div>
<div class="layui-card-body">
<form class="layui-form" action="">
<input type="hidden" name="supplier_id" value="{{$supplier['supplier_id']}}">
<div class="layui-form-item">
<div class="layui-inline" style="margin-left: -30px">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('purchase_uid','渠道开发员',$supplier['purchase_uid'],
$userCodes,['required'=>true,'width'=>'110px']) !!}
{!! $statusPresenter->render('yunxin_channel_uid','云芯采购',$supplier['yunxin_channel_uid'],
$userCodes,['required'=>true,'width'=>'150px']) !!}
</div>
</div>
<div class="layui-form-item">
<div align="center" style="margin-top: 20px;text-align: right">
<button type="button" class="layui-btn layui-btn-sm layui-btn-info submit-loading" lay-submit
lay-filter="auditSupplier">保存
lay-filter="setYunxinChannelUid">保存
</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn-warm" lay-submit
lay-filter="cancel">取消
......@@ -43,8 +26,4 @@
</div>
</form>
</div>
</div>
<blockquote class="layui-elem-quote layui-text">
<b>操作日志</b>
</blockquote>
<table class="layui-table" id="logList" lay-filter="logList"></table>
</div>
\ No newline at end of file
......@@ -38,9 +38,12 @@
合作类型 :{{$supplier['stockup_type_name']}}
</div>
<div class="layui-col-md5">
<div class="layui-col-md2">
采购员 : {{$supplier['channel_username']}}
</div>
<div class="layui-col-md3">
云芯采购员 : {{$supplier['yunxin_channel_username']}}
</div>
<div class="layui-col-md3"></div>
</div>
@if($supplier['status']==\App\Model\SupplierChannelModel::STATUS_PENDING
......
......@@ -59,9 +59,12 @@
<div class="layui-col-md2">
合作类型:{{$supplier['stockup_type_name']}}
</div>
<div class="layui-col-md5">
<div class="layui-col-md2">
采购员 : {{$supplier['channel_username']}}
</div>
<div class="layui-col-md3">
云芯采购员 : {{$supplier['yunxin_channel_username']}}
</div>
<div class="layui-col-md3"></div>
</div>
<div class="layui-row" style="margin-bottom: 25px;margin-top: 5px">
......
......@@ -14,7 +14,7 @@
<button type="button" class="layui-btn layui-btn-sm" id="batchDelete">删除</button>
@endif
@if(checkPerm('SetYunxinChannelUser'))
<button type="button" class="layui-btn layui-btn-sm" id="setYunxinChannelUser">设置云芯采购</button>
<button type="button" class="layui-btn layui-btn-sm" id="set_yunxin_channel_user">设置云芯采购</button>
@endif
</div>
@endif
......
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