|
@@ -16,6 +16,13 @@
|
|
|
const invoiceFormRef=ref(null)
|
|
|
// 到款记录表单
|
|
|
const placementFormRef=ref(null)
|
|
|
+
|
|
|
+ const contractSourceArray=['非CRM合同导入','CRM合同导入']
|
|
|
+ const contractStatusArray=[{id:1,label:"已审批"},{id:2,label:"单章寄回"},{id:3,label:"已签回"}]
|
|
|
+ const contractTypeArray=[{id:1,label:"新签"},{id:2,label:"续约"}]
|
|
|
+ const operationType=[{op_type:1,label:"合规登记"},{op_type:2,label:"开票登记"},{op_type:3,label:"到款登记"},
|
|
|
+ {op_type:4,label:"修改合同状态"},{op_type:5,label:"删除合同登记"}]
|
|
|
+
|
|
|
// 合同信息
|
|
|
const contractInfo=reactive({
|
|
|
/*
|
|
@@ -134,22 +141,21 @@
|
|
|
],
|
|
|
rowErrorShow:''
|
|
|
})
|
|
|
-
|
|
|
+ // 查看套餐报价单 图片
|
|
|
const previewImage=ref('')
|
|
|
+ // 查看套餐报价单 标题
|
|
|
const previewImageTitle=ref('')
|
|
|
+// -----------------------------监听
|
|
|
+ // 已开票金额
|
|
|
watch(()=> contractInfo.moneyData.haveInvoiceMoney ,(newValue)=>{
|
|
|
contractInfo.moneyData.waitInvoiceMoney = contractInfo.moneyData.allInvoiceMoney-newValue
|
|
|
contractInfo.moneyData.waitInvoiceMoney=Math.round(contractInfo.moneyData.waitInvoiceMoney*100)/100
|
|
|
})
|
|
|
+ // 已到款金额
|
|
|
watch(()=> contractInfo.moneyData.havePlacementMoney ,(newValue)=>{
|
|
|
contractInfo.moneyData.waitPlacementMoney = contractInfo.moneyData.allPlacementMoney-newValue
|
|
|
contractInfo.moneyData.waitPlacementMoney=Math.round(contractInfo.moneyData.waitPlacementMoney*100)/100
|
|
|
})
|
|
|
- const contractSourceArray=['非CRM合同导入','CRM合同导入']
|
|
|
- const contractStatusArray=[{id:1,label:"已审批"},{id:2,label:"单章寄回"},{id:3,label:"已签回"}]
|
|
|
- const contractTypeArray=[{id:1,label:"新签"},{id:2,label:"续约"}]
|
|
|
- const operationType=[{op_type:1,label:"合规登记"},{op_type:2,label:"开票登记"},{op_type:3,label:"到款登记"},
|
|
|
- {op_type:4,label:"修改合同状态"},{op_type:5,label:"删除合同登记"}]
|
|
|
// -----------------------method
|
|
|
// 权限验证
|
|
|
const permissionValidation=()=>{
|
|
@@ -180,14 +186,15 @@
|
|
|
messageHint.close()
|
|
|
router.back()
|
|
|
},1000)
|
|
|
+ return false
|
|
|
}
|
|
|
}
|
|
|
+ return true
|
|
|
}
|
|
|
//获取销售列表
|
|
|
const getSellerListFun=()=>{
|
|
|
getSellerList().then(res=>{
|
|
|
contractInfo.sellerList=res.data || []
|
|
|
- // console.log(contractInfo.sellerList);
|
|
|
})
|
|
|
}
|
|
|
// 获取服务列表
|
|
@@ -227,6 +234,7 @@
|
|
|
}
|
|
|
contractInfo.contractValidityDate=[]
|
|
|
setTimeout(()=>{
|
|
|
+ // 去除错误信息
|
|
|
contractInfoForm.value && contractInfoForm.value.clearValidate()
|
|
|
},0)
|
|
|
}
|
|
@@ -312,108 +320,78 @@
|
|
|
}
|
|
|
// 表格删除行
|
|
|
const deleteRow=(type,index)=>{
|
|
|
+ let tempArr=[]
|
|
|
if(type=='invoice'){
|
|
|
- if(invoiceForm.invoiceData[index].amount=='' && invoiceForm.invoiceData[index].invoice_date==''){
|
|
|
- // 没有内容 直接删除
|
|
|
- invoiceForm.invoiceData.splice(index,1)
|
|
|
- }else{
|
|
|
- ElMessageBox.confirm('删除后不可恢复,是否删除该条开票记录?',
|
|
|
- '提示',
|
|
|
- {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- }).then(res=>{
|
|
|
- // 有金额才进行删除后的运算
|
|
|
- if(invoiceForm.invoiceData[index].amount!=''){
|
|
|
- invoiceForm.invoiceData.splice(index,1)
|
|
|
- let money=0
|
|
|
- invoiceForm.invoiceData.map(item =>{
|
|
|
- money+=parseFloat(item.amount) || 0
|
|
|
- // console.log(money);
|
|
|
- })
|
|
|
- // 保留两位小数、防止计算时精度丢失
|
|
|
- money=Math.round(money*100)/100
|
|
|
+ tempArr=invoiceForm.invoiceData
|
|
|
+ }else{
|
|
|
+ tempArr=placementForm.placementData
|
|
|
+ }
|
|
|
+ if(tempArr[index].amount=='' && tempArr[index].invoice_date==''){
|
|
|
+ // 没有内容 直接删除
|
|
|
+ tempArr.splice(index,1)
|
|
|
+ }else{
|
|
|
+ ElMessageBox.confirm('删除后不可恢复,是否删除该条开票记录?',
|
|
|
+ '提示',
|
|
|
+ {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }).then(res=>{
|
|
|
+ // 有金额才进行删除后的运算
|
|
|
+ if(tempArr[index].amount!=''){
|
|
|
+ tempArr.splice(index,1)
|
|
|
+ tempArr.map(item =>{
|
|
|
+ money+=parseFloat(item.amount) || 0
|
|
|
+ // console.log(money);
|
|
|
+ })
|
|
|
+ let money=0
|
|
|
+ // 保留两位小数、防止计算时精度丢失
|
|
|
+ money=Math.round(money*100)/100
|
|
|
+ if(type=='invoice'){
|
|
|
contractInfo.moneyData.haveInvoiceMoney=money
|
|
|
}else{
|
|
|
- invoiceForm.invoiceData.splice(index,1)
|
|
|
- }
|
|
|
- }).catch(()=>{})
|
|
|
- }
|
|
|
- }else{
|
|
|
- if(placementForm.placementData[index].amount=='' && placementForm.placementData[index].invoice_date==''){
|
|
|
- // 没有内容 直接删除
|
|
|
- placementForm.placementData.splice(index,1)
|
|
|
- }else{
|
|
|
- ElMessageBox.confirm('删除后不可恢复,是否删除该条到款记录?',
|
|
|
- '提示',
|
|
|
- {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- }).then(res=>{
|
|
|
- // 有金额才进行删除后的运算
|
|
|
- if(placementForm.placementData[index].amount!=''){
|
|
|
- placementForm.placementData.splice(index,1)
|
|
|
- let money=0
|
|
|
- placementForm.placementData.map(item =>{
|
|
|
- money+=parseFloat(item.amount) || 0
|
|
|
- // console.log(money);
|
|
|
- })
|
|
|
- // 保留两位小数、防止计算时精度丢失
|
|
|
- money=Math.round(money*100)/100
|
|
|
contractInfo.moneyData.havePlacementMoney=money
|
|
|
- }else{
|
|
|
- placementForm.placementData.splice(index,1)
|
|
|
}
|
|
|
- }).catch(()=>{})
|
|
|
- }
|
|
|
+ }else{
|
|
|
+ tempArr.splice(index,1)
|
|
|
+ }
|
|
|
+ }).catch(()=>{})
|
|
|
}
|
|
|
}
|
|
|
// 金额改变
|
|
|
const moneyChange=(type,value,index)=>{
|
|
|
// console.log(value);
|
|
|
let numerValue=parseFloat(value)
|
|
|
+ let tempArr=[]
|
|
|
if(type=='invoice'){
|
|
|
- if(!numerValue&&numerValue!=0&&value){
|
|
|
- invoiceForm.invoiceData[index].amount=''
|
|
|
- ElMessage.error('请输入数字')
|
|
|
- return
|
|
|
- }
|
|
|
- // 如果输入不是 以.结尾&&只有一个.的话,就赋值为转为成数字后的值
|
|
|
- if(!(value.endsWith('.') && value.indexOf('.')==(value.length-1))&&numerValue){
|
|
|
- invoiceForm.invoiceData[index].amount=numerValue
|
|
|
- }
|
|
|
- // console.log(numerValue);
|
|
|
+ tempArr=invoiceForm.invoiceData
|
|
|
+ }else{
|
|
|
+ tempArr=placementForm.placementData
|
|
|
+ }
|
|
|
|
|
|
- let money=0
|
|
|
- invoiceForm.invoiceData.map(item =>{
|
|
|
- money+=parseFloat(item.amount) || 0
|
|
|
- })
|
|
|
- // 保留两位小数、防止计算时精度丢失
|
|
|
- money=Math.round(money*100)/100
|
|
|
+ if(!numerValue&&numerValue!=0&&value){
|
|
|
+ tempArr[index].amount=''
|
|
|
+ ElMessage.error('请输入数字')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 如果输入不是 以.结尾&&只有一个. 或者 不是零结尾的话,就赋值为转为成数字后的值
|
|
|
+ // 考虑到类似12.02的情况
|
|
|
+ if(!((value.endsWith('.') && value.indexOf('.')==(value.length-1)) ||
|
|
|
+ (value.endsWith('0') && value.indexOf('.')==(value.length-2)))&&numerValue){
|
|
|
+ tempArr[index].amount=numerValue
|
|
|
+ }
|
|
|
+ let money=0
|
|
|
+ tempArr.map(item =>{
|
|
|
+ money+=Math.round(item.amount*100)/100 || 0
|
|
|
+ })
|
|
|
+ // 保留两位小数、防止计算时精度丢失
|
|
|
+ money=Math.round(money*100)/100
|
|
|
+
|
|
|
+ if(type=='invoice'){
|
|
|
contractInfo.moneyData.haveInvoiceMoney=money
|
|
|
-
|
|
|
}else{
|
|
|
- if(!numerValue&&numerValue!=0&&value){
|
|
|
- placementForm.placementData[index].amount=''
|
|
|
- ElMessage.error('请输入数字')
|
|
|
- return
|
|
|
- }
|
|
|
- // 如果输入不是 以.结尾&&只有一个.的话,就赋值为转为成数字后的值
|
|
|
- if(!(value.endsWith('.') && value.indexOf('.')==(value.length-1))&&numerValue){
|
|
|
- placementForm.placementData[index].amount=numerValue
|
|
|
- }
|
|
|
-
|
|
|
- let money=0
|
|
|
- placementForm.placementData.map(item =>{
|
|
|
- money+=parseFloat(item.amount) || 0
|
|
|
- })
|
|
|
- // 保留两位小数、防止计算时精度丢失
|
|
|
- money=Math.round(money*100)/100
|
|
|
contractInfo.moneyData.havePlacementMoney=money
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
// 金额格式化,保留两位小数
|
|
|
const moneyFormatter=(money)=>{
|
|
@@ -561,10 +539,11 @@
|
|
|
contractInfo.form.contract_register_id = parseInt(route.query.complianceId) || ''
|
|
|
// complianceId没有,认为是合规登记
|
|
|
contractInfo.operationtype=contractInfo.form.contract_register_id?(route.query.type || 'compliance'):'compliance'
|
|
|
- permissionValidation()
|
|
|
-
|
|
|
- getSellerListFun()
|
|
|
- getServiceListFun()
|
|
|
+ if(permissionValidation()){
|
|
|
+ // 权限通过
|
|
|
+ getSellerListFun()
|
|
|
+ getServiceListFun()
|
|
|
+ }
|
|
|
|
|
|
if(contractInfo.form.contract_register_id){
|
|
|
//请求详情接口
|
|
@@ -608,6 +587,7 @@
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
+ // 到款
|
|
|
if(res.data.payment_list.length>0){
|
|
|
placementForm.placementData=[]
|
|
|
res.data.payment_list.map(item=>{
|
|
@@ -706,7 +686,7 @@
|
|
|
prop="start_date">
|
|
|
<el-date-picker type="daterange"
|
|
|
v-model="contractInfo.contractValidityDate" @change="contractValidityDateChane"
|
|
|
- start-placeholder="合同有效期-开始" range-separator="至" end-placeholder="合同有效期-结束" value-format="YYYY-MM-DD"
|
|
|
+ start-placeholder="开始日期" end-placeholder="结束日期" value-format="YYYY-MM-DD"
|
|
|
:clearable="false">
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|