From 2dc24084675a49f6c55da5ee0069b2de0503c449 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 05 二月 2026 16:33:35 +0800
Subject: [PATCH] 进销存升级app: 1.开票登记、开票台账、回款流水还有客户合同号字段(需要去掉) 2.采购台账、销售台账页面都需要加上删除按钮
---
src/pages/procurementManagement/procurementLedger/index.vue | 72 ++++++++++++++
src/pages/sales/receiptPayment/index.vue | 1
src/pages/sales/invoicingRegistration/view.vue | 5 -
src/pages/sales/invoicingRegistration/index.vue | 4
src/pages/sales/salesAccount/index.vue | 85 ++++++++++++++++
src/pages/sales/invoiceLedger/index.vue | 6 -
src/pages/sales/receiptPaymentHistory/index.vue | 4
src/pages/procurementManagement/procurementInvoiceLedger/detail.vue | 76 ++++++++-------
8 files changed, 196 insertions(+), 57 deletions(-)
diff --git a/src/pages/procurementManagement/procurementInvoiceLedger/detail.vue b/src/pages/procurementManagement/procurementInvoiceLedger/detail.vue
index 179e7e1..3b0bea3 100644
--- a/src/pages/procurementManagement/procurementInvoiceLedger/detail.vue
+++ b/src/pages/procurementManagement/procurementInvoiceLedger/detail.vue
@@ -102,7 +102,7 @@
const temFutureTickets = ref(0);
const originalTicketsNum = ref(0); // 淇濆瓨鍘熷鏉ョエ鏁�
- // 琛ㄥ崟鏍¢獙瑙勫垯
+ // 琛ㄥ崟鏍¢獙瑙勫垯 - 浣跨敤绠�鍗曠殑 required 瑙勫垯
const rules = {
ticketsNum: [{ required: true, message: "璇疯緭鍏ユ潵绁ㄦ暟", trigger: "blur" }],
ticketsAmount: [
@@ -265,44 +265,50 @@
// 琛ㄥ崟鎻愪氦
const onSubmit = async () => {
- if (!formRef.value) {
- console.log("琛ㄥ崟寮曠敤涓嶅瓨鍦�");
+ // 鍦ㄩ獙璇佸墠锛岀‘淇濆繀濉瓧娈垫湁鍊�
+ if (!form.value.ticketsNum || form.value.ticketsNum === "" || form.value.ticketsNum === null || form.value.ticketsNum === undefined) {
+ uni.showToast({
+ title: "璇疯緭鍏ユ潵绁ㄦ暟",
+ icon: "none",
+ });
return;
}
- try {
- // 鍏堣皟鐢� validate 鏂规硶
- const validateResult = formRef.value.validate();
-
- // 濡傛灉 validate 杩斿洖 undefined 鎴� null锛岀洿鎺ユ彁浜�
- if (validateResult === undefined || validateResult === null) {
- submitForm();
- return;
- }
-
- // 濡傛灉杩斿洖 Promise锛屼娇鐢� await 鍜� catch
- if (validateResult && typeof validateResult.then === 'function') {
- const valid = await validateResult.catch(() => false);
- if (valid) {
- // 琛ㄥ崟楠岃瘉閫氳繃锛屾彁浜よ〃鍗�
- submitForm();
- } else {
- // 琛ㄥ崟楠岃瘉澶辫触
- console.log("琛ㄥ崟楠岃瘉澶辫触");
- }
- } else {
- // 濡傛灉杩斿洖甯冨皵鍊硷紝鐩存帴鍒ゆ柇
- if (validateResult) {
- submitForm();
- } else {
- console.log("琛ㄥ崟楠岃瘉澶辫触");
- }
- }
- } catch (error) {
- // 濡傛灉 validate 鏂规硶涓嶅瓨鍦ㄦ垨鎶涘嚭閿欒锛岀洿鎺ユ彁浜�
- console.log("琛ㄥ崟楠岃瘉澶辫触", error);
- submitForm();
+ if (!form.value.ticketsAmount || form.value.ticketsAmount === "" || form.value.ticketsAmount === null || form.value.ticketsAmount === undefined) {
+ uni.showToast({
+ title: "璇疯緭鍏ユ湰娆℃潵绁ㄩ噾棰�",
+ icon: "none",
+ });
+ return;
}
+
+ // 纭繚瀛楁鏄暟瀛楃被鍨嬶紝骞惰浆鎹负瀛楃涓诧紙鍥犱负琛ㄥ崟鍙兘闇�瑕佸瓧绗︿覆绫诲瀷锛�
+ const ticketsNum = Number(form.value.ticketsNum);
+ const ticketsAmount = Number(form.value.ticketsAmount);
+
+ // 濡傛灉鏉ョエ鏁颁负0鎴栨潵绁ㄩ噾棰濅负0锛屾彁绀虹敤鎴�
+ if (isNaN(ticketsNum) || ticketsNum <= 0) {
+ uni.showToast({
+ title: "鏉ョエ鏁板繀椤诲ぇ浜�0",
+ icon: "none",
+ });
+ return;
+ }
+
+ if (isNaN(ticketsAmount) || ticketsAmount <= 0) {
+ uni.showToast({
+ title: "鏈鏉ョエ閲戦蹇呴』澶т簬0",
+ icon: "none",
+ });
+ return;
+ }
+
+ // 鏇存柊琛ㄥ崟鍊硷紝纭繚鏄湁鏁堢殑鏁板瓧瀛楃涓�
+ form.value.ticketsNum = ticketsNum.toString();
+ form.value.ticketsAmount = ticketsAmount.toString();
+
+ // 鎵嬪姩楠岃瘉閫氳繃鍚庯紝鐩存帴鎻愪氦锛岃烦杩囪〃鍗曢獙璇侊紙閬垮厤鐪熸満涓婄殑楠岃瘉闂锛�
+ submitForm();
};
const purchaseLedgerId = ref("");
const productModelId = ref({});
diff --git a/src/pages/procurementManagement/procurementLedger/index.vue b/src/pages/procurementManagement/procurementLedger/index.vue
index ebcf07a..5d44a09 100644
--- a/src/pages/procurementManagement/procurementLedger/index.vue
+++ b/src/pages/procurementManagement/procurementLedger/index.vue
@@ -76,6 +76,21 @@
<text class="detail-value">{{ item.entryDate }}</text>
</view>
</view>
+ <!-- 浠呴潪鈥滃鎵归�氳繃鈥濈殑鍙拌处灞曠ず鍒犻櫎鎸夐挳 -->
+ <view
+ class="detail-row"
+ v-if="item.approvalStatus !== 3"
+ style="justify-content: flex-end; margin-top: 8px;"
+ >
+ <up-button
+ type="error"
+ size="small"
+ plain
+ @click.stop="handleDelete(item)"
+ >
+ 鍒犻櫎
+ </up-button>
+ </view>
</view>
</view>
</view>
@@ -99,7 +114,7 @@
import { onShow } from "@dcloudio/uni-app";
import useUserStore from "@/store/modules/user";
import PageHeader from "@/components/PageHeader.vue";
- import { purchaseListPage } from "@/api/procurementManagement/procurementLedger";
+ import { purchaseListPage, delPurchase } from "@/api/procurementManagement/procurementLedger";
const userStore = useUserStore();
const approvalStatusText = {
1: "寰呭鏍�",
@@ -208,6 +223,61 @@
}
};
+ // 鍒犻櫎鍗曟潯閲囪喘鍙拌处
+ const handleDelete = row => {
+ if (!row || !row.id) {
+ uni.showToast({
+ title: "鏁版嵁鏈夎锛屾棤娉曞垹闄�",
+ icon: "none",
+ });
+ return;
+ }
+
+ uni.showModal({
+ title: "鎻愮ず",
+ content: "閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�",
+ confirmText: "纭",
+ cancelText: "鍙栨秷",
+ success: res => {
+ if (res.confirm) {
+ delPurchase([row.id])
+ .then(result => {
+ // 鎴愬姛锛歝ode === 200
+ if (result && result.code === 200) {
+ uni.showToast({
+ title: "鍒犻櫎鎴愬姛",
+ icon: "success",
+ });
+ getList();
+ return;
+ }
+ // 涓氬姟澶辫触锛氫紭鍏堝睍绀哄悗绔繑鍥炵殑 msg锛堝 CG2026... 涓嶅厑璁稿垹闄わ級
+ uni.showToast({
+ title: (result && result.msg) || "鍒犻櫎澶辫触",
+ icon: "none",
+ });
+ })
+ .catch(error => {
+ // 瀵逛簬 request 灏佽杩斿洖鐨� '500' 鎴栧叾浠� code锛岄敊璇彁绀哄凡缁忓湪 request 閲� toast 杩囦簡锛岃繖閲屼笉鍐嶉噸澶嶈鐩�
+ if (error === "500" || typeof error === "number") {
+ return;
+ }
+ // 鍙湁鍦ㄧ湡姝e紓甯告椂锛屾墠鍦ㄨ繖閲屽厹搴曟彁绀�
+ const msg =
+ (error && error.msg) ||
+ (error && error.response && error.response.data && error.response.data.msg) ||
+ (error && error.message) ||
+ "鍒犻櫎澶辫触";
+ uni.showToast({
+ title: msg,
+ icon: "none",
+ });
+ });
+ }
+ },
+ });
+ };
+
onShow(() => {
// 椤甸潰鏄剧ず鏃跺埛鏂板垪琛�
getList();
diff --git a/src/pages/sales/invoiceLedger/index.vue b/src/pages/sales/invoiceLedger/index.vue
index 04ebbc2..d5d0b17 100644
--- a/src/pages/sales/invoiceLedger/index.vue
+++ b/src/pages/sales/invoiceLedger/index.vue
@@ -8,7 +8,7 @@
<view class="search-bar">
<view class="search-input">
<up-input class="search-text"
- placeholder="璇疯緭鍏ュ鎴峰悕绉�/鍚堝悓鍙锋悳绱�"
+ placeholder="璇疯緭鍏ュ鎴峰悕绉�/閿�鍞悎鍚屽彿鎼滅储"
v-model="searchForm.searchText"
@change="handleQuery"
clearable />
@@ -45,10 +45,6 @@
<view class="detail-row">
<text class="detail-label">瀹㈡埛鍚嶇О</text>
<text class="detail-value">{{ item.customerName }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">瀹㈡埛鍚堝悓鍙�</text>
- <text class="detail-value">{{ item.customerContractNo }}</text>
</view>
<view class="detail-row">
<text class="detail-label">椤圭洰</text>
diff --git a/src/pages/sales/invoicingRegistration/index.vue b/src/pages/sales/invoicingRegistration/index.vue
index b30d1ad..7d5bcbb 100644
--- a/src/pages/sales/invoicingRegistration/index.vue
+++ b/src/pages/sales/invoicingRegistration/index.vue
@@ -44,10 +44,6 @@
<text class="detail-value">{{ item.customerName }}</text>
</view>
<view class="detail-row">
- <text class="detail-label">瀹㈡埛鍚堝悓鍙�</text>
- <text class="detail-value">{{ item.customerContractNo }}</text>
- </view>
- <view class="detail-row">
<text class="detail-label">涓氬姟鍛�</text>
<text class="detail-value">{{ item.salesman }}</text>
</view>
diff --git a/src/pages/sales/invoicingRegistration/view.vue b/src/pages/sales/invoicingRegistration/view.vue
index 85f1001..72828ff 100644
--- a/src/pages/sales/invoicingRegistration/view.vue
+++ b/src/pages/sales/invoicingRegistration/view.vue
@@ -12,10 +12,6 @@
<text class="info-value">{{ form.salesContractNo }}</text>
</view>
<view class="info-item">
- <text class="info-label">瀹㈡埛鍚堝悓鍙�</text>
- <text class="info-value highlight">{{ form.customerContractNo }}</text>
- </view>
- <view class="info-item">
<text class="info-label">瀹㈡埛鍚嶇О</text>
<text class="info-value">{{ form.customerName }}</text>
</view>
@@ -123,7 +119,6 @@
const form = ref({
id: '',
salesContractNo: '',
- customerContractNo: '',
customerId: '',
customerName: '',
projectName: '',
diff --git a/src/pages/sales/receiptPayment/index.vue b/src/pages/sales/receiptPayment/index.vue
index 1f222f6..ffd154a 100644
--- a/src/pages/sales/receiptPayment/index.vue
+++ b/src/pages/sales/receiptPayment/index.vue
@@ -141,7 +141,6 @@
const searchForm = ref({
customerName: "",
status: true,
- customerContractNo: "",
projectName: "",
});
// 鑾峰彇鏍囩鏍峰紡绫�
diff --git a/src/pages/sales/receiptPaymentHistory/index.vue b/src/pages/sales/receiptPaymentHistory/index.vue
index 1242c2b..0d148b5 100644
--- a/src/pages/sales/receiptPaymentHistory/index.vue
+++ b/src/pages/sales/receiptPaymentHistory/index.vue
@@ -56,10 +56,6 @@
<up-divider></up-divider>
<view class="item-details">
<view class="detail-row">
- <text class="detail-label">瀹㈡埛鍚堝悓鍙�</text>
- <text class="detail-value">{{ item.customerContractNo }}</text>
- </view>
- <view class="detail-row">
<text class="detail-label">瀹㈡埛鍚嶇О</text>
<text class="detail-value">{{ item.customerName }}</text>
</view>
diff --git a/src/pages/sales/salesAccount/index.vue b/src/pages/sales/salesAccount/index.vue
index 8e3fdf6..250447d 100644
--- a/src/pages/sales/salesAccount/index.vue
+++ b/src/pages/sales/salesAccount/index.vue
@@ -79,12 +79,21 @@
</view>
</view>
<up-divider></up-divider>
- <u-button class="detail-button"
+ <view class="detail-buttons">
+ <u-button class="detail-button"
size="small"
type="primary"
@click="openOut(item)">
鍙戣揣鐘舵��
</u-button>
+ <u-button class="detail-button"
+ size="small"
+ type="error"
+ plain
+ @click.stop="handleDelete(item)">
+ 鍒犻櫎
+ </u-button>
+ </view>
</view>
</view>
</view>
@@ -106,7 +115,11 @@
<script setup>
import { ref } from "vue";
import { onShow } from "@dcloudio/uni-app";
- import { ledgerListPage } from "@/api/salesManagement/salesLedger";
+ import {
+ ledgerListPage,
+ delLedger,
+ productList,
+ } from "@/api/salesManagement/salesLedger";
import useUserStore from "@/store/modules/user";
import PageHeader from "@/components/PageHeader.vue";
const userStore = useUserStore();
@@ -125,6 +138,20 @@
// 閿�鍞彴璐︽暟鎹�
const ledgerList = ref([]);
+
+ // 鍒ゆ柇鏄惁瀛樺湪宸插彂璐�/鍙戣揣瀹屾垚鐨勪骇鍝�
+ const hasShippedProducts = products => {
+ if (!products || products.length === 0) return false;
+ return products.some(p => {
+ const statusStr = (p.shippingStatus ?? "").toString();
+ // 鍖呭惈鈥滃彂璐р�濇垨鏈夊彂璐ф棩鏈�/杞︾墝鍙疯涓哄凡鍙戣揣
+ return (
+ statusStr.includes("鍙戣揣") ||
+ !!p.shippingDate ||
+ !!p.shippingCarNumber
+ );
+ });
+ };
// 杩斿洖涓婁竴椤�
const goBack = () => {
@@ -151,6 +178,55 @@
uni.setStorageSync("outData", JSON.stringify(item));
uni.navigateTo({
url: "/pages/sales/salesAccount/out",
+ });
+ };
+
+ // 鍒犻櫎鍗曟潯閿�鍞彴璐�
+ const handleDelete = async row => {
+ if (!row || !row.id) return;
+
+ // 鑾峰彇浜у搧鍒楄〃锛岀敤浜庡垽鏂槸鍚﹀凡鍙戣揣
+ let products = row.children && row.children.length > 0 ? row.children : null;
+ if (!products) {
+ try {
+ const res = await productList({ salesLedgerId: row.id, type: 1 });
+ products = res.data || res.records || [];
+ } catch (e) {
+ products = [];
+ }
+ }
+
+ if (hasShippedProducts(products)) {
+ uni.showToast({
+ title: "宸插彂璐�/鍙戣揣瀹屾垚鐨勯攢鍞鍗曚笉鑳藉垹闄�",
+ icon: "none",
+ });
+ return;
+ }
+
+ uni.showModal({
+ title: "鍒犻櫎纭",
+ content: "閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�",
+ success: async res => {
+ if (res.confirm) {
+ try {
+ showLoadingToast("澶勭悊涓�...");
+ await delLedger([row.id]);
+ closeToast();
+ uni.showToast({
+ title: "鍒犻櫎鎴愬姛",
+ icon: "success",
+ });
+ getList();
+ } catch (e) {
+ closeToast();
+ uni.showToast({
+ title: "鍒犻櫎澶辫触锛岃閲嶈瘯",
+ icon: "none",
+ });
+ }
+ }
+ },
});
};
// 澶勭悊鍙拌处淇℃伅鎿嶄綔锛堟煡鐪�/缂栬緫/鏂板锛�
@@ -209,4 +285,9 @@
<style scoped lang="scss">
@import "@/styles/sales-common.scss";
+ .detail-buttons {
+ display: flex;
+ gap: 10px;
+ justify-content: space-between;
+ }
</style>
--
Gitblit v1.9.3