Commit 3f40a276 by 杨树贤

类型切换

parent 126ca0c6
......@@ -12,7 +12,7 @@ use Illuminate\Support\Facades\DB;
class CompanyService
{
public function getCompanyInfo($supplierName, $taxNumber,$regionType = 1)
public function getCompanyInfo($supplierName, $taxNumber, $regionType = 1)
{
$params = [
'keyword' => $supplierName ?: $taxNumber,
......@@ -24,14 +24,17 @@ class CompanyService
$result = json_decode($result, true);
$company = [];
if (array_get($result, 'code') === 0) {
$companyInfo = array_get($result['data'], 0);
$company = [
'supplier_name' => $companyInfo['com_name'],
'registered_capital' => (int)$companyInfo['registered_capital'],
'supplier_address' => $companyInfo['com_address'],
'tax_number' => $companyInfo['tyc_info']['tax_number'],
'phone' => $companyInfo['tyc_info']['phone_number'],
];
$companyInfo = array_get(array_get($result['data'], 'company_info_list'), 0);
if (!empty($companyInfo)) {
$company = [
'supplier_name' => $companyInfo['com_name'],
'registered_capital' => (int)$companyInfo['registered_capital'],
'supplier_address' => $companyInfo['com_address'],
'tax_number' => $companyInfo['tyc_info']['tax_number'],
'phone' => $companyInfo['tyc_info']['phone_number'],
];
}
}
return $company;
}
......
......@@ -17,6 +17,7 @@ class SupplierValidator
//因为控制器那边已经被之前的人魔改的难用的一比,而且控制器那边还接收了一大堆统一变量
public function checkSave($validateData, $isAudit)
{
dd($validateData['tax_number']);
//整理下请求数据
$validateData = $this->transformRequestData($validateData);
//这个supplierId是用来判断是新增还是修改的
......
......@@ -32,7 +32,7 @@ EOF;
if ($value !== null) {
$checked = ($v == $value) ? "checked" : '';
}
$itemsHtml = $itemsHtml . "<input type='radio' lay-filter='${name}' name='${name}' value='${v}' title='${item}' $checked $disabled>";
$itemsHtml = $itemsHtml . "<input type='radio' lay-filter='${name}' name='${name}' id='${name}' value='${v}' title='${item}' $checked $disabled>";
}
return $itemsHtml;
}
......
......@@ -21,7 +21,7 @@ return [
'UploadUrl' => env('API_DOMAIN') . '/oss/upload',
'UploadKey' => 'fh6y5t4rr351d2c3bryi',
'QueueDomain' => 'http://192.168.1.252:16590/mq/push',
'InternalApiDomain' => 'http://192.168.1.192:8200',
'InternalApiDomain' => 'http://192.168.1.252:8200',
'WarningRobot' => 'https://oapi.dingtalk.com/robot/send?access_token=7ff88e1ee208e3a637c17bc51c1c879bccbf101fef5885d22ad70d21ea2f966a',
'CSWarningRobot' => 'https://oapi.dingtalk.com/robot/send?access_token=92917a6e090a8a39832c4843a579d6c6f9dfecc46fa275f8753ddee2b4399045',
......
......@@ -85,3 +85,44 @@ function inArray(needle, haystack) {
}
return false;
}
function attachmentsUploadedChangeSupplierType(supplierType, supplierGroup, fieldName) {
let msg = '';
let radioObj = $('input[name="supplier_type"]');
//已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商?
if (supplierType === '2') {
//如果已经上传品质保证协议,并且供应商性质不是代理商(代理商要代理证)
if ('quality_assurance_agreement' === fieldName && supplierGroup !== '1') {
msg = '已经上传品质保证协议,是否切换为正式供应商?'
layer.confirm(msg, function (index) {
radioObj.get(0).checked = true;
radioObj.get(1).checked = false;
});
}
if ('proxy_certificate' === fieldName && supplierGroup === '1') {
msg = '该供应商为代理供应商,已经上传代理证,是否切换为正式供应商?'
layer.confirm(msg, function (index) {
radioObj.get(0).checked = true;
radioObj.get(1).checked = false;
});
}
} else {
if ('quality_assurance_agreement' === fieldName && supplierGroup !== '1') {
msg = '未上传品质保证协议,是否切换为临时供应商?'
layer.confirm(msg, function (index) {
radioObj.get(0).checked = false;
radioObj.get(1).checked = true;
});
}
if ('proxy_certificate' === fieldName && supplierGroup === '1') {
msg = '该供应商为代理供应商,但是未上传代理证,是否切换为临时供应商?'
layer.confirm(msg, function (index) {
radioObj.get(0).checked = false;
radioObj.get(1).checked = true;
});
}
}
layui.form.render('radio');
return msg;
}
......@@ -182,27 +182,5 @@
}
}
}
function attachmentsUploadedTips(){
let msg = '';
//已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商?
if (data.field.supplier_type === 2) {
//如果已经上传品质保证协议,并且供应商性质不是代理商(代理商要代理证)
if (inArray('quality_assurance_agreement', data.field.field_name) && data.field.supplier_group !== 1) {
msg = '已经上传品质保证协议,是否切换为正式供应商?'
}
if (inArray('proxy_certificate', data.field.field_name) && data.field.supplier_group === 1) {
msg = '该供应商为代理供应商,已经上传代理证,是否切换为正式供应商?'
}
} else {
if (inArray('quality_assurance_agreement', data.field.field_name) && data.field.supplier_group !== 1) {
msg = '未上传品质保证协议,是否切换为临时供应商?'
}
if (inArray('proxy_certificate', data.field.field_name) && data.field.supplier_group === 1) {
msg = '该供应商为代理供应商,但是未上传代理证,是否切换为临时供应商?'
}
}
}
});
</script>
\ No newline at end of file
......@@ -37,13 +37,13 @@
layer.msg(res.err_msg, {icon: 5});
$(this).after("<div id='supplier_check_tip' style='margin-top: 5px'>" +
"<p style='color: red;'>" + res.err_msg + "</p></div>");
$('#supplier_name').prop('disabled', false);
$('#supplier_name').prop('readonly', false);
}
} else {
layer.msg(res.err_msg, {icon: 5});
$(this).after("<div id='supplier_check_tip' style='margin-top: 5px'>" +
"<p style='color: red;'>" + res.err_msg + "</p></div>");
$('#supplier_name').prop('disabled', false);
$('#supplier_name').prop('readonly', false);
}
} else if (res.err_code === 0) {
//如果供应商没有问题,就要去自动填补部分资料
......@@ -71,14 +71,14 @@
let supplierNameObj = $('#supplier_name');
let taxNumberObj = $('#tax_number');
if (data.value) {
supplierNameObj.attr('disabled', false);
supplierNameObj.attr('readonly', false);
supplierNameObj.removeClass('layui-disabled');
taxNumberObj.attr('disabled', false);
taxNumberObj.attr('readonly', false);
taxNumberObj.removeClass('layui-disabled');
} else {
supplierNameObj.attr('disabled', true);
supplierNameObj.attr('readonly', true);
supplierNameObj.addClass('layui-disabled');
taxNumberObj.attr('disabled', true);
taxNumberObj.attr('readonly', true);
taxNumberObj.addClass('layui-disabled');
}
if (data.value === '2') {
......@@ -94,10 +94,10 @@
$('#supplier_name').change(function () {
let taxNumberObj = $('#tax_number');
if ($(this).val()) {
taxNumberObj.attr('disabled', true);
taxNumberObj.attr('readonly', true);
taxNumberObj.addClass('layui-disabled');
} else {
taxNumberObj.attr('disabled', false);
taxNumberObj.attr('readonly', false);
taxNumberObj.removeClass('layui-disabled');
}
......@@ -105,10 +105,10 @@
$('#tax_number').change(function () {
let supplierNameObj = $('#supplier_name');
if ($(this).val()) {
supplierNameObj.attr('disabled', true);
supplierNameObj.attr('readonly', true);
supplierNameObj.addClass('layui-disabled');
} else {
supplierNameObj.attr('disabled', false);
supplierNameObj.attr('readonly', false);
supplierNameObj.removeClass('layui-disabled');
}
});
......@@ -121,10 +121,8 @@
let supplier_type = data.value;
if (supplier_type === '1') {
$('#attachment_required_span').show();
// $('#apply_audit_button').show();
} else {
$('#attachment_required_span').hide();
// $('#apply_audit_button').hide();
}
});
......@@ -231,8 +229,6 @@
$('#recheck_company_info').click(function () {
let supplierName = $('#supplier_name').val();
let taxNumber = $('#tax_number').val();
console.log(supplierName);
console.log(taxNumber);
admin.btnLoading('#recheck_company_info', '正在查验公司信息,请稍后');
if (!supplierName && !taxNumber) {
layer.msg('请填写供应商名称或者税号后再进行查验', {icon: 5});
......@@ -249,11 +245,12 @@
if (res.err_code === 0) {
admin.btnLoading('#recheck_company_info', false);
let companyInfo = res.data;
$('#supplier_name').val(companyInfo.supplier_name);
$('#tax_number').val(companyInfo.tax_number);
$('#phone').val(companyInfo.phone);
$('#supplier_address').val(companyInfo.supplier_address);
$('#registered_capital').val(companyInfo.registered_capital);
$('#supplier_name').attr('value', companyInfo.supplier_name);
$('#tax_number').attr('value', companyInfo.tax_number);
$('#phone').attr('value', companyInfo.phone);
$('#supplier_address').attr('value', companyInfo.supplier_address);
$('#registered_capital').attr('value', companyInfo.registered_capital);
form.render();
layer.msg('校验公司信息通过,自动补全相关数据', {icon: 6})
} else {
admin.btnLoading('#recheck_company_info', false);
......
......@@ -61,6 +61,7 @@
loadIndex = layer.load(1);
},
done: function (res, index, upload) {
let fieldName = '';
fileName = this.files[index].name;
if (res.code === 200) {
//动态添加js
......@@ -72,7 +73,8 @@
fileTemplateObj.find('#file_name').val(fileName);
fileTemplateObj.find('#file_url').val(res.data[0]);
fileTemplateObj.find('#field_name').val($('#file_type_select').val());
fieldName = $('#file_type_select').val();
fileTemplateObj.find('#field_name').val(fieldName);
fileTemplateObj.find('#validity_period').addClass('layui-input validity_period layui-disabled');
fileTemplateObj.find('#validity_period').prop('disabled', true);
......@@ -95,7 +97,9 @@
});
});
delete this.files[index];
let supplierType = $('input[name="supplier_type"]:checked').val();
layer.close(loadIndex);
attachmentsUploadedChangeSupplierType(supplierType, $('#supplier_group').val(), fieldName)
},
});
......
......@@ -58,7 +58,7 @@
layui-disabled
@endif"
value="{{$supplier['supplier_name'] or ''}}"
@if ($supplier['sync_united_status']==1) disabled @endif>
@if ($supplier['sync_united_status']==1) readonly @endif>
</div>
</div>
<div class="layui-col-md5">
......@@ -66,7 +66,7 @@
<label class="layui-form-label"><span class="require">*</span>公司税号</label>
<div class="layui-input-block">
<input type="text" name="tax_number" id="tax_number" placeholder="请输入公司税号,选择所在区域才允许输入"
class="layui-input layui-disabled" disabled value="{{$supplier['tax_number'] or ''}}">
class="layui-input layui-disabled" readonly value="{{$supplier['tax_number'] or ''}}">
</div>
</div>
</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