|
|
@@ -1,5 +1,5 @@
|
|
|
@extends('layouts.app')
|
|
|
-@section('title')项目编辑-客户管理@endsection
|
|
|
+@section('title')项目编辑-项目管理@endsection
|
|
|
@section("head")<link href="{{ mix('css/animation.css') }}" rel="stylesheet">@endsection
|
|
|
@section('content')
|
|
|
@component('customer.project.menu')
|
|
|
@@ -197,6 +197,7 @@
|
|
|
searchItem:{},//搜索子项集
|
|
|
searchBase:5,//搜索基数
|
|
|
hover:{},//可悬浮列表
|
|
|
+ audit:{},
|
|
|
},
|
|
|
mounted(){
|
|
|
let type = "{{$type ?? ''}}";
|
|
|
@@ -426,56 +427,76 @@
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
+ //重载作业费
|
|
|
+ _overrideOperation(operation){
|
|
|
+ if (operation.discount_count){
|
|
|
+ if (operation.discount_count) operation.discount_count = operation.discount_count.split(",");
|
|
|
+ if (operation.total_discount_price) operation.total_discount_price = operation.total_discount_price.split(",");
|
|
|
+ operation.isDiscount = true;
|
|
|
+ }
|
|
|
+ operation.items.forEach((item,j)=>{
|
|
|
+ if (item.discount_price) operation.items[j].discount_price = item.discount_price.split(",");
|
|
|
+ });
|
|
|
+ if (operation.total_price)operation.isSingle = true;
|
|
|
+ return operation;
|
|
|
+ },
|
|
|
+ //重载快递费
|
|
|
+ _overrideExpress(express){
|
|
|
+ express.logistics.forEach((logistic,j)=>{
|
|
|
+ express.logistics[j] = logistic.id;
|
|
|
+ });
|
|
|
+ return JSON.parse(JSON.stringify(express).replace(/details/g,"items"));
|
|
|
+ },
|
|
|
+ //重载物流费
|
|
|
+ _overrideLogistic(logistic){
|
|
|
+ logistic.logistics.forEach((l,j)=>{
|
|
|
+ logistic.logistics[j] = l.id;
|
|
|
+ });
|
|
|
+ return JSON.parse(JSON.stringify(logistic).replace(/details/g,"items"));
|
|
|
+ },
|
|
|
+ //重载直发费
|
|
|
+ _overrideDirectLogistic(directLogistic){
|
|
|
+ return JSON.parse(JSON.stringify(directLogistic).replace(/details/g,"items"));
|
|
|
+ },
|
|
|
//加载计费模型
|
|
|
_loadPriceModel(){
|
|
|
let url = "{{url('customer/project/getPriceModel')}}";
|
|
|
let params = {id:this.ownerTemp.id};
|
|
|
window.tempTip.postBasicRequest(url,params,res=>{
|
|
|
+ let audit = {};
|
|
|
+ if (res.storage_audit_count)audit.storage = true;
|
|
|
+ if (res.operation_audit_count)audit.operation = true;
|
|
|
+ if (res.express_audit_count)audit.express = true;
|
|
|
+ if (res.logistic_audit_count)audit.logistic = true;
|
|
|
+ if (res.direct_logistic_audit_count)audit.directLogistic = true;
|
|
|
+ this.audit = audit;
|
|
|
if (res.owner_storage_price_models.length>0)this.selectedModel.storage = res.owner_storage_price_models;
|
|
|
if (res.owner_price_operations.length>0){
|
|
|
this._loadOperation();
|
|
|
- res.owner_price_operations.forEach((operation,i)=>{
|
|
|
- if (operation.discount_count){
|
|
|
- if (operation.discount_count) res.owner_price_operations[i].discount_count = operation.discount_count.split(",");
|
|
|
- if (operation.total_discount_price) res.owner_price_operations[i].total_discount_price = operation.total_discount_price.split(",");
|
|
|
- operation.isDiscount = true;
|
|
|
- }
|
|
|
- operation.items.forEach((item,j)=>{
|
|
|
- if (item.discount_price) res.owner_price_operations[i].items[j].discount_price = item.discount_price.split(",");
|
|
|
- });
|
|
|
- if (operation.total_price)operation.isSingle = true;
|
|
|
- });
|
|
|
+ res.owner_price_operations.forEach(operation=>{operation = this._overrideOperation(operation);});
|
|
|
this.selectedModel.operation = res.owner_price_operations;
|
|
|
}
|
|
|
if (res.owner_price_expresses.length>0){
|
|
|
this._loadExpress();
|
|
|
res.owner_price_expresses.forEach((express,i)=>{
|
|
|
- express.logistics.forEach((logistic,j)=>{
|
|
|
- express.logistics[j] = logistic.id;
|
|
|
- });
|
|
|
- res.owner_price_expresses[i] = JSON.parse(JSON.stringify(express).replace(/details/g,"items"));
|
|
|
+ express = this._overrideExpress(express);
|
|
|
this.upList['express-item-'+i] = true;
|
|
|
});
|
|
|
this.selectedModel.express = res.owner_price_expresses;
|
|
|
}
|
|
|
if (res.owner_price_logistics.length>0){
|
|
|
if (res.owner_price_expresses.length===0)this._loadLogistic();
|
|
|
- else {
|
|
|
- this._getUnits();
|
|
|
- this._getCities();
|
|
|
- }
|
|
|
+ else {this._getUnits();this._getCities();}
|
|
|
res.owner_price_logistics.forEach((logistic,i)=>{
|
|
|
- logistic.logistics.forEach((l,j)=>{
|
|
|
- logistic.logistics[j] = l.id;
|
|
|
- });
|
|
|
- res.owner_price_logistics[i] = JSON.parse(JSON.stringify(logistic).replace(/details/g,"items"));
|
|
|
+ logistic = this._overrideLogistic(logistic);
|
|
|
this.upList['logistic-item-'+i] = true;
|
|
|
});
|
|
|
this.selectedModel.logistic = res.owner_price_logistics;
|
|
|
}
|
|
|
if (res.owner_price_direct_logistics.length>0){
|
|
|
+ this._loadDirectLogistic();
|
|
|
this.upList["directLogistic-item"] = true;
|
|
|
- this.selectedModel.directLogistic = JSON.parse(JSON.stringify(res.owner_price_direct_logistics[0]).replace(/details/g,"items"));
|
|
|
+ this.selectedModel.directLogistic = this._overrideDirectLogistic(res.owner_price_direct_logistics[0]);
|
|
|
}
|
|
|
setTimeout(()=> {
|
|
|
$(".up").slideUp();
|
|
|
@@ -605,8 +626,10 @@
|
|
|
this.errors = res.errors;
|
|
|
return;
|
|
|
}
|
|
|
- if (this.model.storage.id) this.selectedModel.storage[this.model.storage.index] = this.model.storage;
|
|
|
- else {
|
|
|
+ if (this.model.storage.id){
|
|
|
+ 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;
|
|
|
this.selectedModel.storage.unshift(this.model.storage);
|
|
|
}
|
|
|
@@ -622,6 +645,7 @@
|
|
|
time_unit_id : "",
|
|
|
};
|
|
|
this.errors = {};
|
|
|
+ this.audit.storage = true;
|
|
|
});
|
|
|
},
|
|
|
_verifyOperation() {
|
|
|
@@ -713,6 +737,7 @@
|
|
|
else this.selectedModel.operation.push(res);
|
|
|
this._resetOperation();
|
|
|
this.errors = {};
|
|
|
+ this.audit.operation = true;
|
|
|
});
|
|
|
},
|
|
|
_verifyOperationItem(itemIndex){//验证作业费子项信息完整
|
|
|
@@ -775,8 +800,10 @@
|
|
|
this.model.express.items.forEach((item,i)=>{
|
|
|
item.id = res.details[i].id;
|
|
|
});
|
|
|
- if (this.model.express.id) this.selectedModel.express[this.model.express.index] = this.model.express;
|
|
|
- else{
|
|
|
+ if (this.model.express.id){
|
|
|
+ if (res.operation) this.model.express.id = res.id;
|
|
|
+ this.selectedModel.express[this.model.express.index] = this.model.express;
|
|
|
+ }else{
|
|
|
this.model.express.id = res.id;
|
|
|
this.selectedModel.express.unshift(this.model.express);
|
|
|
}
|
|
|
@@ -790,6 +817,7 @@
|
|
|
this.errors = {};
|
|
|
this.importError = [];
|
|
|
$(".selectpicker").filter('.express').selectpicker('val',[]);
|
|
|
+ this.audit.express = true;
|
|
|
});
|
|
|
},
|
|
|
_verifyLogistic(){
|
|
|
@@ -815,8 +843,10 @@
|
|
|
this.model.logistic.items.forEach((item,i)=>{
|
|
|
item.id = res.details[i].id;
|
|
|
});
|
|
|
- if (this.model.logistic.id) this.selectedModel.logistic[this.model.logistic.index] = this.model.logistic;
|
|
|
- else {
|
|
|
+ if (this.model.logistic.id){
|
|
|
+ if (res.operation) this.model.logistic.id = res.id;
|
|
|
+ this.selectedModel.logistic[this.model.logistic.index] = this.model.logistic;
|
|
|
+ }else {
|
|
|
this.model.logistic.id = res.id;
|
|
|
this.selectedModel.logistic.unshift(this.model.logistic);
|
|
|
}
|
|
|
@@ -829,6 +859,7 @@
|
|
|
this.errors = {};
|
|
|
this.importError = [];
|
|
|
$(".selectpicker").filter('.logistic').selectpicker('val',[]);
|
|
|
+ this.audit.logistic = true;
|
|
|
});
|
|
|
},
|
|
|
_verifyDirectLogistic(){
|
|
|
@@ -857,6 +888,7 @@
|
|
|
};
|
|
|
this.errors = {};
|
|
|
this.importError = [];
|
|
|
+ this.audit.directLogistic = true;
|
|
|
});
|
|
|
},
|
|
|
//增加作业费特征子项
|
|
|
@@ -961,25 +993,6 @@
|
|
|
return "已更新特征";
|
|
|
},true);
|
|
|
},
|
|
|
- /*//渲染作业费子项
|
|
|
- _renderingOperationItem(index){
|
|
|
- let domId = "operation-"+index;
|
|
|
- let trId = "operation-tr-"+index;
|
|
|
- let itemId = "operation-item-"+index;
|
|
|
- let html = "<tr class='d-none' id='"+trId+"'><td></td><td colspan='5'>"+
|
|
|
- "<div id='"+itemId+"'><table class='table table-sm'>"+
|
|
|
- "<th>子策略</th><th>数量</th><th>单位</th><th>单价</th><th>特征</th></th>";
|
|
|
- this.selectedModel.operation[index].items.forEach(item=> {
|
|
|
- html = this._createOperationItemList(html,item.strategy,item.amount,this.poolMapping.units[item.unit_id],item.unit_price,item.featureFormat ? item.featureFormat : '');
|
|
|
- });
|
|
|
- html += "</table></div></td></tr>";
|
|
|
- $("#"+domId).after(html);
|
|
|
- $("#"+itemId).slideUp();
|
|
|
- },
|
|
|
- _createOperationItemList(html,strategy,amount,unit,unit_price,feature){
|
|
|
- html += "<tr><td>"+strategy+"</td><td>"+amount+"</td><td>"+unit+"</td><td>"+unit_price+"</td><td><div class='text-overflow-warp-100'>"+feature+"</div></td></tr>";
|
|
|
- return html;
|
|
|
- },*/
|
|
|
//移入移出时更改长文本显示效果
|
|
|
textClass(event,isOver){
|
|
|
event = event.target.children[0];
|
|
|
@@ -1022,14 +1035,14 @@
|
|
|
//导入快递子项
|
|
|
importExpress(e){
|
|
|
let file=e.target.files[0];
|
|
|
+ window.tempTip.setDuration(3000);
|
|
|
if (!file){
|
|
|
- tempTip.setDuration(3000);
|
|
|
- tempTip.show("未选择文件");
|
|
|
+ window.tempTip.show("未选择文件");
|
|
|
return;
|
|
|
}
|
|
|
let formData = new FormData();
|
|
|
formData.append("file",file);
|
|
|
- axios.post('{{url('maintenance/priceModel/express/import')}}',formData,{
|
|
|
+ window.axios.post('{{url('maintenance/priceModel/express/import')}}',formData,{
|
|
|
'Content-Type':'multipart/form-data'
|
|
|
}).then(res=>{
|
|
|
if (res.data.success) {
|
|
|
@@ -1041,15 +1054,13 @@
|
|
|
if (unique)this.model.express.items.push(data);
|
|
|
});
|
|
|
this.importError = res.data.errors;
|
|
|
- tempTip.setDuration(3000);
|
|
|
- tempTip.showSuccess("导入成功!");
|
|
|
+ window.tempTip.setDuration(2000);
|
|
|
+ window.tempTip.showSuccess("导入成功!");
|
|
|
return;
|
|
|
}
|
|
|
- tempTip.setDuration(3000);
|
|
|
- tempTip.show(res.data.data);
|
|
|
+ window.tempTip.show(res.data.data);
|
|
|
}).catch(err=> {
|
|
|
- tempTip.setDuration(3000);
|
|
|
- tempTip.show("网络错误:"+err);
|
|
|
+ window.tempTip.show("网络错误:"+err);
|
|
|
})
|
|
|
},
|
|
|
//物流详情列表modal
|
|
|
@@ -1391,6 +1402,7 @@
|
|
|
window.tempTip.confirm("您确定要删除仓储计费“"+item.name+"”吗?",()=>{
|
|
|
window.tempTip.postBasicRequest("{{url('maintenance/priceModel/apiDelStorage')}}",{id:item.id},res=>{
|
|
|
this.$delete(this.selectedModel.storage,index);
|
|
|
+ this.audit.storage = true;
|
|
|
return "删除“"+item.name+"”成功";
|
|
|
});
|
|
|
});
|
|
|
@@ -1400,6 +1412,7 @@
|
|
|
window.tempTip.confirm("您确定要删除作业计费“"+item.name+"”吗?",()=>{
|
|
|
window.tempTip.postBasicRequest("{{url('maintenance/priceModel/apiDelOperation')}}",{id:item.id},res=>{
|
|
|
this.$delete(this.selectedModel.operation,index);
|
|
|
+ this.audit.operation = true;
|
|
|
return "删除“"+item.name+"”成功";
|
|
|
});
|
|
|
});
|
|
|
@@ -1408,7 +1421,9 @@
|
|
|
deleteOperationItem(item,index,parentIndex){
|
|
|
window.tempTip.confirm("您确定要删除该作业子项吗?",()=>{
|
|
|
window.tempTip.postBasicRequest("{{url('maintenance/priceModel/apiDelOperationItem')}}",{id:item.id},res=>{
|
|
|
- this.$delete(this.selectedModel.operation[parentIndex].items,index);
|
|
|
+ if (res) this.$set(this.selectedModel.operation,parentIndex,this._overrideOperation(res));
|
|
|
+ else this.$delete(this.selectedModel.operation[parentIndex].items,index);
|
|
|
+ this.audit.operation = true;
|
|
|
return "删除成功";
|
|
|
});
|
|
|
});
|
|
|
@@ -1418,6 +1433,7 @@
|
|
|
window.tempTip.confirm("您确定要删除该快递计费“"+item.name+"”吗?",()=>{
|
|
|
window.tempTip.postBasicRequest("{{url('maintenance/priceModel/apiDelExpress')}}",{id:item.id},res=>{
|
|
|
this.$delete(this.selectedModel.express,index);
|
|
|
+ this.audit.express = true;
|
|
|
return "删除“"+item.name+"”成功";
|
|
|
});
|
|
|
});
|
|
|
@@ -1426,7 +1442,9 @@
|
|
|
deleteExpressItem(item,index,parentIndex){
|
|
|
window.tempTip.confirm("您确定要删除该快递计费子项吗?",()=>{
|
|
|
window.tempTip.postBasicRequest("{{url('maintenance/priceModel/apiDelExpressItem')}}",{id:item.id},res=>{
|
|
|
- this.$delete(this.selectedModel.express[parentIndex].items,index);
|
|
|
+ if (res) this.$set(this.selectedModel.express,parentIndex,this._overrideExpress(res));
|
|
|
+ else this.$delete(this.selectedModel.express[parentIndex].items,index);
|
|
|
+ this.audit.express = true;
|
|
|
return "删除成功";
|
|
|
});
|
|
|
});
|
|
|
@@ -1436,6 +1454,7 @@
|
|
|
window.tempTip.confirm("您确定要删除该物流计费“"+item.name+"”吗?",()=>{
|
|
|
window.tempTip.postBasicRequest("{{url('maintenance/priceModel/apiDelLogistic')}}",{id:item.id},res=>{
|
|
|
this.$delete(this.selectedModel.logistic,index);
|
|
|
+ this.audit.logistic = true;
|
|
|
return "删除“"+item.name+"”成功";
|
|
|
});
|
|
|
});
|
|
|
@@ -1444,7 +1463,9 @@
|
|
|
deleteLogisticItem(item,index,parentIndex){
|
|
|
window.tempTip.confirm("您确定要删除该物流计费子项吗?",()=>{
|
|
|
window.tempTip.postBasicRequest("{{url('maintenance/priceModel/apiDelLogisticItem')}}",{id:item.id},res=>{
|
|
|
- this.$delete(this.selectedModel.logistic[parentIndex].items,index);
|
|
|
+ if (res) this.$set(this.selectedModel.logistic,parentIndex,this._overrideLogistic(res));
|
|
|
+ else this.$delete(this.selectedModel.logistic[parentIndex].items,index);
|
|
|
+ this.audit.logistic = true;
|
|
|
return "删除成功";
|
|
|
});
|
|
|
});
|
|
|
@@ -1454,6 +1475,7 @@
|
|
|
window.tempTip.confirm("您确定要删除该直发车计费“"+item.name+"”吗?",()=>{
|
|
|
window.tempTip.postBasicRequest("{{url('maintenance/priceModel/apiDelDirectLogistic')}}",{id:item.id},res=>{
|
|
|
this.selectedModel.directLogistic = {};
|
|
|
+ this.audit.directLogistic = true;
|
|
|
return "删除“"+item.name+"”成功";
|
|
|
});
|
|
|
});
|
|
|
@@ -1462,7 +1484,9 @@
|
|
|
deleteDirectLogisticItem(item,index){
|
|
|
window.tempTip.confirm("您确定要删除该直发车计费子项吗?",()=>{
|
|
|
window.tempTip.postBasicRequest("{{url('maintenance/priceModel/apiDelDirectLogisticItem')}}",{id:item.id},res=>{
|
|
|
- this.$delete(this.selectedModel.directLogistic.items,index);
|
|
|
+ if (res) this.$set(this.selectedModel,"directLogistic",this._overrideDirectLogistic(res));
|
|
|
+ else this.$delete(this.selectedModel.directLogistic.items,index);
|
|
|
+ this.audit.directLogistic = true;
|
|
|
return "删除成功";
|
|
|
});
|
|
|
});
|
|
|
@@ -1566,6 +1590,47 @@
|
|
|
this.$delete(this.model.operation.total_discount_price,index);
|
|
|
this.$delete(this.model.operation.discount_count,index);
|
|
|
},
|
|
|
+ //审核或恢复
|
|
|
+ auditOrRecoverModel(type,isAudit = true){
|
|
|
+ let url = "{{url('maintenance/priceModel/auditOrRecoverModel')}}";
|
|
|
+ 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=>{operation = this._overrideOperation(operation);});
|
|
|
+ this.selectedModel.operation = res;
|
|
|
+ break;
|
|
|
+ case "express":
|
|
|
+ this._loadExpress();
|
|
|
+ res.forEach((express,i)=>{
|
|
|
+ express = this._overrideExpress(express);
|
|
|
+ this.upList['express-item-'+i] = true;
|
|
|
+ });
|
|
|
+ this.selectedModel.express = res;
|
|
|
+ break;
|
|
|
+ case "logistic":
|
|
|
+ this._loadLogistic();
|
|
|
+ res.forEach((logistic,i)=>{
|
|
|
+ logistic = 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;
|
|
|
+ }
|
|
|
+ this.$set(this.audit,type,false);
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
},
|
|
|
});
|
|
|
</script>
|