电子红本报价添加数量,一次折扣,二次折扣 格式校验

This commit is contained in:
xd 2024-06-28 09:39:44 +08:00
parent 9904f3ecf0
commit 04d517dc29
2 changed files with 172 additions and 64 deletions

View File

@ -324,7 +324,9 @@
searchResultCurrentPage: 1, searchResultCurrentPage: 1,
searchResultPageSize: 10, searchResultPageSize: 10,
searchResultData: [], searchResultData: [],
errIndex: [],/// errSlIndex: [],///
errPercIndex: [],///
errPerc2Index: [],///
/**==============已选择结果========================= */ /**==============已选择结果========================= */
selectedResultLoading: false, selectedResultLoading: false,
@ -732,7 +734,7 @@
}, },
// //
handleSaveClick() { handleSaveClick() {
let flag = this.checkSl(); let flag = this.checkSlZk();
if(flag){ if(flag){
if(!this.isColumn1ValuesEqual){ if(!this.isColumn1ValuesEqual){
this.$modal.msgError("存在与当前调价版本不一致的产品,请选择调价日期批量刷新"); this.$modal.msgError("存在与当前调价版本不一致的产品,请选择调价日期批量刷新");
@ -749,7 +751,7 @@
}, },
// //
handleMadeQuotClick() { handleMadeQuotClick() {
let flag = this.checkSl(); let flag = this.checkSlZk();
if(flag){ if(flag){
if(!this.isColumn1ValuesEqual){ if(!this.isColumn1ValuesEqual){
this.$modal.msgError("存在与当前调价版本不一致的产品,请选择调价日期批量刷新"); this.$modal.msgError("存在与当前调价版本不一致的产品,请选择调价日期批量刷新");
@ -783,7 +785,7 @@
// //
handleMadeXjQuotClick() { handleMadeXjQuotClick() {
let flag = this.checkSl(); let flag = this.checkSlZk();
if(flag){ if(flag){
this.madeQuotDis = true; this.madeQuotDis = true;
this.form.selectedResultData = this.selectedResultData; this.form.selectedResultData = this.selectedResultData;
@ -834,7 +836,7 @@
// //
handleExport(){ handleExport(){
let flag = this.checkSl(); let flag = this.checkSlZk();
if(flag){ if(flag){
const fileName = "RB_BJD_"+this.getTodayCourse(); const fileName = "RB_BJD_"+this.getTodayCourse();
this.download('redBook/redBook/exportProduct', { this.download('redBook/redBook/exportProduct', {
@ -905,25 +907,60 @@
}, },
// - // -
checkSl(){ checkSlZk(){
let flag = true; let flag = true;
this.errIndex = []; this.errSlIndex = [];
this.errPercIndex = [];
this.errPerc2Index = [];
let errMsg = "";
const label = /^(\+)?\d+(\.\d+)?$/; const label = /^(\+)?\d+(\.\d+)?$/;
this.selectedResultData.forEach((row, index) => {
let sl = row.count;
sl = sl.trim();
let reg = new RegExp(label); let reg = new RegExp(label);
this.selectedResultData.forEach((row, index) => {
//
let sl = row.count;
sl = String(sl).trim();
if(sl){ if(sl){
if (!reg.test(sl)) { if (!reg.test(sl)) {
this.errIndex.push(index+1); this.errSlIndex.push(index+1);
}
}
//
let perc = row.per;
perc = String(perc).trim();
if(perc){
if (!reg.test(perc)) {
this.errPercIndex.push(index+1);
}
}
//
let perc2 = row.per2;
perc2 = String(perc2).trim();
if(perc2){
if (!reg.test(perc2)) {
this.errPerc2Index.push(index+1);
} }
} }
}); });
if(this.errIndex.length!=0){ if(this.errPercIndex.length!=0){
flag = false; flag = false;
this.$modal.msgError("第"+this.errIndex.join(",")+"行报价产品明细【数量调整】格式错误"); errMsg = "第"+this.errPercIndex.join(",")+"行报价产品明细【一次折扣】格式错误";
this.$modal.msgError(errMsg);
return flag;
}
if(this.errPerc2Index.length!=0){
flag = false;
errMsg = "第"+this.errPerc2Index.join(",")+"行报价产品明细【二次折扣】格式错误";
this.$modal.msgError(errMsg);
return flag;
}
if(this.errSlIndex.length!=0){
flag = false;
errMsg = "第"+this.errSlIndex.join(",")+"行报价产品明细【数量调整】格式错误";
this.$modal.msgError(errMsg);
return flag;
} }
return flag; return flag;
} }

View File

@ -383,6 +383,8 @@
// //
handleSaveClick() { handleSaveClick() {
let flag = this.checkSlZk();
if(flag){
const allPrice = this.selectedResultData.reduce((sum, row) => sum + parseFloat(row.allPrice), 0); const allPrice = this.selectedResultData.reduce((sum, row) => sum + parseFloat(row.allPrice), 0);
this.form.totalPrice = toDecimal(allPrice); this.form.totalPrice = toDecimal(allPrice);
this.form.selectedResultData = this.selectedResultData; this.form.selectedResultData = this.selectedResultData;
@ -391,10 +393,13 @@
this.open = false; this.open = false;
this.getList(); this.getList();
}) })
}
}, },
// //
handleSaveOtherClick() { handleSaveOtherClick() {
let flag = this.checkSlZk();
if(flag){
this.$modal.confirm('是否确认生成新报价单?').then(function() {}).then(() => { this.$modal.confirm('是否确认生成新报价单?').then(function() {}).then(() => {
const allPrice = this.selectedResultData.reduce((sum, row) => sum + parseFloat(row.allPrice), 0); const allPrice = this.selectedResultData.reduce((sum, row) => sum + parseFloat(row.allPrice), 0);
this.form.totalPrice = toDecimal(allPrice); this.form.totalPrice = toDecimal(allPrice);
@ -406,6 +411,7 @@
this.getList(); this.getList();
}) })
}).catch(() => {}); }).catch(() => {});
}
}, },
// //
@ -426,6 +432,8 @@
// //
handleMadeQuotClick() { handleMadeQuotClick() {
let flag = this.checkSlZk();
if(flag){
this.form.selectedResultData = this.selectedResultData; this.form.selectedResultData = this.selectedResultData;
madeQuot(this.form).then(response => { madeQuot(this.form).then(response => {
this.$modal.msgSuccess("生成报价单成功"); this.$modal.msgSuccess("生成报价单成功");
@ -453,10 +461,13 @@
navigator.msSaveBlob(blob, fileName); navigator.msSaveBlob(blob, fileName);
} }
}); });
}
}, },
// //
handleExport(){ handleExport(){
let flag = this.checkSlZk();
if(flag){
let fileName = "RB_BJD_"+this.getTodayCourse(); let fileName = "RB_BJD_"+this.getTodayCourse();
if(this.form.quotCode){ if(this.form.quotCode){
fileName = this.form.quotCode; fileName = this.form.quotCode;
@ -464,6 +475,7 @@
this.download('redBook/redBook/exportProduct', { this.download('redBook/redBook/exportProduct', {
selectedResultData: JSON.stringify(this.selectedResultData) selectedResultData: JSON.stringify(this.selectedResultData)
}, fileName +".xlsx") }, fileName +".xlsx")
}
}, },
// //
@ -482,6 +494,65 @@
}, },
p(s) { p(s) {
return s < 10 ? '0' + s : s; return s < 10 ? '0' + s : s;
},
// -
checkSlZk(){
let flag = true;
this.errSlIndex = [];
this.errPercIndex = [];
this.errPerc2Index = [];
let errMsg = "";
const label = /^(\+)?\d+(\.\d+)?$/;
let reg = new RegExp(label);
this.selectedResultData.forEach((row, index) => {
//
let sl = row.count;
sl = String(sl).trim();
if(sl){
if (!reg.test(sl)) {
this.errSlIndex.push(index+1);
}
}
//
let perc = row.per;
perc = String(perc).trim();
if(perc){
if (!reg.test(perc)) {
this.errPercIndex.push(index+1);
}
}
//
let perc2 = row.per2;
perc2 = String(perc2).trim();
if(perc2){
if (!reg.test(perc2)) {
this.errPerc2Index.push(index+1);
}
}
});
if(this.errPercIndex.length!=0){
flag = false;
errMsg = "第"+this.errPercIndex.join(",")+"行报价产品明细【一次折扣】格式错误";
this.$modal.msgError(errMsg);
return flag;
}
if(this.errPerc2Index.length!=0){
flag = false;
errMsg = "第"+this.errPerc2Index.join(",")+"行报价产品明细【二次折扣】格式错误";
this.$modal.msgError(errMsg);
return flag;
}
if(this.errSlIndex.length!=0){
flag = false;
errMsg = "第"+this.errSlIndex.join(",")+"行报价产品明细【数量调整】格式错误";
this.$modal.msgError(errMsg);
return flag;
}
return flag;
} }
}, },
computed: { computed: {