Commit 35c2b306 by 杨树贤

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

parents 6845f7b3 65cd5345
......@@ -1597,4 +1597,23 @@ class DataService
}
}
}
\ No newline at end of file
//初始化sku的规则
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
public function getSkuUploadRulerDesc($ruler)
{
if (empty($ruler)) {
return '允许库存为空:否 允许起订量为空:否 允许阶梯价为空:否';
return '现货 : 允许库存为空:否 允许起订量为空:否 允许阶梯价为空:否 | 期货 : 允许库存为空:否 允许起订量为空:否 允许阶梯价为空:否';
}
$ruler = json_decode($ruler, true);
$desc = '';
$desc = '现货 : ';
$futuresDesc = '期货 : ';
foreach ($ruler as $name => $value) {
$name = array_get(config('fixed.SkuUploadRuler'), $name);
$desc .= $name . ":" . ($value ? "是" : "否") . ' ';
if (strpos($name, 'futures') !== false) {
$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上传规则
......@@ -29,7 +35,7 @@ class SupplierSkuUploadRulerService
{
if (empty($ruler)) {
return config('fixed.SkuUploadDefaultRuler');
}else{
} else {
return json_decode($ruler, true);
}
......@@ -53,4 +59,4 @@ class SupplierSkuUploadRulerService
return json_encode($rulers);
}
}
}
\ No newline at end of file
}
......@@ -82,14 +82,15 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
Route::match(['get', 'post'], '/test', function () {
$data = [
'supplier_code' => 'L0015420',
'brand_id' => 0,
'log_id' => 8379,
"down_type" => 1,
];
//改成队列
(new SkuService())->batchOffShelfSkuQueue($data);
(new \App\Http\Services\DataService())->initFuturesSkuUploadRuler();
// $data = [
// 'supplier_code' => 'L0015420',
// 'brand_id' => 0,
// 'log_id' => 8379,
// "down_type" => 1,
// ];
// //改成队列
// (new SkuService())->batchOffShelfSkuQueue($data);
// (new \App\Http\Services\SupplierService())->initialCpTimeDays(15307, 5);
// (new \App\Http\Services\DataService())->initFuturesCpTime();
......
......@@ -157,10 +157,16 @@ return [
//{"allow_stock_lte_0":0,"allow_moq_lte_0":1,"allow_stock_lt_moq":0,"allow_price_null":1}
'SkuUploadRuler' => [
//现货
'allow_stock_lte_0' => '允许库存为空',
'allow_moq_lte_0' => '允许起订量为空',
// 'allow_stock_lt_moq' => '允许起订量大于库存',
'allow_price_null' => '允许阶梯价为空',
//期货
'futures_allow_stock_lte_0' => '允许库存为空',
'futures_allow_moq_lte_0' => '允许起订量为空',
// 'futures_allow_stock_lt_moq' => '允许起订量大于库存',
'futures_allow_price_null' => '允许阶梯价为空',
],
'SkuUploadDefaultRuler' => [
......@@ -168,6 +174,10 @@ return [
'allow_moq_lte_0' => 0,
'allow_stock_lt_moq' => 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) {
return JSON.stringify(subItem) === json;
}) === 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 @@
if (ladder.hasOwnProperty('price_cn')) {
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>';
}else{
} else {
return '';
}
}else{
} else {
return '';
}
......@@ -96,7 +96,7 @@
let ladder = data.ladder_price[data.ladder_price.length - 1];
if (ladder.hasOwnProperty('price_us')) {
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 '';
}
......@@ -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 = '';
$(document).on('mouseenter', '.view_ladder_price_cn', function () {
let self = this;
let rowIndex = $(this).parent().parent().parent().attr('data-index');
let data = table.cache['skuList'][rowIndex].ladder_price;
console.log(data)
if (!data) {
return false;
}
......
......@@ -39,6 +39,7 @@
<button type="button" class="layui-btn layui-btn-sm" id="set_sku_tag">设置标签</button>
@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="update_sku">修改商品信息</button>
@endif
@endif
</div>
......
......@@ -19,24 +19,67 @@
<div class="layui-form-item">
<div class="layui-inline" style="width: 100%">
<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']))
@foreach($supplier['sku_upload_ruler'] as $key=>$flag)
@if(!empty(array_get(config('fixed.SkuUploadRuler'),$key)))
<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 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>
<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
@foreach(config('fixed.SkuUploadRuler') as $key=>$flag)
<input type="checkbox" name="sku_upload_ruler[{{$key}}]"
lay-skin="primary"
title="{{$flag}}">
@endforeach
<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>
<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
</div>
<div class="layui-form-mid layui-word-aux">
......@@ -62,7 +105,7 @@
lay-skin="primary"
class="audit_ruler_item"
@if($flag)
checked
checked
@endif
title="{{array_get(config('fixed.SkuAuditRuler.name_map'),$key)}}">
@endif
......@@ -79,4 +122,4 @@
@include('web.supplier.SkuUploadStatus');
</div>
@include('script.supplier.SkuRulerScript')
\ No newline at end of file
@include('script.supplier.SkuRulerScript')
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