Commit a3f73892 by 杨树贤

优化

parent fe22708b
...@@ -205,8 +205,6 @@ class SkuApiController extends Controller ...@@ -205,8 +205,6 @@ class SkuApiController extends Controller
if (empty($goodsLabel)) { if (empty($goodsLabel)) {
$this->response(-1,'请选择显示类型'); $this->response(-1,'请选择显示类型');
} }
(new SkuService())->batchUpdateGoodsLabel($type,$supplierCode,$skuIds, $goodsLabel); (new SkuService())->batchUpdateGoodsLabel($type,$supplierCode,$skuIds, $goodsLabel);
$text = $type == 1? '设置显示类型成功':'批量设置供应SKU商显示类型任务已开始,请等待任务完成'; $text = $type == 1? '设置显示类型成功':'批量设置供应SKU商显示类型任务已开始,请等待任务完成';
......
...@@ -5,6 +5,7 @@ namespace App\Http\Controllers; ...@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Http\Controllers\Filter\LogFilter; use App\Http\Controllers\Filter\LogFilter;
use App\Http\Controllers\Filter\SupplierLogFilter; use App\Http\Controllers\Filter\SupplierLogFilter;
use App\Http\Services\LogService; use App\Http\Services\LogService;
use App\Http\Services\SupplierService;
use App\Http\Services\SupplierTagService; use App\Http\Services\SupplierTagService;
use App\Model\BrandModel; use App\Model\BrandModel;
use App\Model\IntracodeModel; use App\Model\IntracodeModel;
...@@ -131,21 +132,13 @@ class SkuController extends Controller ...@@ -131,21 +132,13 @@ class SkuController extends Controller
$this->data['isIedge'] = $orgId == 1 ? false : true; $this->data['isIedge'] = $orgId == 1 ? false : true;
$this->data['orgId'] = $orgId; $this->data['orgId'] = $orgId;
$this->data['title'] = '批量设置sku显示类型'; $this->data['title'] = '批量设置sku显示类型';
$suppliers = SupplierChannelModel::where('is_type', 0)->where('status', 2)
->select(['supplier_name', 'supplier_code'])->get();
$supplierCodes = [];
foreach ($suppliers as $supplier) {
$supplier = $supplier->toArray();
$supplierCodes[$supplier['supplier_code']] = $supplier['supplier_name'] . '(' . $supplier['supplier_code'] . ')';
}
$skuIds = $request->input('sku_ids'); $skuIds = $request->input('sku_ids');
if (!empty($skuIds)) { if (!empty($skuIds)) {
$skuIds = explode(',', $skuIds); $skuIds = explode(',', $skuIds);
$this->data['skuIds'] = $skuIds; $this->data['skuIds'] = $skuIds;
} }
$supplierData = SupplierService::getSupplierCodeListForXmSelect();
$this->data['supplierCodes'] = $supplierCodes; $this->data['supplierData'] = $supplierData;
return $this->view('批量设置sku显示类型'); return $this->view('批量设置sku显示类型');
} }
......
...@@ -222,7 +222,6 @@ class SupplierService ...@@ -222,7 +222,6 @@ class SupplierService
$supplierAddressService->saveShippingAddress($supplierId, $shippingAddress); $supplierAddressService->saveShippingAddress($supplierId, $shippingAddress);
} else { } else {
/**这里的是更新供应商的操作**/ /**这里的是更新供应商的操作**/
$supplierId = $this->newSupplierId = $channel['supplier_id']; $supplierId = $this->newSupplierId = $channel['supplier_id'];
...@@ -886,7 +885,7 @@ class SupplierService ...@@ -886,7 +885,7 @@ class SupplierService
{ {
$supplier = SupplierChannelModel::where('supplier_id', $supplierId)->first()->toArray(); $supplier = SupplierChannelModel::where('supplier_id', $supplierId)->first()->toArray();
$originSupplierName = $supplier['supplier_name']; $originSupplierName = $supplier['supplier_name'];
//修改名称,只有驳回状态下才可以修改,修改后要重新提交数据给一体化那边进行审核 //修改名称,修改后要重新提交数据给一体化那边进行审核
$businessLicense = SupplierAttachmentsModel::where('supplier_id', $supplierId) $businessLicense = SupplierAttachmentsModel::where('supplier_id', $supplierId)
->where('field_name', 'business_license')->value('file_url'); ->where('field_name', 'business_license')->value('file_url');
//如果是非大陆的供应商,那么商业登记证的优先级大于营业执照 //如果是非大陆的供应商,那么商业登记证的优先级大于营业执照
...@@ -927,4 +926,20 @@ class SupplierService ...@@ -927,4 +926,20 @@ class SupplierService
return true; return true;
} }
//获取供应商编码给xm-select使用
public static function getSupplierCodeListForXmSelect()
{
$supplierList = SupplierChannelModel::where('status','!=', SupplierChannelModel::STATUS_DISABLE)
->select(['supplier_code', 'supplier_name', 'supplier_id'])->get()->toArray();
$data = [];
foreach ($supplierList as $supplier) {
$data[] = [
'name' => "{$supplier['supplier_name']} ( {$supplier['supplier_code']} )",
'value' => $supplier['supplier_code'],
];
}
return $data;
}
} }
...@@ -291,6 +291,14 @@ class SyncSupplierService ...@@ -291,6 +291,14 @@ class SyncSupplierService
} }
foreach ($suppliers as $supplier) { foreach ($suppliers as $supplier) {
//判断是否是同名多供应商,如果是的话,如果是之前已经禁用的,则直接跳过
if (count($suppliers) > 1) {
if ($supplier['status'] == SupplierChannelModel::STATUS_DISABLE) {
Log::warning("检测到同名供应商并且属于禁用状态,跳过,供应商id为 : " . $supplier['supplier_id']);
continue;
}
}
$originIsEntity = $supplier['is_entity']; $originIsEntity = $supplier['is_entity'];
//$supplier = $supplier->toArray(); //$supplier = $supplier->toArray();
$supplierId = $supplier['supplier_id']; $supplierId = $supplier['supplier_id'];
......
...@@ -11,6 +11,7 @@ class MultiSelectorPresenter ...@@ -11,6 +11,7 @@ class MultiSelectorPresenter
$data = $data ?: [['name' => '启用', 'value' => 1], ['name' => '禁用', 'value' => -1]]; $data = $data ?: [['name' => '启用', 'value' => 1], ['name' => '禁用', 'value' => -1]];
$isRequired = array_get($option, 'required', false); $isRequired = array_get($option, 'required', false);
$width = array_get($option, 'width', '157px'); $width = array_get($option, 'width', '157px');
$radio = array_get($option, 'radio', 'false');
$requiredHtml = $isRequired ? '<span style="color: red">*</span>' : ""; $requiredHtml = $isRequired ? '<span style="color: red">*</span>' : "";
$elemId = $name . "Selector"; $elemId = $name . "Selector";
$data = json_encode($data); $data = json_encode($data);
...@@ -37,6 +38,7 @@ class MultiSelectorPresenter ...@@ -37,6 +38,7 @@ class MultiSelectorPresenter
name: 'name', name: 'name',
value: 'value' value: 'value'
}, },
radio: $radio,
size: 'mini', size: 'mini',
direction: 'down', direction: 'down',
data : $data, data : $data,
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
title: '输入要修改的供应商名称', title: '输入要修改的供应商名称',
btn: ['保存', '取消'], btn: ['保存', '取消'],
}, function (supplierName, index) { }, function (supplierName, index) {
layer.msg('sdasdas', {icon: 6}); // layer.msg('sdasdas', {icon: 6});
let res = ajax('/api/supplier/changeSupplierName', { let res = ajax('/api/supplier/changeSupplierName', {
supplier_id: supplierId, supplier_id: supplierId,
supplier_name: supplierName supplier_name: supplierName
......
...@@ -47,9 +47,11 @@ ...@@ -47,9 +47,11 @@
<div class="layui-form-item" id="supplier_select_div" style="display: none"> <div class="layui-form-item" id="supplier_select_div" style="display: none">
<div class="layui-inline" style="margin-left: -30px"> <div class="layui-inline" style="margin-left: -30px">
@inject('statusPresenter','App\Presenters\StatusPresenter') {{-- @inject('statusPresenter','App\Presenters\StatusPresenter')--}}
{!! $statusPresenter->render('supplier_code','供应商选择 : ',null, {{-- {!! $statusPresenter->render('supplier_code','供应商选择 : ',null,--}}
$supplierCodes,['required'=>true,'width'=>'400px']) !!} {{-- $supplierCodes,['required'=>true,'width'=>'400px']) !!}--}}
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('supplier_code','供应商选择','',$supplierData,['required'=>true,'radio'=>'true','width'=>'400px']) !!}
</div> </div>
</div> </div>
......
...@@ -93,12 +93,18 @@ ...@@ -93,12 +93,18 @@
{{-- class="layui-btn layui-btn">取消拉黑--}} {{-- class="layui-btn layui-btn">取消拉黑--}}
{{-- </button>--}} {{-- </button>--}}
@endif @endif
{{-- 如果是驳回,则可以修改名称--}} {{--如果是驳回,则可以修改名称--}}
@if($supplier['is_entity'] == \App\Model\SupplierChannelModel::IS_ENTITY_REJECT && empty($supplier['group_code'])) @if($supplier['is_entity'] == \App\Model\SupplierChannelModel::IS_ENTITY_REJECT && empty($supplier['group_code']))
<button id="change_supplier_name" <button id="change_supplier_name"
style="margin-bottom: 25px;margin-top: 5px" class="layui-btn layui-btn">修改名称 style="margin-bottom: 25px;margin-top: 5px" class="layui-btn layui-btn">修改名称
</button> </button>
@endif @endif
{{--如果是待提审/未通过并且集团编码为空,则可以修改名称--}}
@if(($supplier['status'] == \App\Model\SupplierChannelModel::STATUS_PENDING || $supplier['status'] == \App\Model\SupplierChannelModel::STATUS_REJECT) && empty($supplier['group_code']))
<button id="change_supplier_name"
style="margin-bottom: 25px;margin-top: 5px" class="layui-btn layui-btn">修改名称
</button>
@endif
@endif @endif
@if (checkPerm('PrintSupplier')) @if (checkPerm('PrintSupplier'))
{{--禁用和黑名单不显示打印按钮--}} {{--禁用和黑名单不显示打印按钮--}}
......
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