Commit c9a2b116 by 杨树贤

Merge branch 'ysx-供应商需求-20250717'

parents 6902a708 194f3769
......@@ -160,7 +160,7 @@ MENU_ID=16
MENU_URL=http://data.liexin.net/api/config/
FOOTSTONE_URL=http://footstone.liexindev.net
#标签系统的地址
TAG_URL=http://tag.liexinlocal.com
TAG_URL=http://tag.liexinlocal.com:32581
SKIP_SEND_EMAIL=true
......
......@@ -2,12 +2,13 @@
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Services\SkuService;
use Illuminate\Http\Request;
use App\Model\SkuUploadLogModel;
use App\Http\Services\SkuService;
use App\Model\SupplierChannelModel;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use function GuzzleHttp\Promise\all;
use App\Http\Services\SupplierTagService;
//通用API,比如获取品牌列表,分类列表等
class SkuApiController extends Controller
......@@ -173,19 +174,39 @@ class SkuApiController extends Controller
//批量新增标签
public function BatchAddSkuTag($request)
{
$type = $request->input('type');
$supplierCode = $request->input('supplier_code');
$skuIds = $request->get('sku_ids');
$skuTags = $request->get('sku_tags');
if ($type == 1 && empty($skuIds)) {
$this->response(-1, '按型号设置标签,必须先选择型号');
$currentTab = $request->input('current_tab');
switch ($currentTab) {
case 'tag_setting':
$type = $request->input('type');
$supplierCode = $request->input('supplier_code');
$skuIds = $request->get('sku_ids');
$skuTags = $request->get('sku_tags');
if ($type == 1 && empty($skuIds)) {
$this->response(-1, '按型号设置标签,必须先选择型号');
}
if ($type == 2 && empty($supplierCode)) {
$this->response(-1, '按供应商设置标签,必须先选择供应商');
}
(new SkuService())->batchAddSkuTags($type, $supplierCode, $skuIds, $skuTags);
$text = $type == 1 ? '设置标签成功' : '批量设置供应商SKU标签任务已开始,请等待任务完成';
break;
case 'goods_label':
$goodsLabel = $request->get('goods_label');
$goodsLabelSystemTags = $request->get('goods_label_system_tags');
(new SupplierTagService())->batchSaveGoodsLabelTags($goodsLabel, $goodsLabelSystemTags);
$text = '设置显示类型标签成功';
break;
case 'goods_source':
$goodsSource = $request->get('goods_source');
$goodsSourceSystemTags = $request->get('goods_source_system_tags');
(new SupplierTagService())->batchSaveGoodsSourceTags($goodsSource, $goodsSourceSystemTags);
$text = '设置接入方式标签成功';
break;
default:
$this->response(-1, '请选择操作类型');
}
if ($type == 2 && empty($supplierCode)) {
$this->response(-1, '按供应商设置标签,必须先选择供应商');
}
(new SkuService())->batchAddSkuTags($type, $supplierCode, $skuIds, $skuTags);
$text = $type == 1 ? '设置标签成功' : '批量设置供应商SKU标签任务已开始,请等待任务完成';
$this->response(0, $text);
}
......
......@@ -101,6 +101,8 @@ class SupplierApiController extends Controller
'agency_brands',
'purchase_type',
'sign_com_id',
'sku_optional_batch',
];
public function Entrance(Request $request, $id)
......@@ -257,7 +259,6 @@ class SupplierApiController extends Controller
public function DisableSupplier($request)
{
//禁用不是直接修改为无法交易,而是改为审核中,然后审核通过后,变成无法交易
$supplierId = $request->get('supplier_id');
$disableReason = trim($request->get('disable_reason'));
if (empty($disableReason)) {
......@@ -271,7 +272,7 @@ class SupplierApiController extends Controller
$result = $model->where('supplier_id', $supplierId)->update([
'update_time' => time(),
'status' => $model::STATUS_DISABLE,
'disable_reason' => $disableReason,
'disable_reason' => '人工禁用:' . $disableReason,
]);
if ($result) {
//写日志
......@@ -811,4 +812,17 @@ class SupplierApiController extends Controller
}
$this->response(0, '修改供应商名称成功,请等待一体化再次审核');
}
//清空线上采购员
public function resetYunxinChannelUser($request)
{
$supplierId = $request->get('supplier_id');
$supplierService = new SupplierService();
$result = $supplierService->resetYunxinChannelUser($supplierId);
if ($result) {
$this->response(0, '清空线上采购员成功');
} else {
$this->response(-1, '清空线上采购员失败');
}
}
}
......@@ -197,17 +197,18 @@ class SupplierFilter
//搜索创建部门的数据
if (!empty($map['create_user_department'])) {
$map['create_user_department'] = explode(',', $map['create_user_department']);
$parentDepartmentIds = DepartmentModel::whereIn('department_id',$map['create_user_department'])
$parentDepartmentIds = DepartmentModel::whereIn('department_id', $map['create_user_department'])
->pluck('parent_id')->toArray();
$parentDepartmentIds = array_unique($parentDepartmentIds);
$departmentIds = array_merge($parentDepartmentIds, $map['create_user_department']);
//先去找出所有的创建人uid
$userIds = UserInfoModel::whereIn('department_id',$departmentIds)->pluck('userId')->toArray();
$query->whereIn('create_uid',$userIds);
$userIds = UserInfoModel::whereIn('department_id', $departmentIds)->pluck('userId')->toArray();
$query->whereIn('create_uid', $userIds);
}
//默认过滤带有-1字符串的供应商名称的数据
$query->whereRaw('supplier_name NOT LIKE "%-1"');
return $query;
}
......@@ -218,59 +219,61 @@ class SupplierFilter
$canViewAllSupplier = checkPerm('ViewAllSupplier');
$canViewSubordinateSupplier = checkPerm('ViewSubordinateSupplier');
$canViewFakeSupplier = checkPerm('ViewFakeSupplier');
//现在普通采购也能看到竞调供应商了(与他有关的)
if (!$canViewFakeSupplier) {
$query->where('is_type', 0);
}
$query->with(['contact', 'attachment']);
$query->whereRaw('supplier_name NOT LIKE "%-1"');
$canViewBlockSupplier = checkPerm('ViewBlockSupplier');
$canViewDisableSupplier = checkPerm('ViewDisableSupplier');
// 构建复合查询条件:基础条件 OR 特殊状态
$query->where(function ($mainQuery) use ($canViewFakeSupplier, $canViewBlockSupplier, $canViewDisableSupplier, $userId, $codeId, $canViewAllSupplier, $canViewSubordinateSupplier) {
// 主要条件组:基础业务条件
$mainQuery->where(function ($baseQuery) use ($canViewFakeSupplier, $userId, $codeId, $canViewAllSupplier, $canViewSubordinateSupplier) {
// 基础类型限制
if (!$canViewFakeSupplier) {
$baseQuery->where('is_type', 0);
}
//默认展示的数据查询
//看全部的权限,优先级最高
if ($canViewAllSupplier) {
//能查看所有的话,限制基本没有
} else {
//如果能看部下的,那需要判断的地方就多了不少
if ($canViewSubordinateSupplier) {
$departmentService = new DepartmentService();
//下属用户id(结果包括自己的id)
$subordinateUserIds = $departmentService->getSubordinateUserIds($userId);
$adminUserService = new AdminUserService();
$subordinateCodeIds = $adminUserService->getCodeIdsByUserIds($subordinateUserIds);
$subordinateCodeIds = $subordinateCodeIds->toArray();
//因为可以查看自己部下相关的采购员,开发员的供应商,所以要构建复杂likeIn语句需要的数据
//注意下面三个条件最外层要用()包围起来,要不然mysql数据会有问题,具体自己查询mysql的and和or的语法注意事项
$likeSqlRaw = implode('|', $subordinateCodeIds);
$inCodeIdSql = implode(',', $subordinateCodeIds);
$inUserIdSql = implode(',', $subordinateUserIds);
$inCodeIdSql = "(" . $inCodeIdSql . ")";
$inUserIdSql = "(" . $inUserIdSql . ")";
if ($subordinateCodeIds) {
if ($canViewFakeSupplier) {
$query->whereRaw(DB::raw("(create_uid in $inUserIdSql or purchase_uid in $inCodeIdSql
or channel_uid REGEXP '$likeSqlRaw' or is_type = 1) "));
} else {
$query->whereRaw(DB::raw("(create_uid in $inUserIdSql or purchase_uid in $inCodeIdSql
or channel_uid REGEXP '$likeSqlRaw') "));
}
} else {
if ($canViewFakeSupplier) {
$query->whereRaw(DB::raw("(create_uid in $inUserIdSql or is_type = 1)"));
// 权限相关的条件
if (!$canViewAllSupplier) {
if ($canViewSubordinateSupplier) {
$departmentService = new DepartmentService();
$subordinateUserIds = $departmentService->getSubordinateUserIds($userId);
$adminUserService = new AdminUserService();
$subordinateCodeIds = $adminUserService->getCodeIdsByUserIds($subordinateUserIds);
$subordinateCodeIds = $subordinateCodeIds->toArray();
$likeSqlRaw = implode('|', $subordinateCodeIds);
$inCodeIdSql = implode(',', $subordinateCodeIds);
$inUserIdSql = implode(',', $subordinateUserIds);
$inCodeIdSql = "(" . $inCodeIdSql . ")";
$inUserIdSql = "(" . $inUserIdSql . ")";
if ($subordinateCodeIds) {
$baseQuery->whereRaw("(create_uid in $inUserIdSql or purchase_uid in $inCodeIdSql or channel_uid REGEXP '$likeSqlRaw')");
} else {
$baseQuery->whereRaw("(create_uid in $inUserIdSql)");
}
} else {
$query->whereRaw(DB::raw("(create_uid in $inUserIdSql)"));
// 只能看自己的
$baseQuery->where(function ($selfQuery) use ($userId, $codeId) {
$selfQuery->where('create_uid', $userId)
->orWhere('purchase_uid', $codeId)
->orWhere('channel_uid', 'like', '%' . $codeId . '%');
});
}
}
});
} else {
if ($codeId) {
//剩下的就只是看自己相关的
$query->whereRaw(DB::raw("(create_uid = $userId or purchase_uid = $codeId or channel_uid like '%${codeId}%') "));
} else {
$query->whereRaw(DB::raw("(create_uid = $userId)"));
}
// 额外显示的特殊状态(如果有权限)
if ($canViewBlockSupplier) {
$mainQuery->orWhere('status', SupplierChannelModel::STATUS_BLOCK);
}
}
if ($canViewDisableSupplier) {
$mainQuery->orWhere('status', SupplierChannelModel::STATUS_DISABLE);
}
});
$query->with(['contact', 'attachment']);
$query->whereRaw('supplier_name NOT LIKE "%-1"');
// 权限逻辑已经移到上面的复合查询条件中
//先判断获取类型
switch ($sourceType) {
case "all":
......@@ -349,17 +352,21 @@ class SupplierFilter
});
break;
//附件里面缺少品质协议的,而且是现货类型供应商
// case "no_quality_assurance_agreement":
// $query->whereDoesntHave('attachment', function ($query) {
// $query->whereNotIn('status',
// [SupplierChannelModel::STATUS_DISABLE, SupplierChannelModel::STATUS_BLOCK])
// ->where('field_name', 'quality_assurance_agreement');
// })->where('supplier_group', 2);
// break;
// case "no_quality_assurance_agreement":
// $query->whereDoesntHave('attachment', function ($query) {
// $query->whereNotIn('status',
// [SupplierChannelModel::STATUS_DISABLE, SupplierChannelModel::STATUS_BLOCK])
// ->where('field_name', 'quality_assurance_agreement');
// })->where('supplier_group', 2);
// break;
//联系人待完善
case "contact_no_complete":
$query->rightjoin('supplier_contact', 'supplier_channel.supplier_id', '=',
'supplier_contact.supplier_id')
$query->rightjoin(
'supplier_contact',
'supplier_channel.supplier_id',
'=',
'supplier_contact.supplier_id'
)
->selectRaw('lie_supplier_channel.*')
->where(function ($q) {
$q->where('supplier_consignee', '')
......
......@@ -11,6 +11,7 @@ use Illuminate\Http\Request;
use App\Model\IntracodeModel;
use App\Model\SupplierLogModel;
use App\Http\Services\LogService;
use App\Http\Services\SkuService;
use App\Model\SupplierChannelModel;
use App\Http\Services\SupplierService;
use App\Http\Services\DepartmentService;
......@@ -110,7 +111,7 @@ class SkuController extends Controller
//批量打标签
public function BatchAddSkuTag($request)
{
$systemTags = (new SkuService())->getSystemTags();
$this->data['title'] = '批量修改Sku标签';
$suppliers = SupplierChannelModel::where('is_type', 0)->where('status', 2)
->select(['supplier_name', 'supplier_code'])->get();
......@@ -124,8 +125,26 @@ class SkuController extends Controller
$skuIds = explode(',', $skuIds);
$this->data['skuIds'] = $skuIds;
}
$supplierCodesForXmSelect = $supplierCodes;
foreach ($supplierCodesForXmSelect as $key => $value) {
$supplierCodesForXmSelect[$key] = ['name' => $value, 'value' => $key];
}
$this->data['supplierCodes'] = $supplierCodes;
$supplierCodesForXmSelect = array_values($supplierCodesForXmSelect);
$this->data['supplierCodesForXmSelect'] = $supplierCodesForXmSelect;
$systemTagsForXmSelect = $systemTags;
foreach ($systemTagsForXmSelect as $key => $value) {
$systemTagsForXmSelect[$key] = ['name' => $value['tag_name'], 'value' => $value['tag_id']];
}
$systemTagsForXmSelect = array_values($systemTagsForXmSelect);
$this->data['systemTagsForXmSelect'] = $systemTagsForXmSelect;
//获取已经设置的标签
$goodsLabelSystemTagList = (new SupplierTagService())->getGoodsLabelSystemTagList();
$this->data['goodsLabelSystemTagList'] = $goodsLabelSystemTagList;
$goodsSourceSystemTagList = (new SupplierTagService())->getGoodsSourceSystemTagList();
$this->data['goodsSourceSystemTagList'] = $goodsSourceSystemTagList;
return $this->view('批量修改Sku标签');
}
......
......@@ -149,6 +149,15 @@ class SupplierController extends Controller
$this->data['sku_upload_log_count'] = (new SkuUploadLogService())->getSkuUploadLogCount($supplierId);
$ruleService = new RuleService();
$this->data['rule'] = $ruleService->getSupplierRule($supplier['supplier_code']);
$skuOptionalBatch = config('field.SkuOptionalBatch');
foreach ($skuOptionalBatch as $key => $value) {
$skuOptionalBatchXmSelect[] = [
'name' => $value,
'value' => $key,
];
}
$this->data['sku_optional_batch_for_xm_select'] = $skuOptionalBatchXmSelect;
return $this->view('供应商详情');
}
......@@ -254,6 +263,14 @@ class SupplierController extends Controller
$ruleService = new RuleService();
$this->data['rule'] = $ruleService->getSupplierRule($supplier['supplier_code']);
$skuOptionalBatchForXmSelect = [];
foreach (config('field.SkuOptionalBatch') as $key => $value) {
$skuOptionalBatchForXmSelect[] = [
'value' => $key,
'name' => $value,
];
}
$this->data['sku_optional_batch_for_xm_select'] = $skuOptionalBatchForXmSelect;
return $this->view('编辑供应商');
}
......
......@@ -55,7 +55,6 @@ class SupplierSyncController extends BaseSyncController
{
$resultData = $request->all();
Log::error(json_encode($resultData));
//$resultData['result_map'] = !empty($resultData['result_map']) ? json_decode($resultData['result_map'], true) : [];
//$resultData['tag_list'] = !empty($resultData['tag_list']) ? json_decode($resultData['tag_list'], true) : [];
if (is_array($resultData['result_map'])) {
......
......@@ -44,9 +44,16 @@ class SkuService extends BaseService
$data = json_decode($return, true);
$list = [];
if (isset($data['error_code']) && $data['error_code'] == 0) {
$url = config('website.GoodsServerUrl').'/synchronization?goods_id='.implode(',', $data['data']['goods_id']);
$return = curl($url, $map, 1);
$skuListData = json_decode($return, true);
if (isset($skuListData['errcode']) && $skuListData['errcode'] == 0) {
$skuListData = collect($skuListData['data'])->keyBy('goods_id')->toArray();
}
$redis = new RedisModel;
//处理供应商
$spuRedis = Redis::connection('spu');
//商品服务获取数据
foreach ($data['data']['goods_id'] as $k => $goodsId) {
$uploadItemService = new SkuUploadItemService();
$auditData = $uploadItemService->getSkuAuditData($data['data']['goods_id']);
......@@ -97,7 +104,11 @@ class SkuService extends BaseService
$standardBrand = json_decode($standardBrand, true);
$sku['standard_brand_name'] = $standardBrand['brand_name'];
}
$skuData = array_get($skuListData, $sku['goods_id'], []);
$sku['goods_tag_names'] = '';
if (!empty($skuData['goods_tag']['goods_tag_names'])) {
$sku['goods_tag_names'] = implode(',', $skuData['goods_tag']['goods_tag_names']);
}
//获取价格
$moqPrice = [];
if (!empty($sku['ladder_price'])) {
......
......@@ -26,14 +26,19 @@ class SupplierService
//获取供应商列表
public function getSupplierList($map)
{
$model = new SupplierChannelModel();
$query = $model->orderBy('update_time', 'desc');
$filter = new SupplierFilter();
$query = $filter->listFilter($map, $query);
$limit = array_get($map, 'limit', 10);
if (!empty($map['is_export'])) {
$list = $query->get()->toArray();
} else {
$sql = $query->toSql();
$bindings = $query->getBindings();
// dd($sql, $bindings);
$list = $query->paginate($limit)->toArray();
$transformer = new SupplierTransformer();
$list['data'] = $transformer->transformList($list['data']);
......@@ -983,4 +988,17 @@ class SupplierService
}
return $data;
}
//清空线上采购员
public function resetYunxinChannelUser($supplierId)
{
$result = SupplierChannelModel::where('supplier_id', $supplierId)->update([
'yunxin_channel_uid' => '',
'update_time' => time(),
]);
//还要记录日志
$logService = new LogService();
$logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '清空线上采购员', '清空线上采购员');
return $result;
}
}
......@@ -4,10 +4,11 @@
namespace App\Http\Services;
//后台用户相关信息服务
use App\Model\SupplierChannelModel;
use GuzzleHttp\Client;
use App\Model\RedisModel;
use GuzzleHttp\RequestOptions;
use Illuminate\Support\Facades\DB;
use App\Model\SupplierChannelModel;
use Illuminate\Support\Facades\Log;
class SupplierTagService
......@@ -162,4 +163,64 @@ class SupplierTagService
]);
}
}
//获取供应商的系统标签
public function getGoodsLabelSystemTagList()
{
$redis = new RedisModel();
$data = $redis->hgetall('goods_label_tags');
$data = array_map(function ($item) {
return json_decode($item, true);
}, $data);
$result = [];
foreach ($data as $key => $value) {
$result[] = [
'goods_label' => isset(config('field.SkuGoodsLabel')[$key]) ? config('field.SkuGoodsLabel')[$key] : '',
'system_tags' => implode(',', $value['system_tags']),
];
}
return $result;
}
//获取供应商的接入方式标签
public function getGoodsSourceSystemTagList()
{
$redis = new RedisModel();
$data = $redis->hgetall('goods_source_tags');
$data = array_map(function ($item) {
return json_decode($item, true);
}, $data);
$result = [];
foreach ($data as $key => $value) {
$result[] = [
'goods_source' => isset(config('field.SkuSource')[$key]) ? config('field.SkuSource')[$key] : '',
'system_tags' => implode(',', $value['system_tags']),
];
}
return $result;
}
//批量更新供应商的SKU显示类型
public function batchSaveGoodsLabelTags($goodsLabel, $goodsLabelSystemTags)
{
$goodsLabelSystemTags = explode(',', $goodsLabelSystemTags);
$data = [
'system_tags' => $goodsLabelSystemTags,
];
//存到redis中
$redis = new RedisModel();
$redis->hset('goods_label_tags', $goodsLabel, json_encode($data));
}
//批量更新供应商的SKU接入方式
public function batchSaveGoodsSourceTags($goodsSource, $goodsSourceSystemTags)
{
$goodsSourceSystemTags = explode(',', $goodsSourceSystemTags);
$data = [
'system_tags' => $goodsSourceSystemTags,
];
//存到redis中
$redis = new RedisModel();
$redis->hset('goods_source_tags', $goodsSource, json_encode($data));
}
}
......@@ -124,20 +124,23 @@ class SyncSupplierService
}
$message['reviewProcess'] = $reviewProcess;
if ($conn) {
} else {
$conn = new AMQPStreamConnection(config('database.connections.rabbitmq.host'),
$conn = new AMQPStreamConnection(
config('database.connections.rabbitmq.host'),
config('database.connections.rabbitmq.port'),
config('database.connections.rabbitmq.login'),
config('database.connections.rabbitmq.password'));
config('database.connections.rabbitmq.password')
);
}
$channel = $conn->channel();
$channel->queue_declare('supplier_sync', false, true, false, false);
Log::warning(json_encode($message));
$msg = new AMQPMessage(json_encode($message),
array('content_type' => 'text/plain'));
$msg = new AMQPMessage(
json_encode($message),
array('content_type' => 'text/plain')
);
$result = $channel->basic_publish($msg, '', 'supplier_sync');
// $result = $channel->basic_publish($msg);
// $result = $channel->basic_publish($msg);
}
//获取采购人员列表
......@@ -167,7 +170,7 @@ class SyncSupplierService
//同步供应商信息到一体化中心
public function syncSupplierToUnited($supplierId)
{
Log::error('同步供应商给一体化 : '. $supplierId);
Log::error('同步供应商给一体化 : ' . $supplierId);
$supplier = SupplierChannelModel::where('supplier_id', $supplierId)->first()->toArray();
$fileUrl = SupplierAttachmentsModel::where('supplier_id', $supplierId)
->where('field_name', 'registration_certificate')
......@@ -183,8 +186,11 @@ class SyncSupplierService
'region' => $supplier['region'] == SupplierChannelModel::REGION_CN ? 1 : 2,
'pi_file_url' => $fileUrl ?: '',
];
(new QueueDeliveryService())->push(QueueDeliveryService::PUSH_TYPE_SYNC_HTTP, '/sync/Company/syncCompany',
$syncData);
(new QueueDeliveryService())->push(
QueueDeliveryService::PUSH_TYPE_SYNC_HTTP,
'/sync/Company/syncCompany',
$syncData
);
}
/**
......@@ -292,16 +298,20 @@ class SyncSupplierService
Log::error('供应商不存在');
return true;
}
foreach ($suppliers as $supplier) {
//判断是否是同名多供应商,如果是的话,如果是之前已经禁用的,则直接跳过
if (count($suppliers) > 1) {
if ($supplier['status'] == SupplierChannelModel::STATUS_DISABLE && $supplier['is_entity'] != SupplierChannelModel::IS_ENTITY_NEED_CONFIRM) {
Log::warning("检测到同名供应商并且属于禁用(实体名单不为待处理)状态,跳过,供应商id为 : " . $supplier['supplier_id']);
if ($supplier['status'] == SupplierChannelModel::STATUS_DISABLE && ($supplier['is_entity'] != SupplierChannelModel::IS_ENTITY_NEED_CONFIRM && $supplier['is_entity'] != SupplierChannelModel::IS_ENTITY_TRUE)) {
Log::warning("检测到同名供应商并且属于禁用(实体名单不为待处理并且也不为实体名单)状态,跳过,供应商id为 : " . $supplier['supplier_id']);
continue;
}
}
//判断是否是人工禁用的,是的话,也跳过
//线上数据,实体名单状态为普通,且供应商状态为禁止交易的,全部为手动禁用;
if ((strpos($supplier['disable_reason'], '人工禁用') !== false && $supplier['status'] == SupplierChannelModel::STATUS_DISABLE) || ($supplier['status'] == SupplierChannelModel::STATUS_DISABLE && $supplier['is_entity'] == SupplierChannelModel::IS_ENTITY_FALSE)) {
Log::warning("检测到供应商并且属于禁用(人工禁用)状态,跳过,供应商id为 : " . $supplier['supplier_id']);
continue;
}
$originIsEntity = $supplier['is_entity'];
//$supplier = $supplier->toArray();
$supplierId = $supplier['supplier_id'];
......
......@@ -262,6 +262,7 @@ class SupplierTransformer
$supplier['purchase_type_name'] = array_get(config('field.PurchaseType'), $supplier['purchase_type'], '无');
$supplier['cp_time_format'] = ('现货 : ' . ($supplier['cp_time_day'] == -1 ? '无限制' : $supplier['cp_time_day'] . '天')) . ' | '
. ('期货 : ' . ($supplier['futures_cp_time_day'] == -1 ? '无限制' : $supplier['futures_cp_time_day'] . '天'));
$supplier['sku_optional_batch_text'] = $this->getSkuOptionalBatchText($supplier['sku_optional_batch']);
return $supplier;
}
......@@ -421,4 +422,14 @@ class SupplierTransformer
return $supplier;
}
public function getSkuOptionalBatchText($skuOptionalBatch)
{
$skuOptionalBatch = explode(',', $skuOptionalBatch);
$skuOptionalBatchText = [];
foreach ($skuOptionalBatch as $batch) {
$skuOptionalBatchText[] = array_get(config('field.SkuOptionalBatch'), $batch);
}
return implode(',', $skuOptionalBatchText);
}
}
......@@ -335,6 +335,11 @@ class SupplierValidator
if ($notCompleteContacts) {
$errorMessageList[] = "存在和你相关的联系人没有完善,请先去完善相关联系人";
}
//还要校验sku可选批次
if (!$validateData['sku_optional_batch']) {
$errorMessageList[] = "请设置SKU可选批次,在SKU概况栏";
}
}
return implode('|', $errorMessageList);
......
......@@ -13,6 +13,8 @@ class MultiSelectorPresenter
$width = array_get($option, 'width', '157px');
$radio = array_get($option, 'radio', 'false');
$requiredHtml = $isRequired ? '<span style="color: red">*</span>' : "";
$disable = array_get($option, 'disable', false);
$disable = $disable ? "true" : "false";
$elemId = $name . "Selector";
$data = json_encode($data);
$html = <<<EOF
......@@ -39,6 +41,7 @@ class MultiSelectorPresenter
value: 'value'
},
radio: $radio,
disabled: $disable,
size: 'mini',
direction: 'down',
data : $data,
......
......@@ -363,4 +363,14 @@ return [
2 => '京东采购',
3 => '华云采购',
],
'SkuOptionalBatch' => [
-1 => '无法指定',
1 => '任意批次',
2 => '1年内',
3 => '2年内',
4 => '3年内',
5 => '4年内',
6 => '5年内',
],
];
......@@ -59,5 +59,6 @@ return [
'purchase_type_name' => '代购类型',
'sign_com_id' => '签约公司id',
'sign_com_name' => '签约公司名称',
'sku_optional_batch_text' => 'SKU可选批次',
]
];
......@@ -45,5 +45,6 @@ return [
'CrmUrl' => env('CRM_URL'),
'SkipSendEmail' => env('skip_send_email'),
'CubeUrl' => env('CUBE_URL'),
'FootstoneCurlUrl' => 'http://footstone.liexindev.net/open/curl?url='
'FootstoneCurlUrl' => 'http://footstone.liexindev.net/open/curl?url=',
'GoodsServerUrl' => 'http://192.168.1.237:60014'
];
......@@ -4,6 +4,49 @@
let form = layui.form;
let table = layui.table
let element = layui.element;
$(document).on('click', '.reset-yunxin-channel-user', function() {
var that = $(this);
var index = layer.confirm('确定要清空该供应商的线上采购员吗?', {
btn: ['确定', '取消'] //按钮
}, function() {
admin.showLoading({
type: 3
});
let supplierId = that.attr('data-id');
let url = '/api/supplier/ResetYunxinChannelUser?supplier_id=' + supplierId;
$.ajax({
url: url
, type: 'GET'
, async: true
, dataType: 'json'
, timeout: 20000
, success: function(res) {
admin.removeLoading();
if (res.err_code === 0) {
parent.layer.msg(res.err_msg, {
icon: 6
});
window.location.reload();
} else {
parent.layer.msg(res.err_msg, {
icon: 5
});
}
}
, error: function() {
admin.removeLoading();
parent.layer.msg('网络错误', {
icon: 5
});
}
});
return false;
});
});
form.on('submit(allocate)', function (data) {
admin.showLoading({
type: 3
......@@ -37,4 +80,4 @@
admin.closeThisDialog();
});
});
</script>
\ No newline at end of file
</script>
......@@ -156,12 +156,8 @@
}
},
{
field: 'sku_tags', title: '标签', align: 'center', width: 150, templet: function (data) {
if (data.invalid_sku_tags) {
return `<span>${data.valid_sku_tags}</span>` + ` <span style="color: #D7D7D7">${data.invalid_sku_tags}</span>`;
} else {
return `<span>${data.valid_sku_tags}</span>`
}
field: 'goods_tag_names', title: '标签', align: 'center', width: 150, templet: function (data) {
return data.goods_tag_names;
}
},
{field: 'ability_level_name', title: '履约程度', align: 'center', width: 80,templet: function (data) {
......@@ -522,7 +518,7 @@
layer.open({
type: 2,
content: '/sku/BatchAddSkuTag?view=iframe&sku_ids=' + skuIds,
area: ['80%', '80%'],
area: ['80%', '90%'],
title: '批量设置SKU标签',
end: function () {
table.reload('skuList');
......
......@@ -37,7 +37,7 @@
<colgroup>
<col width="300">
<col width="500">
<col width="100">
<col width="120">
<col>
</colgroup>
<thead>
......@@ -52,7 +52,11 @@
<tr>
<td>{{$supplier['supplier_name']}}</td>
<td>{{$supplier['channel_username']}}</td>
<td>{{$supplier['yunxin_channel_username']}}</td>
<td>{{$supplier['yunxin_channel_username']}}
@if($supplier['yunxin_channel_username'] != '')
<button class="layui-btn layui-btn-xs reset-yunxin-channel-user" data-id="{{$supplier['supplier_id']}}" style="float: right;">清空</button>
@endif
</td>
</tr>
@endforeach
</tbody>
......
......@@ -509,6 +509,12 @@
</div>
</div>
</div>
<div class="layui-inline">
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('sku_optional_batch','SKU可选批次 : ',!empty($supplier)?$supplier['sku_optional_batch']:'',$sku_optional_batch_for_xm_select,['width'=>'350px','required'=>true,'disable'=>true]) !!}
</div>
<br>
@include('web.supplier.SkuUploadStatus');
<hr>
</div>
......
......@@ -21,65 +21,51 @@
<label class="layui-form-label">数据新增规则 : </label>
<div class="layui-input-inline" style="width: 420px">
@if(!empty($supplier['sku_upload_ruler']))
<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>
<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
<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>
<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">
......@@ -92,33 +78,27 @@
<div class="layui-inline" style="width: 100%">
<label class="layui-form-label">审核内容配置 : </label>
<div class="layui-input-inline" style="width: 205px">
<input type="radio" name="sku_audit_ruler[skip]" lay-filter="is_skip"
@if($supplier['sku_audit_ruler']['skip']==1) checked @endif value="1" title="无需审核">
<input type="radio" name="sku_audit_ruler[skip]" lay-filter="is_skip"
@if($supplier['sku_audit_ruler']['skip']==0) checked @endif value="0" title="需要审核内容">
<input type="radio" name="sku_audit_ruler[skip]" lay-filter="is_skip" @if($supplier['sku_audit_ruler']['skip']==1) checked @endif value="1" title="无需审核">
<input type="radio" name="sku_audit_ruler[skip]" lay-filter="is_skip" @if($supplier['sku_audit_ruler']['skip']==0) checked @endif value="0" title="需要审核内容">
</div>
<div class="layui-input-inline" style="width: 700px">
@if(!empty($supplier['sku_audit_ruler']))
@foreach($supplier['sku_audit_ruler']['audit_ruler'] as $key=>$flag)
@if(!empty(array_get(config('fixed.SkuAuditRuler.audit_ruler'),$key)))
<input type="checkbox" name="sku_audit_ruler[{{$key}}]"
lay-skin="primary"
class="audit_ruler_item"
@if($flag)
checked
@endif
title="{{array_get(config('fixed.SkuAuditRuler.name_map'),$key)}}">
@endif
@endforeach
@foreach($supplier['sku_audit_ruler']['audit_ruler'] as $key=>$flag)
@if(!empty(array_get(config('fixed.SkuAuditRuler.audit_ruler'),$key)))
<input type="checkbox" name="sku_audit_ruler[{{$key}}]" lay-skin="primary" class="audit_ruler_item" @if($flag) checked @endif title="{{array_get(config('fixed.SkuAuditRuler.name_map'),$key)}}">
@endif
@endforeach
@else
@foreach(config('fixed.SkuAuditRuler.audit_ruler') as $key=>$flag)
<input type="checkbox" name="sku_audit_ruler[{{$key}}]"
lay-skin="primary" checked class="audit_ruler_item"
title="{{array_get(config('fixed.SkuAuditRuler.name_map'),$key)}}">
@endforeach
@foreach(config('fixed.SkuAuditRuler.audit_ruler') as $key=>$flag)
<input type="checkbox" name="sku_audit_ruler[{{$key}}]" lay-skin="primary" checked class="audit_ruler_item" title="{{array_get(config('fixed.SkuAuditRuler.name_map'),$key)}}">
@endforeach
@endif
</div>
</div>
<div class="layui-inline">
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('sku_optional_batch','SKU可选批次 : ',!empty($supplier)?$supplier['sku_optional_batch']:'',$sku_optional_batch_for_xm_select,['width'=>'350px','required'=>true]) !!}
</div>
@include('web.supplier.SkuUploadStatus');
</div>
......
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