Commit e03df99c by 杨树贤

一体化需求

parent 176022fd
...@@ -31,10 +31,11 @@ class SupplierTagApiController extends Controller ...@@ -31,10 +31,11 @@ class SupplierTagApiController extends Controller
public function BatchAddTag($request) public function BatchAddTag($request)
{ {
$supplierIds = $request->get('supplier_ids'); $supplierIds = $request->get('supplier_ids');
$systemTags = trim($request->get('system_tags'), ','); //$systemTags = trim($request->get('system_tags'), ',');
$customTags = $request->get('customer_tags'); $customTags = $request->get('customer_tags');
$supplierIds = $supplierIds ? explode(',', $supplierIds) : []; $supplierIds = $supplierIds ? explode(',', $supplierIds) : [];
$systemTags = $systemTags ? explode(',', $systemTags) : []; //$systemTags = $systemTags ? explode(',', $systemTags) : [];
$systemTags = [];
$customTags = $customTags ? explode(',', $customTags) : []; $customTags = $customTags ? explode(',', $customTags) : [];
$supplierTagService = new SupplierTagService(); $supplierTagService = new SupplierTagService();
if (empty($systemTags) && empty($customTags)) { if (empty($systemTags) && empty($customTags)) {
......
...@@ -8,6 +8,7 @@ use App\Http\Services\DepartmentService; ...@@ -8,6 +8,7 @@ use App\Http\Services\DepartmentService;
use App\Model\SupplierAccountModel; use App\Model\SupplierAccountModel;
use App\Model\SupplierChannelModel; use App\Model\SupplierChannelModel;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use function foo\func;
class SupplierAccountFilter class SupplierAccountFilter
{ {
...@@ -59,6 +60,11 @@ class SupplierAccountFilter ...@@ -59,6 +60,11 @@ class SupplierAccountFilter
$query->where('a_type', $map['a_type']); $query->where('a_type', $map['a_type']);
} }
if ((isset($map['is_entity']) && $map['is_entity'] === '0') || !empty($map['is_entity'])) {
$supplierIds = SupplierChannelModel::where('is_entity', $map['is_entity'])->pluck('supplier_id');
$query->whereIn('supplier_id', $supplierIds);
}
if (!empty($map['create_time'])) { if (!empty($map['create_time'])) {
$times = explode('~', $map['create_time']); $times = explode('~', $map['create_time']);
$startTime = strtotime($times[0]); $startTime = strtotime($times[0]);
......
...@@ -126,22 +126,22 @@ class SupplierTagService ...@@ -126,22 +126,22 @@ class SupplierTagService
{ {
$suppliers = SupplierChannelModel::whereIn('supplier_id', $supplierIds)->get()->toArray(); $suppliers = SupplierChannelModel::whereIn('supplier_id', $supplierIds)->get()->toArray();
foreach ($suppliers as $supplier) { foreach ($suppliers as $supplier) {
$oldSystemTags = $supplier['system_tags'] ? explode(',', $supplier['system_tags']) : []; //$oldSystemTags = $supplier['system_tags'] ? explode(',', $supplier['system_tags']) : [];
$oldCustomTags = $supplier['customer_tags'] ? explode(',', $supplier['customer_tags']) : []; $oldCustomTags = $supplier['customer_tags'] ? explode(',', $supplier['customer_tags']) : [];
$newSystemTags = array_unique(array_merge($oldSystemTags, $addSysTags)); //$newSystemTags = array_unique(array_merge($oldSystemTags, $addSysTags));
$newCustomTags = array_unique(array_merge($oldCustomTags, $addCusTags)); $newCustomTags = array_unique(array_merge($oldCustomTags, $addCusTags));
$newCustomTags = implode(',', $newCustomTags); $newCustomTags = implode(',', $newCustomTags);
$newSystemTags = implode(',', $newSystemTags); //$newSystemTags = implode(',', $newSystemTags);
$oldCustomTags = implode(',', $oldCustomTags); $oldCustomTags = implode(',', $oldCustomTags);
$oldSystemTags = implode(',', $oldSystemTags); //$oldSystemTags = implode(',', $oldSystemTags);
$this->saveTags($supplier['supplier_id'], self::TAG_TYPE_SYSTEM, $newSystemTags, $oldSystemTags); //$this->saveTags($supplier['supplier_id'], self::TAG_TYPE_SYSTEM, $newSystemTags, $oldSystemTags);
$this->saveTags($supplier['supplier_id'], self::TAG_TYPE_CUSTOMER, $newCustomTags, $oldCustomTags); $this->saveTags($supplier['supplier_id'], self::TAG_TYPE_CUSTOMER, $newCustomTags, $oldCustomTags);
SupplierChannelModel::where('supplier_id', $supplier['supplier_id'])->update([ SupplierChannelModel::where('supplier_id', $supplier['supplier_id'])->update([
'system_tags' => $newSystemTags, //'system_tags' => $newSystemTags,
'customer_tags' => $newCustomTags 'customer_tags' => $newCustomTags
]); ]);
} }
} }
} }
\ No newline at end of file
...@@ -17,6 +17,8 @@ class SupplierAccountTransformer ...@@ -17,6 +17,8 @@ class SupplierAccountTransformer
foreach ($list as &$item) { foreach ($list as &$item) {
$item['supplier_name'] = array_get($suppliers, $item['supplier_id']); $item['supplier_name'] = array_get($suppliers, $item['supplier_id']);
$item = $this->transformInfo($item); $item = $this->transformInfo($item);
$item['is_entity'] = array_get($item['supplier'], 'is_entity', -1);
$item['is_entity_name'] = array_get(config('field.IsEntity'), $item['is_entity'], '暂无');
} }
unset($item); unset($item);
......
...@@ -45,9 +45,10 @@ class SupplierChannelModel extends Model ...@@ -45,9 +45,10 @@ class SupplierChannelModel extends Model
const HAS_UPLOADED_SKU = 1; const HAS_UPLOADED_SKU = 1;
//是否是实体名单 //是否是实体名单
const IS_ENTITY_NEED_CONFIRM = 0; const IS_ENTITY_NEED_CONFIRM = 0; //待确认
const IS_ENTITY_TRUE = 1; const IS_ENTITY_TRUE = 1; //是
const IS_ENTITY_FALSE = -1; const IS_ENTITY_FALSE = -1; //否
const IS_ENTITY_REJECT = -2; //驳回
//黑名单信息 //黑名单信息
......
...@@ -310,6 +310,7 @@ return [ ...@@ -310,6 +310,7 @@ return [
'IsEntity' => [ 'IsEntity' => [
-1 => '否', -1 => '否',
0 => '待确认', 0 => '待确认',
1 => '是' 1 => '是',
-2 => '驳回'
] ]
]; ];
...@@ -43,10 +43,21 @@ ...@@ -43,10 +43,21 @@
{field: 'type_name', title: '账号类型', align: 'center'}, {field: 'type_name', title: '账号类型', align: 'center'},
{ {
field: 'is_entity', title: '实体名单', align: 'center', width: 80, templet: function (data) { field: 'is_entity', title: '实体名单', align: 'center', width: 80, templet: function (data) {
if (data.supplier) { let color = '';
return data.supplier.is_entity === -1 ? '否' : "<span style='color: red' title='" + data.supplier.disbale_reason + "'></span>"; switch (data.is_entity) {
case 1:
color = '#FF0000';
break;
case 0:
color = '#FFA500';
break;
case -2:
color = '#ff0000';
break;
default:
color = '';
} }
return ''; return '<span style="color: ' + color + '">' + data.is_entity_name + '</span>';
} }
}, },
{ {
......
...@@ -172,6 +172,9 @@ ...@@ -172,6 +172,9 @@
case 0: case 0:
color = '#FFA500'; color = '#FFA500';
break; break;
case -2:
color = '#ff0000';
break;
default: default:
color = ''; color = '';
} }
......
...@@ -371,6 +371,7 @@ ...@@ -371,6 +371,7 @@
if (supplierId) { if (supplierId) {
@if (checkPerm('UpdateSupplierTags')) @if (checkPerm('UpdateSupplierTags'))
let systemTagOption = getTagOption('system_tags_selector', 2); let systemTagOption = getTagOption('system_tags_selector', 2);
systemTagOption.disabled = true;
let tagSelector = xmSelect.render(systemTagOption); let tagSelector = xmSelect.render(systemTagOption);
let tagIds = $('#system_tags').attr('value'); let tagIds = $('#system_tags').attr('value');
tagSelector.setValue(tagIds.split(',')); tagSelector.setValue(tagIds.split(','));
...@@ -448,4 +449,4 @@ ...@@ -448,4 +449,4 @@
}) })
}); });
}); });
</script> </script>
\ No newline at end of file
...@@ -12,16 +12,16 @@ ...@@ -12,16 +12,16 @@
<input type="hidden" name="supplier_ids" id="supplier_ids"> <input type="hidden" name="supplier_ids" id="supplier_ids">
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-input-block" style="margin-left: -30px"> <div class="layui-input-block" style="margin-left: -30px">
<div class="layui-form-item"> {{-- <div class="layui-form-item">--}}
<label class="layui-form-label"> {{-- <label class="layui-form-label">--}}
系统标签 : </label> {{-- 系统标签 : </label>--}}
<div class="layui-input-block" style="margin-top: 15px"> {{-- <div class="layui-input-block" style="margin-top: 15px">--}}
<div id="system_tags_selector" class="layui-input-inline" style="width: 100%;"> {{-- <div id="system_tags_selector" class="layui-input-inline" style="width: 100%;">--}}
</div> {{-- </div>--}}
<input type="hidden" name="system_tags" {{-- <input type="hidden" name="system_tags"--}}
id="system_tags"> {{-- id="system_tags">--}}
</div> {{-- </div>--}}
</div> {{-- </div>--}}
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label"> <label class="layui-form-label">
自定义标签 : </label> 自定义标签 : </label>
......
...@@ -23,6 +23,10 @@ ...@@ -23,6 +23,10 @@
@inject('statusPresenter','App\Presenters\StatusPresenter') @inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('a_status','账号状态',request()->get('status'),[0=>'禁用',1=>'启用']) !!} {!! $statusPresenter->render('a_status','账号状态',request()->get('status'),[0=>'禁用',1=>'启用']) !!}
</div> </div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('is_entity','实体名单','',config('field.IsEntity')) !!}
</div>
</div> </div>
<div class="layui-row"> <div class="layui-row">
<div class="layui-inline"> <div class="layui-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