|
|
@@ -76,6 +76,7 @@
|
|
|
<button type="button" class="btn btn-secondary ml-1" @click="reset()" v-show="base !== 'three'">重置</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ @include("customer.project.part._auditComparison")
|
|
|
</div>
|
|
|
</div>
|
|
|
@stop
|
|
|
@@ -293,8 +294,10 @@
|
|
|
},//审核对比
|
|
|
selectedAudit:"",//当前选择对比项
|
|
|
showAuditPiece:{
|
|
|
- "C":true,"D":true,"U":true
|
|
|
+ "C":false,"D":false,"U":false
|
|
|
},//显示审核块
|
|
|
+ isAudit:true,
|
|
|
+ comparisonTemp:{},
|
|
|
},
|
|
|
created(){
|
|
|
this.filterCustomers = JSON.parse(JSON.stringify(this.customers));
|
|
|
@@ -364,9 +367,7 @@
|
|
|
this._loadStorage();
|
|
|
}
|
|
|
if (base === 'two')if (!this.pool.taxRates) this._getTaxRates();
|
|
|
- setTimeout(()=>{
|
|
|
- this.base = base;
|
|
|
- },300);
|
|
|
+ this.base = base;
|
|
|
},
|
|
|
//切换类型
|
|
|
switchType(type){
|
|
|
@@ -767,14 +768,14 @@
|
|
|
error["price.0"] = ["未输入单价"];
|
|
|
}else{
|
|
|
this.model.storage.amount_interval.forEach((amount,i)=>{
|
|
|
- if (!amount)error["amount_interval."+i] = ["未设定数量区间"];
|
|
|
+ if (amount==="")error["amount_interval."+i] = ["未设定数量区间"];
|
|
|
else if (i!==0 && amount<=this.model.storage.amount_interval[i-1])
|
|
|
error["amount_interval."+i] = ["阶梯区间应大于上一区间值"];
|
|
|
- this.model.storage.amount_interval[i] = Number(this.model.storage.amount_interval[i]);
|
|
|
+ this.model.storage.amount_interval[i] = parseFloat(this.model.storage.amount_interval[i]);
|
|
|
});
|
|
|
this.model.storage.price.forEach((price,i)=>{
|
|
|
- if (!price)error["price."+i] = ["未输入单价"];
|
|
|
- this.model.storage.price[i] = Number(this.model.storage.price[i]);
|
|
|
+ if (price==="")error["price."+i] = ["未输入单价"];
|
|
|
+ this.model.storage.price[i] = parseFloat(this.model.storage.price[i]);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
@@ -784,7 +785,7 @@
|
|
|
}
|
|
|
if (!this.model.storage.isInterval){
|
|
|
this.model.storage.amount_interval = null;
|
|
|
- this.model.storage.price = [Number(this.model.storage.price[0])];
|
|
|
+ this.model.storage.price = [parseFloat(this.model.storage.price[0])];
|
|
|
}
|
|
|
let url = "{{url('maintenance/priceModel/apiStoreStorage')}}";
|
|
|
let params = this.model.storage;
|
|
|
@@ -795,7 +796,7 @@
|
|
|
return;
|
|
|
}
|
|
|
if (this.model.storage.id){
|
|
|
- if (res) this.selectedModel.storage[this.model.storage.index] = this.model.storage;
|
|
|
+ if (!res) this.selectedModel.storage[this.model.storage.index] = this.model.storage;
|
|
|
else this.$set(this.selectedModel.storage,this.model.storage.index,res);
|
|
|
}else {
|
|
|
this.model.storage.id = res;
|
|
|
@@ -837,7 +838,7 @@
|
|
|
if (this.model.operation.isDiscount){
|
|
|
let sign = false;
|
|
|
this.model.operation.discount_count.forEach((item,i)=>{
|
|
|
- if (!item || (i!==0 && Number(item)<=Number(this.model.operation.discount_count[i-1]))){
|
|
|
+ if (!item || (i!==0 && parseFloat(item)<=parseFloat(this.model.operation.discount_count[i-1]))){
|
|
|
this.$set(this.errors,"discount_count_"+i,["非法满减值"]);
|
|
|
sign = true;
|
|
|
}
|
|
|
@@ -876,6 +877,7 @@
|
|
|
for (let i=0;i<this.model.operation.items.length;i++){
|
|
|
if (this._verifyOperationItem(i))return;
|
|
|
}
|
|
|
+ this.model.operation.total_discount_price = [];
|
|
|
this.model.operation.total_price = "";
|
|
|
}else this.$set(this.model.operation,"items",[]);
|
|
|
if (!this.model.operation.isDiscount) {
|
|
|
@@ -980,6 +982,7 @@
|
|
|
else if (i!==0 && amount<=this.model.express.amount_interval[i-1])error["amount_interval."+i] = ["阶梯区间应大于上一区间值"];
|
|
|
if (this.model.express.weight_interval[i].length>0){
|
|
|
this.model.express.weight_interval[i].forEach((weight,j)=>{
|
|
|
+ this.model.express.weight_interval[i][j] = parseFloat(this.model.express.weight_interval[i][j]);
|
|
|
if (weight==="") error["weight_interval."+i+"."+j] = ["区间值不得为空"];
|
|
|
else if (j!==0 && weight<=this.model.express.weight_interval[j-1])error["weight_interval."+i+"."+j] = ["阶梯区间应大于上一区间值"];
|
|
|
})
|
|
|
@@ -995,8 +998,8 @@
|
|
|
this.model.express.weight_interval = null;
|
|
|
if (this.model.express.items.length>0){
|
|
|
this.model.express.items.forEach((item,i)=>{
|
|
|
- this.model.express.items[i].initial_weight_price = [[Number(item.initial_weight_price[0][0])]];
|
|
|
- this.model.express.items[i].additional_weight_price = [[Number(item.additional_weight_price[0][0])]];
|
|
|
+ this.model.express.items[i].initial_weight_price = [[parseFloat(item.initial_weight_price[0][0])]];
|
|
|
+ this.model.express.items[i].additional_weight_price = [[parseFloat(item.additional_weight_price[0][0])]];
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
@@ -1800,6 +1803,7 @@
|
|
|
this.switchType("storage");
|
|
|
this.model.storage = JSON.parse(JSON.stringify(this.selectedModel.storage[index]));
|
|
|
this.model.storage.index = index;
|
|
|
+ if (this.model.storage.amount_interval)this.model.storage.isInterval = true;
|
|
|
},
|
|
|
//编辑作业
|
|
|
editOperation(index){
|
|
|
@@ -1893,47 +1897,57 @@
|
|
|
},
|
|
|
//审核或恢复
|
|
|
auditOrRecoverModel(type,isAudit = true){
|
|
|
+ this.getPriceModelAudit(type,isAudit);
|
|
|
+ this.selectedAudit = type;
|
|
|
+ this.isAudit = isAudit;
|
|
|
+ setTimeout(function () {
|
|
|
+ $("#auditOrRecover").modal("show");
|
|
|
+ },100);
|
|
|
+ },
|
|
|
+ exeAuditOrRecoverModel(){
|
|
|
let url = "{{url('maintenance/priceModel/auditOrRecoverModel')}}";
|
|
|
+ let type = this.selectedAudit;
|
|
|
+ let isAudit = this.isAudit;
|
|
|
let param = {owner_id:this.ownerTemp.id,type:type,isAudit:isAudit};
|
|
|
- window.tempTip.confirm("确定要"+(isAudit ? '审核' : '恢复')+"上次的全部操作吗?",()=>{
|
|
|
- window.tempTip.postBasicRequest(url,param,res=>{
|
|
|
- switch (type){
|
|
|
- case "storage":
|
|
|
- this.selectedModel.storage = res;
|
|
|
- break;
|
|
|
- case "operation":
|
|
|
- this._loadOperation();
|
|
|
- res.forEach((operation,i)=>{res[i] = this._overrideOperation(operation);});
|
|
|
- this.selectedModel.operation = res;
|
|
|
- break;
|
|
|
- case "express":
|
|
|
- this._loadExpress();
|
|
|
- res.forEach((express,i)=>{
|
|
|
- res[i] = this._overrideExpress(express);
|
|
|
- this.upList['express-item-'+i] = true;
|
|
|
- });
|
|
|
- this.selectedModel.express = res;
|
|
|
- break;
|
|
|
- case "logistic":
|
|
|
- this._loadLogistic();
|
|
|
- res.forEach((logistic,i)=>{
|
|
|
- res[i] = this._overrideLogistic(logistic);
|
|
|
- this.upList['logistic-item-'+i] = true;
|
|
|
- });
|
|
|
- this.selectedModel.logistic = res;
|
|
|
- break;
|
|
|
- case "directLogistic":
|
|
|
- this._loadDirectLogistic();
|
|
|
- this.upList["directLogistic-item"] = true;
|
|
|
- this.selectedModel.directLogistic = this._overrideDirectLogistic(res[0]);
|
|
|
- break;
|
|
|
- case "system":
|
|
|
- this.selectedModel.system = res;
|
|
|
- break;
|
|
|
- }
|
|
|
- this.$set(this.audit,type,false);
|
|
|
- })
|
|
|
- })
|
|
|
+ window.tempTip.postBasicRequest(url,param,res=>{
|
|
|
+ switch (type){
|
|
|
+ case "storage":
|
|
|
+ this.selectedModel.storage = res;
|
|
|
+ break;
|
|
|
+ case "operation":
|
|
|
+ this._loadOperation();
|
|
|
+ res.forEach((operation,i)=>{res[i] = this._overrideOperation(operation);});
|
|
|
+ this.selectedModel.operation = res;
|
|
|
+ break;
|
|
|
+ case "express":
|
|
|
+ this._loadExpress();
|
|
|
+ res.forEach((express,i)=>{
|
|
|
+ res[i] = this._overrideExpress(express);
|
|
|
+ this.upList['express-item-'+i] = true;
|
|
|
+ });
|
|
|
+ this.selectedModel.express = res;
|
|
|
+ break;
|
|
|
+ case "logistic":
|
|
|
+ this._loadLogistic();
|
|
|
+ res.forEach((logistic,i)=>{
|
|
|
+ res[i] = this._overrideLogistic(logistic);
|
|
|
+ this.upList['logistic-item-'+i] = true;
|
|
|
+ });
|
|
|
+ this.selectedModel.logistic = res;
|
|
|
+ break;
|
|
|
+ case "directLogistic":
|
|
|
+ this._loadDirectLogistic();
|
|
|
+ this.upList["directLogistic-item"] = true;
|
|
|
+ this.selectedModel.directLogistic = this._overrideDirectLogistic(res[0]);
|
|
|
+ break;
|
|
|
+ case "system":
|
|
|
+ this.selectedModel.system = res;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ this.$set(this.audit,type,false);
|
|
|
+ $("#auditOrRecover").modal("hide");
|
|
|
+ return (isAudit ? '审核' : '恢复')+"成功!";
|
|
|
+ },true)
|
|
|
},
|
|
|
//增加数量区间
|
|
|
addStoreAmount(){
|
|
|
@@ -2018,47 +2032,603 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- getPriceModelAudit(type){
|
|
|
+ getPriceModelAudit(type,isAudit){
|
|
|
+ this.showAuditPiece = {
|
|
|
+ "C":false,"D":false,"U":false
|
|
|
+ };
|
|
|
+ this.auditList[type] = {};
|
|
|
let url="{{url('maintenance/priceModel/getPriceModelAudit')}}";
|
|
|
+ this.comparisonTemp = {};
|
|
|
switch (type) {
|
|
|
case "storage":
|
|
|
- window.tempTip.postBasicRequest(url,{type:type},res=>{
|
|
|
- this._AuditComparisonStorage(res);
|
|
|
+ window.tempTip.postBasicRequest(url,{type:type,owner_id:this.ownerTemp.id},res=>{
|
|
|
+ if (!res)return;
|
|
|
+ if (isAudit)for(let i=0;i<res.length;i++)this._AuditComparisonStorage(res[i],isAudit);
|
|
|
+ else for(let i=res.length-1;i>=0;i--)this._AuditComparisonStorage(res[i],isAudit);
|
|
|
});
|
|
|
break;
|
|
|
case "operation":
|
|
|
- window.tempTip.postBasicRequest(url,{type:type},res=>{
|
|
|
- this._AuditComparisonOperation(res);
|
|
|
+ window.tempTip.postBasicRequest(url,{type:type,owner_id:this.ownerTemp.id},res=>{
|
|
|
+ if (isAudit)for(let i=0;i<res.length;i++)this._AuditComparisonOperation(res[i],isAudit);
|
|
|
+ else for(let i=res.length-1;i>=0;i--)this._AuditComparisonOperation(res[i],isAudit);
|
|
|
});
|
|
|
break;
|
|
|
case "express":
|
|
|
- window.tempTip.postBasicRequest(url,{type:type},res=>{
|
|
|
- this._AuditComparisonExpress(res);
|
|
|
+ window.tempTip.postBasicRequest(url,{type:type,owner_id:this.ownerTemp.id},res=>{
|
|
|
+ if (isAudit)for(let i=0;i<res.length;i++)this._AuditComparisonExpress(res[i],isAudit);
|
|
|
+ else for(let i=res.length-1;i>=0;i--)this._AuditComparisonExpress(res[i],isAudit);
|
|
|
});
|
|
|
break;
|
|
|
case "logistic":
|
|
|
- window.tempTip.postBasicRequest(url,{type:type},res=>{
|
|
|
- this._AuditComparisonLogistic(res);
|
|
|
+ window.tempTip.postBasicRequest(url,{type:type,owner_id:this.ownerTemp.id},res=>{
|
|
|
+ if (isAudit)for(let i=0;i<res.length;i++)this._AuditComparisonLogistic(res[i],isAudit);
|
|
|
+ else for(let i=res.length-1;i>=0;i--)this._AuditComparisonLogistic(res[i],isAudit);
|
|
|
});
|
|
|
break;
|
|
|
case "directLogistic":
|
|
|
- window.tempTip.postBasicRequest(url,{type:type},res=>{
|
|
|
- this._AuditComparisonDirectLogistic(res);
|
|
|
+ window.tempTip.postBasicRequest(url,{type:type,owner_id:this.ownerTemp.id},res=>{
|
|
|
+ if (isAudit)for(let i=0;i<res.length;i++)this._AuditComparisonDirectLogistic(res[i],isAudit);
|
|
|
+ else for(let i=res.length-1;i>=0;i--)this._AuditComparisonDirectLogistic(res[i],isAudit);
|
|
|
});
|
|
|
break;
|
|
|
case "system":
|
|
|
- window.tempTip.postBasicRequest(url,{type:type},res=>{
|
|
|
- this._AuditComparisonSystem(res);
|
|
|
+ window.tempTip.postBasicRequest(url,{type:type,owner_id:this.ownerTemp.id},res=>{
|
|
|
+ if (isAudit)for(let i=0;i<res.length;i++)this._AuditComparisonSystem(res[i],isAudit);
|
|
|
+ else for(let i=res.length-1;i>=0;i--)this._AuditComparisonSystem(res[i],isAudit);
|
|
|
});
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
- _AuditComparisonStorage(){
|
|
|
- if (res){
|
|
|
- for(let i;i<res.length;i++){
|
|
|
+ _pushAuditList(model,type,data){
|
|
|
+ if (this.auditList[model][type]){
|
|
|
+ this.auditList[model][type].push(data);
|
|
|
+ }else{
|
|
|
+ this.showAuditPiece[type] = true;
|
|
|
+ this.auditList[model][type] = [data];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ _reverseAuditComparison(operation){
|
|
|
+ switch (operation) {
|
|
|
+ case "C":
|
|
|
+ return "D";
|
|
|
+ case "D":
|
|
|
+ return "C";
|
|
|
+ case "U":
|
|
|
+ return "";
|
|
|
+ default:
|
|
|
+ return "U";
|
|
|
+ }
|
|
|
+ },
|
|
|
+ _AuditComparisonStorage(data,isAudit){
|
|
|
+ if (!isAudit){
|
|
|
+ if (data.operation==='U' && data.target_id)this.comparisonTemp[data.target_id] = data.id;
|
|
|
+ data.operation = this._reverseAuditComparison(data.operation);
|
|
|
+ }
|
|
|
+ data.tax_rate_id = this.poolMapping.taxRates ? this.poolMapping.taxRates[data.tax_rate_id] : '';
|
|
|
+ data.time_unit_id = this.poolMapping.units ? this.poolMapping.units[data.time_unit_id] : '';
|
|
|
+ data.unit_id = this.poolMapping.units ? this.poolMapping.units[data.unit_id] : '';
|
|
|
+ switch (data.operation) {
|
|
|
+ case "C":
|
|
|
+ this._pushAuditList("storage","C",data);
|
|
|
+ break;
|
|
|
+ case "D":
|
|
|
+ this._pushAuditList("storage","D",data);
|
|
|
+ break;
|
|
|
+ case "U":
|
|
|
+ let result = this._formatComparisonData("storage",data);
|
|
|
+ if (result===null) this._pushAuditList("storage","C",data);
|
|
|
+ else this._pushAuditList("storage","U",result);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ if (!this.auditList.storage.H)this.auditList.storage.H = {};
|
|
|
+ this.auditList.storage.H[data.id] = data;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ _AuditComparisonOperation(data,isAudit){
|
|
|
+ if (!isAudit){
|
|
|
+ if (data.operation==='U' && data.target_id)this.comparisonTemp[data.target_id] = data.id;
|
|
|
+ data.operation = this._reverseAuditComparison(data.operation);
|
|
|
+ }
|
|
|
+ data.discount_count = data.discount_count ? data.discount_count.split(",") : [];
|
|
|
+ data.total_discount_price = data.total_discount_price ? data.total_discount_price.split(",") : [];
|
|
|
+ data.surcharge_unit_id = this.poolMapping.units ? this.poolMapping.units[data.surcharge_unit_id] : '';
|
|
|
+ data.tax_rate_id = this.poolMapping.taxRates ? this.poolMapping.taxRates[data.tax_rate_id] : '';
|
|
|
+ data.items.forEach((item,j)=>{
|
|
|
+ data.items[j].discount_price = data.items[j].discount_price ? data.items[j].discount_price.split(",") : [];
|
|
|
+ data.items[j].unit_id = this.poolMapping.units ? this.poolMapping.units[data.items[j].unit_id] : '';
|
|
|
+ });
|
|
|
+ switch (data.operation) {
|
|
|
+ case "C":
|
|
|
+ this._pushAuditList("operation","C",data);
|
|
|
+ break;
|
|
|
+ case "D":
|
|
|
+ this._pushAuditList("operation","D",data);
|
|
|
+ break;
|
|
|
+ case "U":
|
|
|
+ let result = this._formatComparisonData("operation",data);
|
|
|
+ if (result===null) this._pushAuditList("operation","C",data);
|
|
|
+ else this._pushAuditList("operation","U",result);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ if (!this.auditList.operation.H)this.auditList.operation.H = {};
|
|
|
+ this.auditList.operation.H[data.id] = data;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ _AuditComparisonExpress(data,isAudit){
|
|
|
+ if (!isAudit){
|
|
|
+ if (data.operation==='U' && data.target_id)this.comparisonTemp[data.target_id] = data.id;
|
|
|
+ data.operation = this._reverseAuditComparison(data.operation);
|
|
|
+ }
|
|
|
+ data.tax_rate_id = this.poolMapping.taxRates ? this.poolMapping.taxRates[data.tax_rate_id] : '';
|
|
|
+ data.logistics.forEach((logistic,j)=>{
|
|
|
+ data.logistics[j] = logistic.name;
|
|
|
+ });
|
|
|
+ data.details.forEach((detail,j)=>{
|
|
|
+ data.details[j].province_id = this.poolMapping.provinces ? this.poolMapping.provinces[data.details[j].province_id] : '';
|
|
|
+ });
|
|
|
+ switch (data.operation) {
|
|
|
+ case "C":
|
|
|
+ this._pushAuditList("express","C",data);
|
|
|
+ break;
|
|
|
+ case "D":
|
|
|
+ this._pushAuditList("express","D",data);
|
|
|
+ break;
|
|
|
+ case "U":
|
|
|
+ let result = this._formatComparisonData("express",data);
|
|
|
+ if (result===null) this._pushAuditList("express","C",data);
|
|
|
+ else this._pushAuditList("express","U",result);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ if (!this.auditList.express.H)this.auditList.express.H = {};
|
|
|
+ this.auditList.express.H[data.id] = data;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ _AuditComparisonLogistic(data,isAudit){
|
|
|
+ if (!isAudit){
|
|
|
+ if (data.operation==='U' && data.target_id)this.comparisonTemp[data.target_id] = data.id;
|
|
|
+ data.operation = this._reverseAuditComparison(data.operation);
|
|
|
+ }
|
|
|
+ data.tax_rate_id = this.poolMapping.taxRates ? this.poolMapping.taxRates[data.tax_rate_id] : '';
|
|
|
+ data.logistics.forEach((logistic,j)=>{
|
|
|
+ data.logistics[j] = logistic.name;
|
|
|
+ });
|
|
|
+ data.other_unit_id = this.poolMapping.units ? this.poolMapping.units[data.other_unit_id] : '';
|
|
|
+ data.unit_id = this.poolMapping.units ? this.poolMapping.units[data.unit_id] : '';
|
|
|
+ data.unit_range = data.unit_range ? data.unit_range.split(",") : [];
|
|
|
+ data.other_unit_range = data.other_unit_range ? data.other_unit_range.split(",") : [];
|
|
|
+ data.details.forEach((detail,j)=>{
|
|
|
+ data.details[j].province_id = this.poolMapping.provinces ? this.poolMapping.provinces[data.details[j].province_id] : '';
|
|
|
+ data.details[j].city_id = this.poolMapping.cities ? this.poolMapping.cities[data.details[j].city_id] : '';
|
|
|
+ data.details[j].unit_id = this.poolMapping.units ? this.poolMapping.units[data.details[j].unit_id] : '';
|
|
|
+ });
|
|
|
+ switch (data.operation) {
|
|
|
+ case "C":
|
|
|
+ this._pushAuditList("logistic","C",data);
|
|
|
+ break;
|
|
|
+ case "D":
|
|
|
+ this._pushAuditList("logistic","D",data);
|
|
|
+ break;
|
|
|
+ case "U":
|
|
|
+ let result = this._formatComparisonData("logistic",data);
|
|
|
+ if (result===null) this._pushAuditList("logistic","C",data);
|
|
|
+ else this._pushAuditList("logistic","U",result);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ if (!this.auditList.logistic.H)this.auditList.logistic.H = {};
|
|
|
+ this.auditList.logistic.H[data.id] = data;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ _AuditComparisonDirectLogistic(data,isAudit){
|
|
|
+ if (!isAudit){
|
|
|
+ if (data.operation==='U' && data.target_id)this.comparisonTemp[data.target_id] = data.id;
|
|
|
+ data.operation = this._reverseAuditComparison(data.operation);
|
|
|
+ }
|
|
|
+ data.tax_rate_id = this.poolMapping.taxRates ? this.poolMapping.taxRates[data.tax_rate_id] : '';
|
|
|
+ data.details.forEach((detail,j)=>{
|
|
|
+ data.details[j].car_type_id = this.poolMapping.cars ? this.poolMapping.cars[data.details[j].car_type_id] : '';
|
|
|
+ });
|
|
|
+ switch (data.operation) {
|
|
|
+ case "C":
|
|
|
+ this._pushAuditList("directLogistic","C",data);
|
|
|
+ break;
|
|
|
+ case "D":
|
|
|
+ this._pushAuditList("directLogistic","D",data);
|
|
|
+ break;
|
|
|
+ case "U":
|
|
|
+ let result = this._formatComparisonData("directLogistic",data);
|
|
|
+ if (result===null) this._pushAuditList("directLogistic","C",data);
|
|
|
+ else this._pushAuditList("directLogistic","U",result);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ if (!this.auditList.directLogistic.H)this.auditList.directLogistic.H = {};
|
|
|
+ this.auditList.directLogistic.H[data.id] = data;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ _AuditComparisonSystem(data,isAudit){
|
|
|
+ if (!isAudit){
|
|
|
+ if (data.operation==='U' && data.target_id)this.comparisonTemp[data.target_id] = data.id;
|
|
|
+ data.operation = this._reverseAuditComparison(data.operation);
|
|
|
+ }
|
|
|
+ data.tax_rate_id = this.poolMapping.taxRates ? this.poolMapping.taxRates[data.tax_rate_id] : '';
|
|
|
+ switch (res[i].operation) {
|
|
|
+ case "C":
|
|
|
+ this.auditList.system.C = data;
|
|
|
+ this.showAuditPiece.C = true;
|
|
|
+ break;
|
|
|
+ case "D":
|
|
|
+ this.auditList.system.D = data;
|
|
|
+ this.showAuditPiece.D = true;
|
|
|
+ break;
|
|
|
+ case "U":
|
|
|
+ if (!this.auditList.system.H){
|
|
|
+ this.auditList.system.C = data;
|
|
|
+ this.showAuditPiece.C = true;
|
|
|
+ }else{
|
|
|
+ this.auditList.system.U = data;
|
|
|
+ this.showAuditPiece.U = true;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ this.auditList.system.H = data;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ _formatComparisonData(type,data){
|
|
|
+ let temp = {"name":"名称"};
|
|
|
+ let font = "<div class='float-left'><span class='float-left fa fa-arrow-right text-info ml-2 mr-2' style='margin-top: 0.25em'></span>";
|
|
|
+ let tar = null;
|
|
|
+ let itemTem;
|
|
|
+ let items;
|
|
|
+ let amount;
|
|
|
+ switch (type) {
|
|
|
+ case "storage":
|
|
|
+ tar = this.auditList.storage.H ? this.auditList.storage.H[data.target_id ? data.target_id : this.comparisonTemp[data.id]] : null;
|
|
|
+ if (!tar)return null;
|
|
|
+ for (let key in this.auditList.mapping.storage){
|
|
|
+ if (String(data[key])!==String(tar[key])){
|
|
|
+ if (!temp[key]) temp[key] = this.auditList.mapping.storage[key];
|
|
|
+ data[key] = this.transformData(tar,key)+font+this.transformData(data,key,true)+"</div>";
|
|
|
+ }else data[key] = this.transformData(data,key);
|
|
|
+ }
|
|
|
+ if (String(data["price"])!==String(tar["price"]) && String(data["amount_interval"])===String(tar["amount_interval"])){
|
|
|
+ data["amount_interval"] = this.transformData(tar,"amount_interval")+font+this.transformData(data,"amount_interval",true)+"</div>";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "operation":
|
|
|
+ temp={"name":"名称",child:{strategy:"子策略"}};
|
|
|
+ itemTem = {};
|
|
|
+ items=[];
|
|
|
+ amount=0;
|
|
|
+ tar = this.auditList.operation.H ? this.auditList.operation.H[data.target_id ? data.target_id : this.comparisonTemp[data.id]] : '';
|
|
|
+ if (!tar)return null;
|
|
|
+ for (let key in this.auditList.mapping.operation){
|
|
|
+ if (String(data[key])!==String(tar[key])){
|
|
|
+ if (!temp[key]) temp[key] = this.auditList.mapping.operation[key];
|
|
|
+ data[key] = this.transformData(tar,key)+font+this.transformData(data,key,true)+"</div>";
|
|
|
+ }else data[key] = this.transformData(data,key);
|
|
|
+ }
|
|
|
+ tar.items.forEach(item=>{
|
|
|
+ if (!itemTem[item.strategy])itemTem[item.strategy] = [];
|
|
|
+ itemTem[item.strategy].push(item);
|
|
|
+ });
|
|
|
+ data.items.forEach(item=>{
|
|
|
+ if (itemTem[item.strategy]){
|
|
|
+ let mark = true;
|
|
|
+ for (let i=0;i<itemTem[item.strategy].length;i++){
|
|
|
+ for (let key in this.auditList.mapping.operation.child){
|
|
|
+ let oldStr = itemTem[item.strategy][i][key];
|
|
|
+ let newStr = item[key];
|
|
|
+ if (String(newStr)!==String(oldStr)){
|
|
|
+ mark = false;break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (mark){
|
|
|
+ item.operation = "H";
|
|
|
+ itemTem[item.strategy].splice(i,1);
|
|
|
+ if (itemTem[item.strategy].length===0)itemTem[item.strategy] = null;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }//去重
|
|
|
+ });
|
|
|
+ data.items.forEach(item=>{
|
|
|
+ if (item.operation!=='H'){
|
|
|
+ if (!itemTem[item.strategy]){
|
|
|
+ for (let key in this.auditList.mapping.operation.child)item[key] = this.transformData(item,key);
|
|
|
+ item.operation = "C";
|
|
|
+ items.unshift(item);
|
|
|
+ amount++;
|
|
|
+ }else{
|
|
|
+ let tar = item.strategy;
|
|
|
+ for (let key in this.auditList.mapping.operation.child){
|
|
|
+ if (String(item[key])!==String(itemTem[tar][0][key])){
|
|
|
+ if (!temp.child[key]) temp.child[key] = this.auditList.mapping.operation.child[key];
|
|
|
+ item[key] = this.transformData(itemTem[tar][0],key)+font+this.transformData(item,key,true)+"</div>";
|
|
|
+ }else item[key] = this.transformData(item,key);
|
|
|
+ }
|
|
|
+ item.operation = "U";
|
|
|
+ items.push(item);
|
|
|
+ itemTem[tar].splice(0,1);
|
|
|
+ if (itemTem[tar].length===0) itemTem[tar] = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ for (let key in itemTem){
|
|
|
+ if (itemTem[key]){
|
|
|
+ itemTem[key].forEach(item=>{
|
|
|
+ for (let key in this.auditList.mapping.operation.child)item[key] = this.transformData(item,key);
|
|
|
+ item.operation = "D";
|
|
|
+ items.splice(amount,0,item);
|
|
|
+ amount++;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ data.items = items;
|
|
|
+ break;
|
|
|
+ case "express":
|
|
|
+ temp={"name":"名称",child:{province_id:"省"}};
|
|
|
+ itemTem={};
|
|
|
+ items=[];
|
|
|
+ amount=0;
|
|
|
+ tar = this.auditList.express.H ? this.auditList.express.H[data.target_id ? data.target_id : this.comparisonTemp[data.id]] : null;
|
|
|
+ if (!tar)return null;
|
|
|
+ for (let key in this.auditList.mapping.express) {
|
|
|
+ if (String(data[key]) !== String(tar[key])) {
|
|
|
+ if (!temp[key]) temp[key] = this.auditList.mapping.express[key];
|
|
|
+ data[key] = this.transformData(tar, key) + font + this.transformData(data, key, true) + "</div>";
|
|
|
+ } else data[key] = this.transformData(data, key);
|
|
|
+ if (String(data["amount_interval"])!==String(tar["amount_interval"]) && String(data["weight_interval"])===String(tar["weight_interval"])){
|
|
|
+ data["weight_interval"] = this.transformData(tar,"weight_interval")+font+this.transformData(data,"weight_interval",true)+"</div>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tar.details.forEach(item => {itemTem[item.province_id] = item;});
|
|
|
+ data.details.forEach(item=>{
|
|
|
+ if (!itemTem[item.province_id]){
|
|
|
+ for (let key in this.auditList.mapping.express.child)item[key] = this.transformData(item,key);
|
|
|
+ item.operation = "C";
|
|
|
+ items.unshift(item);
|
|
|
+ amount++;
|
|
|
+ }else{
|
|
|
+ let mark = true;
|
|
|
+ for (let key in this.auditList.mapping.express.child){
|
|
|
+ if (String(item[key])!==String(itemTem[item.province_id][key])){
|
|
|
+ mark = false;break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!mark){
|
|
|
+ let tar = item.province_id;
|
|
|
+ for (let key in this.auditList.mapping.express.child) {
|
|
|
+ if (String(item[key]) !== String(itemTem[tar][key])) {
|
|
|
+ if (!temp.child[key]) temp.child[key] = this.auditList.mapping.express.child[key];
|
|
|
+ item[key] = this.transformData(itemTem[tar], key) + font + this.transformData(item, key, true) + "</div>";
|
|
|
+ } else item[key] = this.transformData(item, key);
|
|
|
+ }
|
|
|
+ item.operation = "U";
|
|
|
+ items.push(item);
|
|
|
+ delete itemTem[tar];
|
|
|
+ }else delete itemTem[item.province_id];
|
|
|
|
|
|
+ }
|
|
|
+ });
|
|
|
+ for (let key in itemTem){
|
|
|
+ for (let k in this.auditList.mapping.express.child)itemTem[key][k] = this.transformData(itemTem[key],k);
|
|
|
+ itemTem[key].operation = "D";
|
|
|
+ items.splice(amount,0,itemTem[key]);
|
|
|
+ amount++;
|
|
|
+ }
|
|
|
+ data.details = items;
|
|
|
+ break;
|
|
|
+ case "logistic":
|
|
|
+ temp={name:"名称",child:{province_id:"省份",city_id:"城市"}};
|
|
|
+ tar = this.auditList.logistic.H ? this.auditList.logistic.H[data.target_id ? data.target_id : this.comparisonTemp[data.id]] : '';
|
|
|
+ if (!tar)return null;
|
|
|
+ for (let key in this.auditList.mapping.logistic) {
|
|
|
+ if (String(data[key]) !== String(tar[key])) {
|
|
|
+ if (!temp[key]) temp[key] = this.auditList.mapping.logistic[key];
|
|
|
+ data[key] = this.transformData(tar, key) + font + this.transformData(data, key, true) + "</div>";
|
|
|
+ } else data[key] = this.transformData(data, key);
|
|
|
+ }
|
|
|
+ itemTem = this.logisticDataFormat(tar);
|
|
|
+ let dataTem = this.logisticDataFormat(data);
|
|
|
+ items = [];
|
|
|
+ for (let key in itemTem){
|
|
|
+ if (dataTem[key]){
|
|
|
+ for (let key2 in itemTem[key]){
|
|
|
+ if (dataTem[key][key2]){
|
|
|
+ for (let key3 in itemTem[key][key2]){
|
|
|
+ if (dataTem[key][key2][key3]){
|
|
|
+ for (let key4 in itemTem[key][key2][key3]){
|
|
|
+ if (dataTem[key][key2][key3][key4]){
|
|
|
+ let mark = true;
|
|
|
+ for (let key5 in this.auditList.mapping.logistic.child){
|
|
|
+ if (String(dataTem[key][key2][key3][key4][key5]) !== String(itemTem[key][key2][key3][key4][key5])){
|
|
|
+ if (!temp.child[key5]) temp.child[key5] = this.auditList.mapping.logistic.child[key5];
|
|
|
+ mark=false;
|
|
|
+ if (!temp.child[key5]) temp.child[key5] = this.auditList.mapping.logistic.child[key5];
|
|
|
+ dataTem[key][key2][key3][key4][key5] = this.transformData(itemTem[key][key2][key3][key4], key5) + font + this.transformData(dataTem[key][key2][key3][key4], key5, true) + "</div>";
|
|
|
+ } else dataTem[key][key2][key3][key4][key5] = this.transformData(dataTem[key][key2][key3][key4], key5);
|
|
|
+ }
|
|
|
+ if (!mark){
|
|
|
+ dataTem[key][key2][key3][key4].operation = "U";
|
|
|
+ items.push(dataTem[key][key2][key3][key4])
|
|
|
+ }
|
|
|
+ delete dataTem[key][key2][key3][key4];
|
|
|
+ delete itemTem[key][key2][key3][key4];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dataTem = this.logisticDataRestore(dataTem,"C");
|
|
|
+ dataTem.push.apply(dataTem,this.logisticDataRestore(itemTem,"D"));
|
|
|
+ dataTem.push.apply(dataTem,items);
|
|
|
+ data.details = dataTem;
|
|
|
+ break;
|
|
|
+ case "directLogistic":
|
|
|
+ temp={name:"名称",child:{car_type_id:"车型"}};
|
|
|
+ itemTem={};
|
|
|
+ items=[];
|
|
|
+ amount=0;
|
|
|
+ tar = this.auditList.directLogistic.H ? this.auditList.directLogistic.H[data.target_id ? data.target_id : this.comparisonTemp[data.id]] : '';
|
|
|
+ if (!tar)return null;
|
|
|
+ for (let key in this.auditList.mapping.directLogistic) {
|
|
|
+ if (String(data[key]) !== String(tar[key])) {
|
|
|
+ if (!temp[key]) temp[key] = this.auditList.mapping.directLogistic[key];
|
|
|
+ data[key] = this.transformData(tar, key) + font + this.transformData(data, key, true) + "</div>";
|
|
|
+ } else data[key] = this.transformData(data, key);
|
|
|
+ }
|
|
|
+ tar.details.forEach(item => {itemTem[item.car_type_id] = item;});
|
|
|
+ data.details.forEach(item => {
|
|
|
+ if (itemTem[item.car_type_id]){
|
|
|
+ let car = item.car_type_id;
|
|
|
+ let mark = true;
|
|
|
+ for (let key in this.auditList.mapping.directLogistic.child) {
|
|
|
+ if (String(item[key]) !== String(itemTem[car][key])) {
|
|
|
+ mark = false;
|
|
|
+ if (!temp.child[key]) temp.child[key] = this.auditList.mapping.directLogistic.child[key];
|
|
|
+ item[key] = this.transformData(itemTem[car], key) + font + this.transformData(item, key, true) + "</div>";
|
|
|
+ } else item[key] = this.transformData(item, key);
|
|
|
+ }
|
|
|
+ if (!mark){
|
|
|
+ item.operation = "U";
|
|
|
+ items.push(item);
|
|
|
+ }
|
|
|
+ delete itemTem[car];
|
|
|
+ }else{
|
|
|
+ item.operation = "C";
|
|
|
+ items.unshift(item);
|
|
|
+ amount++;
|
|
|
+ }
|
|
|
+ for (let key in itemTem){
|
|
|
+ for (let k in this.auditList.mapping.directLogistic.child)itemTem[key][k] = this.transformData(itemTem[key],k);
|
|
|
+ itemTem[key].operation = "D";
|
|
|
+ items.splice(amount,0,itemTem[key]);
|
|
|
+ amount++;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ data.details = items;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ this.auditList.mapping[type] = temp;
|
|
|
+ return data;
|
|
|
+ },
|
|
|
+ transformData(data,key,font=false){
|
|
|
+ if (!data[key])return;
|
|
|
+ let html = '<div class="float-left small ';
|
|
|
+ if (font)html += "text-primary font-weight-bold";
|
|
|
+ else html += "text-secondary";
|
|
|
+ html+='">';
|
|
|
+ switch (key) {
|
|
|
+ case "amount_interval":
|
|
|
+ data[key].forEach((am,i)=>{
|
|
|
+ if (i!==data[key].length-1) html += "<span>"+am+"-"+data[key][i+1]+"("+data["price"][i]+"元)<br></span>";
|
|
|
+ });
|
|
|
+ html += "<span>"+data[key][data[key].length-1]+" +("+data["price"][data[key].length-1]+"元)<br></span></div>";
|
|
|
+ return html;
|
|
|
+ case "total_discount_price":
|
|
|
+ data[key].forEach(am=>{
|
|
|
+ html += '<span>'+am+'元<br></span>'
|
|
|
+ });
|
|
|
+ return html+"</div>";
|
|
|
+ case "discount_price":
|
|
|
+ data[key].forEach(am=>{
|
|
|
+ html += '<span>'+am+'元<br></span>'
|
|
|
+ });
|
|
|
+ return html+"</div>";
|
|
|
+ case "discount_count":
|
|
|
+ data[key].forEach((am,i)=>{
|
|
|
+ if (i!==data[key].length-1)html += '<span>'+am+'-'+data[key][i+1]+'<br></span>'
|
|
|
+ });
|
|
|
+ html += '<span>'+data[key][data[key].length-1]+' +<br></span>';
|
|
|
+ return html+"</div>";
|
|
|
+ case "weight_interval":
|
|
|
+ data[key].forEach((arr,i)=>{
|
|
|
+ if (i!==data[key].length-1) html += '<span>'+data.amount_interval[i]+'-'+data.amount_interval[i+1]+'/单(';
|
|
|
+ arr.forEach((w,j)=>{
|
|
|
+ if (j!==arr.length-1)html += w+'-'+arr[j+1]+'/KG,';
|
|
|
+ });
|
|
|
+ html += (arr[arr.length-1] ? arr[arr.length-1] : 0)+' +/KG)<br></span>';
|
|
|
+ });
|
|
|
+ html += '<span>'+data.amount_interval[data.amount_interval.length-1]+' +/单(';
|
|
|
+ let arr = data.weight_interval[data.weight_interval.length-1];
|
|
|
+ arr.forEach((w,j)=>{
|
|
|
+ if (j!==arr.length-1)html += w+'-'+arr[j+1]+'/KG,';
|
|
|
+ });
|
|
|
+ html += (arr[arr.length-1] ? arr[arr.length-1] : 0)+' +/KG)<br></span>';
|
|
|
+ return html+"</div>";
|
|
|
+ case "initial_weight_price":
|
|
|
+ data[key].forEach(arr=>{
|
|
|
+ html += "<span class='small'>"+arr+"<br></span>";
|
|
|
+ });
|
|
|
+ return html+"</div>";
|
|
|
+ case "additional_weight_price":
|
|
|
+ data[key].forEach(arr=>{
|
|
|
+ html += "<span class='small'>"+arr+"<br></span>";
|
|
|
+ });
|
|
|
+ return html+"</div>";
|
|
|
+ case "unit_range":
|
|
|
+ data[key].forEach(r=>{
|
|
|
+ html += '<span class="small">'+r+'<br></span>';
|
|
|
+ });
|
|
|
+ return html+"</div>";
|
|
|
+ case "other_unit_range":
|
|
|
+ data[key].forEach(r=>{
|
|
|
+ html += '<span class="small">'+r+'<br></span>';
|
|
|
+ });
|
|
|
+ return html+"</div>";
|
|
|
+ }
|
|
|
+ return html+= data[key]+"</div>";
|
|
|
+ },
|
|
|
+ logisticDataFormat(tar){
|
|
|
+ let obj={};
|
|
|
+ tar.details.forEach(item => {
|
|
|
+ if (obj[item.province_id]){
|
|
|
+ if (obj[item.province_id][item.city_id]){
|
|
|
+ if (obj[item.province_id][item.city_id][item.unit_id]){
|
|
|
+ obj[item.province_id][item.city_id][item.unit_id][item.range] = item;
|
|
|
+ }else{
|
|
|
+ let arr1={};
|
|
|
+ arr1[item.range] = item;
|
|
|
+ obj[item.province_id][item.city_id][item.unit_id] = arr1;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ let arr1={};
|
|
|
+ arr1[item.range] = item;
|
|
|
+ let arr2={};
|
|
|
+ arr2[item.unit_id] = arr1;
|
|
|
+ obj[item.province_id][item.city_id] = arr2;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ let arr1={};
|
|
|
+ arr1[item.range] = item;
|
|
|
+ let arr2={};
|
|
|
+ arr2[item.unit_id] = arr1;
|
|
|
+ let arr3={};
|
|
|
+ arr3[item.city_id] = arr2;
|
|
|
+ obj[item.province_id] = arr3;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return obj;
|
|
|
+ },
|
|
|
+ logisticDataRestore(tar,type,items=[],count=0){
|
|
|
+ if (count===4){
|
|
|
+ tar["operation"] = type;
|
|
|
+ items.push(tar);
|
|
|
+ } else{
|
|
|
+ count++;
|
|
|
+ for (let key in tar){
|
|
|
+ this.logisticDataRestore(tar[key],type,items,count);
|
|
|
}
|
|
|
}
|
|
|
+ return items;
|
|
|
},
|
|
|
},
|
|
|
});
|