Commit e03df99c by 杨树贤

一体化需求

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