增加单位功能
This commit is contained in:
1 parent
a8c09c1db5
commit
6f106e43af
22 files changed
+1473
-128
No files matched your search
@@ -90,8 +90,17 @@
|
||||
<el-table-column label="备注" min-width="120" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.remark || "-" }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="80" align="center" fixed="right">
|
||||
<el-table-column label="操作" width="150" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-if="!row.receipt_url"
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="openReceipt(row)"
|
||||
>
|
||||
补回执
|
||||
</el-button>
|
||||
<el-tooltip
|
||||
:disabled="Number((planOf(row.payback_id) || {}).status) !== 2"
|
||||
content="所属回款计划已完成(回款已收齐),不允许删除回款记录"
|
||||
@@ -192,6 +201,35 @@
|
||||
<el-button type="primary" :loading="receiveSaving" @click="submitReceive">保存</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 补传回款回执:针对已登记但漏传回执的回款记录 -->
|
||||
<el-dialog v-model="receiptVisible" title="补传回款回执" width="460px">
|
||||
<el-form :model="receiptForm" label-width="90px">
|
||||
<el-form-item label="流水回执">
|
||||
<div class="receipt-block">
|
||||
<el-upload
|
||||
:show-file-list="false"
|
||||
:http-request="handleReceiptFileUpload"
|
||||
:disabled="receiptUploading"
|
||||
accept=".jpg,.jpeg,.png,.pdf,.doc,.docx,.xls,.xlsx"
|
||||
>
|
||||
<el-button :icon="Upload" :loading="receiptUploading" size="small">上传流水回执</el-button>
|
||||
</el-upload>
|
||||
<div v-if="receiptForm.receipt_url" class="receipt-file">
|
||||
<el-link type="primary" :href="receiptForm.receipt_url" target="_blank" :underline="false">
|
||||
<el-icon><Document /></el-icon>
|
||||
<span class="receipt-name">{{ receiptForm.receipt_name || "流水回执" }}</span>
|
||||
</el-link>
|
||||
<el-button link type="danger" size="small" :icon="Delete" @click="clearReceiptForm">移除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="receiptVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="receiptUploading" @click="submitReceipt">保存回执</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -203,6 +241,7 @@ import {
|
||||
getPaybackList,
|
||||
getPaybackRecordList,
|
||||
createPaybackRecord,
|
||||
updatePaybackRecord,
|
||||
deletePaybackRecord,
|
||||
} from "@/api/crmPayback";
|
||||
import { uploadFile } from "@/api/file";
|
||||
@@ -404,6 +443,65 @@ function clearReceipt() {
|
||||
receiveForm.receipt_name = "";
|
||||
}
|
||||
|
||||
/* ---------------------------- 补传回款回执(事后补凭证) ---------------------------- */
|
||||
const receiptVisible = ref(false);
|
||||
const receiptUploading = ref(false);
|
||||
const receiptForm = reactive({ id: null, receipt_url: "", receipt_name: "" });
|
||||
|
||||
/** 打开补回执:仅针对未上传回执的回款记录 */
|
||||
function openReceipt(row) {
|
||||
receiptForm.id = row.id;
|
||||
receiptForm.receipt_url = "";
|
||||
receiptForm.receipt_name = "";
|
||||
receiptVisible.value = true;
|
||||
}
|
||||
|
||||
async function handleReceiptFileUpload(options) {
|
||||
const file = options.file;
|
||||
receiptUploading.value = true;
|
||||
try {
|
||||
const fd = new FormData();
|
||||
fd.append("file", file);
|
||||
const res = await uploadFile(fd);
|
||||
const data = res?.data || {};
|
||||
receiptForm.receipt_url = data.url || "";
|
||||
receiptForm.receipt_name = data.name || file.name;
|
||||
ElMessage.success("上传成功");
|
||||
} catch (e) {
|
||||
ElMessage.error(e.message || "上传失败");
|
||||
} finally {
|
||||
receiptUploading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function clearReceiptForm() {
|
||||
receiptForm.receipt_url = "";
|
||||
receiptForm.receipt_name = "";
|
||||
}
|
||||
|
||||
async function submitReceipt() {
|
||||
if (!receiptForm.id) return;
|
||||
if (!receiptForm.receipt_url) {
|
||||
ElMessage.warning("请先上传回执文件");
|
||||
return;
|
||||
}
|
||||
receiptUploading.value = true;
|
||||
try {
|
||||
await updatePaybackRecord(receiptForm.id, {
|
||||
receipt_url: receiptForm.receipt_url,
|
||||
receipt_name: receiptForm.receipt_name,
|
||||
});
|
||||
ElMessage.success("回执已补传");
|
||||
receiptVisible.value = false;
|
||||
await fetchRecords();
|
||||
emit("saved");
|
||||
} catch (e) {
|
||||
ElMessage.error(e.message || "补传失败");
|
||||
} finally {
|
||||
receiptUploading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function submitReceive() {
|
||||
if (!receiveForm.payback_id) {
|
||||
ElMessage.warning("请选择回款计划");
|
||||
|
||||
Reference in new issue
Block a user