From 6216744c95c501f93d2c937228867b3cae5ad8cf Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 21 九月 2026 12:09:05 +0800
Subject: [PATCH] 新疆-融邦 1.销售台账根据类别修改展示字段 2.数据四舍五入
---
src/views/basicData/customerFile/index.vue | 268 ++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 223 insertions(+), 45 deletions(-)
diff --git a/src/views/basicData/customerFile/index.vue b/src/views/basicData/customerFile/index.vue
index d0f829c..2773c55 100644
--- a/src/views/basicData/customerFile/index.vue
+++ b/src/views/basicData/customerFile/index.vue
@@ -1,6 +1,6 @@
<template>
<div class="app-container">
- <div class="search_form">
+ <div class="search_form" style="margin-bottom: 20px;">
<div>
<span class="search_title">瀹㈡埛鍚嶇О锛�</span>
<el-input v-model="searchForm.customerName"
@@ -9,17 +9,6 @@
@change="handleQuery"
clearable
:prefix-icon="Search" />
- <span class="search_title">瀹㈡埛鍒嗙被锛�</span>
- <el-select v-model="searchForm.customerType"
- placeholder="璇烽�夋嫨"
- style="width: 240px"
- clearable
- @change="handleQuery">
- <el-option label="闆跺敭瀹㈡埛"
- value="闆跺敭瀹㈡埛" />
- <el-option label="杩涢攢鍟嗗鎴�"
- value="杩涢攢鍟嗗鎴�" />
- </el-select>
<el-button type="primary"
@click="handleQuery"
style="margin-left: 10px">鎼滅储</el-button>
@@ -27,6 +16,9 @@
<div>
<el-button type="primary"
@click="openForm('add')">鏂板瀹㈡埛</el-button>
+ <el-button type="primary"
+ plain
+ @click="back">娴佸叆鍏捣</el-button>
<el-button @click="handleOut">瀵煎嚭</el-button>
<el-button type="info"
plain
@@ -37,6 +29,17 @@
@click="handleDelete">鍒犻櫎</el-button>
</div>
</div>
+ <!-- 鎸夈�屽鎴峰垎绫汇�嶆媶椤电锛涖�屽叏閮ㄣ�嶄笉甯﹀垎绫绘煡璇紝淇濊瘉杩樻病琛ュ垎绫荤殑鑰佹暟鎹篃鑳界湅鍒� -->
+ <el-tabs v-model="activeTab"
+ @tab-change="handleTabChange"
+ class="customer-tabs">
+ <el-tab-pane label="鍏ㄩ儴"
+ name="鍏ㄩ儴" />
+ <el-tab-pane label="閿�鍞鎴�"
+ name="閿�鍞鎴�" />
+ <el-tab-pane label="浠e偍瀹㈡埛"
+ name="浠e偍瀹㈡埛" />
+ </el-tabs>
<div class="table_list">
<PIMTable rowKey="id"
:column="tableColumn"
@@ -45,7 +48,16 @@
:isSelection="true"
@selection-change="handleSelectionChange"
:tableLoading="tableLoading"
- @pagination="pagination"></PIMTable>
+ @pagination="pagination">
+ <template #depositAmountSlot="{ row }">
+ <el-tooltip v-if="row.exceedsTrustFund"
+ :content="`浠e偍閲戦鍚堣宸茶秴鍑鸿瀹㈡埛淇℃墭鍩洪噾锛堜俊鎵樺熀閲戯細${row.trustFund}锛塦"
+ placement="top">
+ <el-text type="danger">{{ formatAmount(row.depositTotalAmount) }}</el-text>
+ </el-tooltip>
+ <span v-else>{{ formatAmount(row.depositTotalAmount) }}</span>
+ </template>
+ </PIMTable>
</div>
<el-dialog v-model="dialogFormVisible"
:title="operationType === 'add' ? '鏂板瀹㈡埛淇℃伅' : '缂栬緫瀹㈡埛淇℃伅'"
@@ -125,11 +137,24 @@
<el-select v-model="form.customerType"
placeholder="璇烽�夋嫨"
clearable>
- <el-option label="闆跺敭瀹㈡埛"
- value="闆跺敭瀹㈡埛" />
- <el-option label="杩涢攢鍟嗗鎴�"
- value="杩涢攢鍟嗗鎴�" />
+ <el-option v-for="dict in customer_type"
+ :key="dict.value"
+ :label="dict.label"
+ :value="dict.value" />
</el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="淇℃墭鍩洪噾(鍏�)锛�"
+ prop="trustFund">
+ <el-input-number v-model="form.trustFund"
+ :min="0"
+ :precision="2"
+ :controls="false"
+ placeholder="璇疯緭鍏ワ紝鍙负绌�"
+ style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
@@ -211,7 +236,8 @@
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
- :action="upload.url + '?updateSupport=' + upload.updateSupport"
+ :action="upload.url"
+ :data="upload.data"
:disabled="upload.isUploading"
:before-upload="upload.beforeUpload"
:on-progress="upload.onProgress"
@@ -457,6 +483,32 @@
</div>
</el-col>
</el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <div class="info-item">
+ <span class="info-label">淇℃墭鍩洪噾(鍏�)锛�</span>
+ <span class="info-value">{{ formatAmount(detailForm.trustFund) }}</span>
+ </div>
+ </el-col>
+ <el-col :span="12">
+ <div class="info-item">
+ <span class="info-label">浠e偍閲戦(鍏�)锛�</span>
+ <span class="info-value"
+ :class="{ 'text-danger': detailForm.exceedsTrustFund }">
+ {{ formatAmount(detailForm.depositTotalAmount) }}
+ </span>
+ </div>
+ </el-col>
+ </el-row>
+ <el-row v-if="detailForm.exceedsTrustFund"
+ :gutter="20">
+ <el-col :span="24">
+ <el-alert type="warning"
+ show-icon
+ :closable="false"
+ :title="`璇ュ鎴蜂唬鍌ㄩ噾棰濆悎璁� ${formatAmount(detailForm.depositTotalAmount)} 鍏冿紝宸茶秴鍑轰俊鎵樺熀閲� ${formatAmount(detailForm.trustFund)} 鍏僠" />
+ </el-col>
+ </el-row>
</div>
</div>
<!-- 娲借皥杩涘害璁板綍 -->
@@ -609,28 +661,30 @@
</template>
<script setup>
- import { onMounted, ref, reactive, getCurrentInstance, toRefs } from "vue";
+ import {
+ onMounted,
+ ref,
+ reactive,
+ getCurrentInstance,
+ toRefs,
+ watch,
+ } from "vue";
import { Search, Paperclip, Upload } from "@element-plus/icons-vue";
import {
- addCustomerPrivate,
- delCustomerPrivate,
- getCustomer,
- getCustomerPrivatePoolById,
- getCustomerPrivatePoolInfo,
- listCustomerPrivatePool,
- updateCustomerPrivatePool,
addCustomerFollow,
updateCustomerFollow,
delCustomerFollow,
addReturnVisit,
getReturnVisit,
} from "@/api/basicData/customerFile.js";
+ import {listCustomer, getCustomer, addCustomer, updateCustomer, delCustomer, backCustomer} from "@/api/basicData/customer.js";
import { ElMessageBox } from "element-plus";
import { userListNoPage } from "@/api/system/user.js";
import useUserStore from "@/store/modules/user";
import { getToken } from "@/utils/auth.js";
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
+ const { customer_type } = proxy.useDict("customer_type");
// 鍥炶鎻愰啋鐩稿叧
const reminderDialogVisible = ref(false);
@@ -656,7 +710,7 @@
const negotiationFormRef = ref();
const negotiationForm = reactive({
customerName: "",
- customerPrivatePoolId: "",
+ customerId: "",
followUpMethod: "",
followUpLevel: "",
followUpTime: "",
@@ -676,6 +730,11 @@
content: [{ required: true, message: "璇疯緭鍏ュ唴瀹�", trigger: "blur" }],
};
+ const formatAmount = value => {
+ return value === null || value === undefined || value === ""
+ ? "-"
+ : Number(value).toFixed(2);
+ };
// 璇︽儏鐩稿叧
const detailDialogVisible = ref(false);
const detailForm = reactive({
@@ -691,6 +750,9 @@
contactPhone: "",
maintainer: "",
maintenanceTime: "",
+ trustFund: "",
+ depositTotalAmount: "",
+ exceedsTrustFund: false,
});
const negotiationRecords = ref([]);
@@ -715,6 +777,7 @@
label: "瀹㈡埛鍒嗙被",
prop: "customerType",
width: 120,
+ formatData: value => proxy.selectDictLabel(customer_type.value, value),
},
{
label: "瀹㈡埛鍚嶇О",
@@ -761,6 +824,22 @@
width: 220,
},
{
+ label: "淇℃墭鍩洪噾(鍏�)",
+ prop: "trustFund",
+ width: 140,
+ formatData: value =>
+ value === null || value === undefined || value === ""
+ ? "-"
+ : Number(value).toFixed(2),
+ },
+ {
+ label: "浠e偍閲戦(鍏�)",
+ prop: "depositTotalAmount",
+ dataType: "slot",
+ slot: "depositAmountSlot",
+ width: 150,
+ },
+ {
label: "寮�鎴疯鍙�",
prop: "bankCode",
width: 220,
@@ -802,7 +881,12 @@
{
name: "缂栬緫",
type: "text",
+ showHide: row => !isCustomerEditLocked(row),
clickFun: row => {
+ if (isCustomerEditLocked(row)) {
+ proxy.$modal.msgWarning("宸茶閿�鍞ā鍧楀紩鐢ㄧ殑绉佹捣瀹㈡埛涓嶈兘缂栬緫");
+ return;
+ }
openForm("edit", row);
},
},
@@ -856,7 +940,7 @@
const data = reactive({
searchForm: {
customerName: "",
- customerType: "",
+ type: 0
},
form: {
customerName: "",
@@ -871,6 +955,9 @@
bankAccount: "",
bankCode: "",
customerType: "",
+ // 閲戦瀛楁缁� null 鑰岄潪 ""锛岄伩鍏� el-input-number 鎶婄┖涓叉姌绠楁垚 0
+ trustFund: null,
+ type: 0
},
rules: {
customerName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
@@ -901,7 +988,10 @@
// 璁剧疆涓婁紶鐨勮姹傚ご閮�
headers: { Authorization: "Bearer " + getToken() },
// 涓婁紶鐨勫湴鍧�
- url: import.meta.env.VITE_APP_BASE_API + "/customerPrivate/importData",
+ url: import.meta.env.VITE_APP_BASE_API + "/basic/customer/importData",
+ data: {
+ type: 0
+ },
// 鏂囦欢涓婁紶鍓嶇殑鍥炶皟
beforeUpload: file => {
console.log("鏂囦欢鍗冲皢涓婁紶", file);
@@ -970,14 +1060,37 @@
page.size = obj.limit;
getList();
};
+ // 鍏ㄩ儴 / 閿�鍞鎴� / 浠e偍瀹㈡埛涓変釜椤电锛屽悇鑷甫瀹㈡埛鍒嗙被鏌ュ悓涓�涓垪琛ㄦ帴鍙�
+ const activeTab = ref("鍏ㄩ儴");
+ // 銆屽叏閮ㄣ�嶄笉浼犲垎绫伙紙undefined 浼氳 axios 涓㈡帀锛夛紝閿�鍞�/浠e偍鎸夊瓧鍏稿�肩瓫锛�
+ // 瀛楀吀鐨� value 鏈繀灏辨槸涓枃鏍囩锛屾寜 label 鍙嶆煡鐪熷疄鍙栧�煎啀浼犳帴鍙�
+ const activeCustomerType = () => {
+ if (activeTab.value === "鍏ㄩ儴") {
+ return undefined;
+ }
+ const list = customer_type.value || [];
+ const hit = list.find(item => item.label === activeTab.value);
+ return hit ? hit.value : activeTab.value;
+ };
+ // 椤电鍒囨崲锛氭崲瀹㈡埛鍒嗙被閲嶆柊鏌ュ垪琛�
+ const handleTabChange = () => {
+ page.current = 1;
+ getList();
+ };
const getList = () => {
tableLoading.value = true;
- listCustomerPrivatePool({ ...searchForm.value, ...page }).then(res => {
+ listCustomer({
+ ...searchForm.value,
+ ...page,
+ customerType: activeCustomerType(),
+ }).then(res => {
tableLoading.value = false;
tableData.value = res.data.records;
page.total = res.data.total;
});
};
+ // 瀛楀吀鏄紓姝ユ媺鐨勶紝鍒拌揪鍚庢寜鐪熷疄瀛楀吀鍊奸噸鏌ヤ竴娆★紝閬垮厤棣栧睆鐢ㄤ腑鏂囨爣绛剧瓫涓嶅埌鏁版嵁
+ watch(customer_type, () => getList());
// 琛ㄦ牸閫夋嫨鏁版嵁
const handleSelectionChange = selection => {
selectedRows.value = selection;
@@ -994,10 +1107,14 @@
}
/** 涓嬭浇妯℃澘 */
function importTemplate() {
- proxy.download("/customerPrivate/downloadTemplate", {}, "瀹㈡埛瀵煎叆妯℃澘.xlsx");
+ proxy.download("/basic/customer/downloadTemplate", {}, "瀹㈡埛瀵煎叆妯℃澘.xlsx");
}
// 鎵撳紑寮规
const openForm = (type, row) => {
+ if (type === "edit" && isCustomerEditLocked(row)) {
+ proxy.$modal.msgWarning("宸茶閿�鍞ā鍧楀紩鐢ㄧ殑绉佹捣瀹㈡埛涓嶈兘缂栬緫");
+ return;
+ }
operationType.value = type;
form.value = {};
form.value.maintainer = userStore.nickName;
@@ -1007,12 +1124,15 @@
contactPhone: "",
},
];
+ form.value.type = 0;
+ // 瀹㈡埛鍒嗙被榛樿璺熼殢褰撳墠椤电
+ form.value.customerType = activeCustomerType();
form.value.maintenanceTime = getCurrentDate();
userListNoPage().then(res => {
userList.value = res.data;
});
if (type === "edit") {
- getCustomerPrivatePoolById(row.id).then(res => {
+ getCustomer(row.id).then(res => {
form.value = { ...res.data };
formYYs.value.contactList = res.data.contactPerson
.split(",")
@@ -1025,6 +1145,12 @@
});
}
dialogFormVisible.value = true;
+ };
+ const isCustomerEditLocked = row => {
+ const salesReferenced = Number(row?.salesReferenceFlag || 0) === 1;
+ const customerType = Number(row?.type);
+ const usageStatus = Number(row?.usageStatus || 0);
+ return salesReferenced && (customerType === 0 || (customerType === 1 && usageStatus === 1));
};
// 鎻愪氦琛ㄥ崟
const submitForm = () => {
@@ -1049,7 +1175,7 @@
form.value.contactPhone = formYYs.value.contactList
.map(item => item.contactPhone)
.join(",");
- addCustomerPrivate(form.value).then(res => {
+ addCustomer(form.value).then(res => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeDia();
getList();
@@ -1063,7 +1189,7 @@
form.value.contactPhone = formYYs.value.contactList
.map(item => item.contactPhone)
.join(",");
- updateCustomerPrivatePool(form.value).then(res => {
+ updateCustomer(form.value).then(res => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeDia();
getList();
@@ -1082,7 +1208,12 @@
type: "warning",
})
.then(() => {
- proxy.download("/customerPrivate/export", {}, "瀹㈡埛妗f.xlsx");
+ // 瀵煎嚭璺熼殢褰撳墠椤电鐨勫鎴峰垎绫�
+ proxy.download(
+ "/basic/customer/export",
+ { type: 0, customerType: activeCustomerType() },
+ "瀹㈡埛妗f.xlsx"
+ );
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
@@ -1111,7 +1242,7 @@
})
.then(() => {
tableLoading.value = true;
- delCustomerPrivate(ids)
+ delCustomer(ids)
.then(() => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
getList();
@@ -1122,6 +1253,36 @@
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+
+ const back = () => {
+ if (selectedRows.value.length === 0) {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ const ids = selectedRows.value.map(item => item.id);
+ ElMessageBox.confirm("閫変腑鐨勫鎴峰皢娴佸叆鍏捣锛屾槸鍚︾‘璁わ紵", "娴佸叆鍏捣鎻愮ず", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ tableLoading.value = true;
+ return Promise.all(ids.map(id => backCustomer(id)))
+ .then(() => {
+ proxy.$modal.msgSuccess("娴佸叆鍏捣鎴愬姛");
+ selectedRows.value = [];
+ getList();
+ })
+ .finally(() => {
+ tableLoading.value = false;
+ });
+ })
+ .catch(error => {
+ if (error === "cancel" || error === "close") {
+ proxy.$modal.msg("宸插彇娑�");
+ }
});
};
@@ -1165,8 +1326,7 @@
if (reminderForm.id) {
submitvalue.value = {
id: reminderForm.id,
- customerPrivatePoolId: reminderForm.id,
- customerPrivatePoolId: currentCustomerId.value,
+ customerId: currentCustomerId.value,
isEnabled: reminderForm.reminderSwitch ? 1 : 0,
content: reminderForm.reminderContent,
reminderTime: reminderForm.reminderTime,
@@ -1174,7 +1334,7 @@
};
} else {
submitvalue.value = {
- customerPrivatePoolId: currentCustomerId.value,
+ customerId: currentCustomerId.value,
isEnabled: reminderForm.reminderSwitch ? 1 : 0,
content: reminderForm.reminderContent,
reminderTime: reminderForm.reminderTime,
@@ -1203,7 +1363,7 @@
// 鎵撳紑娲借皥杩涘害寮圭獥
const openNegotiationDialog = row => {
negotiationForm.customerName = row.customerName;
- negotiationForm.customerPrivatePoolId = row.id;
+ negotiationForm.customerId = row.id;
negotiationForm.followUpMethod = "";
negotiationForm.followUpLevel = "";
negotiationForm.followUpTime = "";
@@ -1232,7 +1392,7 @@
// 淇敼鎿嶄綔
updateCustomerFollow(negotiationForm).then(res => {
// 鏇存柊鏈湴鏁版嵁
- getCustomer(negotiationForm.customerPrivatePoolId).then(res => {
+ getCustomer(negotiationForm.customerId).then(res => {
// 鏇存柊鏈湴鏁版嵁
negotiationRecords.value = res.data.followUpList || [];
});
@@ -1264,7 +1424,7 @@
// 鎵撳紑璇︽儏寮圭獥
const openDetailDialog = row => {
- getCustomerPrivatePoolInfo(row.id).then(res => {
+ getCustomer(row.id).then(res => {
// 濉厖瀹㈡埛鍩烘湰淇℃伅
Object.assign(detailForm, res.data);
@@ -1285,7 +1445,7 @@
// 灏嗗綋鍓嶈褰曟暟鎹~鍏呭埌琛ㄥ崟
Object.assign(negotiationForm, {
customerName: row.customerName,
- customerPrivatePoolId: row.customerPrivatePoolId,
+ customerId: row.customerId,
followUpMethod: row.followUpMethod,
followUpLevel: row.followUpLevel,
followUpTime: row.followUpTime,
@@ -1313,7 +1473,7 @@
// });
delCustomerFollow(row.id).then(() => {
// 鍒犻櫎鎴愬姛鍚庢洿鏂版湰鍦版暟鎹�
- getCustomer(row.customerPrivatePoolId).then(res => {
+ getCustomer(row.customerId).then(res => {
// 鏇存柊鏈湴鏁版嵁
negotiationRecords.value = res.data.followUpList || [];
});
@@ -1413,7 +1573,7 @@
const downloadAttachment = row => {
if (row.url) {
// proxy.download(row.url, {}, row.name);
- proxy.$download.name(row.url);
+ proxy.$download.byUrl(row.url, row.originalFilename);
} else {
proxy.$modal.msgError("涓嬭浇閾炬帴涓嶅瓨鍦�");
}
@@ -1480,6 +1640,19 @@
</script>
<style scoped lang="scss">
+ /* 閿�鍞鎴� / 浠e偍瀹㈡埛椤电锛氬彧瑕佹爣绛炬爮锛屽唴瀹圭敱涓嬫柟鍒楄〃灞曠ず */
+ .customer-tabs {
+ margin-bottom: 8px;
+
+ :deep(.el-tabs__header) {
+ margin-bottom: 0;
+ }
+
+ :deep(.el-tabs__content) {
+ display: none;
+ }
+ }
+
.detail-section {
margin-bottom: 20px;
padding: 15px;
@@ -1526,6 +1699,11 @@
word-break: break-word;
}
+ .text-danger {
+ color: var(--el-color-danger);
+ font-weight: 600;
+ }
+
.no-records {
text-align: center;
padding: 30px;
--
Gitblit v1.9.3