From dc5f0f4dffb0ba5feeeaf479b563a2c0ede8b741 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期三, 08 四月 2026 15:17:33 +0800
Subject: [PATCH] app名称修改
---
src/pages/sales/salesAccount/index.vue | 157 ++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 139 insertions(+), 18 deletions(-)
diff --git a/src/pages/sales/salesAccount/index.vue b/src/pages/sales/salesAccount/index.vue
index 250447d..cafae6f 100644
--- a/src/pages/sales/salesAccount/index.vue
+++ b/src/pages/sales/salesAccount/index.vue
@@ -27,7 +27,7 @@
<view v-for="(item, index) in ledgerList"
:key="index">
<view class="ledger-item"
- @click="handleInfo('edit', item)">
+ @click="openOut(item)">
<view class="item-header">
<view class="item-left">
<view class="document-icon">
@@ -67,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">
@@ -81,18 +88,33 @@
<up-divider></up-divider>
<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>
+ size="small"
+ type="primary"
+ plain
+ :disabled="!canLedgerShip(item)"
+ @click.stop="handleShip(item)">
+ 鍙戣揣
+ </u-button>
+ <!-- <u-button class="detail-button"
+ size="small"
+ type="primary"
+ @click.stop="handleInfo('edit', item)">
+ 缂栬緫
+ </u-button>
+ <u-button class="detail-button"
+ size="small"
+ type="primary"
+ plain
+ @click.stop="openOut(item)">
+ 鍙戣揣鐘舵��
+ </u-button> -->
+ <!-- <u-button class="detail-button"
+ size="small"
+ type="error"
+ plain
+ @click.stop="handleDelete(item)">
+ 鍒犻櫎
+ </u-button> -->
</view>
</view>
</view>
@@ -103,12 +125,12 @@
<text>鏆傛棤閿�鍞彴璐︽暟鎹�</text>
</view>
<!-- 娴姩鎿嶄綔鎸夐挳 -->
- <view class="fab-button"
+ <!-- <view class="fab-button"
@click="handleInfo('add')">
<up-icon name="plus"
size="24"
color="#ffffff"></up-icon>
- </view>
+ </view> -->
</view>
</template>
@@ -146,11 +168,109 @@
const statusStr = (p.shippingStatus ?? "").toString();
// 鍖呭惈鈥滃彂璐р�濇垨鏈夊彂璐ф棩鏈�/杞︾墝鍙疯涓哄凡鍙戣揣
return (
- statusStr.includes("鍙戣揣") ||
- !!p.shippingDate ||
- !!p.shippingCarNumber
+ statusStr.includes("鍙戣揣") || !!p.shippingDate || !!p.shippingCarNumber
);
});
+ };
+
+ // 鍙拌处鍙戣揣鐘舵�侊細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",
+ });
+ }
};
// 杩斿洖涓婁竴椤�
@@ -234,6 +354,7 @@
try {
// 璁剧疆鎿嶄綔绫诲瀷
uni.setStorageSync("operationType", type);
+ uni.removeStorageSync("editData");
// 濡傛灉鏄煡鐪嬫垨缂栬緫鎿嶄綔
if (type !== "add") {
--
Gitblit v1.9.3