Commit 35c2b306 by 杨树贤

Merge branch 'ysx-供应商需求0823-20230823' into ysx-备忘录-20230824

parents 6845f7b3 65cd5345
...@@ -1597,4 +1597,23 @@ class DataService ...@@ -1597,4 +1597,23 @@ class DataService
} }
} }
} //初始化sku的规则
\ No newline at end of file public function initFuturesSkuUploadRuler()
{
$suppliers = SupplierChannelModel::where('sku_upload_ruler', '!=', '')->get()->toArray();
foreach ($suppliers as $supplier) {
$uploadRuler = $supplier['sku_upload_ruler'];
$uploadRuler = json_decode($uploadRuler, true);
$uploadRuler['futures_allow_stock_lte_0'] = 0;
$uploadRuler['futures_allow_moq_lte_0'] = 0;
$uploadRuler['futures_allow_price_null'] = 0;
$uploadRuler = json_encode($uploadRuler);
SupplierChannelModel::where('supplier_id',$supplier['supplier_id'])->update([
'sku_upload_ruler' => $uploadRuler,
]);
(new SupplierService())->saveSkuUploadRulerToRedis($supplier['supplier_id'],$uploadRuler);
}
}
}
...@@ -13,15 +13,21 @@ class SupplierSkuUploadRulerService ...@@ -13,15 +13,21 @@ class SupplierSkuUploadRulerService
public function getSkuUploadRulerDesc($ruler) public function getSkuUploadRulerDesc($ruler)
{ {
if (empty($ruler)) { if (empty($ruler)) {
return '允许库存为空:否 允许起订量为空:否 允许阶梯价为空:否'; return '现货 : 允许库存为空:否 允许起订量为空:否 允许阶梯价为空:否 | 期货 : 允许库存为空:否 允许起订量为空:否 允许阶梯价为空:否';
} }
$ruler = json_decode($ruler, true); $ruler = json_decode($ruler, true);
$desc = ''; $desc = '现货 : ';
$futuresDesc = '期货 : ';
foreach ($ruler as $name => $value) { foreach ($ruler as $name => $value) {
$name = array_get(config('fixed.SkuUploadRuler'), $name); if (strpos($name, 'futures') !== false) {
$desc .= $name . ":" . ($value ? "是" : "否") . ' '; $name = array_get(config('fixed.SkuUploadRuler'), $name);
$futuresDesc .= $name . ":" . ($value ? "是" : "否") . ' ';
} else {
$name = array_get(config('fixed.SkuUploadRuler'), $name);
$desc .= $name . ":" . ($value ? "是" : "否") . ' ';
}
} }
return $desc; return $desc . ' | ' . $futuresDesc;
} }
//给默认的sku上传规则 //给默认的sku上传规则
...@@ -29,7 +35,7 @@ class SupplierSkuUploadRulerService ...@@ -29,7 +35,7 @@ class SupplierSkuUploadRulerService
{ {
if (empty($ruler)) { if (empty($ruler)) {
return config('fixed.SkuUploadDefaultRuler'); return config('fixed.SkuUploadDefaultRuler');
}else{ } else {
return json_decode($ruler, true); return json_decode($ruler, true);
} }
...@@ -53,4 +59,4 @@ class SupplierSkuUploadRulerService ...@@ -53,4 +59,4 @@ class SupplierSkuUploadRulerService
return json_encode($rulers); return json_encode($rulers);
} }
} }
} }
\ No newline at end of file
...@@ -82,14 +82,15 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function () ...@@ -82,14 +82,15 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
Route::match(['get', 'post'], '/test', function () { Route::match(['get', 'post'], '/test', function () {
$data = [ (new \App\Http\Services\DataService())->initFuturesSkuUploadRuler();
'supplier_code' => 'L0015420', // $data = [
'brand_id' => 0, // 'supplier_code' => 'L0015420',
'log_id' => 8379, // 'brand_id' => 0,
"down_type" => 1, // 'log_id' => 8379,
]; // "down_type" => 1,
//改成队列 // ];
(new SkuService())->batchOffShelfSkuQueue($data); // //改成队列
// (new SkuService())->batchOffShelfSkuQueue($data);
// (new \App\Http\Services\SupplierService())->initialCpTimeDays(15307, 5); // (new \App\Http\Services\SupplierService())->initialCpTimeDays(15307, 5);
// (new \App\Http\Services\DataService())->initFuturesCpTime(); // (new \App\Http\Services\DataService())->initFuturesCpTime();
......
...@@ -157,10 +157,16 @@ return [ ...@@ -157,10 +157,16 @@ return [
//{"allow_stock_lte_0":0,"allow_moq_lte_0":1,"allow_stock_lt_moq":0,"allow_price_null":1} //{"allow_stock_lte_0":0,"allow_moq_lte_0":1,"allow_stock_lt_moq":0,"allow_price_null":1}
'SkuUploadRuler' => [ 'SkuUploadRuler' => [
//现货
'allow_stock_lte_0' => '允许库存为空', 'allow_stock_lte_0' => '允许库存为空',
'allow_moq_lte_0' => '允许起订量为空', 'allow_moq_lte_0' => '允许起订量为空',
// 'allow_stock_lt_moq' => '允许起订量大于库存', // 'allow_stock_lt_moq' => '允许起订量大于库存',
'allow_price_null' => '允许阶梯价为空', 'allow_price_null' => '允许阶梯价为空',
//期货
'futures_allow_stock_lte_0' => '允许库存为空',
'futures_allow_moq_lte_0' => '允许起订量为空',
// 'futures_allow_stock_lt_moq' => '允许起订量大于库存',
'futures_allow_price_null' => '允许阶梯价为空',
], ],
'SkuUploadDefaultRuler' => [ 'SkuUploadDefaultRuler' => [
...@@ -168,6 +174,10 @@ return [ ...@@ -168,6 +174,10 @@ return [
'allow_moq_lte_0' => 0, 'allow_moq_lte_0' => 0,
'allow_stock_lt_moq' => 0, 'allow_stock_lt_moq' => 0,
'allow_price_null' => 0, 'allow_price_null' => 0,
'futures_allow_stock_lte_0' => 0,
'futures_allow_moq_lte_0' => 0,
'futures_allow_stock_lt_moq' => 0,
'futures_allow_price_null' => 0,
], ],
......
...@@ -141,4 +141,12 @@ function multiArrayUnique(arr) { ...@@ -141,4 +141,12 @@ function multiArrayUnique(arr) {
return JSON.stringify(subItem) === json; return JSON.stringify(subItem) === json;
}) === index; }) === index;
}); });
} }
\ No newline at end of file
function getFootstoneDomain() {
var defaultDomain = "http://footstone.liexindev.net";
if (document.domain.indexOf("ichunt") !== -1) {
defaultDomain = "https://footstone_v2.ichunt.net";
}
return defaultDomain;
}
...@@ -79,10 +79,10 @@ ...@@ -79,10 +79,10 @@
if (ladder.hasOwnProperty('price_cn')) { if (ladder.hasOwnProperty('price_cn')) {
if (ladder.price_cn > 0) { if (ladder.price_cn > 0) {
return '<div class="view_ladder_price_cn layui-row"><div class="layui-col-xs5"><span>' + (ladder.purchases) + '+</span></div><div class="layui-col-xs7"><span>' + (ladder.price_cn) + '</span></div></div>'; return '<div class="view_ladder_price_cn layui-row"><div class="layui-col-xs5"><span>' + (ladder.purchases) + '+</span></div><div class="layui-col-xs7"><span>' + (ladder.price_cn) + '</span></div></div>';
}else{ } else {
return ''; return '';
} }
}else{ } else {
return ''; return '';
} }
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
let ladder = data.ladder_price[data.ladder_price.length - 1]; let ladder = data.ladder_price[data.ladder_price.length - 1];
if (ladder.hasOwnProperty('price_us')) { if (ladder.hasOwnProperty('price_us')) {
if (ladder.price_us > 0) { if (ladder.price_us > 0) {
return '<div class="view_ladder_price_us layui-row""><div class="layui-col-xs5"><span>'+ (ladder.purchases) + '+</span></div><div class="layui-col-xs7"><span>$' + (ladder.price_us) + '</span></div></div>'; return '<div class="view_ladder_price_us layui-row""><div class="layui-col-xs5"><span>' + (ladder.purchases) + '+</span></div><div class="layui-col-xs7"><span>$' + (ladder.price_us) + '</span></div></div>';
} }
return ''; return '';
} }
...@@ -455,13 +455,31 @@ ...@@ -455,13 +455,31 @@
}); });
$("#update_sku").click(function () {
let checkStatus = table.checkStatus('skuList');
let data = checkStatus.data;
let skuIds = Array.from(data, ({goods_id}) => goods_id);
if (skuIds.length === 0) {
layer.msg('请选择要操作的sku', {icon: 5});
return false;
}
console.log(skuIds);
if (skuIds.length > 1) {
layer.msg('此操作只支持单选', {icon: 5});
return false;
}
let skuId = skuIds[0];
let domain = getFootstoneDomain();
window.open(domain + '/web/sku/saveSku?from=supplier&goods_id=' + skuId);
});
//划过显示成本价格 //划过显示成本价格
let ladderPriceTipsVal = ''; let ladderPriceTipsVal = '';
$(document).on('mouseenter', '.view_ladder_price_cn', function () { $(document).on('mouseenter', '.view_ladder_price_cn', function () {
let self = this; let self = this;
let rowIndex = $(this).parent().parent().parent().attr('data-index'); let rowIndex = $(this).parent().parent().parent().attr('data-index');
let data = table.cache['skuList'][rowIndex].ladder_price; let data = table.cache['skuList'][rowIndex].ladder_price;
console.log(data)
if (!data) { if (!data) {
return false; return false;
} }
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
<button type="button" class="layui-btn layui-btn-sm" id="set_sku_tag">设置标签</button> <button type="button" class="layui-btn layui-btn-sm" id="set_sku_tag">设置标签</button>
@if (checkPerm('SetSupplierSkuCpTimeLimit')) @if (checkPerm('SetSupplierSkuCpTimeLimit'))
<button type="button" class="layui-btn layui-btn-sm" id="set_sku_cp_time_ruler">商品有效期配置</button> <button type="button" class="layui-btn layui-btn-sm" id="set_sku_cp_time_ruler">商品有效期配置</button>
<button type="button" class="layui-btn layui-btn-sm" id="update_sku">修改商品信息</button>
@endif @endif
@endif @endif
</div> </div>
......
...@@ -19,24 +19,67 @@ ...@@ -19,24 +19,67 @@
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-inline" style="width: 100%"> <div class="layui-inline" style="width: 100%">
<label class="layui-form-label">数据新增规则 : </label> <label class="layui-form-label">数据新增规则 : </label>
<div class="layui-input-inline" style="width: 380px"> <div class="layui-input-inline" style="width: 420px">
@if(!empty($supplier['sku_upload_ruler'])) @if(!empty($supplier['sku_upload_ruler']))
@foreach($supplier['sku_upload_ruler'] as $key=>$flag) <div class="layui-row">
@if(!empty(array_get(config('fixed.SkuUploadRuler'),$key))) 现货 :
<input type="checkbox" name="sku_upload_ruler[{{$key}}]" @foreach($supplier['sku_upload_ruler'] as $key=>$flag)
lay-skin="primary" @php
@if($flag) $ruler = array_get(config('fixed.SkuUploadRuler'),$key);
checked @endphp
@endif @if(!empty($ruler) && strpos($key,'futures')===false)
title="{{array_get(config('fixed.SkuUploadRuler'),$key)}}"> <input type="checkbox" name="sku_upload_ruler[{{$key}}]"
@endif lay-skin="primary"
@endforeach @if($flag)
checked
@endif
title="{{array_get(config('fixed.SkuUploadRuler'),$key)}}">
@endif
@endforeach
</div>
<div class="layui-row">
期货 :
@foreach($supplier['sku_upload_ruler'] as $key=>$flag)
@php
$ruler = array_get(config('fixed.SkuUploadRuler'),$key);
@endphp
@if(!empty($ruler) && strpos($key,'futures')!==false)
<input type="checkbox" name="sku_upload_ruler[{{$key}}]"
lay-skin="primary"
@if($flag)
checked
@endif
title="{{array_get(config('fixed.SkuUploadRuler'),$key)}}">
@endif
@endforeach
</div>
@else @else
@foreach(config('fixed.SkuUploadRuler') as $key=>$flag) <div class="layui-row">
<input type="checkbox" name="sku_upload_ruler[{{$key}}]" 现货 :
lay-skin="primary" @foreach(config('fixed.SkuUploadRuler') as $key=>$flag)
title="{{$flag}}"> @php
@endforeach $ruler = array_get(config('fixed.SkuUploadRuler'),$key);
@endphp
@if(!empty($ruler) && strpos($key,'futures')===false)
<input type="checkbox" name="sku_upload_ruler[{{$key}}]"
lay-skin="primary"
title="{{$flag}}">
@endif
@endforeach
</div>
<div class="layui-row">
期货 :
@foreach(config('fixed.SkuUploadRuler') as $key=>$flag)
@php
$ruler = array_get(config('fixed.SkuUploadRuler'),$key);
@endphp
@if(!empty($ruler) && strpos($key,'futures')!==false)
<input type="checkbox" name="sku_upload_ruler[{{$key}}]"
lay-skin="primary"
title="{{$flag}}">
@endif
@endforeach
</div>
@endif @endif
</div> </div>
<div class="layui-form-mid layui-word-aux"> <div class="layui-form-mid layui-word-aux">
...@@ -62,7 +105,7 @@ ...@@ -62,7 +105,7 @@
lay-skin="primary" lay-skin="primary"
class="audit_ruler_item" class="audit_ruler_item"
@if($flag) @if($flag)
checked checked
@endif @endif
title="{{array_get(config('fixed.SkuAuditRuler.name_map'),$key)}}"> title="{{array_get(config('fixed.SkuAuditRuler.name_map'),$key)}}">
@endif @endif
...@@ -79,4 +122,4 @@ ...@@ -79,4 +122,4 @@
@include('web.supplier.SkuUploadStatus'); @include('web.supplier.SkuUploadStatus');
</div> </div>
@include('script.supplier.SkuRulerScript') @include('script.supplier.SkuRulerScript')
\ No newline at end of file
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