Commit 22bd5b22 by 杨树贤

完成页面修改

parent 1c409391
......@@ -83,13 +83,6 @@ class SupplierApiController extends Controller
'pay_type_value',
'pay_type_extra',
'supplier_type',
//附件
'file_name',
'file_url',
'field_name',
'validity_type',
'validity_period',
];
public function Entrance(Request $request, $id)
......@@ -105,7 +98,6 @@ class SupplierApiController extends Controller
$data = $request->all();
//直接提交的不需要做复杂的表单校验
$isAudit = false;
dd($data);
if (request()->get('direct_apply')) {
$isAudit = true;
$validateResult = $validator->checkSave($data, $isAudit);
......@@ -124,7 +116,23 @@ class SupplierApiController extends Controller
'supplier_telephone',
'supplier_qq',
'supplier_fax',
'can_check_uids'
'can_check_uids',
//附件
'file_name',
'file_url',
'field_name',
'validity_type',
'validity_period',
//银行信息
'receipt_type',
'bank_name',
'bank_adderss',
'account_no',
'account_name',
'account_adderss',
'certificate',
'swift_code',
]);
$channel = $request->only($channelMap);
$service = new SupplierService();
......
......@@ -89,8 +89,7 @@ class SupplierAttachmentService
}
$attachments[] = $attachment;
}
$attachments = array_unique($attachments);
if (!$attachments) {
if ($attachments) {
return SupplierAttachmentsModel::insert($attachments);
}
return true;
......
......@@ -73,7 +73,6 @@ class SupplierService
unset($channel['shipping_address'], $channel['cn_delivery_time_period'],
$channel['us_delivery_time_period'], $channel['attachment']);
//sku上传规则相关设置
$skuAuditRulerService = new SupplierSkuAuditRulerService();
$channel['sku_audit_ruler'] = $skuAuditRulerService->getSkuAuditRulerForDB($channel['sku_audit_ruler']);
......@@ -154,8 +153,10 @@ class SupplierService
$contact['admin_id'] = request()->user->userId;
SupplierContactModel::insert($contact);
}
//添加附件
SupplierAttachmentService::addAttachmentFromAddPage($supplierId, $attachmentData);
if (!checkArrayAllValueNull($attachmentData)) {
//添加附件
SupplierAttachmentService::addAttachmentFromAddPage($supplierId, $attachmentData);
}
//添加银行信息,也是有填一个表单域也要新增,排除receipt_type字段,因为这个肯定有的
if (!checkArrayAllValueNull($receiptData, ['receipt_type'])) {
......@@ -163,7 +164,6 @@ class SupplierService
SupplierReceiptModel::insert($receiptData);
}
//如果是临时供应商,要打上临时供应商的标签
if ($channel['supplier_type'] == SupplierChannelModel::SUPPLIER_TYPE_TEMPORARY) {
$tagService->saveTags($supplierId, SupplierTagService::TAG_TYPE_SYSTEM, '临时供应商', '');
......
......@@ -225,7 +225,7 @@ class SupplierValidator
'currency.required' => '结算币种 不能为空',
'legal_representative.required' => '法人代表 不能为空',
'stockup_type.required' => '合作类型 不能为空',
'pay_type.required' => '付款方式 不能为空',
'pay_type.required' => '付款周期 不能为空',
'settlement_type.required' => '结算方式 不能为空',
'register_company_name.required' => '注册公司名 不能为空',
'supplier_group.required' => '公司性质 不能为空',
......
<script>
layui.use(['table', 'form', 'element', 'layer', 'admin', 'laydate', 'xmSelect', 'upload'], function () {
layui.use(['table', 'form', 'element', 'layer', 'index', 'admin', 'laydate', 'xmSelect', 'upload'], function () {
let admin = layui.admin;
let form = layui.form;
let index = layui.index;
let laydate = layui.laydate;
let upload = layui.upload;
let element = layui.element;
......@@ -60,6 +61,24 @@
});
form.on('submit(addSupplier)', function (data) {
let file_name = [];
let file_url = [];
let validity_type = [];
let field_name = [];
let validity_period = [];
$('.single_file_div').each(function () {
file_name.push($(this).find('#file_name').val());
file_url.push($(this).find('#file_url').val());
field_name.push($(this).find('#field_name').val());
validity_type.push($(this).find('#validity_type').val());
validity_period.push($(this).find('#validity_period').val());
});
data.field.file_name = file_name;
data.field.file_url = file_url;
data.field.field_name = field_name;
data.field.validity_type = validity_type;
data.field.validity_period = validity_period;
data.field.apply_audit_reason = $('#apply_audit_reason').val();
let url = '/api/supplier/AddSupplier';
let res = ajax(url, data.field);
if (!res) {
......@@ -67,7 +86,10 @@
} else {
if (res.err_code === 0) {
layer.msg(res.err_msg, {icon: 6});
admin.closeThisTabs();
setTimeout(function () {
admin.closeThisTabs();
location.href = "/supplier/SupplierList"
}, 1000);
} else {
layer.msg(res.err_msg, {icon: 5});
}
......@@ -80,6 +102,25 @@
});
form.on('submit(addAndApplySupplier)', function (data) {
//去找出附件的所有数据
let file_name = [];
let file_url = [];
let validity_type = [];
let field_name = [];
let validity_period = [];
$('.single_file_div').each(function () {
file_name.push($(this).find('#file_name').val());
file_url.push($(this).find('#file_url').val());
field_name.push($(this).find('#field_name').val());
validity_type.push($(this).find('#validity_type').val());
validity_period.push($(this).find('#validity_period').val());
});
data.field.file_name = file_name;
data.field.file_url = file_url;
data.field.field_name = field_name;
data.field.validity_type = validity_type;
data.field.validity_period = validity_period;
data.field.apply_audit_reason = $('#apply_audit_reason').val();
if (data.field.supplier_type === '2') {
layer.open({
type: 1,
......@@ -87,6 +128,10 @@
content: $('#apply_audit_reason_div'),
btn: ['保存并申请审核', '取消'],
btn1: function (index, layero) {//点击保存按钮
if ($('#apply_audit_reason').val() === '') {
layer.msg('请选择申请理由', {icon: 5})
return false;
}
addSupplier(data);
layer.close(index);
},
......@@ -108,7 +153,10 @@
} else {
if (res.err_code === 0) {
layer.msg(res.err_msg, {icon: 6});
admin.closeThisTabs();
setTimeout(function () {
admin.closeThisTabs();
location.href = "/supplier/SupplierList"
}, 1000);
} else {
let errMsg = res.err_msg;
let msg = '';
......
......@@ -43,20 +43,16 @@
btn: ['保存并申请审核', '取消'],
btn1: function (index, layero) {//点击保存按钮
updateSupplier(data);
layer.close(index);
setTimeout(function () {
layer.close(index);
}, 1000);
},
});
} else {
layer.confirm('确定直接申请审核吗?确定后会直接进入审核中的状态,审核完成前无法进行二次修改', function (index) {
updateSupplier(data);
});
}
// let confirmMessage = '确定直接申请审核吗?确定后会直接进入审核中的状态,审核完成前无法进行二次修改';
// layer.confirm(confirmMessage, function (index) {
// data.field.is_audit = 1;
// updateSupplier(data);
// });
});
function updateSupplier(data) {
......@@ -66,7 +62,6 @@
table.reload('receiptList')
location.href = "/supplier/SupplierDetail?view=iframe&supplier_id={{$supplier['supplier_id']}}"
layer.msg(res.err_msg, {icon: 6})
layer.close(index);
} else {
let errMsg = res.err_msg;
let msg = '';
......
......@@ -71,18 +71,17 @@
fileTemplateObj.find('#file_name').val(fileName);
fileTemplateObj.find('#file_url').val(res.data[0]);
fileTemplateObj.find('#field_name').val($('#file_type_select').val());
fileTemplateObj.find('#validity_period_input').addClass('layui-input validity_period layui-disabled');
fileTemplateObj.find('#validity_period').addClass('layui-input validity_period layui-disabled');
let fileTemplate = fileTemplateObj.html();
$('#' + fileType + '_div').show();
$('#' + fileType + '_file_div').append(fileTemplate);
fileTemplateObj.find('#validity_period_input').removeClass('layui-input validity_period layui-disabled');
fileTemplateObj.find('#validity_period').removeClass('layui-input validity_period layui-disabled');
form.render();
} else {
layer.msg('上传接口异常,请重试或者联系管理员 . ' + res.message);
}
lay('.validity_period').each(function () {
console.log(this)
laydate.render({
elem: this,
type: 'date',
......
......@@ -23,7 +23,9 @@
//正式供应商不允许修改供应商类型了或者是竞调供应商is_type=1也不允许修改供应商
if ((!empty($supplier) && $supplier['supplier_type'] == \App\Model\SupplierChannelModel::SUPPLIER_TYPE_OFFICIAL) || (!empty($supplier) && $supplier['is_type'] == 1)) {
$option['disable'] = true;
$supplierType[3] = '待转正';
}
if ($supplier['supplier_type'] == 2) {
unset($supplierType[3]);
}
?>
......@@ -239,6 +241,6 @@
<input name="customer_tags" id="customer_tags" value="{{$supplier['customer_tags'] or ''}}">
</div>
</div>
@endif
@endif
@include('script.supplier.SupplierBaseScript')
@include('script.supplier.SupplierBaseScript')
......@@ -46,22 +46,22 @@
<label class="layui-form-label">附件文件名 : </label>
<div class="layui-input-inline" style="padding-top: 10px">
<a href="" target="_blank"></a>
<input type="hidden" name="file_name[]" id="file_name">
<input type="hidden" name="file_url[]" id="file_url">
<input type="hidden" name="field_name[]" id="field_name">
<input type="hidden" id="file_name">
<input type="hidden" id="file_url">
<input type="hidden" id="field_name">
</div>
</div>
<div class="layui-col-md7">
<label class="layui-form-label">有效期 : </label>
<div class="layui-input-inline" style="width: 100px">
<select name="validity_type[]" lay-filter="validity_period_selector">
<select id="validity_type" lay-filter="validity_period_selector">
<option value="1">长期有效</option>
<option value="2">自定义</option>
</select>
</div>
<div class="layui-input-inline" style="width: 300px">
<input type="text" name="validity_period[]"
placeholder="请选择时间区间" autocomplete="off" id="validity_period_input" class="" disabled>
<input type="text" id="validity_period"
placeholder="请选择时间区间" autocomplete="off" class="" disabled>
</div>
<button style="margin-top: 3px" class="layui-btn layui-btn-xs layui-btn-danger delete_file">删除</button>
</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