Commit a3f73892 by 杨树贤

优化

parent fe22708b
......@@ -205,8 +205,6 @@ class SkuApiController extends Controller
if (empty($goodsLabel)) {
$this->response(-1,'请选择显示类型');
}
(new SkuService())->batchUpdateGoodsLabel($type,$supplierCode,$skuIds, $goodsLabel);
$text = $type == 1? '设置显示类型成功':'批量设置供应SKU商显示类型任务已开始,请等待任务完成';
......
......@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Http\Controllers\Filter\LogFilter;
use App\Http\Controllers\Filter\SupplierLogFilter;
use App\Http\Services\LogService;
use App\Http\Services\SupplierService;
use App\Http\Services\SupplierTagService;
use App\Model\BrandModel;
use App\Model\IntracodeModel;
......@@ -131,21 +132,13 @@ class SkuController extends Controller
$this->data['isIedge'] = $orgId == 1 ? false : true;
$this->data['orgId'] = $orgId;
$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');
if (!empty($skuIds)) {
$skuIds = explode(',', $skuIds);
$this->data['skuIds'] = $skuIds;
}
$this->data['supplierCodes'] = $supplierCodes;
$supplierData = SupplierService::getSupplierCodeListForXmSelect();
$this->data['supplierData'] = $supplierData;
return $this->view('批量设置sku显示类型');
}
......
......@@ -222,7 +222,6 @@ class SupplierService
$supplierAddressService->saveShippingAddress($supplierId, $shippingAddress);
} else {
/**这里的是更新供应商的操作**/
$supplierId = $this->newSupplierId = $channel['supplier_id'];
......@@ -886,7 +885,7 @@ class SupplierService
{
$supplier = SupplierChannelModel::where('supplier_id', $supplierId)->first()->toArray();
$originSupplierName = $supplier['supplier_name'];
//修改名称,只有驳回状态下才可以修改,修改后要重新提交数据给一体化那边进行审核
//修改名称,修改后要重新提交数据给一体化那边进行审核
$businessLicense = SupplierAttachmentsModel::where('supplier_id', $supplierId)
->where('field_name', 'business_license')->value('file_url');
//如果是非大陆的供应商,那么商业登记证的优先级大于营业执照
......@@ -927,4 +926,20 @@ class SupplierService
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
}
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'];
//$supplier = $supplier->toArray();
$supplierId = $supplier['supplier_id'];
......
......@@ -11,6 +11,7 @@ class MultiSelectorPresenter
$data = $data ?: [['name' => '启用', 'value' => 1], ['name' => '禁用', 'value' => -1]];
$isRequired = array_get($option, 'required', false);
$width = array_get($option, 'width', '157px');
$radio = array_get($option, 'radio', 'false');
$requiredHtml = $isRequired ? '<span style="color: red">*</span>' : "";
$elemId = $name . "Selector";
$data = json_encode($data);
......@@ -19,7 +20,7 @@ class MultiSelectorPresenter
$requiredHtml
$text</label>
<div class="layui-input-inline" style="margin-top: 0">
<div id="$elemId" class="layui-input-inline" value="$value" style="width: $width;">
<div id="$elemId" class="layui-input-inline" value="$value" style="width: $width;">
</div>
<input type="hidden" name="$name" id="$name" value="$value">
</div>
......@@ -37,6 +38,7 @@ class MultiSelectorPresenter
name: 'name',
value: 'value'
},
radio: $radio,
size: 'mini',
direction: 'down',
data : $data,
......@@ -61,4 +63,4 @@ class MultiSelectorPresenter
EOF;
return $html;
}
}
\ No newline at end of file
}
......@@ -46,7 +46,7 @@
title: '输入要修改的供应商名称',
btn: ['保存', '取消'],
}, function (supplierName, index) {
layer.msg('sdasdas', {icon: 6});
// layer.msg('sdasdas', {icon: 6});
let res = ajax('/api/supplier/changeSupplierName', {
supplier_id: supplierId,
supplier_name: supplierName
......
......@@ -47,9 +47,11 @@
<div class="layui-form-item" id="supplier_select_div" style="display: none">
<div class="layui-inline" style="margin-left: -30px">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('supplier_code','供应商选择 : ',null,
$supplierCodes,['required'=>true,'width'=>'400px']) !!}
{{-- @inject('statusPresenter','App\Presenters\StatusPresenter')--}}
{{-- {!! $statusPresenter->render('supplier_code','供应商选择 : ',null,--}}
{{-- $supplierCodes,['required'=>true,'width'=>'400px']) !!}--}}
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('supplier_code','供应商选择','',$supplierData,['required'=>true,'radio'=>'true','width'=>'400px']) !!}
</div>
</div>
......
......@@ -93,11 +93,17 @@
{{-- class="layui-btn layui-btn">取消拉黑--}}
{{-- </button>--}}
@endif
{{-- 如果是驳回,则可以修改名称--}}
{{--如果是驳回,则可以修改名称--}}
@if($supplier['is_entity'] == \App\Model\SupplierChannelModel::IS_ENTITY_REJECT && empty($supplier['group_code']))
<button id="change_supplier_name"
style="margin-bottom: 25px;margin-top: 5px" class="layui-btn layui-btn">修改名称
</button>
<button id="change_supplier_name"
style="margin-bottom: 25px;margin-top: 5px" class="layui-btn layui-btn">修改名称
</button>
@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
@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