Commit 2c8811a0 by 杨树贤

Merge branch 'master' into ysx-供应商需求-20230602

parents 7c9cfdf2 b3db4df6
......@@ -81,7 +81,7 @@ class ExternalApiController extends Controller
//判断这个手机号对应的云芯账号是否已经存在
$existAccount = SupplierAccountModel::where('mobile', $data['mobile'])->exists();
if ($existAccount) {
$this->externalResponse(-1, '该手机号已经有对应的云芯账号,请重新选择手机号');
$this->externalResponse(-1, '该手机号已经有对应的芯链账号,请重新选择手机号');
}
$result = (new SupplierApplyService())->applySupplier($data);
if (!$result) {
......@@ -89,7 +89,7 @@ class ExternalApiController extends Controller
}
$supplier = SupplierChannelModel::where('supplier_name', $data['supplier_name'])->first()->toArray();
//还要发邮件
$data['data']['title'] = "供应商:{$supplier['supplier_name']},供应商编码:{$supplier['supplier_code']};申请了云芯入驻,请在三个工作日内,前往【供应商系统-云芯入驻申请】页面进行审核操作;";
$data['data']['title'] = "供应商:{$supplier['supplier_name']},供应商编码:{$supplier['supplier_code']};申请了芯链入驻,请在三个工作日内,前往【供应商系统-芯链入驻申请】页面进行审核操作;";
(new MessageService())->sendMessage('supplier_apply_admin_notify', $data, 'qiang@ichunt.com', true);
$this->externalResponse(0, '申请供应商成功');
}
......
......@@ -340,7 +340,7 @@ class SupplierApiController extends Controller
//还要校验提交上来的公司是否有合法信息
$unitedInfo = $unitedCompanyInfo['united_company_info'];
if ($unitedInfo) {
if ($unitedInfo['is_entity'] == 1) {
if (isset($unitedCompanyInfo['is_entity']) && $unitedCompanyInfo['is_entity'] == 1) {
$this->response(-3, '该供应商已经被一体化系统加入黑名单,不能新增');
}
if ($unitedInfo['company_category'] != '') {
......
......@@ -6,6 +6,7 @@ namespace App\Http\Controllers\Filter;
use App\Http\Services\AdminUserService;
use App\Http\Services\DepartmentService;
use App\Model\SupplierAttachmentsModel;
use App\Model\SupplierChannelModel;
use Illuminate\Support\Facades\DB;
......@@ -147,20 +148,21 @@ class SupplierFilter
}
}
//获取没有平台合作协议的数据
if (!empty($map['has_cooperation_agreement'])) {
if ($map['has_cooperation_agreement'] == 1) {
$query->whereIn('supplier_id', function ($query) {
$query->select('supplier_id')->from(with(new SupplierAttachmentsModel())->getTable())->where('field_name','cooperation_agreement');
});
} else {
$query->whereNotIn('supplier_id', function ($query) {
$query->select('supplier_id')->from(with(new SupplierAttachmentsModel())->getTable())->where('field_name','cooperation_agreement');
});
}
}
//默认过滤带有-1字符串的供应商名称的数据
$query->whereRaw('supplier_name NOT LIKE "%-1"');
// if (config('website.domain') == 'liexin.net' && !in_array(request()->user->userId, [
// 1611,
// 1499,
// 1354,
// 1613,
// 1000,
// 1619,
// 1629
// ])) {
// $query->where('supplier_channel.supplier_id', '>', 12211);
// }
return $query;
}
......@@ -304,20 +306,13 @@ class SupplierFilter
});
break;
//附件里面缺少品质协议的,而且是现货类型供应商
case "no_quality_assurance_agreement":
// $query->leftjoin('supplier_attachments', 'supplier_channel.supplier_id', '=',
// 'supplier_attachments.supplier_id')
// ->selectRaw('lie_supplier_channel.*,
// lie_supplier_attachments.quality_assurance_agreement,lie_supplier_attachments.supplier_id as supplier_attachment_supplier_id')
// ->where(function ($q) {
// $q->where('supplier_attachments.quality_assurance_agreement', '')
// ->orWhereNull('supplier_attachment.supplier_id');
// });
// $query->whereNotIn('status',
// [SupplierChannelModel::STATUS_DISABLE, SupplierChannelModel::STATUS_BLOCK]);
// //而且还是现货商类型的供应商
// $query->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', '=',
......@@ -359,44 +354,44 @@ class SupplierFilter
$query->where('uploaded_sku', 1);
break;
case "not_yunxin":
$query->where('stockup_type', 'NOT LIKE', '%5%');
$query->where('stockup_type', 'NOT LIKE', '%5%')->where('uploaded_sku', 1);
break;
case "not_yunxin_and_has_sku":
$query->where('stockup_type', 'NOT LIKE', '%5%')->where('sku_num', '>', 0);
$query->where('stockup_type', 'NOT LIKE', '%5%')->where('sku_num', '>', 0)->where('uploaded_sku', 1);
break;
case "not_yunxin_expired":
$query->where('stockup_type', 'NOT LIKE', '%5%')->where('sku_num', 0);
$query->where('stockup_type', 'NOT LIKE', '%5%')->where('sku_num', 0)->where('uploaded_sku', 1);
break;
case "not_yunxin_and_has_no_sku":
$query->where('stockup_type', 'NOT LIKE', '%5%')->where('sku_num', 0)->where('uploaded_sku',1);
$query->where('stockup_type', 'NOT LIKE', '%5%')->where('sku_num', 0)->where('uploaded_sku', 1)->where('uploaded_sku', 1);
break;
case "yunxin":
$query->where('stockup_type', 'LIKE', '%5%');
$query->where('stockup_type', 'LIKE', '%5%')->where('uploaded_sku', 1);
break;
case "yunxin_and_has_sku":
$query->where('stockup_type', 'LIKE', '%5%')->where('sku_num', '>', 0);
$query->where('stockup_type', 'LIKE', '%5%')->where('sku_num', '>', 0)->where('uploaded_sku', 1);
break;
case "yunxin_expired":
$query->where('stockup_type', 'LIKE', '%5%')->where('sku_num', 0);
$query->where('stockup_type', 'LIKE', '%5%')->where('sku_num', 0)->where('uploaded_sku', 1);
break;
case "yunxin_and_has_no_sku":
$query->where('stockup_type', 'LIKE', '%5%')->where('sku_num', 0)->where('uploaded_sku',1);
$query->where('stockup_type', 'LIKE', '%5%')->where('sku_num', 0)->where('uploaded_sku', 1)->where('uploaded_sku', 1);
break;
case "yunxin_expired_at_days":
$query->where('stockup_type', 'LIKE', '%5%')->where('sku_expired_in_days', '!=', 0);
$query->where('stockup_type', 'LIKE', '%5%')->where('sku_expired_in_days', '!=', 0)->where('uploaded_sku', 1);
break;
case "not_yunxin_expired_at_days":
$query->where('stockup_type', 'NOT LIKE', '%5%')->where('sku_expired_in_days', '!=', 0);
$query->where('stockup_type', 'NOT LIKE', '%5%')->where('sku_expired_in_days', '!=', 0)->where('uploaded_sku', 1);
break;
case "no_quality_assurance_agreement_all":
$query->whereDoesntHave('attachment', function ($query) {
$query->where('field_name', 'quality_assurance_agreement');
})->where('uploaded_sku', '>', 0);
$query->whereNotIn('supplier_id', function ($query) {
$query->select('supplier_id')->from(with(new SupplierAttachmentsModel())->getTable())->where('field_name','quality_assurance_agreement');
})->where('uploaded_sku', 1);
break;
case "no_cooperation_agreement":
$query->whereDoesntHave('attachment', function ($query) {
$query->where('field_name', 'cooperation_agreement');
})->where('uploaded_sku', '>', 0);
$query->whereNotIn('supplier_id', function ($query) {
$query->select('supplier_id')->from(with(new SupplierAttachmentsModel())->getTable())->where('field_name','cooperation_agreement');
})->where('uploaded_sku', 1);
break;
}
return $query;
......
......@@ -27,8 +27,9 @@ class CompanyService
$unitedCompanyInfo = [];
if (array_get($result, 'code') === 0) {
$unitedCompanyInfo['united_company_info'] = !empty($result['data']['companyInfo']) ? $result['data']['companyInfo'] : [];
$company = [];
$unitedCompanyInfo['is_entity'] = isset($result['data']['is_entity']) ? $result['data']['is_entity'] : 0;
$companyInfoList = array_get(array_get($result['data'], 'tycList'), 'company_info_list');
$company = [];
if (!empty($companyInfoList)) {
$companyInfo = $companyInfoList[0];
$companyInfo['establishment_time'] = $companyInfo['establishment_time'] ? $companyInfo['establishment_time'] / 1000 : 0;
......
......@@ -1161,7 +1161,7 @@ class DataService
echo json_encode($supplierList);
}
//获取上传了平台合作协议的供应商
//获取上传了平台平台合作协议的供应商
public function exportHasCooperationAgreementSupplierList()
{
$header = [
......@@ -1191,7 +1191,7 @@ class DataService
];
}
array_unshift($excelData, $header);
Excel::create('上传了“平台合作协议”的供应商', function ($excel) use ($excelData) {
Excel::create('上传了“平台平台合作协议”的供应商', function ($excel) use ($excelData) {
$excel->sheet('sheet1', function ($sheet) use ($excelData) {
$sheet->fromArray($excelData);
});
......@@ -1201,13 +1201,13 @@ class DataService
//初始化主营品牌到上传限制
public function initialMainBrandsToSkuRuler()
{
$suppliers = SupplierChannelModel::where('main_brands', '!=', '')->where('is_type', 0)->get()->toArray();
$suppliers = SupplierChannelModel::where('main_brands', '!=', '')->get()->toArray();
$redis = new RedisModel();
foreach ($suppliers as $supplier) {
if (DataManageModel::where('canal', $supplier['supplier_code'])->where('is_type', 0)->exists()) {
dump("大数据供应商");
continue;
}
// if (DataManageModel::where('canal', $supplier['supplier_code'])->where('is_type', 0)->exists()) {
// dump("大数据供应商");
// continue;
// }
if (trim($supplier['main_brands'], ',')) {
$mainBrands = explode(',', trim($supplier['main_brands'], ','));
$ruler = $redis->hget('supplier_sku_upload_ruler_v2', $supplier['supplier_id']);
......@@ -1217,6 +1217,7 @@ class DataService
} else {
$ruler['upload_allow_brands'] = $mainBrands;
}
dump($supplier['supplier_id'], $ruler);
$redis->hset('supplier_sku_upload_ruler_v2', $supplier['supplier_id'], json_encode($ruler));
}
}
......@@ -1254,11 +1255,11 @@ class DataService
//找出哪些是云芯上传的
$yunxinUploadSupplierCodes = SkuUploadLogModel::whereIn('supplier_code', $yunxinSupplierCodes)->where('source', 2)->pluck('supplier_code')->unique()->toArray();
$skuNumYunxin = SupplierChannelModel::whereIn('supplier_code', $yunxinUploadSupplierCodes)->sum('sku_num');
dump("上架供应商数(不含代购,原厂):" . $supplierCount);
dump("上架云芯供应商数:" . count($yunxinUploadSupplierCodes));
dump("SKU 上架总条数(含API接口):" . $skuNum1);
dump("SKU上架总条数(只含云芯):" . $skuNumYunxin);
dump("SKU 上架条数(不含API接口):" . $skuNum2);
echo("<p>上架供应商数(不含代购,原厂):" . $supplierCount . '</p>');
echo("<p>上架云芯供应商数:" . count($yunxinUploadSupplierCodes) . '</p>');
echo("<p>SKU 上架总条数(含API接口):" . $skuNum1 . '</p>');
echo("<p>SKU上架总条数(只含云芯):" . $skuNumYunxin . '</p>');
echo("<p>SKU 上架条数(不含API接口):" . $skuNum2 . '</p>');
}
//获取采购系统24号作废的深圳入库明细
......@@ -1284,8 +1285,110 @@ class DataService
dd(count((array_column($stockInItems, 'stock_in_item_id'))));
}
public function deleteSupplierAccount()
//统计有上传sku的供应商
public function exportHasSkuSupplierList()
{
$header = [
'采购部门',
'sku采购员',
'供应商性质',
'供应商编码',
'供应商名称',
'是否开通云芯',
'接入方式',
'sku上架数量',
'末次更新时间'
];
$intraCodeModel = new IntracodeModel();
$users = $intraCodeModel->getSampleName(true);
$excelData = [];
$suppliers = SupplierChannelModel::where('sku_num', '>', 0)->where('is_type', 0)->get()->toArray();
foreach ($suppliers as $supplier) {
$skuUserNameRaw = array_get($users, $supplier['yunxin_channel_uid']);
$departmentName = (new DepartmentService())->getDepartmentNameByUserName($skuUserNameRaw);
//判断是否是api对接那边的供应商
$isApiSupplier = DataManageModel::where('canal', $supplier['supplier_code'])->where('is_type', 0)->exists();
//末次人工更新时间
$lastUpload = SkuUploadLogModel::where('supplier_code', $supplier['supplier_code'])->orderBy('create_time', 'desc')
->first();
$lastUploadTime = '';
if ($lastUpload) {
$lastUpload = $lastUpload->toArray();
$lastUploadTime = date('Y-md-m H:i:s', $lastUpload['create_time']);
}
$excelData[] = [
$departmentName,
$skuUserNameRaw,
array_get(config('fixed.SupplierGroup'), $supplier['supplier_group'], '未设置'),
$supplier['supplier_code'],
$supplier['supplier_name'],
strpos($supplier['stockup_type'], "5") !== false ? '是' : '否',
$isApiSupplier ? 'API和采集对接' : '人工上传',
$supplier['sku_num'],
$lastUploadTime
];
}
array_unshift($excelData, $header);
Excel::create('供应商统计报表', function ($excel) use ($excelData) {
$excel->sheet('sheet1', function ($sheet) use ($excelData) {
$sheet->fromArray($excelData);
});
})->export('csv');
}
//导入主营品牌
public function importMainBrands()
{
SupplierAccountModel::where('id', 54)->delete();
$isUpdate = request()->input('is_update', 0);
ini_set('memory_limit', -1);
$filePath = public_path('data') . DIRECTORY_SEPARATOR . 'supplier_brands.xlsx';
try {
Excel::selectSheetsByIndex(0)->load($filePath, function ($reader) use ($isUpdate) {
$reader->sheet('Sheet1', function () use ($reader, $isUpdate) {
$allBrands = $reader->all()->toArray();
$allBrandsGroupBySupplierCode = [];
foreach ($allBrands as $brand) {
$supplierCode = trim($brand[0]);
$brandName = trim($brand[2]);
$supplierCodeList = array_keys($allBrandsGroupBySupplierCode);
if (in_array($supplierCode, $supplierCodeList)) {
$allBrandsGroupBySupplierCode[$supplierCode][] = trim($brandName);
} else {
$allBrandsGroupBySupplierCode[$supplierCode][] = trim($brandName);
}
}
foreach ($allBrandsGroupBySupplierCode as $supplierCode => $brands) {
$supplier = SupplierChannelModel::select(['main_brands', 'supplier_id', 'supplier_code'])->where('supplier_code', $supplierCode)->first();
if (empty($supplier)) {
continue;
}
$supplier = $supplier->toArray();
$supplier['main_brands'] = trim($supplier['main_brands'], ',');
dump('供应商编码 : ' . $supplierCode);
//找出所有标品的id
$standardBrandIds = StandardBrandModel::whereIn('brand_name', $brands)->pluck('standard_brand_id')->toArray();
dump('excel得出的标品ids : ' . implode(',', $standardBrandIds));
if ($supplier['main_brands']) {
dump('原来有标品id :' . $supplier['main_brands']);
$supplier['main_brands'] = explode(',', $supplier['main_brands']);
$mainBrands = array_merge($supplier['main_brands'], $standardBrandIds);
} else {
$mainBrands = $standardBrandIds;
}
$mainBrands = implode(',', $mainBrands);
if ($isUpdate) {
SupplierChannelModel::where('supplier_code', $supplierCode)->update([
'main_brands' => $mainBrands,
]);
}
dump($mainBrands);
}
});
});
} catch (\Exception $exception) {
dd($exception);
}
}
}
\ No newline at end of file
......@@ -365,8 +365,9 @@ class SkuService
->pluck('supplier_id')->toArray();
$supplierIds = collect($supplierIds)->chunk(300)->toArray();
foreach ($supplierIds as $supplierIdList) {
$supplierIdList = array_values($supplierIdList);
//先去批量设置过期时间限制天数
SupplierChannelModel::whereIn('supplier_id', $supplierIdList)->update([
$result = SupplierChannelModel::whereIn('supplier_id', $supplierIdList)->update([
'cp_time_day' => $cpTimeDay
]);
foreach ($supplierIdList as $supplierId) {
......@@ -382,8 +383,8 @@ class SkuService
$redis->hset('supplier_sku_upload_ruler_v2', $supplierId, $ruler);
}
$cpTimeDay = $cpTimeDay == -1 ? '无限制' : $cpTimeDay;
(new LogService())->BatchAddIgnoreAuditLogs($supplierIdList, LogModel::UPDATE_OPERATE, '批量配置供应商sku上架有效期', '上架有效期修改为' . $cpTimeDay . '天');
$cpTimeDayStr = $cpTimeDay == -1 ? '无限制' : $cpTimeDay;
(new LogService())->BatchAddIgnoreAuditLogs($supplierIdList, LogModel::UPDATE_OPERATE, '批量配置供应商sku上架有效期', '上架有效期修改为' . $cpTimeDayStr . '天');
}
}
......
......@@ -40,7 +40,7 @@ class SupplierApplyService
$existSupplierApply = SupplierApplyModel::where('supplier_id', $supplier['supplier_id'])
->whereIn('status', [SupplierApplyModel::STATUS_NEED_AUDIT, SupplierApplyModel::STATUS_PASS])->exists();
if ($existSupplierApply) {
return '贵司已申请云芯入驻,无需重复申请';
return '贵司已申请芯链入驻,无需重复申请';
}
//再去判断是否有上传sku
$uploadedSku = $supplier['uploaded_sku'];
......@@ -120,9 +120,9 @@ class SupplierApplyService
}
//无论是否通过,都要发短信通知
if ($status == SupplierApplyModel::STATUS_REJECT) {
$message = "${apply['contact_name']} 先生/女生您好,您的“云芯入驻申请”已收到,审核结果为:不通过,原因为:${auditReason},如对审核结果有疑问,可联系您在猎芯的专属渠道经理(周强),联系电话:13427991931,联系邮箱:qiang@ichunt.com";
$message = "${apply['contact_name']} 先生/女生您好,您的“芯链入驻申请”已收到,审核结果为:不通过,原因为:${auditReason},如对审核结果有疑问,可联系您在猎芯的专属渠道经理(周强),联系电话:13427991931,联系邮箱:qiang@ichunt.com";
} else {
$message = "${apply['contact_name']} 先生/女生您好,您的“云芯入驻申请”已收到,审核结果为:通过,云芯登录网址:http://yunxin.ichunt.com,您的云芯登录账号:${apply['mobile']},初始密码:123456,请在登录云芯后修改密码,后续有任何疑问都可联系您在猎芯的专属渠道经理(周强),联系电话:13427991931,联系邮箱:qiang@ichunt.com;";
$message = "${apply['contact_name']} 先生/女生您好,您的“芯链入驻申请”已收到,审核结果为:通过,芯链登录网址:http://xinlian.ichunt.com,您的芯链登录账号:${apply['mobile']},初始密码:123456,请在登录芯链后修改密码,后续有任何疑问都可联系您在猎芯的专属渠道经理(周强),联系电话:13427991931,联系邮箱:qiang@ichunt.com;";
}
$data = [];
$data['data']['title'] = $message;
......
......@@ -58,7 +58,7 @@ class SupplierStatisticsService
$payTypeTerm = $this->getStatisticsCount('pay_type_term');
//账期供应商
$levelA = $this->getStatisticsCount('level_a');
//缺少合作协议(线上)
//缺少平台合作协议(线上)
//缺少品质协议(线上)
$result = [
'total' => $total,
......@@ -105,7 +105,7 @@ class SupplierStatisticsService
'yunxin_expired' => null,
//已过期(非云芯)供应商
'not_yunxin_expired' => null,
//缺少合作协议(线上)
//缺少平台合作协议(线上)
'no_cooperation_agreement' => null,
];
$result = array_map(function ($value) {
......@@ -115,7 +115,7 @@ class SupplierStatisticsService
return $value;
}, $result);
$redis->set($statisticsKey, json_encode($result));
$redis->expire($statisticsKey, 50);
$redis->expire($statisticsKey, 600);
return $result;
}
......
......@@ -53,7 +53,8 @@ class SupplierTransformer
$supplier['has_sku'] = $supplier['sku_num'] ? '是' : '否';
$supplier['is_business_abnormal_name'] = $supplier['is_business_abnormal'] == 1 ? '是' : '否';
if (isset($supplier['attachment'])) {
$supplier['has_quality_assurance_agreement'] = $this->checkHasQualityAssuranceAgreement($supplier['attachment']) ? '有' : '无';
$supplier['has_quality_assurance_agreement'] = $this->checkHasSpecificAttachment('quality_assurance_agreement', $supplier['attachment']) ? '有' : '无';
$supplier['has_cooperation_agreement'] = $this->checkHasSpecificAttachment('cooperation_agreement', $supplier['attachment']) ? '有' : '无';
} else {
$supplier['has_quality_assurance_agreement'] = '无';
}
......@@ -112,13 +113,14 @@ class SupplierTransformer
return $suppliers;
}
public function checkHasQualityAssuranceAgreement($attachment)
//判断是否有特定的协议
public function checkHasSpecificAttachment($specificAttacmentName, $attachments)
{
if (!$attachment) {
if (!$attachments) {
return false;
}
foreach ($attachment as $key => $value) {
if ($value['field_name'] == 'quality_assurance_agreement') {
foreach ($attachments as $key => $value) {
if ($value['field_name'] == $specificAttacmentName) {
return true;
}
}
......
......@@ -40,7 +40,7 @@ class SupplierValidator
$regionType);
$unitedInfo = $unitedCompanyInfo['united_company_info'];
if ($unitedInfo && $isAdd) {
if ($unitedInfo['is_entity'] == 1) {
if (isset($unitedCompanyInfo['is_entity']) && $unitedCompanyInfo['is_entity'] == 1) {
return '该供应商已经被一体化系统加入黑名单,不能新增';
}
......@@ -77,27 +77,27 @@ class SupplierValidator
//这个supplierId是用来判断是新增还是修改的
$supplierId = array_get($validateData, 'supplier_id');
//如果是修改直接提交,不是点申请审核的,只需要校验供应商名称和采购员是否完整即可
// if (!$isAudit) {
// if (empty($validateData['supplier_name'])) {
// return '供应商名称 不能为空';
// }
//
// if (empty($supplierId)) {
// //新增的时候,必须要设置采购员
// if (empty($validateData['can_check_uids'])) {
// return '第一次新增供应商,必须设置联系人的采购员';
// }
// $count = SupplierChannelModel::where('supplier_name', $validateData['supplier_name'])->count();
// } else {
// //对接一体化以后,名称不能修改了,所以直接为0
// $count = 0;
// }
// if ($count) {
// return "该供应商名称已经存在,请核验后再提交";
// }
//
// return null;
// }
if (!$isAudit) {
if (empty($validateData['supplier_name'])) {
return '供应商名称 不能为空';
}
if (empty($supplierId)) {
//新增的时候,必须要设置采购员
if (empty($validateData['can_check_uids'])) {
return '第一次新增供应商,必须设置联系人的采购员';
}
$count = SupplierChannelModel::where('supplier_name', $validateData['supplier_name'])->count();
} else {
//对接一体化以后,名称不能修改了,所以直接为0
$count = 0;
}
if ($count) {
return "该供应商名称已经存在,请核验后再提交";
}
return null;
}
$rules = [
'supplier_type' => 'required',
......@@ -146,15 +146,15 @@ class SupplierValidator
$errorMessageList = [];
//主营品牌数量的判断
if ($validateData['main_brands_limit_type'] == 1) {
if (!$validateData['main_brands_limit']) {
$errorMessageList[] = '主营品牌限制数量不能为空';
}
if (count(explode(',', trim($validateData['main_brands'], ','))) > $validateData['main_brands_limit']) {
$errorMessageList[] = '主营品牌数量大于设置的限制数量';
}
}
// if ($validateData['main_brands_limit_type'] == 1) {
// if (!$validateData['main_brands_limit']) {
// $errorMessageList[] = '主营品牌限制数量不能为空';
// }
//
// if (count(explode(',', trim($validateData['main_brands'], ','))) > $validateData['main_brands_limit']) {
// $errorMessageList[] = '主营品牌数量大于设置的限制数量';
// }
// }
......
......@@ -50,6 +50,10 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
Route::match(['get', 'post'], '/api/supplier_examination/{key}', 'SupplierExaminationApiController@Entrance');
Route::match(['get', 'post'], '/api/sku_upload_log/{key}', 'SkuUploadLogApiController@Entrance');
Route::match(['get', 'post'], '/api/supplier_apply/{key}', 'SupplierApplyApiController@Entrance');
//单独的统计接口
Route::match(['get', 'post'], '/statisticsSkuNumber', function () {
(new \App\Http\Services\DataService())->statisticsSkuNumber();
});
});
//提供给其它系统使用的接口,不需要验证那种
......@@ -66,6 +70,8 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
Route::get('/sync/audit/GetNeedAuditSupplierCount', 'SupplierSyncController@GetNeedAuditSupplierCount');
});
Route::match(['get', 'post'], '/test', function () {
(new \App\Http\Services\DataService())->statisticsSkuNumber();
// (new \App\Http\Services\DataService())->initialMainBrandsLimit();
......
......@@ -207,7 +207,7 @@ return [
'quality_assurance_agreement' => '品质保证协议',
'legal_ID_card' => '法人身份证',
'registration_certificate' => '商业登记证',
'cooperation_agreement' => '合作协议',
'cooperation_agreement' => '平台合作协议',
'proxy_certificate' => '代理证',
'incorporation_certificate' => '公司注册证',
'certification_notice' => '认证通知书',
......@@ -251,7 +251,7 @@ return [
'not_yunxin_expired_at_days' => '3天内到期(非云芯)供应商',
'yunxin_expired' => '已过期(云芯)供应商',
'not_yunxin_expired' => '已过期(非云芯)供应商',
'no_cooperation_agreement' => '缺少合作协议(线上)',
'no_cooperation_agreement' => '缺少平台合作协议(线上)',
],
//Sku列表的罗盘对应菜单id
'SkuListCompassMenuMap' => [
......
No preview for this file type
......@@ -19,15 +19,17 @@
success: function (res) {
admin.removeLoading();
if (res.err_code === 0) {
admin.closeThisDialog();
parent.layer.msg(res.err_msg, {icon: 6});
layer.msg(res.err_msg, {icon: 6});
setTimeout(function () {
admin.closeThisDialog();
},1000);
} else {
parent.layer.msg(res.err_msg, {icon: 5});
layer.msg(res.err_msg, {icon: 5});
}
},
error: function () {
admin.removeLoading();
parent.layer.msg('网络错误', {icon: 5});
layer.msg('网络错误', {icon: 5});
}
});
return false;
......
......@@ -127,6 +127,12 @@
width: 80,
},
{
field: 'has_cooperation_agreement',
title: '平台合作协议',
align: 'center',
width: 120,
},
{
field: 'contact_num', title: '联系人', align: 'center', width: 70, templet: function (data) {
return "<a ew-href='/supplier/SupplierDetail?view=iframe&tab=contact&supplier_id=" + data.supplier_id +
"' class='list-href' ew-title='供应商详情 - " + data.supplier_code + "' title='点击跳转查看联系人列表'>" + data.contact_num + "</a>"
......
......@@ -163,44 +163,35 @@
}
});
//主营品牌限制的初始化
let mainBrandsLimitTypeObj = $('#main_brands_limit_type');
if (supplierId) {
let mainBrandsLimitObj = $('#main_brands_limit');
if (mainBrandsLimitObj.val() == -1) {
mainBrandsLimitTypeObj.val(2);
mainBrandsLimitObj.val('');
mainBrandsLimitObj.attr('disabled', true);
mainBrandsLimitObj.addClass('layui-disabled');
form.render('select');
}
}
let mainBrandsLimitObj = $('#main_brands_limit');
//修改主营品牌数量限制权限校验
let canModifyBrandLimit = {{checkPerm('ModifyMainBrandsLimit')?1:0}};
let supplierGroupMap = {!! json_encode(config('fixed.SupplierGroup')) !!};
let limitMap = {!!json_encode(config('field.SupplierGroupMainBrandsLimitMap'))!!};
if(!canModifyBrandLimit){
mainBrandsLimitObj.attr('disabled', true);
mainBrandsLimitObj.addClass('layui-disabled');
mainBrandsLimitTypeObj.attr('disabled', true);
mainBrandsLimitTypeObj.addClass('layui-disabled');
}
//监听主营品牌限制的数字,不同供应商性质的数量限制不一样
$(document).on('change', '#main_brands_limit', function () {
let supplierGroup = $('#supplier_group').val();
if (!supplierGroup) {
layer.msg("请先选择供应商性质", {icon: 5});
$('#main_brands_limit').val('');
return false;
}
let limit = limitMap[supplierGroup];
if ($(this).val() > limit && limit !== -1) {
layer.msg("供应商性质为" + supplierGroupMap[supplierGroup] + "时,主营品牌数量最大可以设置为 " + limit, {icon: 5});
$('#main_brands_limit').val(limit);
}
});
// //主营品牌限制的初始化
// let mainBrandsLimitTypeObj = $('#main_brands_limit_type');
// if (supplierId) {
// let mainBrandsLimitObj = $('#main_brands_limit');
// if (mainBrandsLimitObj.val() == -1) {
// mainBrandsLimitTypeObj.val(2);
// mainBrandsLimitObj.val('');
// mainBrandsLimitObj.attr('disabled', true);
// mainBrandsLimitObj.addClass('layui-disabled');
// form.render('select');
// }
// }
{{--let supplierGroupMap = {!! json_encode(config('fixed.SupplierGroup')) !!};--}}
{{--let limitMap = {!!json_encode(config('field.SupplierGroupMainBrandsLimitMap'))!!};--}}
{{--//监听主营品牌限制的数字,不同供应商性质的数量限制不一样--}}
{{--$(document).on('change', '#main_brands_limit', function () {--}}
{{-- let supplierGroup = $('#supplier_group').val();--}}
{{-- if (!supplierGroup) {--}}
{{-- layer.msg("请先选择供应商性质", {icon: 5});--}}
{{-- $('#main_brands_limit').val('');--}}
{{-- return false;--}}
{{-- }--}}
{{-- let limit = limitMap[supplierGroup];--}}
{{-- if ($(this).val() > limit && limit !== -1) {--}}
{{-- layer.msg("供应商性质为" + supplierGroupMap[supplierGroup] + "时,主营品牌数量最大可以设置为 " + limit, {icon: 5});--}}
{{-- $('#main_brands_limit').val(limit);--}}
{{-- }--}}
{{--});--}}
//监听供应商性质选择,如果为混合分销商,那么要展示混合分销商品牌设置
form.on('select(supplier_group)', function (data) {
......@@ -209,38 +200,38 @@
} else {
$('#agency_brands_div').hide();
}
// 这里还要去判断主营品牌数量限制的切换
// 原厂,代理商,分销平台,品牌数量不做限制;默认为“无限制”;
// 混合分销商,现货商,代工厂,品牌数量默认为10;
// 方案商,其他,品牌数量默认为5;
let limit = limitMap[data.value];
console.log(limit)
if (limit === -1) {
mainBrandsLimitObj.attr('disabled', true);
mainBrandsLimitObj.addClass('layui-disabled');
mainBrandsLimitTypeObj.val(2);
} else {
if (canModifyBrandLimit) {
mainBrandsLimitObj.attr('disabled', false);
mainBrandsLimitObj.removeClass('layui-disabled');
}
mainBrandsLimitTypeObj.val(1);
}
form.render('select');
mainBrandsLimitObj.val(limit === -1 ? '' : limit);
// // 这里还要去判断主营品牌数量限制的切换
// // 原厂,代理商,分销平台,品牌数量不做限制;默认为“无限制”;
// // 混合分销商,现货商,代工厂,品牌数量默认为10;
// // 方案商,其他,品牌数量默认为5;
// let mainBrandsLimitObj = $('#main_brands_limit');
// let limit = limitMap[data.value];
// console.log(limit)
// if (limit === -1) {
// mainBrandsLimitObj.attr('disabled', true);
// mainBrandsLimitObj.addClass('layui-disabled');
// mainBrandsLimitTypeObj.val(2);
// } else {
// mainBrandsLimitObj.attr('disabled', false);
// mainBrandsLimitObj.removeClass('layui-disabled');
// mainBrandsLimitTypeObj.val(1);
// }
// form.render('select');
//
// mainBrandsLimitObj.val(limit === -1 ? '' : limit);
});
form.on('select(main_brands_limit_type)', function (data) {
let mainBrandsLimitObj = $('#main_brands_limit');
if (data.value == 2) {
mainBrandsLimitObj.attr('disabled', true);
mainBrandsLimitObj.addClass('layui-disabled');
} else {
mainBrandsLimitObj.attr('disabled', false);
mainBrandsLimitObj.removeClass('layui-disabled');
}
});
// form.on('select(main_brands_limit_type)', function (data) {
// let mainBrandsLimitObj = $('#main_brands_limit');
// if (data.value == 2) {
// mainBrandsLimitObj.attr('disabled', true);
// mainBrandsLimitObj.addClass('layui-disabled');
// } else {
// mainBrandsLimitObj.attr('disabled', false);
// mainBrandsLimitObj.removeClass('layui-disabled');
// }
// });
//如果没有直接忽略公司校验的权限,那么就要做到下面的互相disable
@if (!checkPerm('IgnoreCompanyCheck'))
......
......@@ -209,7 +209,7 @@
</div>
</div>
<div class="layui-form-item">
<div class="layui-col-md8">
<div class="layui-col-md12">
<label class="layui-form-label">
<span class="require">*</span>
主营品牌</label>
......@@ -220,19 +220,19 @@
id="main_brands">
</div>
</div>
<div class="layui-col-md4">
<label class="layui-form-label" style="width: 100px">主营品牌数量: </label>
<div class="layui-input-inline" style="width: 150px">
<input type="text" name="main_brands_limit" id="main_brands_limit"
placeholder="请输入主营品牌数量限制" class="layui-input" value="">
</div>
<div class="layui-inline">
<select id="main_brands_limit_type" lay-filter="main_brands_limit_type" name="main_brands_limit_type">
<option value="1">自定义</option>
<option value="2">无限制</option>
</select>
</div>
</div>
{{-- <div class="layui-col-md4">--}}
{{-- <label class="layui-form-label" style="width: 100px">主营品牌数量: </label>--}}
{{-- <div class="layui-input-inline" style="width: 150px">--}}
{{-- <input type="text" name="main_brands_limit" id="main_brands_limit"--}}
{{-- placeholder="请输入主营品牌数量限制" class="layui-input" value="">--}}
{{-- </div>--}}
{{-- <div class="layui-inline">--}}
{{-- <select id="main_brands_limit_type" lay-filter="main_brands_limit_type" name="main_brands_limit_type">--}}
{{-- <option value="1">自定义</option>--}}
{{-- <option value="2">无限制</option>--}}
{{-- </select>--}}
{{-- </div>--}}
{{-- </div>--}}
</div>
{{--选择“混合分销商”时,在主营品牌下面新增一栏“代理品牌”;代理品牌取值同主营品牌一样--}}
......
......@@ -178,10 +178,10 @@
</div>
<div class="layui-row">
<span class="required_field">*</span> 主营品牌 :{{$supplier['main_brand_names']}}
<div style="">
主营品牌数量
:{{$supplier['main_brands_limit']!=-1?$supplier['main_brands_limit']:'无限制'}}
</div>
{{-- <div style="">--}}
{{-- 主营品牌数量--}}
{{-- :{{$supplier['main_brands_limit']!=-1?$supplier['main_brands_limit']:'无限制'}}--}}
{{-- </div>--}}
</div>
@if($supplier['supplier_group'] == \App\Model\SupplierChannelModel::SUPPLIER_GROUP_MIX)
<div class="layui-row">
......
......@@ -213,7 +213,7 @@
</div>
</div>
<div class="layui-form-item">
<div class="layui-col-md8">
<div class="layui-col-md12">
<label class="layui-form-label">
<span class="require">*</span>
主营品牌</label>
......@@ -224,19 +224,19 @@
id="main_brands" value="{{$supplier['main_brands'] or ''}}">
</div>
</div>
<div class="layui-col-md4">
<label class="layui-form-label" style="width: 100px">主营品牌数量: </label>
<div class="layui-input-inline" style="width: 150px">
<input type="text" name="main_brands_limit" id="main_brands_limit"
placeholder="请输入主营品牌数量限制" class="layui-input" value="{{$supplier['main_brands_limit'] or ''}}">
</div>
<div class="layui-inline">
<select id="main_brands_limit_type" name="main_brands_limit_type" lay-filter="main_brands_limit_type">
<option value="1">自定义</option>
<option value="2">无限制</option>
</select>
</div>
</div>
{{-- <div class="layui-col-md4">--}}
{{-- <label class="layui-form-label" style="width: 100px">主营品牌数量: </label>--}}
{{-- <div class="layui-input-inline" style="width: 150px">--}}
{{-- <input type="text" name="main_brands_limit" id="main_brands_limit"--}}
{{-- placeholder="请输入主营品牌数量限制" class="layui-input" value="{{$supplier['main_brands_limit'] or ''}}">--}}
{{-- </div>--}}
{{-- <div class="layui-inline">--}}
{{-- <select id="main_brands_limit_type" name="main_brands_limit_type" lay-filter="main_brands_limit_type">--}}
{{-- <option value="1">自定义</option>--}}
{{-- <option value="2">无限制</option>--}}
{{-- </select>--}}
{{-- </div>--}}
{{-- </div>--}}
</div>
{{--选择“混合分销商”时,在主营品牌下面新增一栏“代理品牌”;代理品牌取值同主营品牌一样--}}
......
......@@ -92,11 +92,11 @@
</a>
</div>
@endif
<div class="layui-row">
<a title="公司性质为现货商性质的供应商没有上传品质协议" class="main_filter"
id="no_quality_assurance_agreement">
</a>
</div>
{{-- <div class="layui-row">--}}
{{-- <a title="公司性质为现货商性质的供应商没有上传品质协议" class="main_filter"--}}
{{-- id="no_quality_assurance_agreement">--}}
{{-- </a>--}}
{{-- </div>--}}
<div class="layui-row">
<a title="采购员全离职" class="main_filter" id="all_channel_user_resigned">
</a>
......@@ -134,8 +134,8 @@
</a>
</div>
<div class="layui-row">
<a class="main_filter" title="缺少合作协议(线上)" id="no_cooperation_agreement">
缺少合作协议(线上)
<a class="main_filter" title="缺少平台合作协议(线上)" id="no_cooperation_agreement">
缺少平台合作协议(线上)
</a>
</div>
<div class="layui-row">
......@@ -214,44 +214,57 @@
<?php
$routerName = explode('/', request()->path())[1];
?>
<div class="layui-inline">
@inject('multiTransformableSelectPresenter','App\Presenters\Filter\MultiTransformableSelectPresenter')
{!! $multiTransformableSelectPresenter->render(['supplier_group'=>'供应商性质','company_nature'=>'公司实际性质'],
['supplier_group'=>config('fixed.SupplierGroup'),'company_nature'=>config('field.CompanyNature')]) !!}
</div>
<div class="layui-inline">
@inject('transformableInputPresenter','App\Presenters\Filter\TransformableInputPresenter')
{!! $transformableInputPresenter->render(['supplier_name'=>'供应商名称','supplier_code'=>'供应商编码','group_code'=>'集团编码','supplier_id'=>'供应商ID']) !!}
</div>
<div class="layui-inline">
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('status','供应商状态','',$statusData) !!}
</div>
<div class="layui-inline">
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('stockup_type','合作类型','',$stockupTypeData) !!}
</div>
<div class="layui-inline">
@inject('transformableSelectPresenter','App\Presenters\Filter\TransformableSelectPresenter')
{!! $transformableSelectPresenter->render(['channel_uid'=>'采购员','purchase_uid'=>'开发员','create_uid'=>'创建人'],$userCodes) !!}
</div>
<div class="layui-inline">
@inject('multiTransformableSelectPresenter','App\Presenters\Filter\MultiTransformableSelectPresenter')
{!! $multiTransformableSelectPresenter->render(['has_sku'=>'SKU上传','sku_tag'=>'SKU标准','sku_mode'=>'SKU模式','uploaded_sku' => '历史SKU合作','outside_contact_type' => 'SKU上传方式','yunxin_channel_uid' => 'SKU采购员'],
['has_sku'=>[1=>'是',-1=>'否'], 'sku_tag'=>config('field.SkuTag'),'sku_mode'=>config('field.SkuMode'),'uploaded_sku'=>[1=>'是',-1=>'否'],'outside_contact_type'=>config('field.OutsideContactType'),'yunxin_channel_uid' => $userCodes]) !!}
</div>
<div class="layui-inline">
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('supplier_type','供应商类型','',$supplierTypeData) !!}
<div class="layui-row">
<div class="layui-inline">
@inject('multiTransformableSelectPresenter','App\Presenters\Filter\MultiTransformableSelectPresenter')
{!! $multiTransformableSelectPresenter->render(['supplier_group'=>'供应商性质','company_nature'=>'公司实际性质'],
['supplier_group'=>config('fixed.SupplierGroup'),'company_nature'=>config('field.CompanyNature')]) !!}
</div>
<div class="layui-inline">
@inject('transformableInputPresenter','App\Presenters\Filter\TransformableInputPresenter')
{!! $transformableInputPresenter->render(['supplier_name'=>'供应商名称','supplier_code'=>'供应商编码','group_code'=>'集团编码','supplier_id'=>'供应商ID']) !!}
</div>
<div class="layui-inline">
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('status','供应商状态','',$statusData) !!}
</div>
<div class="layui-inline">
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('stockup_type','合作类型','',$stockupTypeData) !!}
</div>
<div class="layui-inline">
@inject('transformableSelectPresenter','App\Presenters\Filter\TransformableSelectPresenter')
{!! $transformableSelectPresenter->render(['channel_uid'=>'采购员','purchase_uid'=>'开发员','create_uid'=>'创建人'],$userCodes) !!}
</div>
</div>
<div class="layui-inline">
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('level','等级','',$levelData) !!}
<div class="layui-row">
<div class="layui-inline">
@inject('multiTransformableSelectPresenter','App\Presenters\Filter\MultiTransformableSelectPresenter')
{!! $multiTransformableSelectPresenter->render(['has_sku'=>'SKU上传','sku_tag'=>'SKU标准','sku_mode'=>'SKU模式','uploaded_sku' => '历史SKU合作','outside_contact_type' => 'SKU上传方式','yunxin_channel_uid' => 'SKU采购员'],
['has_sku'=>[1=>'是',-1=>'否'], 'sku_tag'=>config('field.SkuTag'),'sku_mode'=>config('field.SkuMode'),'uploaded_sku'=>[1=>'是',-1=>'否'],'outside_contact_type'=>config('field.OutsideContactType'),'yunxin_channel_uid' => $userCodes]) !!}
</div>
<div class="layui-inline">
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('supplier_type','供应商类型','',$supplierTypeData) !!}
</div>
<div class="layui-inline">
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('level','等级','',$levelData) !!}
</div>
<div class="layui-inline">
@inject('multiTransformableSelectPresenter','App\Presenters\Filter\MultiTransformableSelectPresenter')
{!! $multiTransformableSelectPresenter->render(['has_cooperation_agreement'=>'平台合作协议'],
['has_cooperation_agreement'=>[1=>'是',-1=>'否']]) !!}
</div>
</div>
<div class="layui-inline" style="width: 600px">
@inject('transformableTimeIntervalPresenter','App\Presenters\Filter\TransformableTimeIntervalPresenter')
{!! $transformableTimeIntervalPresenter->render(['update_time'=>'更新时间','create_time'=>'创建时间']) !!}
<div class="layui-row">
<div class="layui-inline" style="width: 600px">
@inject('transformableTimeIntervalPresenter','App\Presenters\Filter\TransformableTimeIntervalPresenter')
{!! $transformableTimeIntervalPresenter->render(['update_time'=>'更新时间','create_time'=>'创建时间']) !!}
</div>
</div>
<div class="layui-row" style="margin-top:10px;margin-bottom: 10px;margin-left: 20px;">
<button class="layui-btn layui-btn-sm layui-btn load" id="getSupplierListButton" lay-submit=""
lay-filter="load">查询
......
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