|
|
@@ -42,7 +42,7 @@
|
|
|
<el-table-column prop="receivablePremium" label="应收总额"></el-table-column>
|
|
|
<el-table-column prop="reconciliationAmount" label="对账金额">
|
|
|
<template #default="scope">
|
|
|
- <div class="flex items-center cursor-pointer" @click="handleEdit(scope.row,scope.$index)"
|
|
|
+ <div class="flex items-center cursor-pointer" @click="handleEdit(scope.row, scope.$index)"
|
|
|
@mouseenter="scope.row.showEdit = true" @mouseleave="scope.row.showEdit = false">
|
|
|
¥{{ scope.row.reconciliationAmount || 0 }}
|
|
|
<el-icon class="m-l-4px " v-if="scope.row.showEdit">
|
|
|
@@ -80,8 +80,7 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="receivableSupervisePremium" label="开票金额">
|
|
|
<el-input-number :disabled="selectedList.length > 1" v-model="countForm.receivableSupervisePremium"
|
|
|
- style="width: 100%;" :min="0" :precision="2" controls-position="right"
|
|
|
- @change="handleChange()" />
|
|
|
+ style="width: 100%;" :min="0" :precision="2" controls-position="right" @change="handleChange()" />
|
|
|
</el-form-item>
|
|
|
<!-- <el-form-item prop="overinflatedAmount" label="虚增金额">
|
|
|
<el-input v-model="countForm.overinflatedAmount" disabled></el-input>
|
|
|
@@ -135,7 +134,8 @@
|
|
|
<el-button type="primary" @click="handelComfirm()">确定</el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
- <el-dialog :close-on-click-modal="false" v-model="editShow" width="600" :title="isSettlement ? '开票并结算' : '开票'" draggable>
|
|
|
+ <el-dialog :close-on-click-modal="false" v-model="editShow" width="600" :title="isSettlement ? '开票并结算' : '开票'"
|
|
|
+ draggable>
|
|
|
<el-form ref="CountForm" :model="editForm" :rules="countRules" label-width="120">
|
|
|
<el-form-item prop="receivableSupervisePremium" label="应收金额">
|
|
|
<el-input v-model="editForm.receivablePremium" placeholder="请输入" disabled></el-input>
|
|
|
@@ -153,10 +153,10 @@
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<el-button class="border-[#0083FF] color-[#0083FF]" plain @click="editShow = false">取消</el-button>
|
|
|
- <el-button type="primary" @click="handelComfirmEdit" >确定</el-button>
|
|
|
+ <el-button type="primary" @click="handelComfirmEdit">确定</el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
- <el-image-viewer v-if="imageShow" :url-list="[bigImageUrl]" @close="imageShow = false" />
|
|
|
+ <el-image-viewer v-if="imageShow" :url-list="[bigImageUrl]" @close="imageShow = false" />
|
|
|
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -182,8 +182,9 @@ const editForm = ref({})
|
|
|
const rowIndex = ref(0)
|
|
|
const handleEdit = (row: any, index: number) => {
|
|
|
editShow.value = true
|
|
|
- editForm.value = {...row}
|
|
|
+ editForm.value = { ...row }
|
|
|
rowIndex.value = index
|
|
|
+ console.log(editForm.value)
|
|
|
}
|
|
|
const companyIdprops = {
|
|
|
expandTrigger: 'hover' as const,
|
|
|
@@ -196,8 +197,11 @@ const tableRef = ref('')
|
|
|
const selCompanyId = ref('')
|
|
|
/** 处理选择变更,更新选中的公司ID和选中列表 */
|
|
|
const handleSelection = (val: any) => {
|
|
|
+ console.log(val)
|
|
|
if (val.length) selCompanyId.value = val[0].partnerCompanyId
|
|
|
- if (!val.length) selCompanyId.value = ''
|
|
|
+ if (!val.length){
|
|
|
+
|
|
|
+ } selCompanyId.value = ''
|
|
|
selectedList.value = val
|
|
|
}
|
|
|
/** 处理全选/多选操作,确保所选行仅限于同一合作公司:选取首项的公司ID作为当前选中公司,过滤掉不同公司的选项并取消其选中状态 */
|
|
|
@@ -299,15 +303,21 @@ const handleTicket = async (bool: boolean) => {
|
|
|
ElMessage.error('请选择应收单据')
|
|
|
return
|
|
|
}
|
|
|
- if (selectedList.value.find(v => v.reconciliationAmount === undefined)) {
|
|
|
+ if (selectedList.value.some(v => v.reconciliationAmount === undefined || v.reconciliationAmount === null || v.reconciliationAmount === '')) {
|
|
|
ElMessage.error('请先确认对账金额')
|
|
|
return
|
|
|
}
|
|
|
isSettlement.value = bool
|
|
|
- const arr = selectedList.value.map(v => v.uninvoiced)
|
|
|
+ console.log(selectedList.value)
|
|
|
+ // 使用接口计算每项的差值(对账金额 - 已开票金额)
|
|
|
+ const arr = await Promise.all(selectedList.value.map(async v => {
|
|
|
+ const diff = await calSub(v.reconciliationAmount, v.invoiced)
|
|
|
+ return diff
|
|
|
+ }))
|
|
|
+ console.log(arr)
|
|
|
const res = await api.financeApi.calculateTotalSum(arr.join())
|
|
|
if (res.code == 200) {
|
|
|
- countForm.value.selectFlag=1;
|
|
|
+ countForm.value.selectFlag = 1;
|
|
|
openCountForm()
|
|
|
countForm.value.companyId = selectedList.value[0].companyId
|
|
|
countForm.value.reconciliationAmount = selectedList.value.reduce((total, current) => total + current.reconciliationAmount, 0);
|
|
|
@@ -351,16 +361,20 @@ const openCountForm = () => {
|
|
|
|
|
|
countShow.value = true
|
|
|
}
|
|
|
-const handelComfirm = () => {
|
|
|
- if (countForm.value.reconciliationAmount < countForm.value.receivableSupervisePremium) {
|
|
|
- ElMessage.error('开票金额不可大于对账金额')
|
|
|
+const handelComfirm = async () => {
|
|
|
+ const arr = await Promise.all(selectedList.value.map(async v => {
|
|
|
+ const diff = await calSub(v.reconciliationAmount, v.invoiced)
|
|
|
+ return diff
|
|
|
+ }))
|
|
|
+ const res = await api.financeApi.calculateTotalSum(arr.join())
|
|
|
+ if (countForm.value.receivableSupervisePremium > res.data) {
|
|
|
+ ElMessage.error('开票金额不可大于未开票金额')
|
|
|
return
|
|
|
}
|
|
|
if (countForm.value.receivableSupervisePremium === 0) {
|
|
|
ElMessage.error('开票金额不能为0')
|
|
|
return
|
|
|
}
|
|
|
- console.log()
|
|
|
const attachmentIds = countForm.value.attachmentIds
|
|
|
let params: any = {
|
|
|
details: selectedList.value,
|
|
|
@@ -486,6 +500,7 @@ onMounted(() => {
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
}
|
|
|
+
|
|
|
.imageDiv {
|
|
|
position: relative;
|
|
|
width: 80px;
|
|
|
@@ -525,6 +540,7 @@ onMounted(() => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.upload-btn {
|
|
|
:deep(.el-button) {
|
|
|
width: 80px;
|
|
|
@@ -533,4 +549,4 @@ onMounted(() => {
|
|
|
color: #ccc;
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|