|
|
@ -32,7 +32,7 @@ |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
<template #differencePrice="{row}"> |
|
|
|
<span :class="{'red-text':row.differencePrice!=0}">{{ Number(row.differencePrice).toFixed(5) }}</span> |
|
|
|
<span :class="{'red-text':row.differencePrice!=0}">{{ Number(row.differencePrice).toFixed(2) }}</span> |
|
|
|
</template> |
|
|
|
<template #action="{ row,$index }"> |
|
|
|
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
|
|
@ -53,19 +53,37 @@ |
|
|
|
:tableAllSchemas="SupplierinvoiceRequestDetail.allSchemas" |
|
|
|
:tableFormRules="SupplierinvoiceRequestDetailRules" |
|
|
|
:tableData="tableData" |
|
|
|
:sumFormDataByForm ="(formRef,formModel)=>{ |
|
|
|
const {taxRate=0,amount=0,taxAmount=0,adjustingTaxAmount=0} = formModel |
|
|
|
:sumFormDataByForm ="(formRef,formModel,tableData,formType)=>{ |
|
|
|
const {taxRate=0,amount=0,taxAmount=0,beforeTaxAmount=0,totalTaxAmount=0,discountAmount1=0,beforeTaxDiffAmount=0,taxAmountDiff=0} = formModel |
|
|
|
// 2、系统税额:每条数据的合同价格X可开票数量,计算结果取两位小数之后*税率的计算结果,再保留2位。所有子表数据再求和 |
|
|
|
let taxAmount_ = 0.00 |
|
|
|
if(formType=='update'){ // 编辑 |
|
|
|
taxAmount_ = taxAmount |
|
|
|
}else if(formType=='create'){ // 新增 |
|
|
|
taxAmount_ = tableData.reduce((prev, item) => prev + Number(Number(taxRate*0.01*Number(Number(item['singlePrice']*item['invoicableQuantity']).toFixed(2))).toFixed(2)),0) |
|
|
|
} |
|
|
|
console.log('sumFormDataByForm',tableData) |
|
|
|
console.log('taxAmount_',taxAmount_) |
|
|
|
|
|
|
|
if(tableData) |
|
|
|
formRef.value.setValues({ |
|
|
|
taxAmount:taxRate*amount*0.01, |
|
|
|
afterTaxAmount:amount+taxAmount |
|
|
|
taxAmount:taxAmount_, |
|
|
|
afterTaxAmount:amount+taxAmount, // 3、系统价税合计:系统未税金额+系统税额 |
|
|
|
adTaxAmount:beforeTaxAmount+totalTaxAmount, //6、价税合计金额:未税金额+税额 |
|
|
|
beforeTaxDiffAmount:beforeTaxAmount-amount-discountAmount1,//未税差额:未税金额-系统未税金额-折扣金额 |
|
|
|
taxAmountDiff:totalTaxAmount-taxAmount,// 税额差异:税额-系统税额 |
|
|
|
totalTaxDiffAmount:beforeTaxDiffAmount+taxAmountDiff // 价税合计差额=未税差额+税额差异 |
|
|
|
}) |
|
|
|
}" |
|
|
|
|
|
|
|
:sumFormDataByTableCustom ="(formRef,formModel,tableData)=>{ |
|
|
|
// 1、系统未税金额: 合同价格X可开票数量。每条数据的合同价格X可开票数量,计算结果取两位小数之后,求和 |
|
|
|
const sumObject = { |
|
|
|
amount:tableData.reduce((prev, item) => prev + (item['singlePrice']*item['invoicableQuantity']),0) |
|
|
|
amount:tableData.reduce((prev, item) => prev + Number(Number(item['singlePrice']*item['invoicableQuantity']).toFixed(2)),0) |
|
|
|
} |
|
|
|
formRef.value.setValues(sumObject) |
|
|
|
}" |
|
|
|
|
|
|
|
:apiUpdate="SupplierinvoiceRequestMainApi.updateSupplierinvoiceRequestMain" |
|
|
|
:apiCreate="SupplierinvoiceRequestMainApi.createSupplierinvoiceRequestMain" |
|
|
|
:isBusiness="true" |
|
|
@ -76,16 +94,26 @@ |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
@submitForm="submitForm" |
|
|
|
> |
|
|
|
<template #foorter> |
|
|
|
<!-- <template #foorter> |
|
|
|
<div style="text-align: left"> |
|
|
|
{{ basicFormFooter }} |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> --> |
|
|
|
<template v-slot="{row}"> |
|
|
|
<el-input :disabled="true" :class="{'is-red': row['singlePrice'] - row['purchasePrice'] > 0}" :modelValue="((row['singlePrice']) - (row['purchasePrice'])).toFixed(6)"/> |
|
|
|
<el-input :disabled="true" :class="{'is-red': row['singlePrice'] - row['purchasePrice'] > 0}" :modelValue="((row['singlePrice']) - (row['purchasePrice'])).toFixed(2)"/> |
|
|
|
</template> |
|
|
|
</BasicForm> |
|
|
|
|
|
|
|
<!-- 财务通过窗口 finance_mainPlanSub --> |
|
|
|
<BasicForm |
|
|
|
ref="formFinanceRef" |
|
|
|
:rules="SupplierinvoiceRequestFinanceRules" |
|
|
|
:formAllSchemas="SupplierinvoiceRequestFinance.allSchemas" |
|
|
|
:isBusiness="false" |
|
|
|
:footButttondata="undefined" |
|
|
|
@success="submitFormFinance" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
|
<Detail |
|
|
|
ref="detailRef" |
|
|
@ -137,7 +165,7 @@ |
|
|
|
:sumFormDataByForm ="(formRef,formModel)=>{ |
|
|
|
const {singlePrice=0,purchasePrice=0} = formModel |
|
|
|
formRef.value.setValues({ |
|
|
|
differencePrice:Number((Number(singlePrice)-Number(purchasePrice)).toFixed(6)) |
|
|
|
differencePrice:Number((Number(singlePrice)-Number(purchasePrice)).toFixed(2)) |
|
|
|
}) |
|
|
|
}" |
|
|
|
:isBasic="false" |
|
|
@ -183,7 +211,10 @@ |
|
|
|
import { SupplierinvoiceRequestMain, |
|
|
|
SupplierinvoiceRequestMainRules, |
|
|
|
SupplierinvoiceRequestDetail, |
|
|
|
SupplierinvoiceRequestDetailRules } from './supplierinvoiceRequestMain.data' |
|
|
|
SupplierinvoiceRequestDetailRules, |
|
|
|
SupplierinvoiceRequestFinance, |
|
|
|
SupplierinvoiceRequestFinanceRules |
|
|
|
} from './supplierinvoiceRequestMain.data' |
|
|
|
import * as SupplierinvoiceRequestMainApi from '@/api/wms/supplierinvoiceRequestMain' |
|
|
|
import * as SupplierinvoiceRequestDetailApi from '@/api/wms/supplierinvoiceRequestDetail' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
@ -251,16 +282,16 @@ const searchTableSuccessDetail = async (formField, searchField, val, formRef,sea |
|
|
|
detailRef.value.updateList() |
|
|
|
} |
|
|
|
|
|
|
|
const basicFormFooter = computed(()=>{ |
|
|
|
let formModel = formRef.value?.formRef?.formModel |
|
|
|
if(formModel){ |
|
|
|
let price1 = formModel.amount+formModel.discountAmount+formModel.discountAmount1 |
|
|
|
let price2 = formModel.taxAmount+formModel.adjustingTaxAmount |
|
|
|
return `合计金额:未税金额=${accountantFormart(undefined,undefined,price1)};税额=${accountantFormart(undefined,undefined,price2)};价税合计金额=${accountantFormart(undefined,undefined,price1+price2)};` |
|
|
|
} |
|
|
|
return `合计金额` |
|
|
|
// const basicFormFooter = computed(()=>{ |
|
|
|
// let formModel = formRef.value?.formRef?.formModel |
|
|
|
// if(formModel){ |
|
|
|
// let price1 = formModel.amount+formModel.discountAmount+formModel.discountAmount1 |
|
|
|
// let price2 = formModel.taxAmount+formModel.adjustingTaxAmount |
|
|
|
// return `合计金额:未税金额=${accountantFormart(undefined,undefined,price1)};税额=${accountantFormart(undefined,undefined,price2)};价税合计金额=${accountantFormart(undefined,undefined,price1+price2)};` |
|
|
|
// } |
|
|
|
// return `合计金额` |
|
|
|
|
|
|
|
}) |
|
|
|
// }) |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, searchFormRef, type, row) => { |
|
|
@ -461,7 +492,7 @@ const handleImport = () => { |
|
|
|
} else if (val == 'invoice_sent_out') { // 发票寄出确认 |
|
|
|
handleInvoiceSentOut(row.id) |
|
|
|
} else if(val == 'finance_mainPlanSub'){ // 财务审批通过 |
|
|
|
handleFinanceApp(row.id) |
|
|
|
handleFinanceApp(row) |
|
|
|
} else if(val == 'finance_mainPlanTur'){ //财务审批拒绝 |
|
|
|
resonSubmit(val, row) |
|
|
|
// handleFinaceTur(row.masterId) |
|
|
@ -493,73 +524,27 @@ const handleImport = () => { |
|
|
|
if(item.field == 'orderType'){ |
|
|
|
item.componentProps.disabled = true |
|
|
|
} |
|
|
|
// 根据状态判断 |
|
|
|
if(row.status=='1'||row.status=='6'){ |
|
|
|
if(item.field == 'procurementCreator'){ |
|
|
|
// 采购价格审批人 |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
if(item.field == 'taxRate'){ |
|
|
|
// 税率 |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
// 调整价差 |
|
|
|
if(item.field == 'discountAmount'){ |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
// 调整税额 |
|
|
|
if(item.field == 'adjustingTaxAmount'){ |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
// 折扣金额 |
|
|
|
if(item.field == 'discountAmount1'){ |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
// 金税票号 |
|
|
|
if(item.field == 'goldenTaxInvoiceNumber'){ |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
// 开票日期 |
|
|
|
if(item.field == 'invoiceTime'){ |
|
|
|
|
|
|
|
// 编辑---taxRate税率\beforeTaxAmount未税金额\totalTaxAmount税额\goldenTaxInvoiceNumber金税票号\invoiceTime发票日期 |
|
|
|
if(item.field == 'taxRate'||item.field == 'beforeTaxAmount'||item.field == 'totalTaxAmount'||item.field == 'goldenTaxInvoiceNumber'||item.field == 'invoiceTime'){ |
|
|
|
if(row.status=='1'||row.status=='3'||row.status=='6'||row.status=='7'){ |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
}else{ |
|
|
|
// 采购价格审批人 |
|
|
|
if(item.field == 'procurementCreator'){ |
|
|
|
}else{ |
|
|
|
item.componentProps.disabled = true |
|
|
|
} |
|
|
|
// 税率 |
|
|
|
if(item.field == 'taxRate'){ |
|
|
|
item.componentProps.disabled = true |
|
|
|
} |
|
|
|
// 调整价差 |
|
|
|
if(item.field == 'discountAmount'){ |
|
|
|
item.componentProps.disabled = true |
|
|
|
} |
|
|
|
// 调整税额 |
|
|
|
if(item.field == 'adjustingTaxAmount'){ |
|
|
|
item.componentProps.disabled = true |
|
|
|
} |
|
|
|
// 折扣金额 |
|
|
|
if(item.field == 'discountAmount1'){ |
|
|
|
item.componentProps.disabled = true |
|
|
|
} |
|
|
|
// 金税票号 |
|
|
|
if(item.field == 'goldenTaxInvoiceNumber'){ |
|
|
|
item.componentProps.disabled = true |
|
|
|
} |
|
|
|
// 开票日期 |
|
|
|
if(item.field == 'invoiceTime'){ |
|
|
|
} |
|
|
|
// 编辑---procurementCreator采购审批人、discountAmount1折扣金额 |
|
|
|
if(item.field == 'procurementCreator'||item.field == 'discountAmount1'){ |
|
|
|
if(row.status=='1'||row.status=='6'){ |
|
|
|
item.componentProps.disabled = false |
|
|
|
}else{ |
|
|
|
item.componentProps.disabled = true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}else{ |
|
|
|
// 新增 |
|
|
|
SupplierinvoiceRequestMain.allSchemas.formSchema.forEach((item) => { |
|
|
|
|
|
|
|
// 供应商代码 |
|
|
|
if(item.field == 'supplierCode'){ |
|
|
|
//默认供应商代码 |
|
|
@ -571,44 +556,23 @@ const handleImport = () => { |
|
|
|
if(item.field == 'orderType'){ |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
|
|
|
|
//采购价格审批人 |
|
|
|
if(item.field == 'procurementCreator'){ |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
// 税率 |
|
|
|
if(item.field == 'taxRate'){ |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
// 调整价差 |
|
|
|
if(item.field == 'discountAmount'){ |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
// 调整税额 |
|
|
|
if(item.field == 'adjustingTaxAmount'){ |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
// 折扣金额 |
|
|
|
if(item.field == 'discountAmount1'){ |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
// 金税票号 |
|
|
|
if(item.field == 'goldenTaxInvoiceNumber'){ |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
// 开票日期 |
|
|
|
if(item.field == 'invoiceTime'){ |
|
|
|
// 税率 \采购价格审批人 \未税金额 \税额\金税票号\开票日期\折扣金额 |
|
|
|
if(item.field == 'taxRate'||item.field == 'procurementCreator'||item.field == 'beforeTaxAmount'||item.field == 'totalTaxAmount'||item.field == 'goldenTaxInvoiceNumber'||item.field == 'invoiceTime'||item.field == 'discountAmount1'){ |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
if(row && (row.status == '3' || row.status == '7')){ |
|
|
|
SupplierinvoiceRequestMainRules.beforeTaxAmount[0].required = true //未税金额 |
|
|
|
SupplierinvoiceRequestMainRules.totalTaxAmount[0].required = true //税额 |
|
|
|
SupplierinvoiceRequestMainRules.goldenTaxInvoiceNumber[0].required = true //金税票号 |
|
|
|
SupplierinvoiceRequestMainRules.invoiceTime[0].required = true |
|
|
|
SupplierinvoiceRequestMainRules.goldenTaxInvoiceNumber[0].required = true |
|
|
|
|
|
|
|
}else{ |
|
|
|
SupplierinvoiceRequestMainRules.beforeTaxAmount[0].required = false //未税金额 |
|
|
|
SupplierinvoiceRequestMainRules.totalTaxAmount[0].required = false //税额 |
|
|
|
SupplierinvoiceRequestMainRules.goldenTaxInvoiceNumber[0].required = false //金税票号 |
|
|
|
SupplierinvoiceRequestMainRules.invoiceTime[0].required = false |
|
|
|
SupplierinvoiceRequestMainRules.goldenTaxInvoiceNumber[0].required = false |
|
|
|
} |
|
|
|
if(row&&row.procurementCreator) row.procurementCreator = Number(row.procurementCreator) |
|
|
|
// 校验是否可以开票 |
|
|
@ -662,10 +626,7 @@ const handleImport = () => { |
|
|
|
clicKRowId.value = row.id |
|
|
|
|
|
|
|
// 合同附件 |
|
|
|
if(roleList.value.indexOf('purchase')>-1&&row.status=='2'){ |
|
|
|
detailAnnexTable.value[0].hiddenDelete = false |
|
|
|
detailAnnexTable.value[0].hiddenUpload = false |
|
|
|
}else if(roleList.value.indexOf('supplier_operator')>-1&&(row.status=='1' || row.status=='6')){ |
|
|
|
if(row.status=='1'||row.status=='2'||row.status=='6'){ |
|
|
|
detailAnnexTable.value[0].hiddenDelete = false |
|
|
|
detailAnnexTable.value[0].hiddenUpload = false |
|
|
|
}else{ |
|
|
@ -673,7 +634,7 @@ const handleImport = () => { |
|
|
|
detailAnnexTable.value[0].hiddenUpload = true |
|
|
|
} |
|
|
|
// 发票附件 |
|
|
|
if(roleList.value.indexOf('supplier_operator')>-1&&(row.status=='3'||row.status=='7')){ |
|
|
|
if(row.status=='3'||row.status=='7'){ |
|
|
|
detailAnnexTable.value[1].hiddenDelete = false |
|
|
|
detailAnnexTable.value[1].hiddenUpload = false |
|
|
|
}else{ |
|
|
@ -787,21 +748,35 @@ const handleImport = () => { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 审批通过按钮操作 */ |
|
|
|
const handleFinanceApp = async (id : number) => { |
|
|
|
try { |
|
|
|
// 审批通过的二次确认 |
|
|
|
await message.confirm(t('ts.是否审批通过所选中数据?')) |
|
|
|
tableObject.loading = true |
|
|
|
// 发起审批通过 |
|
|
|
await SupplierinvoiceRequestMainApi.financeappSupplierinvoiceRequestMain(id) |
|
|
|
message.success(t('ts.审批通过成功!')) |
|
|
|
tableObject.loading = false |
|
|
|
// 刷新列表 |
|
|
|
await getList() |
|
|
|
} catch { }finally{ |
|
|
|
tableObject.loading = false |
|
|
|
} |
|
|
|
/** 审批通过按钮操作 finance_mainPlanSub */ |
|
|
|
const formFinanceRef = ref() |
|
|
|
const handleFinanceApp = async (row) => { |
|
|
|
formFinanceRef.value.open('update', row,null,'财务通过','财务通过') |
|
|
|
} |
|
|
|
|
|
|
|
const submitFormFinance = async (formType, submitData) => { |
|
|
|
let data = {...submitData} |
|
|
|
console.log('submitFormFinance',data) |
|
|
|
await SupplierinvoiceRequestMainApi.financeappSupplierinvoiceRequestMain({ |
|
|
|
id:data.id, |
|
|
|
postingDate:data.postingDate, |
|
|
|
voucherNumberRemark:data.voucherNumberRemark, |
|
|
|
}) |
|
|
|
formFinanceRef.value.dialogVisible = false |
|
|
|
getList() |
|
|
|
// try { |
|
|
|
// // 审批通过的二次确认 |
|
|
|
// await message.confirm(t('ts.是否审批通过所选中数据?')) |
|
|
|
// tableObject.loading = true |
|
|
|
// // 发起审批通过 |
|
|
|
// await SupplierinvoiceRequestMainApi.financeappSupplierinvoiceRequestMain(id) |
|
|
|
// message.success(t('ts.审批通过成功!')) |
|
|
|
// tableObject.loading = false |
|
|
|
// // 刷新列表 |
|
|
|
// await getList() |
|
|
|
// } catch { }finally{ |
|
|
|
// tableObject.loading = false |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
/** 驳回按钮操作 */ |
|
|
@ -967,18 +942,10 @@ const handleImport = () => { |
|
|
|
const submitForm = async (formType, submitData) => { |
|
|
|
let data = {...submitData} |
|
|
|
tableData.value.forEach((item) => { |
|
|
|
item.differencePrice = Number((Number(item?.singlePrice)-Number(item?.purchasePrice)).toFixed(6)) |
|
|
|
item.differencePrice = Number((Number(item?.singlePrice)-Number(item?.purchasePrice)).toFixed(2)) |
|
|
|
}) |
|
|
|
data.subList = tableData.value // 拼接子表数据参数 |
|
|
|
if(data){ |
|
|
|
// 未税金额\价税合计金额\税额 |
|
|
|
let price1 = data.amount+data.discountAmount+data.discountAmount1 |
|
|
|
let price2 = data.taxAmount+data.adjustingTaxAmount |
|
|
|
data.beforeTaxAmount = price1 |
|
|
|
data.totalTaxAmount = price2 |
|
|
|
data.adTaxAmount = price1+price2 |
|
|
|
} |
|
|
|
|
|
|
|
console.log('data',data) |
|
|
|
try { |
|
|
|
if (formType === 'create') { |
|
|
|
if(data.subList.length == 0){ |
|
|
@ -1108,11 +1075,12 @@ const importSuccess = () => { |
|
|
|
}else{ |
|
|
|
roleList.value = [] |
|
|
|
} |
|
|
|
if(roleList.value.indexOf('supplier_operator')>-1){ |
|
|
|
detailButtonIsShowAddStatusArray.value = ['1','6'] |
|
|
|
}else{ |
|
|
|
detailButtonIsShowAddStatusArray.value = [] |
|
|
|
} |
|
|
|
detailButtonIsShowAddStatusArray.value = ['1','6'] |
|
|
|
// if(roleList.value.indexOf('supplier_operator')>-1){ |
|
|
|
// detailButtonIsShowAddStatusArray.value = ['1','6'] |
|
|
|
// }else{ |
|
|
|
// detailButtonIsShowAddStatusArray.value = [] |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
/** 初始化 **/ |
|
|
|