From c3848e5b556612b79102692e94c4c88a26167127 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Mon, 13 Jan 2020 10:11:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8A=E6=B8=B8=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/Statement/createCpStatement.html | 77 +++++++++++++------ 1 file changed, 55 insertions(+), 22 deletions(-) diff --git a/Application/Admin/View/Statement/createCpStatement.html b/Application/Admin/View/Statement/createCpStatement.html index 6eaf25ea8..b8a6a8fe7 100644 --- a/Application/Admin/View/Statement/createCpStatement.html +++ b/Application/Admin/View/Statement/createCpStatement.html @@ -436,6 +436,55 @@ }); //基础类 var PUBLIC = { + CompanyKeyName:{ + id:"公司表id", + partner:"公司名称", + link_man:'联系人', + link_phone:"联系电话", + address:'邮寄地址', + company_tax_no:'公司税号', + payee_name:'名称', + bank_account:"银行账号", + opening_bank:"开户行" + }, + checkCompanyKey(type,key){ + //获取公司名 + var company = ''; + if(key == "payee_name" || key == "bank_account" || key == "opening_bank"){ + if((DATAOBJ.statement_type == 0 && type == "first_party_info") || (DATAOBJ.statement_type == 1 && type == "second_party_info")){ + company = "收款方"; + } + if((DATAOBJ.statement_type == 0 && type == "second_party_info")|| (DATAOBJ.statement_type == 1 && type == "first_party_info")){ + company = "付款方"; + } + }else{ + if(type == "first_party_info"){ + company = "甲方"; + }else{ + company = "乙方"; + } + } + //获取键名 + try { + var keyname = company+PUBLIC.CompanyKeyName[key]; + } catch (error) { + var keyname = false; + } + //验证 + if(DATAOBJ[type][key] ===''){ + layer.msg(keyname+"不能为空"); + return false; + } + if(key == "link_phone" && !CHECK.mobile.test(DATAOBJ[type][key])){ + layer.msg(keyname+"格式错误"); + return false; + } + if(key == "bank_account" && !CHECK.BankNo.test(DATAOBJ[type][key])){ + layer.msg(keyname+"格式错误"); + return false; + } + return true; + }, postData(url,data,callback){ $.ajax({ url:url, @@ -546,33 +595,17 @@ //验证甲方信息 for (const key in DATAOBJ.first_party_info) { var t = DATAOBJ.first_party_info; - if(t[key] ===''){ - layer.msg('甲方信息不全,请先补全 code:'+key); - return false; - } - if(key == "link_phone" && !CHECK.mobile.test(t[key])){ - layer.msg('甲方联系人手机号格式错误'); - return false; - } - if(key == "bank_account" && !CHECK.BankNo.test(t[key])){ - layer.msg('甲方银行卡号格式错误'); - return false; + var flag = PUBLIC.checkCompanyKey("first_party_info",key); + if(!flag){ + return flag; } } //乙方 for (const key in DATAOBJ.second_party_info) { var t = DATAOBJ.second_party_info; - if(!t[key] || t[key] ==''){ - layer.msg('乙方信息不全,请先补全 code:'+key); - return false; - } - if(key == "link_phone" && !CHECK.mobile.test(t[key])){ - layer.msg('乙方联系人手机号格式错误'); - return false; - } - if(key == "bank_account" && !CHECK.BankNo.test(t[key])){ - layer.msg('乙方银行卡号格式错误'); - return false; + var flag = PUBLIC.checkCompanyKey("second_party_info",key); + if(!flag){ + return flag; } } layer.load(2);