From 4db45250f9e0e47b1df480eb4e325a931f40c9c6 Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期六, 28 三月 2026 13:24:26 +0800
Subject: [PATCH] Merge branch 'dev_HXSJ' of http://114.132.189.42:9002/r/product-inventory-management into dev_HXSJ
---
src/views/procurementManagement/procurementLedger/index.vue | 132 ++++
src/views/basicData/customerFile/index.vue | 1277 ++++++++++++++++++++++++++-------------------
src/views/procurementManagement/advancedPriceManagement/index.vue | 189 ++++-
src/views/basicData/supplierManage/filesDia.vue | 30
4 files changed, 1,024 insertions(+), 604 deletions(-)
diff --git a/src/views/basicData/customerFile/index.vue b/src/views/basicData/customerFile/index.vue
index 0f39e25..5a752cb 100644
--- a/src/views/basicData/customerFile/index.vue
+++ b/src/views/basicData/customerFile/index.vue
@@ -3,244 +3,291 @@
<div class="search_form">
<div>
<span class="search_title">瀹㈡埛鍚嶇О锛�</span>
- <el-input
- v-model="searchForm.customerName"
- style="width: 240px;margin-right: 10px"
- placeholder="璇疯緭鍏�"
- @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-input v-model="searchForm.customerName"
+ style="width: 240px;margin-right: 10px"
+ placeholder="璇疯緭鍏�"
+ @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
- >
+ <el-button type="primary"
+ @click="handleQuery"
+ style="margin-left: 10px">鎼滅储</el-button>
</div>
<div>
- <el-button type="primary" @click="openForm('add')">鏂板瀹㈡埛</el-button>
+ <el-button type="primary"
+ @click="openForm('add')">鏂板瀹㈡埛</el-button>
<el-button @click="handleOut">瀵煎嚭</el-button>
- <el-button type="info" plain icon="Upload" @click="handleImport"
- >瀵煎叆</el-button
- >
- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
+ <el-button type="info"
+ plain
+ icon="Upload"
+ @click="handleImport">瀵煎叆</el-button>
+ <el-button type="danger"
+ plain
+ @click="handleDelete">鍒犻櫎</el-button>
</div>
</div>
<div class="table_list">
- <PIMTable
- rowKey="id"
- :column="tableColumn"
- :tableData="tableData"
- :page="page"
- :isSelection="true"
- @selection-change="handleSelectionChange"
- :tableLoading="tableLoading"
- @pagination="pagination"
- ></PIMTable>
+ <PIMTable rowKey="id"
+ :column="tableColumn"
+ :tableData="tableData"
+ :page="page"
+ :isSelection="true"
+ @selection-change="handleSelectionChange"
+ :tableLoading="tableLoading"
+ @pagination="pagination"></PIMTable>
</div>
- <el-dialog
- v-model="dialogFormVisible"
- :title="operationType === 'add' ? '鏂板瀹㈡埛淇℃伅' : '缂栬緫瀹㈡埛淇℃伅'"
- width="70%"
- @close="closeDia"
- >
- <el-form
- :model="form"
- label-width="140px"
- label-position="top"
- :rules="rules"
- ref="formRef"
- >
+ <el-dialog v-model="dialogFormVisible"
+ :title="operationType === 'add' ? '鏂板瀹㈡埛淇℃伅' : '缂栬緫瀹㈡埛淇℃伅'"
+ width="70%"
+ @close="closeDia">
+ <el-form :model="form"
+ label-width="140px"
+ label-position="top"
+ :rules="rules"
+ ref="formRef">
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="瀹㈡埛鍚嶇О锛�" prop="customerName">
- <el-input
- v-model="form.customerName"
- placeholder="璇疯緭鍏�"
- clearable
- />
+ <el-form-item label="瀹㈡埛鍚嶇О锛�"
+ prop="customerName">
+ <el-input v-model="form.customerName"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item
- label="绾崇◣浜鸿瘑鍒彿锛�"
- prop="taxpayerIdentificationNumber"
- >
- <el-input
- v-model="form.taxpayerIdentificationNumber"
- placeholder="璇疯緭鍏�"
- clearable
- />
+ <el-form-item label="绾崇◣浜鸿瘑鍒彿锛�"
+ prop="taxpayerIdentificationNumber">
+ <el-input v-model="form.taxpayerIdentificationNumber"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="鍏徃鍦板潃锛�" prop="companyAddress">
- <el-input
- v-model="form.companyAddress"
- placeholder="璇疯緭鍏�"
- clearable
- />
+ <el-form-item label="鍏徃鍦板潃锛�"
+ prop="companyAddress">
+ <el-input v-model="form.companyAddress"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鍏徃鐢佃瘽锛�" prop="companyPhone">
- <el-input
- v-model="form.companyPhone"
- placeholder="璇疯緭鍏�"
- clearable
- />
+ <el-form-item label="鍏徃鐢佃瘽锛�"
+ prop="companyPhone">
+ <el-input v-model="form.companyPhone"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="閾惰鍩烘湰鎴凤細" prop="basicBankAccount">
- <el-input
- v-model="form.basicBankAccount"
- placeholder="璇疯緭鍏�"
- clearable
- />
+ <el-form-item label="閾惰鍩烘湰鎴凤細"
+ prop="basicBankAccount">
+ <el-input v-model="form.basicBankAccount"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="閾惰璐﹀彿锛�" prop="bankAccount">
- <el-input
- v-model="form.bankAccount"
- placeholder="璇疯緭鍏�"
- clearable
- />
+ <el-form-item label="閾惰璐﹀彿锛�"
+ prop="bankAccount">
+ <el-input v-model="form.bankAccount"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="寮�鎴疯鍙凤細" prop="bankCode">
- <el-input
- v-model="form.bankCode"
- placeholder="璇疯緭鍏�"
- clearable
- />
+ <el-form-item label="寮�鎴疯鍙凤細"
+ prop="bankCode">
+ <el-input v-model="form.bankCode"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="瀹㈡埛鍒嗙被锛�" prop="customerType">
- <el-select v-model="form.customerType" placeholder="璇烽�夋嫨" clearable>
- <el-option label="闆跺敭瀹㈡埛" value="闆跺敭瀹㈡埛" />
- <el-option label="杩涢攢鍟嗗鎴�" value="杩涢攢鍟嗗鎴�" />
+ <el-form-item label="瀹㈡埛鍒嗙被锛�"
+ prop="customerType">
+ <el-select v-model="form.customerType"
+ placeholder="璇烽�夋嫨"
+ clearable>
+ <el-option label="闆跺敭瀹㈡埛"
+ value="闆跺敭瀹㈡埛" />
+ <el-option label="缁忛攢鍟嗗鎴�"
+ value="缁忛攢鍟嗗鎴�" />
</el-select>
</el-form-item>
</el-col>
</el-row>
- <el-row :gutter="30" v-for="(contact, index) in formYYs.contactList" :key="index">
- <el-col :span="12">
- <el-form-item label="鑱旂郴浜猴細" prop="contactPerson">
- <el-input v-model="contact.contactPerson" placeholder="璇疯緭鍏�" clearable />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="鑱旂郴鐢佃瘽锛�" prop="contactPhone">
- <div style="display: flex; align-items: center;width: 100%;">
- <el-input v-model="contact.contactPhone" placeholder="璇疯緭鍏�" clearable />
- <el-button @click="removeContact(index)" type="danger" circle style="margin-left: 5px;">
- <el-icon><Close /></el-icon>
- </el-button>
- </div>
- </el-form-item>
- </el-col>
- </el-row>
- <el-button @click="addNewContact" style="margin-bottom: 10px;">+ 鏂板鑱旂郴浜�</el-button>
+ <el-row :gutter="30"
+ v-for="(contact, index) in formYYs.contactList"
+ :key="index">
+ <el-col :span="12">
+ <el-form-item label="鑱旂郴浜猴細"
+ prop="contactPerson">
+ <el-input v-model="contact.contactPerson"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鑱旂郴鐢佃瘽锛�"
+ prop="contactPhone">
+ <div style="display: flex; align-items: center;width: 100%;">
+ <el-input v-model="contact.contactPhone"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ <el-button @click="removeContact(index)"
+ type="danger"
+ circle
+ style="margin-left: 5px;">
+ <el-icon>
+ <Close />
+ </el-icon>
+ </el-button>
+ </div>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-button @click="addNewContact"
+ style="margin-bottom: 10px;">+ 鏂板鑱旂郴浜�</el-button>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="缁存姢浜猴細" prop="maintainer">
- <el-select
- v-model="form.maintainer"
- placeholder="璇烽�夋嫨"
- clearable
- disabled
- >
- <el-option
- v-for="item in userList"
- :key="item.nickName"
- :label="item.nickName"
- :value="item.nickName"
- />
+ <el-form-item label="缁存姢浜猴細"
+ prop="maintainer">
+ <el-select v-model="form.maintainer"
+ placeholder="璇烽�夋嫨"
+ clearable
+ disabled>
+ <el-option v-for="item in userList"
+ :key="item.nickName"
+ :label="item.nickName"
+ :value="item.nickName" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="缁存姢鏃堕棿锛�" prop="maintenanceTime">
- <el-date-picker
- style="width: 100%"
- v-model="form.maintenanceTime"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- type="date"
- placeholder="璇烽�夋嫨"
- clearable
- />
+ <el-form-item label="缁存姢鏃堕棿锛�"
+ prop="maintenanceTime">
+ <el-date-picker style="width: 100%"
+ v-model="form.maintenanceTime"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
- <el-button type="primary" @click="submitForm">纭</el-button>
+ <el-button type="primary"
+ @click="submitForm">纭</el-button>
<el-button @click="closeDia">鍙栨秷</el-button>
</div>
</template>
</el-dialog>
<!-- 鐢ㄦ埛瀵煎叆瀵硅瘽妗� -->
- <el-dialog
- :title="upload.title"
- v-model="upload.open"
- width="400px"
- append-to-body
- >
- <el-upload
- ref="uploadRef"
- :limit="1"
- accept=".xlsx, .xls"
- :headers="upload.headers"
- :action="upload.url + '?updateSupport=' + upload.updateSupport"
- :disabled="upload.isUploading"
- :before-upload="upload.beforeUpload"
- :on-progress="upload.onProgress"
- :on-success="upload.onSuccess"
- :on-error="upload.onError"
- :on-change="upload.onChange"
- :auto-upload="false"
- drag
- >
+ <el-dialog :title="upload.title"
+ v-model="upload.open"
+ width="400px"
+ append-to-body>
+ <el-upload ref="uploadRef"
+ :limit="1"
+ accept=".xlsx, .xls"
+ :headers="upload.headers"
+ :action="upload.url + '?updateSupport=' + upload.updateSupport"
+ :disabled="upload.isUploading"
+ :before-upload="upload.beforeUpload"
+ :on-progress="upload.onProgress"
+ :on-success="upload.onSuccess"
+ :on-error="upload.onError"
+ :on-change="upload.onChange"
+ :auto-upload="false"
+ drag>
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
<div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div>
<template #tip>
<div class="el-upload__tip text-center">
<span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span>
- <el-link
- type="primary"
- :underline="false"
- style="font-size: 12px; vertical-align: baseline"
- @click="importTemplate"
- >涓嬭浇妯℃澘</el-link
- >
+ <el-link type="primary"
+ :underline="false"
+ style="font-size: 12px; vertical-align: baseline"
+ @click="importTemplate">涓嬭浇妯℃澘</el-link>
</div>
</template>
</el-upload>
<template #footer>
<div class="dialog-footer">
- <el-button type="primary" @click="submitFileForm">纭� 瀹�</el-button>
+ <el-button type="primary"
+ @click="submitFileForm">纭� 瀹�</el-button>
<el-button @click="upload.open = false">鍙� 娑�</el-button>
+ </div>
+ </template>
+ </el-dialog>
+ <!-- 瀹㈡埛鐢诲儚寮圭獥 -->
+ <el-dialog v-model="profileDialogVisible"
+ title="瀹㈡埛鐢诲儚"
+ width="70%"
+ @close="closeProfileDialog">
+ <div class="profile-content">
+ <div class="profile-info">
+ <h3 class="profile-title">璐拱涔犳儻</h3>
+ <el-descriptions :column="2"
+ border>
+ <el-descriptions-item label="瀹㈡埛鍚嶇О">{{ currentCustomer.customerName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="璐拱娆℃暟">{{ purchaseHabits.purchaseCount || 0 }}</el-descriptions-item>
+ <el-descriptions-item label="骞冲潎閲戦"><span style="color:#ff6f00">{{ purchaseHabits.averageAmount || 0 }}</span> 鍏�</el-descriptions-item>
+ <el-descriptions-item label="鏈�杩戣喘涔版椂闂�">{{ purchaseHabits.latestPurchaseTime || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="甯歌喘鍝�">
+ <el-tag v-for="item in purchaseHabits.topProducts"
+ style="margin-right: 10px;"
+ :key="item">{{ item }}</el-tag>
+ </el-descriptions-item>
+ </el-descriptions>
+ </div>
+ <div class="profile-form">
+ <h3 class="profile-title">瀹㈡埛鏍囩璁剧疆</h3>
+ <el-form :model="profileForm"
+ label-width="120px">
+ <el-form-item label="瀹㈡埛绛夌骇">
+ <el-radio-group v-model="profileForm.isVip">
+ <el-radio :label="true">VIP瀹㈡埛</el-radio>
+ <el-radio :label="false">鏅�氬鎴�</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ <el-form-item label="浠锋牸鏁忔劅">
+ <el-checkbox v-model="profileForm.isPriceSensitive">浠锋牸鏁忔劅</el-checkbox>
+ </el-form-item>
+ <el-form-item label="瀹㈡埛鍋忓ソ">
+ <el-input v-model="profileForm.preferences"
+ type="textarea"
+ :rows="4"
+ placeholder="璇疯緭鍏ュ鎴峰亸濂斤紝濡傦細鍠滄楂樺搧璐ㄤ骇鍝併�佹敞閲嶅敭鍚庢湇鍔$瓑" />
+ </el-form-item>
+ </el-form>
+ </div>
+ </div>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary"
+ @click="saveProfile">淇濆瓨</el-button>
+ <el-button @click="closeProfileDialog">鍙栨秷</el-button>
</div>
</template>
</el-dialog>
@@ -248,384 +295,546 @@
</template>
<script setup>
-import {onMounted, ref} from "vue";
-import { Search } from "@element-plus/icons-vue";
-import {
- addCustomer,
- delCustomer,
- getCustomer,
- listCustomer,
- updateCustomer,
-} from "@/api/basicData/customerFile.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();
+ import { onMounted, ref } from "vue";
+ import { Search } from "@element-plus/icons-vue";
+ import {
+ addCustomer,
+ delCustomer,
+ getCustomer,
+ listCustomer,
+ updateCustomer,
+ } from "@/api/basicData/customerFile.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 tableColumn = ref([
- {
- label: "瀹㈡埛鍒嗙被",
- prop: "customerType",
- width: 120,
- },
- {
- label: "瀹㈡埛鍚嶇О",
- prop: "customerName",
- width: 220,
- },
- {
- label: "绾崇◣浜鸿瘑鍒爜",
- prop: "taxpayerIdentificationNumber",
- width: 220,
- },
- {
- label: "鍦板潃鍙婅仈绯绘柟寮�",
- prop: "addressPhone",
- width: 250,
- },
- {
- label: "鑱旂郴浜�",
- prop: "contactPerson",
- },
- {
- label: "鑱旂郴鐢佃瘽",
- prop: "contactPhone",
- width:150
- },
- {
- label: "閾惰鍩烘湰鎴�",
- prop: "basicBankAccount",
- width: 220,
- },
- {
- label: "閾惰璐﹀彿",
- prop: "bankAccount",
- width: 220,
- },
- {
- label: "寮�鎴疯鍙�",
- prop: "bankCode",
- width:220
- },
- {
- label: "缁存姢浜�",
- prop: "maintainer",
- },
- {
- label: "缁存姢鏃堕棿",
- prop: "maintenanceTime",
- width: 100,
- },
- {
- dataType: "action",
- label: "鎿嶄綔",
- align: "center",
- fixed: 'right',
- operation: [
- {
- name: "缂栬緫",
- type: "text",
- clickFun: (row) => {
- openForm("edit", row);
+ const tableColumn = ref([
+ {
+ label: "瀹㈡埛鍒嗙被",
+ prop: "customerType",
+ width: 120,
+ },
+ {
+ label: "瀹㈡埛鍚嶇О",
+ prop: "customerName",
+ width: 220,
+ },
+
+ {
+ label: "绾崇◣浜鸿瘑鍒爜",
+ prop: "taxpayerIdentificationNumber",
+ width: 220,
+ },
+ {
+ label: "鍦板潃鍙婅仈绯绘柟寮�",
+ prop: "addressPhone",
+ width: 250,
+ },
+ {
+ label: "鑱旂郴浜�",
+ prop: "contactPerson",
+ },
+ {
+ label: "鑱旂郴鐢佃瘽",
+ prop: "contactPhone",
+ width: 150,
+ },
+ {
+ label: "閾惰鍩烘湰鎴�",
+ prop: "basicBankAccount",
+ width: 220,
+ },
+ {
+ label: "閾惰璐﹀彿",
+ prop: "bankAccount",
+ width: 220,
+ },
+ {
+ label: "寮�鎴疯鍙�",
+ prop: "bankCode",
+ width: 220,
+ },
+
+ {
+ label: "缁存姢浜�",
+ prop: "maintainer",
+ },
+ {
+ label: "缁存姢鏃堕棿",
+ prop: "maintenanceTime",
+ width: 100,
+ },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ width: 160,
+ fixed: "right",
+ operation: [
+ {
+ name: "缂栬緫",
+ type: "text",
+ clickFun: row => {
+ openForm("edit", row);
+ },
},
+ {
+ name: "瀹㈡埛鐢诲儚",
+ type: "text",
+ color: "rgb(229 187 21)",
+ showHide: row => {
+ return row.customerType == "缁忛攢鍟嗗鎴�";
+ },
+ clickFun: row => {
+ openCustomerProfile(row);
+ },
+ },
+ ],
+ },
+ ]);
+ const tableData = ref([]);
+ const selectedRows = ref([]);
+ const userList = ref([]);
+ const tableLoading = ref(false);
+ const page = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+ });
+ const total = ref(0);
+
+ // 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
+ const operationType = ref("");
+ const dialogFormVisible = ref(false);
+ const formYYs = ref({
+ // 鍏朵粬瀛楁...
+ contactList: [
+ {
+ contactPerson: "",
+ contactPhone: "",
},
],
- },
-]);
-const tableData = ref([]);
-const selectedRows = ref([]);
-const userList = ref([]);
-const tableLoading = ref(false);
-const page = reactive({
- current: 1,
- size: 100,
- total: 0,
-});
-const total = ref(0);
-
-// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
-const operationType = ref("");
-const dialogFormVisible = ref(false);
-const formYYs = ref({ // 鍏朵粬瀛楁...
- contactList: [
- {
+ });
+ const data = reactive({
+ searchForm: {
+ customerName: "",
+ customerType: "",
+ },
+ form: {
+ customerName: "",
+ taxpayerIdentificationNumber: "",
+ companyAddress: "",
+ companyPhone: "",
contactPerson: "",
- contactPhone: ""
- }
- ]
-});
-const data = reactive({
- searchForm: {
- customerName: "",
- customerType: "",
- },
- form: {
- customerName: "",
- taxpayerIdentificationNumber: "",
- companyAddress: "",
- companyPhone: "",
- contactPerson: "",
- contactPhone: "",
- maintainer: "",
- maintenanceTime: "",
- basicBankAccount: "",
- bankAccount: "",
- bankCode: "",
- customerType: "",
- },
- rules: {
- customerName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- taxpayerIdentificationNumber: [
- { required: true, message: "璇疯緭鍏�", trigger: "blur" },
- ],
- companyAddress: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- companyPhone: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- // contactPerson: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- // contactPhone: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- maintainer: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }],
- maintenanceTime: [
- { required: false, message: "璇烽�夋嫨", trigger: "change" },
- ],
- basicBankAccount: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- bankAccount: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- bankCode: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- customerType: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- },
-});
-const upload = reactive({
- // 鏄惁鏄剧ず寮瑰嚭灞傦紙瀹㈡埛瀵煎叆锛�
- open: false,
- // 寮瑰嚭灞傛爣棰橈紙瀹㈡埛瀵煎叆锛�
- title: "",
- // 鏄惁绂佺敤涓婁紶
- isUploading: false,
- // 璁剧疆涓婁紶鐨勮姹傚ご閮�
- headers: { Authorization: "Bearer " + getToken() },
- // 涓婁紶鐨勫湴鍧�
- url: import.meta.env.VITE_APP_BASE_API + "/basic/customer/importData",
- // 鏂囦欢涓婁紶鍓嶇殑鍥炶皟
- beforeUpload: (file) => {
- console.log('鏂囦欢鍗冲皢涓婁紶', file);
- // 鍙互鍦ㄦ澶勫仛鏂囦欢绫诲瀷鎴栧ぇ灏忔牎楠�
- const isValid = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' || file.name.endsWith('.xlsx') || file.name.endsWith('.xls');
- if (!isValid) {
- proxy.$modal.msgError("鍙兘涓婁紶 Excel 鏂囦欢");
- }
- return isValid;
- },
- // 鏂囦欢鐘舵�佹敼鍙樻椂鐨勫洖璋�
- onChange: (file, fileList) => {
- console.log('鏂囦欢鐘舵�佹敼鍙�', file, fileList);
- },
- // 鏂囦欢涓婁紶鎴愬姛鏃剁殑鍥炶皟
- onSuccess: (response, file, fileList) => {
- console.log('涓婁紶鎴愬姛', response, file, fileList);
- upload.isUploading = false;
- if(response.code === 200){
- proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛");
- upload.open = false;
- proxy.$refs["uploadRef"].clearFiles();
- getList();
- }else if(response.code === 500){
- proxy.$modal.msgError(response.msg);
- }else{
- proxy.$modal.msgWarning(response.msg);
- }
- },
- // 鏂囦欢涓婁紶澶辫触鏃剁殑鍥炶皟
- onError: (error, file, fileList) => {
- console.error('涓婁紶澶辫触', error, file, fileList);
- upload.isUploading = false;
- proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
- },
- // 鏂囦欢涓婁紶杩涘害鍥炶皟
- onProgress: (event, file, fileList) => {
- console.log('涓婁紶涓�...', event.percent);
- }
-});
-const { searchForm, form, rules } = toRefs(data);
-const addNewContact = () => {
- formYYs.value.contactList.push({
- contactPerson: "",
- contactPhone: ""
+ contactPhone: "",
+ maintainer: "",
+ maintenanceTime: "",
+ basicBankAccount: "",
+ bankAccount: "",
+ bankCode: "",
+ customerType: "",
+ },
+ rules: {
+ customerName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ taxpayerIdentificationNumber: [
+ { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+ ],
+ companyAddress: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ companyPhone: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ // contactPerson: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ // contactPhone: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ maintainer: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }],
+ maintenanceTime: [
+ { required: false, message: "璇烽�夋嫨", trigger: "change" },
+ ],
+ basicBankAccount: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ bankAccount: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ bankCode: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ customerType: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ },
});
-};
-
-const removeContact = (index) => {
- if (formYYs.value.contactList.length > 1) {
- formYYs.value.contactList.splice(index, 1);
- }
-};
-// 鏌ヨ鍒楄〃
-/** 鎼滅储鎸夐挳鎿嶄綔 */
-const handleQuery = () => {
- page.current = 1;
- getList();
-};
-const pagination = (obj) => {
- page.current = obj.page;
- page.size = obj.limit;
- getList();
-};
-const getList = () => {
- tableLoading.value = true;
- listCustomer({ ...searchForm.value, ...page }).then((res) => {
- tableLoading.value = false;
- tableData.value = res.records;
- page.total = res.total;
- });
-};
-// 琛ㄦ牸閫夋嫨鏁版嵁
-const handleSelectionChange = (selection) => {
- selectedRows.value = selection;
-};
-/** 鎻愪氦涓婁紶鏂囦欢 */
-function submitFileForm() {
- upload.isUploading = true;
- proxy.$refs["uploadRef"].submit();
-}
-/** 瀵煎叆鎸夐挳鎿嶄綔 */
-function handleImport() {
- upload.title = "瀹㈡埛瀵煎叆";
- upload.open = true;
-}
-/** 涓嬭浇妯℃澘 */
-function importTemplate() {
- proxy.download("/basic/customer/downloadTemplate", {}, "瀹㈡埛瀵煎叆妯℃澘.xlsx");
-}
-// 鎵撳紑寮规
-const openForm = (type, row) => {
- operationType.value = type;
- form.value = {};
- form.value.maintainer = userStore.nickName;
- formYYs.value.contactList = [
- {
- contactPerson: "",
- contactPhone: ""
- }
- ];
- form.value.maintenanceTime = getCurrentDate();
- userListNoPage().then((res) => {
- userList.value = res.data;
- });
- if (type === "edit") {
- getCustomer(row.id).then((res) => {
- form.value = { ...res.data };
- formYYs.value.contactList = res.data.contactPerson.split(",").map((item, index) => {
- return {
- contactPerson: item,
- contactPhone: res.data.contactPhone.split(",")[index]
- }
- });
-
- });
- }
- dialogFormVisible.value = true;
-};
-// 鎻愪氦琛ㄥ崟
-const submitForm = () => {
- proxy.$refs["formRef"].validate((valid) => {
- if (valid) {
- if (operationType.value === "edit") {
- submitEdit();
- } else {
- submitAdd();
+ const upload = reactive({
+ // 鏄惁鏄剧ず寮瑰嚭灞傦紙瀹㈡埛瀵煎叆锛�
+ open: false,
+ // 寮瑰嚭灞傛爣棰橈紙瀹㈡埛瀵煎叆锛�
+ title: "",
+ // 鏄惁绂佺敤涓婁紶
+ isUploading: false,
+ // 璁剧疆涓婁紶鐨勮姹傚ご閮�
+ headers: { Authorization: "Bearer " + getToken() },
+ // 涓婁紶鐨勫湴鍧�
+ url: import.meta.env.VITE_APP_BASE_API + "/basic/customer/importData",
+ // 鏂囦欢涓婁紶鍓嶇殑鍥炶皟
+ beforeUpload: file => {
+ console.log("鏂囦欢鍗冲皢涓婁紶", file);
+ // 鍙互鍦ㄦ澶勫仛鏂囦欢绫诲瀷鎴栧ぇ灏忔牎楠�
+ const isValid =
+ file.type ===
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
+ file.name.endsWith(".xlsx") ||
+ file.name.endsWith(".xls");
+ if (!isValid) {
+ proxy.$modal.msgError("鍙兘涓婁紶 Excel 鏂囦欢");
}
- }
+ return isValid;
+ },
+ // 鏂囦欢鐘舵�佹敼鍙樻椂鐨勫洖璋�
+ onChange: (file, fileList) => {
+ console.log("鏂囦欢鐘舵�佹敼鍙�", file, fileList);
+ },
+ // 鏂囦欢涓婁紶鎴愬姛鏃剁殑鍥炶皟
+ onSuccess: (response, file, fileList) => {
+ console.log("涓婁紶鎴愬姛", response, file, fileList);
+ upload.isUploading = false;
+ if (response.code === 200) {
+ proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛");
+ upload.open = false;
+ proxy.$refs["uploadRef"].clearFiles();
+ getList();
+ } else if (response.code === 500) {
+ proxy.$modal.msgError(response.msg);
+ } else {
+ proxy.$modal.msgWarning(response.msg);
+ }
+ },
+ // 鏂囦欢涓婁紶澶辫触鏃剁殑鍥炶皟
+ onError: (error, file, fileList) => {
+ console.error("涓婁紶澶辫触", error, file, fileList);
+ upload.isUploading = false;
+ proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
+ },
+ // 鏂囦欢涓婁紶杩涘害鍥炶皟
+ onProgress: (event, file, fileList) => {
+ console.log("涓婁紶涓�...", event.percent);
+ },
});
-};
-// 鎻愪氦鏂板
-const submitAdd = () => {
- if(formYYs.value.contactList.length < 1){
- return proxy.$modal.msgWarning("璇疯嚦灏戞坊鍔犱竴涓仈绯讳汉");
- }
- form.value.contactPerson = formYYs.value.contactList.map(item => item.contactPerson).join(",");
- form.value.contactPhone = formYYs.value.contactList.map(item => item.contactPhone).join(",");
- addCustomer(form.value).then((res) => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
- getList();
- });
-};
-// 鎻愪氦淇敼
-const submitEdit = () => {
- form.value.contactPerson = formYYs.value.contactList.map(item => item.contactPerson).join(",");
- form.value.contactPhone = formYYs.value.contactList.map(item => item.contactPhone).join(",");
- updateCustomer(form.value).then((res) => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
- getList();
- });
-};
-// 鍏抽棴寮规
-const closeDia = () => {
- proxy.resetForm("formRef");
- dialogFormVisible.value = false;
-};
-// 瀵煎嚭
-const handleOut = () => {
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
- .then(() => {
- proxy.download("/basic/customer/export", {}, "瀹㈡埛妗f.xlsx");
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
+ const { searchForm, form, rules } = toRefs(data);
+ const addNewContact = () => {
+ formYYs.value.contactList.push({
+ contactPerson: "",
+ contactPhone: "",
});
-};
-// 鍒犻櫎
-const handleDelete = () => {
- let ids = [];
- if (selectedRows.value.length > 0) {
- // 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹�
- const unauthorizedData = selectedRows.value.filter(item => item.maintainer !== userStore.nickName);
- if (unauthorizedData.length > 0) {
- proxy.$modal.msgWarning("涓嶅彲鍒犻櫎浠栦汉缁存姢鐨勬暟鎹�");
+ };
+
+ const removeContact = index => {
+ if (formYYs.value.contactList.length > 1) {
+ formYYs.value.contactList.splice(index, 1);
+ }
+ };
+ // 鏌ヨ鍒楄〃
+ /** 鎼滅储鎸夐挳鎿嶄綔 */
+ const handleQuery = () => {
+ page.current = 1;
+ getList();
+ };
+ const pagination = obj => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+ };
+ const getList = () => {
+ tableLoading.value = true;
+ listCustomer({ ...searchForm.value, ...page }).then(res => {
+ tableLoading.value = false;
+ tableData.value = res.records;
+ page.total = res.total;
+ });
+ };
+ // 琛ㄦ牸閫夋嫨鏁版嵁
+ const handleSelectionChange = selection => {
+ selectedRows.value = selection;
+ };
+ /** 鎻愪氦涓婁紶鏂囦欢 */
+ function submitFileForm() {
+ upload.isUploading = true;
+ proxy.$refs["uploadRef"].submit();
+ }
+ /** 瀵煎叆鎸夐挳鎿嶄綔 */
+ function handleImport() {
+ upload.title = "瀹㈡埛瀵煎叆";
+ upload.open = true;
+ }
+ /** 涓嬭浇妯℃澘 */
+ function importTemplate() {
+ proxy.download("/basic/customer/downloadTemplate", {}, "瀹㈡埛瀵煎叆妯℃澘.xlsx");
+ }
+ // 鎵撳紑寮规
+ const openForm = (type, row) => {
+ operationType.value = type;
+ form.value = {};
+ form.value.maintainer = userStore.nickName;
+ formYYs.value.contactList = [
+ {
+ contactPerson: "",
+ contactPhone: "",
+ },
+ ];
+ form.value.maintenanceTime = getCurrentDate();
+ userListNoPage().then(res => {
+ userList.value = res.data;
+ });
+ if (type === "edit") {
+ getCustomer(row.id).then(res => {
+ form.value = { ...res.data };
+ formYYs.value.contactList = res.data.contactPerson
+ .split(",")
+ .map((item, index) => {
+ return {
+ contactPerson: item,
+ contactPhone: res.data.contactPhone.split(",")[index],
+ };
+ });
+ });
+ }
+ dialogFormVisible.value = true;
+ };
+ // 鎻愪氦琛ㄥ崟
+ const submitForm = () => {
+ proxy.$refs["formRef"].validate(valid => {
+ if (valid) {
+ if (operationType.value === "edit") {
+ submitEdit();
+ } else {
+ submitAdd();
+ }
+ }
+ });
+ };
+ // 鎻愪氦鏂板
+ const submitAdd = () => {
+ if (formYYs.value.contactList.length < 1) {
+ return proxy.$modal.msgWarning("璇疯嚦灏戞坊鍔犱竴涓仈绯讳汉");
+ }
+ form.value.contactPerson = formYYs.value.contactList
+ .map(item => item.contactPerson)
+ .join(",");
+ form.value.contactPhone = formYYs.value.contactList
+ .map(item => item.contactPhone)
+ .join(",");
+ addCustomer(form.value).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ getList();
+ });
+ };
+ // 鎻愪氦淇敼
+ const submitEdit = () => {
+ form.value.contactPerson = formYYs.value.contactList
+ .map(item => item.contactPerson)
+ .join(",");
+ form.value.contactPhone = formYYs.value.contactList
+ .map(item => item.contactPhone)
+ .join(",");
+ updateCustomer(form.value).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ getList();
+ });
+ };
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ proxy.resetForm("formRef");
+ dialogFormVisible.value = false;
+ };
+ // 瀵煎嚭
+ const handleOut = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ proxy.download("/basic/customer/export", {}, "瀹㈡埛妗f.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+ // 鍒犻櫎
+ const handleDelete = () => {
+ let ids = [];
+ if (selectedRows.value.length > 0) {
+ // 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹�
+ const unauthorizedData = selectedRows.value.filter(
+ item => item.maintainer !== userStore.nickName
+ );
+ if (unauthorizedData.length > 0) {
+ proxy.$modal.msgWarning("涓嶅彲鍒犻櫎浠栦汉缁存姢鐨勬暟鎹�");
+ return;
+ }
+ ids = selectedRows.value.map(item => item.id);
+ } else {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
return;
}
- ids = selectedRows.value.map((item) => item.id);
- } else {
- proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
- return;
- }
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
- .then(() => {
- tableLoading.value = true;
- delCustomer(ids)
- .then((res) => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- getList();
- })
- .finally(() => {
- tableLoading.value = false;
- });
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
})
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
+ .then(() => {
+ tableLoading.value = true;
+ delCustomer(ids)
+ .then(res => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ })
+ .finally(() => {
+ tableLoading.value = false;
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+
+ // 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
+ function getCurrentDate() {
+ const today = new Date();
+ const year = today.getFullYear();
+ const month = String(today.getMonth() + 1).padStart(2, "0"); // 鏈堜唤浠�0寮�濮�
+ const day = String(today.getDate()).padStart(2, "0");
+ return `${year}-${month}-${day}`;
+ }
+
+ // 瀹㈡埛鐢诲儚鐩稿叧
+ const profileDialogVisible = ref(false);
+ const currentCustomer = ref({});
+ const purchaseHabits = ref({
+ purchaseCount: 0,
+ averageAmount: 1240,
+ latestPurchaseTime: "",
+ topProducts: [],
+ });
+ const profileForm = ref({
+ isVip: false,
+ isPriceSensitive: false,
+ preferences: "",
+ });
+
+ // 鎵撳紑瀹㈡埛鐢诲儚寮圭獥
+ const openCustomerProfile = row => {
+ currentCustomer.value = { ...row };
+ purchaseHabits.value = {
+ purchaseCount: row.purchaseCount || 0,
+ averageAmount: row.averageAmount || 0,
+ latestPurchaseTime: row.latestPurchaseTime || "-",
+ topProducts: row.topProducts || [],
+ };
+ profileForm.value = {
+ isVip: row.isVip,
+ isPriceSensitive: row.isPriceSensitive,
+ preferences: row.preferences || "",
+ };
+ profileDialogVisible.value = true;
+ };
+
+ // 鍏抽棴瀹㈡埛鐢诲儚寮圭獥
+ const closeProfileDialog = () => {
+ profileDialogVisible.value = false;
+ currentCustomer.value = {};
+ };
+
+ // 淇濆瓨瀹㈡埛鐢诲儚
+ const saveProfile = () => {
+ const updateData = {
+ id: currentCustomer.value.id,
+ preferences: profileForm.value.preferences,
+ isPriceSensitive: profileForm.value.isPriceSensitive,
+ isVip: profileForm.value.isVip,
+ };
+ updateCustomer(updateData).then(res => {
+ proxy.$modal.msgSuccess("瀹㈡埛鐢诲儚淇濆瓨鎴愬姛");
+ closeProfileDialog();
+ getList();
});
-};
+ };
-// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
-function getCurrentDate() {
- const today = new Date();
- const year = today.getFullYear();
- const month = String(today.getMonth() + 1).padStart(2, "0"); // 鏈堜唤浠�0寮�濮�
- const day = String(today.getDate()).padStart(2, "0");
- return `${year}-${month}-${day}`;
-}
-
-onMounted(() => {
- getList();
-});
+ onMounted(() => {
+ getList();
+ });
</script>
-<style scoped lang="scss"></style>
+<style scoped lang="scss">
+ .profile-content {
+ .profile-title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+ margin: 20px 0 15px 0;
+ padding-bottom: 10px;
+ border-bottom: 2px solid #409eff;
+ position: relative;
+
+ &::before {
+ content: "";
+ position: absolute;
+ left: 0;
+ bottom: -2px;
+ width: 60px;
+ height: 2px;
+ background-color: #409eff;
+ }
+ }
+
+ .profile-info {
+ margin-bottom: 30px;
+
+ :deep(.el-descriptions) {
+ border-radius: 8px;
+ overflow: hidden;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
+ }
+
+ :deep(.el-descriptions__label) {
+ background-color: #f5f7fa;
+ font-weight: 500;
+ color: #606266;
+ }
+
+ :deep(.el-descriptions__content) {
+ color: #303133;
+ font-weight: 500;
+ }
+ }
+
+ .profile-form {
+ background-color: #f9f9f9;
+ padding: 20px;
+ border-radius: 8px;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
+
+ :deep(.el-form-item__label) {
+ font-weight: 500;
+ color: #606266;
+ }
+
+ :deep(.el-radio-group) {
+ display: flex;
+ gap: 20px;
+ }
+
+ :deep(.el-radio) {
+ margin-right: 0;
+ }
+
+ :deep(.el-checkbox) {
+ font-weight: normal;
+ }
+
+ :deep(.el-textarea__inner) {
+ border-radius: 6px;
+ border: 1px solid #dcdfe6;
+ transition: all 0.3s ease;
+
+ &:focus {
+ border-color: #409eff;
+ box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1);
+ }
+ }
+ }
+ }
+</style>
diff --git a/src/views/basicData/supplierManage/filesDia.vue b/src/views/basicData/supplierManage/filesDia.vue
index 6284d6b..6b35afe 100644
--- a/src/views/basicData/supplierManage/filesDia.vue
+++ b/src/views/basicData/supplierManage/filesDia.vue
@@ -28,18 +28,11 @@
:tableData="tableData"
:tableLoading="tableLoading"
:isSelection="true"
+ :page="{ total, current: page.current, size: page.size }"
+ @pagination="paginationSearch"
@selection-change="handleSelectionChange"
- height="500"
- >
- </PIMTable>
- <pagination
- style="margin: 10px 0"
- v-show="total > 0"
- @pagination="paginationSearch"
- :total="total"
- :page="page.current"
- :limit="page.size"
- />
+ height="450"
+ />
<template #footer>
<div class="dialog-footer">
<el-button @click="closeDia">鍙栨秷</el-button>
@@ -60,7 +53,6 @@
fileDel,
fileListPage
} from "@/api/basicData/supplierManageFile.js";
-import Pagination from "@/components/PIMTable/Pagination.vue";
const { proxy } = getCurrentInstance()
const emit = defineEmits(['close'])
@@ -85,13 +77,13 @@
downLoadFile(row);
},
},
- {
- name: "棰勮",
- type: "text",
- clickFun: (row) => {
- lookFile(row);
- },
- }
+ // {
+ // name: "棰勮",
+ // type: "text",
+ // clickFun: (row) => {
+ // lookFile(row);
+ // },
+ // }
],
},
]);
diff --git a/src/views/procurementManagement/advancedPriceManagement/index.vue b/src/views/procurementManagement/advancedPriceManagement/index.vue
index 597b39b..5af8311 100644
--- a/src/views/procurementManagement/advancedPriceManagement/index.vue
+++ b/src/views/procurementManagement/advancedPriceManagement/index.vue
@@ -8,7 +8,7 @@
</el-form-item>
<el-form-item label="渚涘簲鍟嗭細">
<el-select v-model="searchForm.supplierId" placeholder="璇烽�夋嫨渚涘簲鍟�" clearable style="width: 200px">
- <el-option v-for="supplier in supplierList" :key="supplier.id" :label="supplier.name" :value="supplier.id" />
+ <el-option v-for="supplier in supplierList" :key="supplier.id" :label="supplier.supplierName" :value="supplier.id" />
</el-select>
</el-form-item>
<el-form-item>
@@ -62,11 +62,11 @@
<div class="product-info">
<div class="product-name">{{ row.productName }}</div>
<div class="product-spec">{{ row.specification }}</div>
- <div class="product-code">缂栫爜: {{ row.productCode }}</div>
+ <!-- <div class="product-code">缂栫爜: {{ row.productCode }}</div> -->
</div>
</template>
</el-table-column>
- <el-table-column label="渚涘簲鍟�" prop="supplierName" width="150" />
+ <el-table-column label="渚涘簲鍟�" prop="supplierName" width="200" />
<el-table-column label="鍩虹浠锋牸" width="120" align="right">
<template #default="{ row }">
<span class="price-text">楼{{ row.basePrice }}</span>
@@ -103,9 +103,9 @@
<el-table-column label="鐘舵��" width="100" align="center">
<template #default="{ row }">
<el-tag :type="getStatusType(row.status)">{{ getStatusText(row.status) }}</el-tag>
- <div v-if="isPriceWarning(row)" class="warning-indicator">
+ <!-- <div v-if="isPriceWarning(row)" class="warning-indicator">
<el-icon color="#F56C6C"><Warning /></el-icon>
- </div>
+ </div> -->
</template>
</el-table-column>
<el-table-column label="鐢熸晥鏃堕棿" prop="effectiveTime" width="180" />
@@ -143,10 +143,20 @@
<el-form :model="formData" :rules="formRules" ref="formRef" label-width="120px">
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="鍟嗗搧鍚嶇О" prop="productName">
- <el-select v-model="formData.productName" placeholder="璇烽�夋嫨鍟嗗搧" style="width: 100%" filterable>
- <el-option v-for="product in productList" :key="product.id" :label="product.name" :value="product.name" />
- </el-select>
+ <el-form-item label="鍟嗗搧鍚嶇О" prop="productId">
+ <el-tree-select
+ v-model="formData.productId"
+ placeholder="璇烽�夋嫨鍟嗗搧"
+ clearable
+ filterable
+ check-strictly
+ @change="getModels"
+ :data="productOptions"
+ :props="{ label: 'productName', value: 'id', children: 'children' }"
+ node-key="id"
+ :render-after-expand="false"
+ style="width: 100%"
+ />
</el-form-item>
</el-col>
<el-col :span="12">
@@ -158,13 +168,35 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="瑙勬牸鍨嬪彿" prop="specification">
- <el-input v-model="formData.specification" placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�" />
+ <el-select
+ v-model="formData.specification"
+ placeholder="璇烽�夋嫨"
+ clearable
+ @change="getProductModel"
+ >
+ <el-option
+ v-for="item in modelOptions"
+ :key="item.id"
+ :label="item.model"
+ :value="item.id"
+ />
+ </el-select>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="渚涘簲鍟�" prop="supplierName">
- <el-select v-model="formData.supplierName" placeholder="璇烽�夋嫨渚涘簲鍟�" style="width: 100%">
- <el-option v-for="supplier in supplierList" :key="supplier.id" :label="supplier.name" :value="supplier.name" />
+ <el-form-item label="渚涘簲鍟�" prop="supplierId">
+ <el-select
+ v-model="formData.supplierId"
+ placeholder="璇烽�夋嫨渚涘簲鍟�"
+ clearable
+ @change="handleSupplierChange"
+ >
+ <el-option
+ v-for="item in supplierList"
+ :key="item.id"
+ :label="item.supplierName"
+ :value="item.id"
+ />
</el-select>
</el-form-item>
</el-col>
@@ -185,7 +217,7 @@
<!-- 鎶樻墸璁剧疆 -->
<el-divider content-position="left">鎶樻墸璁剧疆</el-divider>
<el-row :gutter="20">
- <el-col :span="8">
+ <el-col :span="12">
<el-form-item label="鎶樻墸绫诲瀷">
<el-select v-model="formData.discountType" placeholder="璇烽�夋嫨鎶樻墸绫诲瀷" style="width: 100%">
<el-option label="鏃犳姌鎵�" value="" />
@@ -194,10 +226,11 @@
</el-select>
</el-form-item>
</el-col>
- <el-col :span="8">
- <el-form-item label="鎶樻墸鍊�" v-if="formData.discountType && formData.discountType !== 'tiered'">
+ <el-col :span="12">
+ <el-form-item label="鎶樻墸鍊�">
<el-input-number
v-model="formData.discountValue"
+ :disabled="!(formData.discountType && formData.discountType !== 'tiered')"
:min="0"
:max="formData.discountType === 'percentage' ? 100 : undefined"
:precision="2"
@@ -206,10 +239,11 @@
/>
</el-form-item>
</el-col>
- <el-col :span="8">
+ <el-col :span="12">
<el-form-item label="鎶樻墸鏈夋晥鏈�">
<el-date-picker
v-model="formData.discountEndTime"
+ :disabled="!(formData.discountType && formData.discountType !== 'tiered')"
type="datetime"
placeholder="閫夋嫨缁撴潫鏃堕棿"
style="width: 100%"
@@ -221,19 +255,14 @@
<!-- 浠锋牸鎺у埗 -->
<el-divider content-position="left">浠锋牸鎺у埗</el-divider>
<el-row :gutter="20">
- <el-col :span="8">
+ <el-col :span="12">
<el-form-item label="鏈�浣庝环鏍�">
<el-input-number v-model="formData.minPrice" :min="0" :precision="2" placeholder="鏈�浣庝环鏍�" style="width: 100%" />
</el-form-item>
</el-col>
- <el-col :span="8">
+ <el-col :span="12">
<el-form-item label="鏈�楂樹环鏍�">
<el-input-number v-model="formData.maxPrice" :min="0" :precision="2" placeholder="鏈�楂樹环鏍�" style="width: 100%" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="棰勮闃堝��(%)">
- <el-input-number v-model="formData.warningThreshold" :min="0" :max="100" :precision="1" placeholder="棰勮闃堝��" style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
@@ -334,12 +363,14 @@
<script setup>
import {ref, reactive, computed, onMounted, getCurrentInstance} from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
+import { productTreeList, modelList } from "@/api/basicData/product.js";
import {
Search, Refresh, Plus, Discount, Setting, Download, Delete, Edit,
- Warning
} from '@element-plus/icons-vue'
import { listPage, update, del, add } from '@/api/procurementManagement/advancedPriceManagement'
-
+import {
+ getOptions,
+} from "@/api/procurementManagement/procurementLedger.js";
// 鍝嶅簲寮忔暟鎹�
const loading = ref(false)
const submitLoading = ref(false)
@@ -347,6 +378,8 @@
const batchDiscountVisible = ref(false)
const priceControlVisible = ref(false)
const dialogType = ref('add')
+const productOptions = ref([]);
+const modelOptions = ref([]);
const selectedRows = ref([])
const formRef = ref()
@@ -367,10 +400,13 @@
// 琛ㄥ崟鏁版嵁
const formData = reactive({
+ productId: null,
productName: '',
productCode: '',
specification: '',
+ supplierId: null,
supplierName: '',
+ specificationId: null,
basePrice: 0,
unit: '',
discountType: '',
@@ -405,24 +441,19 @@
// 琛ㄥ崟楠岃瘉瑙勫垯
const formRules = {
- productName: [{ required: true, message: '璇烽�夋嫨鍟嗗搧鍚嶇О', trigger: 'change' }],
+ productId: [{ required: true, message: '璇烽�夋嫨鍟嗗搧鍚嶇О', trigger: 'change' }],
productCode: [{ required: true, message: '璇疯緭鍏ュ晢鍝佺紪鐮�', trigger: 'blur' }],
- supplierName: [{ required: true, message: '璇烽�夋嫨渚涘簲鍟�', trigger: 'change' }],
+ supplierId: [{ required: true, message: '璇烽�夋嫨渚涘簲鍟�', trigger: 'change' }],
basePrice: [{ required: true, message: '璇疯緭鍏ュ熀纭�浠锋牸', trigger: 'blur' }],
effectiveTime: [{ required: true, message: '璇烽�夋嫨鐢熸晥鏃堕棿', trigger: 'change' }],
reason: [{ required: true, message: '璇烽�夋嫨璋冧环鍘熷洜', trigger: 'change' }]
}
-const supplierList = ref([
- { id: 1, name: '浼樿川浜旈噾渚涘簲鍟�' },
- { id: 2, name: '閽㈡潗璐告槗鍏徃' },
- { id: 3, name: '寤烘潗鎵瑰彂鍟�' }
-])
+getOptions().then((res) => {
+ supplierList.value = res.data;
+ });
-const productList = ref([
- { id: 1, name: '楂樺己搴﹁灪鏍�' },
- { id: 2, name: '涓嶉攬閽㈢' },
- { id: 3, name: '閾濆悎閲戝瀷鏉�' }
+const supplierList = ref([
])
@@ -434,7 +465,8 @@
} else if (row.discountType === 'fixed') {
finalPrice = row.basePrice - row.discountValue
}
- return Math.max(finalPrice, 0)
+ let man = Math.max(finalPrice, 0)
+ return man.toFixed(2)
}
const getDiscountTagType = (discountType) => {
@@ -454,6 +486,40 @@
return textMap[discountType] || '鏈煡'
}
+const getProductOptions = () => {
+ productTreeList().then((res) => {
+ productOptions.value = res;
+ });
+};
+
+const findNodeById = (data, id) => {
+ for (const item of data) {
+ if (item.id === id) return item;
+ if (item.children) {
+ const found = findNodeById(item.children, id);
+ if (found) return found;
+ }
+ }
+ return null;
+};
+
+const getModels = (value) => {
+ if (value) {
+ const selectedProduct = findNodeById(productOptions.value, value);
+ if (selectedProduct) {
+ formData.productName = selectedProduct.productName;
+ formData.productCode = selectedProduct.productCode;
+ }
+ modelList({ id: value }).then((res) => {
+ modelOptions.value = res;
+ });
+ } else {
+ formData.productName = "";
+ formData.productCode = "";
+ modelOptions.value = [];
+ }
+};
+
const getStatusType = (status) => {
const statusMap = {
active: 'success',
@@ -461,6 +527,27 @@
expired: 'info'
}
return statusMap[status] || 'info'
+}
+
+const getProductModel = (value) => {
+ const index = modelOptions.value.findIndex((item) => item.id === value);
+ if (index !== -1) {
+ formData.specification = modelOptions.value[index].model;
+ formData.specificationId = modelOptions.value[index].id;
+ formData.unit = modelOptions.value[index].unit;
+ } else {
+ formData.specification = null;
+ formData.specificationId = null;
+ formData.unit = null;
+ }
+};
+
+const handleSupplierChange = (value) => {
+ const supplier = supplierList.value.find(supplier => supplier.id === value)
+ if (supplier) {
+ formData.supplierId = supplier.id
+ formData.supplierName = supplier.supplierName
+ }
}
const getStatusText = (status) => {
@@ -471,13 +558,6 @@
}
return statusMap[status] || '鏈煡'
}
-
-const isPriceWarning = (row) => {
- if (!row.priceControl) return false
- const finalPrice = calculateFinalPrice(row)
- return finalPrice < row.priceControl.minPrice || finalPrice > row.priceControl.maxPrice
-}
-
const handleSearch = () => {
loading.value = true
@@ -501,10 +581,14 @@
const openDialog = (type, row = {}) => {
dialogType.value = type
if (type === 'edit' && row.id) {
+ // 澶嶅埗琛屾暟鎹埌琛ㄥ崟
Object.assign(formData, {
...row,
- minPrice: row.priceControl?.minPrice,
- maxPrice: row.priceControl?.maxPrice,
+ // 鍏煎涓ょ鏁版嵁缁撴瀯锛氬钩閾虹殑瀛楁鎴栧祵濂楀湪 priceControl 涓殑瀛楁
+ minPrice: row.minPrice ?? row.priceControl?.minPrice,
+ maxPrice: row.maxPrice ?? row.priceControl?.maxPrice,
+ // 纭繚鎶樻墸鏈夋晥鏈熶篃琚祴鍊� (濡傛灉 row.discountEndTime 瀛樺湪鐨勮瘽)
+ discountEndTime: row.discountEndTime || row.discountEndTime,
tieredDiscount: row.tieredDiscount || []
})
} else {
@@ -515,9 +599,11 @@
const resetFormData = () => {
Object.assign(formData, {
+ productId: null,
productName: '',
productCode: '',
specification: '',
+ supplierId: null,
supplierName: '',
basePrice: 0,
unit: '',
@@ -543,12 +629,12 @@
})
}
-const removeTieredRow = (index) => {
- formData.tieredDiscount.splice(index, 1)
-}
-
const handleSubmit = async () => {
if (!formRef.value) return
+ formData.actualPrice = calculateFinalPrice(formData)
+ if( formData.discountType === ''){
+ formData.discountEndTime = '2099-12-31 23:59:59'
+ }
try {
await formRef.value.validate()
@@ -677,6 +763,7 @@
// 鐢熷懡鍛ㄦ湡
onMounted(() => {
handleSearch()
+ getProductOptions()
})
</script>
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index a7935b5..400f061 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -552,6 +552,11 @@
</el-select>
</el-form-item>
</el-col>
+ <el-col :span="24">
+ <el-form-item label=" ">
+ <el-button type="warning" :disabled="!(productForm.productId && productForm.productModelId && productForm.taxRate)" @click="showPriceReference" icon="Search">鏌ョ湅鍘嗗彶閲囪喘浠锋牸鍙傝��</el-button>
+ </el-form-item>
+ </el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
@@ -636,6 +641,62 @@
<el-button type="primary" @click="submitProduct">纭</el-button>
<el-button @click="closeProductDia">鍙栨秷</el-button>
</div>
+ </template>
+ </el-dialog>
+
+ <!-- 鍘嗗彶閲囪喘浠锋牸鍙傝�冨脊绐� -->
+ <el-dialog
+ v-model="priceReferenceVisible"
+ title="鍘嗗彶閲囪喘浠锋牸鍙傝��"
+ width="1000px"
+ append-to-body
+ >
+ <el-table
+ v-loading="priceReferenceLoading"
+ :data="priceReferenceData"
+ border
+ style="width: 100%"
+ >
+ <el-table-column label="鍟嗗搧鍚嶇О" prop="productName" min-width="150" show-overflow-tooltip />
+ <el-table-column label="瑙勬牸鍨嬪彿" prop="specification" width="150" show-overflow-tooltip />
+ <el-table-column label="渚涘簲鍟�" prop="supplierName" width="200" show-overflow-tooltip />
+ <el-table-column label="鍩虹浠锋牸" width="120" align="right">
+ <template #default="{ row }">
+ <span style="color: #f56c6c; font-weight: bold;">楼{{ row.basePrice }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="鎶樻墸淇℃伅" width="120" align="center">
+ <template #default="{ row }">
+ <el-tag v-if="row.discountType === 'percentage'" type="success">
+ {{ row.discountValue }}%
+ </el-tag>
+ <el-tag v-else-if="row.discountType === 'fixed'" type="warning">
+ -楼{{ row.discountValue }}
+ </el-tag>
+ <span v-else>鏃犳姌鎵�</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="鐢熸晥鏃堕棿" prop="effectiveTime" width="180" align="center" />
+ <el-table-column label="鎿嶄綔" width="100" align="center" fixed="right">
+ <template #default="{ row }">
+ <el-button type="primary" link @click="selectPriceReference(row)">閫夋嫨</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+
+ <div class="pagination-container" style="margin-top: 20px; display: flex; justify-content: flex-end;">
+ <el-pagination
+ v-model:current-page="priceReferencePagination.current"
+ v-model:page-size="priceReferencePagination.size"
+ :page-sizes="[10, 20, 50]"
+ :total="priceReferenceTotal"
+ layout="total, sizes, prev, pager, next"
+ @size-change="handlePriceReferenceSizeChange"
+ @current-change="handlePriceReferenceCurrentChange"
+ />
+ </div>
+ <template #footer>
+ <el-button @click="priceReferenceVisible = false">鍏抽棴</el-button>
</template>
</el-dialog>
@@ -903,6 +964,7 @@
let nextApproverId = 2;
import useUserStore from "@/store/modules/user";
import { modelList, productTreeList } from "@/api/basicData/product.js";
+import { listPage as listAdvancedPrice } from "@/api/procurementManagement/advancedPriceManagement.js";
import dayjs from "dayjs";
const userStore = useUserStore();
@@ -996,6 +1058,72 @@
},
});
const { productForm, productRules } = toRefs(productFormData);
+
+// 閲囪喘浠锋牸绠$悊鍙傝�冨脊绐�
+const priceReferenceVisible = ref(false);
+const priceReferenceLoading = ref(false);
+const priceReferenceData = ref([]);
+const priceReferenceTotal = ref(0);
+const priceReferencePagination = reactive({
+ current: 1,
+ size: 10
+});
+
+const showPriceReference = () => {
+ priceReferenceVisible.value = true;
+ handlePriceReferenceSearch();
+};
+
+const handlePriceReferenceSearch = () => {
+ priceReferenceLoading.value = true;
+ // 妯℃嫙鎼滅储鍙傛暟锛歱roductId 鏄犲皠涓� productName 鎴� ID锛岃繖閲屾牴鎹� advancedPriceManagement 鐨� API 纭畾鍙傛暟
+ // 鍋囪楂樼骇浠锋牸绠$悊鐨� listPage 鎺ユ敹 productId
+ const query = {
+ productId: productForm.value.productId,
+ specificationId: productForm.value.productModelId,
+ current: priceReferencePagination.current,
+ size: priceReferencePagination.size
+ };
+ listAdvancedPrice(query).then(res => {
+ priceReferenceData.value = res.data.records;
+ priceReferenceTotal.value = res.data.total;
+ priceReferenceLoading.value = false;
+ }).catch(() => {
+ priceReferenceLoading.value = false;
+ });
+};
+
+const handlePriceReferenceSizeChange = (size) => {
+ priceReferencePagination.size = size;
+ handlePriceReferenceSearch();
+};
+
+const handlePriceReferenceCurrentChange = (page) => {
+ priceReferencePagination.current = page;
+ handlePriceReferenceSearch();
+};
+
+const selectPriceReference = (row) => {
+ // 璁$畻瀹為檯浠锋牸锛氬熀纭�浠锋牸 - 鎶樻墸
+ let actualPrice = row.basePrice;
+ if (row.discountType === 'percentage') {
+ actualPrice = row.basePrice * (1 - row.discountValue / 100);
+ } else if (row.discountType === 'fixed') {
+ actualPrice = row.basePrice - row.discountValue;
+ }
+
+ // 濉厖鍚◣鍗曚环锛屼繚鐣欎袱浣嶅皬鏁�
+ productForm.value.taxInclusiveUnitPrice = Number(Math.max(actualPrice, 0)).toFixed(2);
+
+ // 濡傛灉宸茬粡杈撳叆浜嗘暟閲忥紝鍒欒嚜鍔ㄨ绠楁�讳环
+ if (productForm.value.quantity) {
+ mathNum();
+ }
+
+ priceReferenceVisible.value = false;
+ proxy.$modal.msgSuccess("宸插紩鐢ㄥ巻鍙蹭环鏍�");
+ };
+
const upload = reactive({
// 涓婁紶鐨勫湴鍧�
url: import.meta.env.VITE_APP_BASE_API + "/file/upload",
@@ -1230,6 +1358,10 @@
};
// 鎵撳紑浜у搧寮规
const openProductForm = (type, row, index) => {
+ if(!form.value.supplierId){
+ proxy.$modal.msgWarning("璇烽�夋嫨渚涘簲鍟�");
+ return;
+ }
productOperationType.value = type;
productOperationIndex.value = index;
productForm.value = {};
--
Gitblit v1.9.3