From 0fd269224211075e9657d6cb285b10805cd5d24f Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期五, 03 四月 2026 13:43:29 +0800
Subject: [PATCH] refactor: 更新发货状态页面和相关逻辑
---
src/pages.json | 2
src/pages/sales/salesAccount/index.vue | 115 ++++++++++++++++++++++
src/pages/sales/salesAccount/out.vue | 161 ++++++++++---------------------
3 files changed, 166 insertions(+), 112 deletions(-)
diff --git a/src/pages.json b/src/pages.json
index b6eeda7..1699610 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -82,7 +82,7 @@
{
"path": "pages/sales/salesAccount/out",
"style": {
- "navigationBarTitleText": "鍙戣揣鐘舵��",
+ "navigationBarTitleText": "浜у搧鏄庣粏",
"navigationStyle": "custom"
}
},
diff --git a/src/pages/sales/salesAccount/index.vue b/src/pages/sales/salesAccount/index.vue
index d6a3d8c..cafae6f 100644
--- a/src/pages/sales/salesAccount/index.vue
+++ b/src/pages/sales/salesAccount/index.vue
@@ -26,7 +26,8 @@
v-if="ledgerList.length > 0">
<view v-for="(item, index) in ledgerList"
:key="index">
- <view class="ledger-item">
+ <view class="ledger-item"
+ @click="openOut(item)">
<view class="item-header">
<view class="item-left">
<view class="document-icon">
@@ -66,6 +67,13 @@
<text class="detail-label">绛捐鏃ユ湡</text>
<text class="detail-value">{{ item.executionDate }}</text>
</view>
+ <view class="detail-row">
+ <text class="detail-label">鍙戣揣鐘舵��</text>
+ <u-tag size="mini"
+ :type="getLedgerShippingTagType(item)">{{
+ getLedgerShippingLabel(item)
+ }}</u-tag>
+ </view>
<up-divider></up-divider>
<view class="detail-info">
<view class="detail-row">
@@ -83,8 +91,9 @@
size="small"
type="primary"
plain
- @click.stop="openOut(item)">
- 鍙戣揣鐘舵��
+ :disabled="!canLedgerShip(item)"
+ @click.stop="handleShip(item)">
+ 鍙戣揣
</u-button>
<!-- <u-button class="detail-button"
size="small"
@@ -164,6 +173,106 @@
});
};
+ // 鍙拌处鍙戣揣鐘舵�侊細1-鏈彂璐э紝2-瀹℃壒涓紝3-瀹℃壒涓嶉�氳繃锛�4-宸插彂璐э紙涓庡悗绔灇涓惧榻愶紝鍏煎澶氱瀛楁鍚嶏級
+ const LEDGER_SHIPPING_LABELS = {
+ 1: "鏈彂璐�",
+ 2: "瀹℃壒涓�",
+ 3: "瀹℃壒涓嶉�氳繃",
+ 4: "宸插彂璐�",
+ };
+
+ const normalizeShippingStatusToCode = v => {
+ if (v === null || v === undefined || v === "") return 1;
+ const n = Number(v);
+ if (!Number.isNaN(n) && n >= 1 && n <= 4) return n;
+ const s = String(v).trim();
+ const textMap = {
+ 鏈彂璐�: 1,
+ 寰呭彂璐�: 1,
+ 瀹℃壒涓�: 2,
+ 瀹℃牳涓�: 2,
+ 寰呭鏍�: 2,
+ 瀹℃壒涓嶉�氳繃: 3,
+ 瀹℃牳鎷掔粷: 3,
+ 宸插彂璐�: 4,
+ };
+ return textMap[s] ?? 1;
+ };
+
+ const getLedgerShippingStatusCode = item => {
+ if (!item) return 1;
+ const raw =
+ item.deliveryStatus ??
+ item.shippingApprovalStatus ??
+ item.shipmentApproveStatus ??
+ item.ledgerShippingStatus;
+ if (raw !== null && raw !== undefined && raw !== "") {
+ return normalizeShippingStatusToCode(raw);
+ }
+ if (item.shippingStatus !== null && item.shippingStatus !== undefined && item.shippingStatus !== "") {
+ return normalizeShippingStatusToCode(item.shippingStatus);
+ }
+ return 1;
+ };
+
+ const getLedgerShippingLabel = item =>
+ LEDGER_SHIPPING_LABELS[getLedgerShippingStatusCode(item)] ?? "鏈彂璐�";
+
+ const getLedgerShippingTagType = item => {
+ const t = { 1: "info", 2: "warning", 3: "error", 4: "success" };
+ return t[getLedgerShippingStatusCode(item)] ?? "info";
+ };
+
+ const canLedgerShip = item => {
+ const c = getLedgerShippingStatusCode(item);
+ return c === 1 || c === 3;
+ };
+
+ // 涓庢槑缁嗛〉鍘熼�昏緫涓�鑷达細浠呭簱瀛樺厖瓒炽�佹湭瀹為檯鍙戣揣銆佺姸鎬佷负鏈彂璐�/瀹℃壒涓嶉�氳繃鏃跺彲鎻愪氦鍙戣揣瀹℃壒
+ const canShipProduct = row => {
+ if (!row || row.approveStatus !== 1) return false;
+ if (row.shippingDate || row.shippingCarNumber) return false;
+ const code = normalizeShippingStatusToCode(row.shippingStatus);
+ if (code === 1 || code === 3) return true;
+ const s = row.shippingStatus ? String(row.shippingStatus).trim() : "";
+ return s === "寰呭彂璐�" || s === "鏈彂璐�" || s === "瀹℃牳鎷掔粷" || s === "瀹℃壒涓嶉�氳繃";
+ };
+
+ const handleShip = async item => {
+ if (!canLedgerShip(item)) {
+ uni.showToast({
+ title: "浠呮湭鍙戣揣鎴栧鎵逛笉閫氳繃鏃跺彲鍙戣揣",
+ icon: "none",
+ });
+ return;
+ }
+ if (!item?.id) return;
+ showLoadingToast("鍔犺浇涓�...");
+ try {
+ const res = await productList({ salesLedgerId: item.id, type: 1 });
+ const products = res.data || res.records || [];
+ const row = products.find(p => canShipProduct(p));
+ closeToast();
+ if (!row) {
+ uni.showToast({
+ title: "娌℃湁鍙彂璐х殑浜у搧",
+ icon: "none",
+ });
+ return;
+ }
+ uni.setStorageSync("goOutData", JSON.stringify(row));
+ uni.navigateTo({
+ url: "/pages/sales/salesAccount/goOut",
+ });
+ } catch (e) {
+ closeToast();
+ uni.showToast({
+ title: "鍔犺浇浜у搧澶辫触",
+ icon: "none",
+ });
+ }
+ };
+
// 杩斿洖涓婁竴椤�
const goBack = () => {
uni.navigateBack();
diff --git a/src/pages/sales/salesAccount/out.vue b/src/pages/sales/salesAccount/out.vue
index d4fc5be..fe7a8ba 100644
--- a/src/pages/sales/salesAccount/out.vue
+++ b/src/pages/sales/salesAccount/out.vue
@@ -1,7 +1,7 @@
<template>
<view class="receipt-payment-detail">
<!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
- <PageHeader title="鍙戣揣鐘舵��"
+ <PageHeader title="浜у搧鏄庣粏"
@back="goBack" />
<!-- 缁熻淇℃伅 -->
<view class="summary-info">
@@ -37,16 +37,48 @@
<up-divider></up-divider>
<view class="item-details">
<view class="detail-row">
+ <text class="detail-label">妤煎眰缂栧彿</text>
+ <text class="detail-value">{{ dv(item.floorCode) }}</text>
+ </view>
+ <view class="detail-row">
<text class="detail-label">浜у搧澶х被</text>
- <text class="detail-value">{{ item.productCategory }}</text>
+ <text class="detail-value">{{ dv(item.productCategory) }}</text>
</view>
<view class="detail-row">
<text class="detail-label">瑙勬牸鍨嬪彿</text>
- <text class="detail-value">{{ item.specificationModel }}</text>
+ <text class="detail-value">{{ dv(item.specificationModel) }}</text>
</view>
<view class="detail-row">
- <text class="detail-label">鍗曚綅</text>
- <text class="detail-value">{{ item.unit }}</text>
+ <text class="detail-label">鍘氬害</text>
+ <text class="detail-value">{{ dv(item.thickness) }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">瀹�(mm)</text>
+ <text class="detail-value">{{ dv(item.width) }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">楂�(mm)</text>
+ <text class="detail-value">{{ dv(item.height) }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鍛ㄩ暱(cm)</text>
+ <text class="detail-value">{{ dv(item.perimeter) }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鎬婚潰绉�(cm虏)</text>
+ <text class="detail-value">{{ dv(item.actualTotalArea) }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鍔犲伐瑕佹眰</text>
+ <text class="detail-value">{{ dv(item.processRequirement) }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">澶囨敞</text>
+ <text class="detail-value">{{ dv(item.remark) }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">閲嶇</text>
+ <text class="detail-value">{{ dv(item.heavyBox) }}</text>
</view>
<view class="detail-row">
<text class="detail-label">浜у搧鐘舵��</text>
@@ -56,17 +88,12 @@
class="detail-value danger">涓嶈冻</text>
</view>
<view class="detail-row">
- <text class="detail-label">鍙戣揣鐘舵��</text>
- <u-tag size="mini"
- :type="getShippingStatusType(item)">{{ getShippingStatusText(item) }}</u-tag>
- </view>
- <view class="detail-row">
<text class="detail-label">蹇�掑叕鍙�</text>
- <text class="detail-value">{{ item.expressCompany }}</text>
+ <text class="detail-value">{{ dv(item.expressCompany) }}</text>
</view>
<view class="detail-row">
<text class="detail-label">蹇�掑崟鍙�</text>
- <text class="detail-value">{{ item.expressNumber }}</text>
+ <text class="detail-value">{{ dv(item.expressNumber) }}</text>
</view>
<view class="detail-row">
<text class="detail-label">鍙戣揣杞︾墝</text>
@@ -79,36 +106,28 @@
</view>
<view class="detail-row">
<text class="detail-label">鍙戣揣鏃ユ湡</text>
- <text class="detail-value">{{ item.shippingDate || '-' }}</text>
+ <text class="detail-value">{{ dv(item.shippingDate) }}</text>
</view>
<view class="detail-row">
<text class="detail-label">鏁伴噺</text>
- <text class="detail-value">{{ item.quantity }}</text>
+ <text class="detail-value">{{ dv(item.quantity) }}</text>
</view>
<view class="detail-row">
- <text class="detail-label">绋庣巼锛�%锛�</text>
- <text class="detail-value">{{ item.taxRate }}</text>
+ <text class="detail-label">绋庣巼(%)</text>
+ <text class="detail-value">{{ dv(item.taxRate) }}</text>
</view>
<view class="detail-row">
- <text class="detail-label">鍚◣鍗曚环锛堝厓锛�</text>
- <text class="detail-value">{{ item.taxInclusiveUnitPrice }}</text>
+ <text class="detail-label">鍚◣鍗曚环(鍏�)</text>
+ <text class="detail-value">{{ dv(item.taxInclusiveUnitPrice) }}</text>
</view>
<view class="detail-row">
- <text class="detail-label">鍚◣鎬讳环锛堝厓锛�</text>
- <text class="detail-value">{{ item.taxInclusiveTotalPrice }}</text>
+ <text class="detail-label">鍚◣鎬讳环(鍏�)</text>
+ <text class="detail-value">{{ dv(item.taxInclusiveTotalPrice) }}</text>
</view>
<view class="detail-row">
- <text class="detail-label">涓嶅惈绋庢�讳环锛堝厓锛�</text>
- <text class="detail-value">{{ item.taxExclusiveTotalPrice }}</text>
+ <text class="detail-label">涓嶅惈绋庢�讳环(鍏�)</text>
+ <text class="detail-value">{{ dv(item.taxExclusiveTotalPrice) }}</text>
</view>
- <up-divider></up-divider>
- <u-button class="detail-button"
- size="small"
- type="primary"
- :disabled="!canShip(item)"
- @click="goout(item)">
- 鍙戣揣
- </u-button>
</view>
</view>
</view>
@@ -120,7 +139,7 @@
</template>
<script setup>
- import { ref, computed, onMounted } from "vue";
+ import { ref, onMounted } from "vue";
import { productList } from "@/api/salesManagement/salesLedger";
// 瀹㈡埛淇℃伅
@@ -129,63 +148,15 @@
// 琛ㄦ牸鏁版嵁
const tableData = ref([]);
+ const dv = v =>
+ v === null || v === undefined || v === "" ? "-" : v;
+
// 杩斿洖涓婁竴椤�
const goBack = () => {
uni.removeStorageSync("supplierId");
uni.navigateBack();
};
- const getShippingStatusType = row => {
- // 濡傛灉宸插彂璐э紙鏈夊彂璐ф棩鏈熸垨杞︾墝鍙凤級锛屾樉绀虹豢鑹�
- if (row.shippingDate || row.shippingCarNumber) {
- return "success";
- }
- // 鑾峰彇鍙戣揣鐘舵�佸瓧娈�
- const status = row.shippingStatus;
-
- // 濡傛灉鐘舵�佷负绌烘垨鏈畾涔夛紝榛樿涓虹伆鑹诧紙寰呭彂璐э級
- if (status === null || status === undefined || status === "") {
- return "info";
- }
-
- // 鐘舵�佹槸瀛楃涓�
- const statusStr = String(status).trim();
- const typeTextMap = {
- 寰呭彂璐�: "info",
- 寰呭鏍�: "info",
- 瀹℃牳涓�: "warning",
- 瀹℃牳鎷掔粷: "danger",
- 瀹℃牳閫氳繃: "success",
- 宸插彂璐�: "success",
- };
- return typeTextMap[statusStr] || "info";
- };
- const getShippingStatusText = row => {
- // 濡傛灉宸插彂璐э紙鏈夊彂璐ф棩鏈熸垨杞︾墝鍙凤級锛屾樉绀�"宸插彂璐�"
- if (row.shippingDate || row.shippingCarNumber) {
- return "宸插彂璐�";
- }
-
- // 鑾峰彇鍙戣揣鐘舵�佸瓧娈�
- const status = row.shippingStatus;
-
- // 濡傛灉鐘舵�佷负绌烘垨鏈畾涔夛紝榛樿涓�"寰呭彂璐�"
- if (status === null || status === undefined || status === "") {
- return "寰呭彂璐�";
- }
-
- // 鐘舵�佹槸瀛楃涓�
- const statusStr = String(status).trim();
- const statusTextMap = {
- 寰呭彂璐�: "寰呭彂璐�",
- 寰呭鏍�: "寰呭鏍�",
- 瀹℃牳涓�: "瀹℃牳涓�",
- 瀹℃牳鎷掔粷: "瀹℃牳鎷掔粷",
- 瀹℃牳閫氳繃: "瀹℃牳閫氳繃",
- 宸插彂璐�: "宸插彂璐�",
- };
- return statusTextMap[statusStr] || "寰呭彂璐�";
- };
// 鑾峰彇椤甸潰鍙傛暟
const getPageParams = () => {
// 浠庢湰鍦板瓨鍌ㄨ幏鍙栦緵搴斿晢ID
@@ -194,13 +165,6 @@
supplierId.value = storedSupplierId;
}
};
- const goout = item => {
- uni.setStorageSync("goOutData", JSON.stringify(item));
- uni.navigateTo({
- url: "/pages/sales/salesAccount/goOut",
- });
- };
-
// 鏌ヨ鍒楄〃
const getList = () => {
showLoadingToast("鍔犺浇涓�...");
@@ -220,25 +184,6 @@
});
});
};
- const canShip = row => {
- // 浜у搧鐘舵�佸繀椤绘槸鍏呰冻锛坅pproveStatus === 1锛�
- if (row.approveStatus !== 1) {
- return false;
- }
-
- // 鑾峰彇鍙戣揣鐘舵��
- const shippingStatus = row.shippingStatus;
-
- // 濡傛灉宸插彂璐э紙鏈夊彂璐ф棩鏈熸垨杞︾墝鍙凤級锛屼笉鑳藉啀娆″彂璐�
- if (row.shippingDate || row.shippingCarNumber) {
- return false;
- }
-
- // 鍙戣揣鐘舵�佸繀椤绘槸"寰呭彂璐�"鎴�"瀹℃牳鎷掔粷"
- const statusStr = shippingStatus ? String(shippingStatus).trim() : "";
- return statusStr === "寰呭彂璐�" || statusStr === "瀹℃牳鎷掔粷";
- };
-
// 鏄剧ず鍔犺浇鎻愮ず
const showLoadingToast = message => {
uni.showLoading({
--
Gitblit v1.9.3