Commit 01373727 by 杨树贤

弹窗逻辑

parent e5a97e7d
...@@ -291,16 +291,15 @@ class SupplierApiController extends Controller ...@@ -291,16 +291,15 @@ class SupplierApiController extends Controller
//如果是编辑操作,则要忽略非当前 //如果是编辑操作,则要忽略非当前
if ($supplierId) { if ($supplierId) {
if (in_array($supplierId, [195, 12263])) {
$this->response(0, '供应商名称合理');
}
$originSupplierName = $model->where('supplier_id', $supplierId)->value('supplier_name'); $originSupplierName = $model->where('supplier_id', $supplierId)->value('supplier_name');
$existedSupplierName = $model->where('supplier_name', $supplierName)->where('supplier_name', '!=', $existedSupplierName = $model->where('supplier_name', $supplierName)->where('supplier_name', '!=',
$originSupplierName) $originSupplierName)
->value('supplier_name'); ->value('supplier_name');
if ($supplierName !== $existedSupplierName) { if ($supplierName !== $existedSupplierName) {
// $supplierName = $model->where('supplier_name', 'like',
// "%$supplierName%")->limit(1)->value('supplier_name');
// if (!empty($supplierName)) {
// $this->response(-2, '存在类似的供应商名称', $supplierName);
// }
} else { } else {
$this->response(-1, '供应商已存在,请重新输入或者咨询审批人'); $this->response(-1, '供应商已存在,请重新输入或者咨询审批人');
} }
......
...@@ -61,9 +61,9 @@ class SupplierAttachmentService ...@@ -61,9 +61,9 @@ class SupplierAttachmentService
$attachments = []; $attachments = [];
foreach ($attachmentData['file_name'] as $key => $value) { foreach ($attachmentData['file_name'] as $key => $value) {
//最后一个跳过,因为是模板里的数据 //最后一个跳过,因为是模板里的数据
if ($key == (count($attachmentData['file_name']) - 1)) { // if ($key == (count($attachmentData['file_name']) - 1)) {
continue; // continue;
} // }
$attachment = [ $attachment = [
'supplier_id' => $supplierId, 'supplier_id' => $supplierId,
'file_name' => $attachmentData['file_name'][$key], 'file_name' => $attachmentData['file_name'][$key],
......
...@@ -45,7 +45,6 @@ class SupplierService ...@@ -45,7 +45,6 @@ class SupplierService
$oldSupplier = $model->where('supplier_id', $channel['supplier_id'])->first(); $oldSupplier = $model->where('supplier_id', $channel['supplier_id'])->first();
$oldSupplier = $supplierTransformer->transformInfo($oldSupplier); $oldSupplier = $supplierTransformer->transformInfo($oldSupplier);
} }
//走事务 //走事务
$supplierId = DB::connection('web')->transaction(function () use ($channel, $model, $oldSupplier) { $supplierId = DB::connection('web')->transaction(function () use ($channel, $model, $oldSupplier) {
......
...@@ -226,11 +226,7 @@ class SupplierTransformer ...@@ -226,11 +226,7 @@ class SupplierTransformer
$stockupType = !empty($stockupType) ? implode(",", $stockupType) : ''; $stockupType = !empty($stockupType) ? implode(",", $stockupType) : '';
$channel['stockup_type'] = $stockupType; $channel['stockup_type'] = $stockupType;
} }
if (!empty($channel['currency'])) {
if ($channel['currency'] != 1) {
$channel['tax_number'] = '';
}
}
if (empty($channel['purchase_uid'])) { if (empty($channel['purchase_uid'])) {
unset($channel['purchase_uid']); unset($channel['purchase_uid']);
} }
......
...@@ -122,7 +122,8 @@ class SupplierValidator ...@@ -122,7 +122,8 @@ class SupplierValidator
$errorMessageList[] = '如果选择币种为人民币,开票资料必须上传'; $errorMessageList[] = '如果选择币种为人民币,开票资料必须上传';
} }
if ($validateData['supplier_type'] == SupplierChannelModel::SUPPLIER_TYPE_OFFICIAL) { if ($validateData['supplier_type'] == SupplierChannelModel::SUPPLIER_TYPE_OFFICIAL && !in_array($validateData['supplier_group'],
[SupplierChannelModel::SUPPLIER_TYPE_OFFICIAL, SupplierChannelModel::SUPPLIER_GROUP_PROXY])) {
if (!in_array('quality_assurance_agreement', $attachmentFields)) { if (!in_array('quality_assurance_agreement', $attachmentFields)) {
$errorMessageList[] = '供应商为正式供应商,品质保证协议必须上传 (代理商跟原厂类型除外) '; $errorMessageList[] = '供应商为正式供应商,品质保证协议必须上传 (代理商跟原厂类型除外) ';
} }
......
...@@ -33,6 +33,10 @@ class SupplierChannelModel extends Model ...@@ -33,6 +33,10 @@ class SupplierChannelModel extends Model
const SYNC_UNITED_STATUS_NOT_SYNC = 0; const SYNC_UNITED_STATUS_NOT_SYNC = 0;
const SYNC_UNITED_STATUS_OK = 1; const SYNC_UNITED_STATUS_OK = 1;
//供应商类型
const SUPPLIER_GROUP_ORIGINAL = 1; //原厂
const SUPPLIER_GROUP_PROXY = 4; //代理
//黑名单信息 //黑名单信息
public function blacklist() public function blacklist()
......
...@@ -85,54 +85,3 @@ function inArray(needle, haystack) { ...@@ -85,54 +85,3 @@ function inArray(needle, haystack) {
} }
return false; return false;
} }
function attachmentsUploadedChangeSupplierType(supplierType, supplierGroup, fieldNameList) {
if (fieldNameList.length === 0) {
return true;
}
let msg = '';
let radioObj = $('input[name="supplier_type"]');
//已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商?
if (supplierType === '2') {
//如果已经上传品质保证协议,并且供应商性质不是代理商(代理商要代理证)
if (inArray('quality_assurance_agreement', fieldNameList) && supplierGroup !== '1') {
msg = '已经上传品质保证协议,是否切换为正式供应商?'
layer.confirm(msg, function (index) {
radioObj.get(0).checked = true;
radioObj.get(1).checked = false;
layui.form.render('radio');
layer.closeAll();
});
}
if (inArray('proxy_certificate', fieldNameList) && supplierGroup === '1') {
msg = '该供应商为代理供应商,已经上传代理证,是否切换为正式供应商?'
layer.confirm(msg, function (index) {
radioObj.get(0).checked = true;
radioObj.get(1).checked = false;
layui.form.render('radio');
layer.closeAll();
});
}
} else {
if (!inArray('quality_assurance_agreement', fieldNameList) && supplierGroup !== '1') {
msg = '未上传品质保证协议,是否切换为临时供应商?'
layer.confirm(msg, function (index) {
radioObj.get(0).checked = false;
radioObj.get(1).checked = true;
layui.form.render('radio');
layer.closeAll();
});
}
if (!inArray('proxy_certificate', fieldNameList) && supplierGroup === '1') {
msg = '该供应商为代理供应商,但是未上传代理证,是否切换为临时供应商?'
layer.confirm(msg, function (index) {
radioObj.get(0).checked = false;
radioObj.get(1).checked = true;
layui.form.render('radio');
layer.closeAll();
});
}
}
return true;
}
...@@ -115,7 +115,8 @@ ...@@ -115,7 +115,8 @@
let field_name = []; let field_name = [];
let validity_period = []; let validity_period = [];
let description = []; let description = [];
$('.single_file_div').each(function () { //只要寻找上传主区域的数据即可
$('#attachment_upload_div').find('.single_file_div').each(function () {
file_name.push($(this).find('#file_name').val()); file_name.push($(this).find('#file_name').val());
file_url.push($(this).find('#file_url').val()); file_url.push($(this).find('#file_url').val());
field_name.push($(this).find('#field_name').val()); field_name.push($(this).find('#field_name').val());
...@@ -130,9 +131,7 @@ ...@@ -130,9 +131,7 @@
data.field.validity_type = validity_type; data.field.validity_type = validity_type;
data.field.validity_period = validity_period; data.field.validity_period = validity_period;
data.field.apply_audit_reason = $('#apply_audit_reason').val(); data.field.apply_audit_reason = $('#apply_audit_reason').val();
let fieldNameList = field_name; let fieldNameList = field_name;
//提交先提示是否要转换供应商类型 //提交先提示是否要转换供应商类型
let radioObj = $('input[name="supplier_type"]'); let radioObj = $('input[name="supplier_type"]');
//已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商? //已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商?
...@@ -165,16 +164,21 @@ ...@@ -165,16 +164,21 @@
} }
} }
if (msg) { if (msg) {
layer.confirm(msg, function (index) { layer.confirm(msg, {btn: ["确认", "取消"]},
if (obj1Checked !== 0) { function (index) {
radioObj.get(0).checked = obj1Checked; if (obj1Checked !== 0) {
radioObj.get(1).checked = obj2Checked; radioObj.get(0).checked = obj1Checked;
layui.form.render('radio'); radioObj.get(1).checked = obj2Checked;
data.field.supplier_type = obj1Checked ? 1 : 2; layui.form.render('radio');
layer.closeAll(); data.field.supplier_type = obj1Checked ? 1 : 2;
layer.closeAll();
}
auditAndAddSupplier(data);
},
function (index) {
auditAndAddSupplier(data);
} }
auditAndAddSupplier(data); );
});
} else { } else {
auditAndAddSupplier(data); auditAndAddSupplier(data);
} }
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
confirmMessage = '确定要重新提交审核吗?一旦提交,该供应商就会再次进入审核中阶段,审核过程中无法进行信息修改'; confirmMessage = '确定要重新提交审核吗?一旦提交,该供应商就会再次进入审核中阶段,审核过程中无法进行信息修改';
} else { } else {
//修改不需要进入审核了,有个单独提交审核的按钮 //修改不需要进入审核了,有个单独提交审核的按钮
confirmMessage = '确定要修改供应商信息吗?<br>一旦修改关键字段,该供应商就会再次进入<b>待审核</b>状态,需要去列表页<b>提交申请审核</b>,送至主管审核';
updateSupplier(data); updateSupplier(data);
return; return;
} }
...@@ -35,7 +34,7 @@ ...@@ -35,7 +34,7 @@
}); });
form.on('submit(applyAuditSupplier)', function (data) { form.on('submit(applyAuditSupplier)', function (data) {
$('input:disabled').attr('disabled', false);
let fieldNameList = []; let fieldNameList = [];
$('.attachment_fields').each(function () { $('.attachment_fields').each(function () {
fieldNameList.push($(this).text()); fieldNameList.push($(this).text());
...@@ -73,22 +72,28 @@ ...@@ -73,22 +72,28 @@
} }
} }
if (msg) { if (msg) {
layer.confirm(msg, function (index) { layer.confirm(msg, {btn: ["确认", "取消"]},
if (obj1Checked !== 0) { function (index) {
radioObj.get(0).checked = obj1Checked; if (obj1Checked !== 0) {
radioObj.get(1).checked = obj2Checked; radioObj.get(0).checked = obj1Checked;
layui.form.render('radio'); radioObj.get(1).checked = obj2Checked;
data.field.supplier_type = obj1Checked ? "1" : "2"; layui.form.render('radio');
layer.closeAll(); data.field.supplier_type = obj1Checked ? "1" : "2";
layer.closeAll();
}
auditAndUpdateSupplier(data);
},
function (index) {
auditAndUpdateSupplier(data);
} }
auditAndUpdateSupplier(data); );
});
} else { } else {
auditAndUpdateSupplier(data); auditAndUpdateSupplier(data);
} }
return false; return false;
}); });
//直接审核并且更新供应商
function auditAndUpdateSupplier(data) { function auditAndUpdateSupplier(data) {
data.field.is_audit = 1; data.field.is_audit = 1;
if (data.field.supplier_type === '2') { if (data.field.supplier_type === '2') {
......
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
let companyInfo = res.data; let companyInfo = res.data;
$('#supplier_name').val(companyInfo.supplier_name); $('#supplier_name').val(companyInfo.supplier_name);
//这个属性因为是disabled了,没法直接用jq去修改,就算直接修改layui也是没法接到值的 //这个属性因为是disabled了,没法直接用jq去修改,就算直接修改layui也是没法接到值的
layui.form.val('supplier_form', {tax_number: companyInfo.tax_number}) form.val('supplier_form', {tax_number: companyInfo.tax_number})
$('#tax_number').val(companyInfo.tax_number); $('#tax_number').val(companyInfo.tax_number);
$('#supplier_address').val(companyInfo.supplier_address); $('#supplier_address').val(companyInfo.supplier_address);
$('#registered_capital').val(companyInfo.registered_capital); $('#registered_capital').val(companyInfo.registered_capital);
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</button> </button>
<input type="hidden" class="upload_obj" value=""> <input type="hidden" class="upload_obj" value="">
</div> </div>
<div class="layui-col-md12" style="padding-left: 45px;margin-top: 5px"> <div class="layui-col-md12" style="padding-left: 45px;margin-top: 5px" id="attachment_upload_div">
<blockquote class="layui-elem-quote layui-quote-nm" style="padding-bottom: 5px"> <blockquote class="layui-elem-quote layui-quote-nm" style="padding-bottom: 5px">
<div id="file_list" class="layui-row"> <div id="file_list" class="layui-row">
@foreach(config('fixed.FileNameMapping') as $name=>$cnName) @foreach(config('fixed.FileNameMapping') as $name=>$cnName)
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
</div> </div>
</div> </div>
{{--这个模板是用来附加附件的--}}
<div id="file_template" style="display: none"> <div id="file_template" style="display: none">
<div class="layui-row single_file_div"> <div class="layui-row single_file_div">
<div class="layui-col-md3"> <div class="layui-col-md3">
......
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