Commit 5add41e2 by 杨树贤

根据组织判断显示类型

parent c5ffddb1
<?php
namespace App\Http\Services;
//后台用户相关信息服务
use App\Model\SupplierBlacklistModel;
use App\Model\SupplierChannelModel;
use Illuminate\Support\Facades\DB;
class BaseService
{
public $logId = 1;
public function __construct()
{
$this->orgId = !empty(request()->user->org_id) ? request()->user->org_id : 1;
}
}
......@@ -16,7 +16,7 @@ use Illuminate\Support\Facades\Redis;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
class SkuService
class SkuService extends BaseService
{
const OPERATE_TYPE_PUTAWAY = 1;
......@@ -108,7 +108,11 @@ class SkuService
//获取是否精选和标签
$goodsTag = $this->getGoodsTag($sku['goods_id']);
$sku['goods_label'] = array_get($goodsTag, 'goods_label', '');
$sku['goods_label_name'] = array_get(config('field.SkuGoodsLabel'), $sku['goods_label'], '');
if ($this->orgId == 1) {
$sku['goods_label_name'] = array_get(config('field.SkuGoodsLabel'), $sku['goods_label'], '');
}else{
$sku['goods_label_name'] = array_get(config('field.SkuGoodsLabelForIedge'), $sku['goods_label'], '');
}
$sku['tags'] = array_get($goodsTag, 'tags', []);
if (!empty($sku['tags'])) {
$sku['is_prefer'] = in_array(1, $sku['tags']) ? 1 : 0;
......@@ -136,7 +140,7 @@ class SkuService
$dbInfo = getSpuSkuDb($item['goods_id']);
$connection = DB::connection($dbInfo["db"]);
$table = $dbInfo['table'];
$selectFields = ['goods_id', 'create_time', 'eccn', 'source', 'encoded','org_id'];
$selectFields = ['goods_id', 'create_time', 'eccn', 'source', 'encoded', 'org_id'];
$skuDBData = $connection->table($table)->select($selectFields)->where('goods_id', $item['goods_id'])->first();
$skuDBData = $skuDBData ? $skuDBData : [];
$item['source_name'] = array_get(config('field.SkuSource'), @$skuDBData['source'], '');
......@@ -506,7 +510,7 @@ class SkuService
} else {
$goodsTag = [
'goods_label' => $goodsLabel,
];
}
$redis->hset('goods_tag', $skuId, json_encode($goodsTag));
......
......@@ -2,6 +2,7 @@
namespace App\Providers;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
......@@ -13,7 +14,10 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot()
{
//
//共享全局模板变量
$orgId = !empty(request()->user->orgId) ? request()->user->orgId : 1;
View::share('orgId', $orgId);
View::share('isIedge', $orgId == 1 ? false : true);
}
/**
......
......@@ -53,6 +53,16 @@ return [
-1 => '代购现货'
],
'SkuGoodsLabelForIedge' => [
1 => '华云现货',
2 => '国际现货',
3 => '华云期货',
4 => '询价现货',
5 => '原厂直售',
6 => '猎芯精选',
-1 => '代购现货'
],
//SKU 标签
'SkuTag' => [
1 => '优选',
......
......@@ -56,7 +56,7 @@
<div class="layui-form-item" style="margin-left: -50px">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('goods_label','SKU显示类型 : ',null,
config('field.SkuGoodsLabel'),['required'=>true,'label_width'=>'100px']) !!}
$isIedge?config('field.SkuGoodsLabelForIedge'):config('field.SkuGoodsLabel'),['required'=>true,'label_width'=>'100px']) !!}
</div>
<div align="center" style="margin-top: 10px;text-align: right">
<button type="button" class="layui-btn layui-btn-sm layui-btn-info submit-loading" lay-submit
......
......@@ -79,18 +79,12 @@
</div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('goods_label/condition','SKU显示类型','',config('field.SkuGoodsLabel')) !!}
{!! $statusPresenter->render('goods_label/condition','SKU显示类型','',$isIedge?config('field.SkuGoodsLabelForIedge'):config('field.SkuGoodsLabel')) !!}
</div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('tags/condition','是否精选',request()->get('tags/condition'),[1=>'是',0=>'否']) !!}
</div>
{{-- <div class="layui-inline">--}}
{{-- @inject('statusPresenter','App\Presenters\StatusPresenter')--}}
{{-- {!! $statusPresenter->render('status/condition','是否过期',request()->get('status/condition'),[0=>'是',1=>'否']) !!}--}}
{{-- </div>--}}
<div class="layui-inline">
<label class="layui-form-label">起订量库存</label>
<div class="layui-input-inline">
......
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