generated from zhaoxingchang/i-tax-management-front-lxzy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
266 lines
8.4 KiB
266 lines
8.4 KiB
10 months ago
|
let titleInfo = JSON.parse(window.sessionStorage.getItem("titleInfo"));
|
||
|
const screenHeigth = window.screen.height;
|
||
|
$(function () {
|
||
|
if (titleInfo == null || titleInfo === undefined || titleInfo === '') {
|
||
|
titleInfo = {};
|
||
|
$('#markNotes').val('');
|
||
|
$('#registerAddr').val('');
|
||
|
$('#registerPhone').val('');
|
||
|
$('#bankName').val('');
|
||
|
$('#bankAccount').val('');
|
||
|
} else {
|
||
|
// var textarea = document.getElementById("markNotes");
|
||
|
// autoTextArea(textarea);
|
||
|
if (titleInfo.bz !== '' && titleInfo.bz != null && titleInfo.bz !== undefined) {
|
||
|
$('#markNotes').val(titleInfo.bz);
|
||
|
changerow('', titleInfo.bz, 1);
|
||
|
} else {
|
||
|
$('#markNotes').val('');
|
||
|
}
|
||
|
$('#registerAddr').val(titleInfo.gfdz == null ? "" : titleInfo.gfdz);
|
||
|
$('#registerPhone').val(titleInfo.gfdh == null ? "" : titleInfo.gfdh);
|
||
|
$('#bankName').val(titleInfo.gfyh == null ? "" : titleInfo.gfyh);
|
||
|
$('#bankAccount').val(titleInfo.gfzh == null ? "" : titleInfo.gfzh);
|
||
|
}
|
||
|
// var textarea = document.getElementById("markNotes");
|
||
|
// autoTextArea(textarea);
|
||
|
// var clickHistory = sessionStorage.getItem('save_historyClick')
|
||
|
const fpTypeId = sessionStorage.getItem('fpTypeId');
|
||
|
if (fpTypeId === "0" || fpTypeId === "52") { //专票和电专情况
|
||
|
$('#registerAddr').val(sessionStorage.getItem('registerAddr')==='null' ?'': sessionStorage.getItem('registerAddr'));
|
||
|
$('#registerPhone').val(sessionStorage.getItem('registerPhone') ==='null' ?'': sessionStorage.getItem('registerPhone'));
|
||
|
$('#bankName').val(sessionStorage.getItem('bankName')==='null' ?'': sessionStorage.getItem('bankName'));
|
||
|
$('#bankAccount').val(sessionStorage.getItem('bankAccount')==='null' ?'': sessionStorage.getItem('bankAccount'));
|
||
|
} else {
|
||
|
$('.stars').css('display','none');
|
||
|
if (titleInfo !== '' && titleInfo != null && titleInfo !== undefined) {
|
||
|
$('#registerAddr').val(titleInfo.gfdz);
|
||
|
$('#registerPhone').val(titleInfo.gfdh);
|
||
|
$('#bankName').val(titleInfo.gfyh);
|
||
|
$('#bankAccount').val(titleInfo.gfzh);
|
||
|
} else {
|
||
|
$('#registerAddr').val('');
|
||
|
$('#registerPhone').val('');
|
||
|
$('#bankName').val('');
|
||
|
$('#bankAccount').val('');
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
|
||
|
/*更多信息填写点击确认*/
|
||
|
function moreMsg_click() {
|
||
|
const registerAddr = $.trim($("#registerAddr").val());
|
||
|
const registerPhone = $.trim($("#registerPhone").val());
|
||
|
const bankName = $.trim($("#bankName").val());
|
||
|
const bankAccount = $.trim($("#bankAccount").val());
|
||
|
const bz = $.trim($('#markNotes').val());
|
||
|
const ttTypeId = sessionStorage.getItem('ttTypeId');
|
||
|
|
||
|
if (addressOnblur() && phoneOnblur() && accountNameOnblur() && accountNoOnblur()) {
|
||
|
if (checkLength(registerAddr) > 86) {
|
||
|
alert_timing_open("注册地址长度超过限制");
|
||
|
return false;
|
||
|
}
|
||
|
if (checkLength(registerAddr) + checkLength(registerPhone) > 100) {
|
||
|
alert_timing_open("注册地址和注册电话长度超过限制");
|
||
|
return false;
|
||
|
}
|
||
|
if (checkLength(bankName) > 74) {
|
||
|
alert_timing_open("开户银行长度超过限制");
|
||
|
return false;
|
||
|
}
|
||
|
titleInfo.gfdz = registerAddr;
|
||
|
titleInfo.gfdh = registerPhone;
|
||
|
titleInfo.gfyh = bankName;
|
||
|
titleInfo.gfzh = bankAccount;
|
||
|
titleInfo.bz = bz;
|
||
|
titleInfo.ghfqylx = ttTypeId;
|
||
|
sessionStorage.setItem('titleInfo', JSON.stringify(titleInfo));
|
||
|
//电票和普票如果手动添加更多信息,提交时带出数据,否则不带出
|
||
|
toPage("/html/wxscaninvoice/writing.html");
|
||
|
}
|
||
|
}
|
||
|
/*备注框随着输入文字增多而自动增大当前行高度*/
|
||
|
function changerow(ele, data, num) {
|
||
|
if (num === 1) {
|
||
|
controlDis(data.length);
|
||
|
} else {
|
||
|
controlDis(ele.value.length);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function controlDis(val) {
|
||
|
if (val > 16) {
|
||
|
$('.markNotes').css('paddingTop', '0.2rem');
|
||
|
} else {
|
||
|
$('.markNotes').css('paddingTop', '0.2rem');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/*更多信息查看示例*/
|
||
|
function viewExample_click() {
|
||
|
document.addEventListener('touchmove', defaul, false);
|
||
|
getEle('.viewExample_shade')[0].style.cssText = 'opacity:1;top:0px;transition-duration:0.3s;transition-timing-function: ease;';
|
||
|
}
|
||
|
|
||
|
function viewExample_close() {
|
||
|
document.removeEventListener('touchmove', defaul, false);
|
||
|
getEle('.viewExample_shade')[0].style.cssText = 'opacity:0;top:' + screenHeigth + 'px;transition-duration:0.3s;transition-timing-function: ease;';
|
||
|
}
|
||
|
|
||
|
/*原声js添加移除需要针对同一个函数 */
|
||
|
function defaul(evt) {
|
||
|
if (!evt._isScroller) {
|
||
|
evt.preventDefault();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function checkLength(str) {
|
||
|
return str.replace(/[^\x00-\xff]/g, "aa").length;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
/*验证注册地址*/
|
||
|
function addressOnblur() {
|
||
|
const registerAddr = $.trim($("#registerAddr").val());
|
||
|
const length = registerAddr.length;
|
||
|
const regRule = /\ud800\udc00-\udbff\udfff\ud800-\udfff/g;
|
||
|
if (registerAddr !== '') {
|
||
|
if (length > 86) {
|
||
|
alert_timing_open("注册地址长度超过限制!");
|
||
|
return false;
|
||
|
}
|
||
|
const tempStr = "|";
|
||
|
if (registerAddr.indexOf(tempStr) >= 0) {
|
||
|
alert_timing_open("注册地址不能包含 |");
|
||
|
return false;
|
||
|
}
|
||
|
if (registerAddr.indexOf(" ") >= 0) {
|
||
|
alert_timing_open("注册地址不能包含空格!");
|
||
|
return false;
|
||
|
}
|
||
|
for (let i = 0; i < length; i++) {
|
||
|
if (registerAddr[i].charCodeAt() >= 55356 && registerAddr[i].charCodeAt() <= 59000) {
|
||
|
alert_timing_open("注册地址不能输入表情");
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
/*验证注册电话*/
|
||
|
function phoneOnblur() {
|
||
|
const registerPhone = $.trim($("#registerPhone").val());
|
||
|
const length = registerPhone.length;
|
||
|
if (length !== 0) {
|
||
|
const regexEl = /^[\d-]*$/;
|
||
|
if (!regexEl.test(registerPhone)) {
|
||
|
alert_timing_open("注册电话只能为半角'数字'和中横线'-'");
|
||
|
return false;
|
||
|
}
|
||
|
if (length > 14) {
|
||
|
alert_timing_open("注册电话长度超过限制!");
|
||
|
return false;
|
||
|
}
|
||
|
const tempStr = "|";
|
||
|
if (registerPhone.indexOf(tempStr) >= 0) {
|
||
|
alert_timing_open("注册电话不能包含 |");
|
||
|
return false;
|
||
|
}
|
||
|
if (registerPhone.indexOf(" ") >= 0) {
|
||
|
alert_timing_open("注册电话不能包含空格!");
|
||
|
return false;
|
||
|
}
|
||
|
for (let i = 0; i < length; i++) {
|
||
|
if (registerPhone[i].charCodeAt() >= 55356 && registerPhone[i].charCodeAt() <= 59000) {
|
||
|
alert_timing_open("注册电话不能输入表情");
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
/*验证开户银行*/
|
||
|
function accountNameOnblur() {
|
||
|
const bankName = $.trim($("#bankName").val());
|
||
|
const length = bankName.length;
|
||
|
if (bankName !== '') {
|
||
|
if (length > 74) {
|
||
|
alert_timing_open("开户银行长度超过限制!");
|
||
|
return false;
|
||
|
}
|
||
|
const tempStr = "|";
|
||
|
if (bankName.indexOf(tempStr) >= 0) {
|
||
|
alert_timing_open("开户银行不能包含 |");
|
||
|
return false;
|
||
|
}
|
||
|
if (bankName.indexOf(" ") >= 0) {
|
||
|
alert_timing_open("开户银行不能包含空格!");
|
||
|
return false;
|
||
|
}
|
||
|
for (let i = 0; i < length; i++) {
|
||
|
if (bankName[i].charCodeAt() >= 55356 && bankName[i].charCodeAt() <= 59000) {
|
||
|
alert_timing_open("开户银行不能输入表情");
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
/*验证开户账号*/
|
||
|
function accountNoOnblur() {
|
||
|
const bankAccount = $.trim($("#bankAccount").val());
|
||
|
const length = bankAccount.length;
|
||
|
if (bankAccount !== '') {
|
||
|
const regexEl = /^[\d-]*$/;
|
||
|
if (length !== 0 && !regexEl.test(bankAccount)) {
|
||
|
alert_timing_open("开户账号只能为半角'数字'和中横线'-'");
|
||
|
return false;
|
||
|
}
|
||
|
if (length > 25) {
|
||
|
alert_timing_open("开户账号长度超过限制!");
|
||
|
return false;
|
||
|
}
|
||
|
const tempStr = "|";
|
||
|
if (bankAccount.indexOf(tempStr) >= 0) {
|
||
|
alert_timing_open("开户账号不能包含 |");
|
||
|
return false;
|
||
|
}
|
||
|
for (let i = 0; i < length; i++) {
|
||
|
if (bankAccount[i].charCodeAt() >= 55356 && bankAccount[i].charCodeAt() <= 59000) {
|
||
|
alert_timing_open("开户账号不能输入表情");
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
function otherTitleChange(ele) {
|
||
|
setTimeout(function () {
|
||
|
$('.fptt_close').css('display', 'none');
|
||
|
if ($(ele).val().length === 0) {
|
||
|
$(ele).next().css('display', 'none');
|
||
|
} else {
|
||
|
$(ele).next().css('display', 'block');
|
||
|
}
|
||
|
}, 100)
|
||
|
}
|
||
|
|
||
|
function fptt_close_click(ele) {
|
||
|
$(ele).prev().val('');
|
||
|
$(ele).css('display', 'none');
|
||
|
}
|
||
|
|
||
|
function resetCloseIcon(ele) {
|
||
|
$(ele).children[1].css('display', 'none');
|
||
|
}
|
||
|
|
||
|
function fpttClose() {
|
||
|
$('.fptt_close').css('display', 'none');
|
||
|
}
|