yyb
8 天以前 9581c0ae9f0d9a2e92744f3dca78960780b9a2df
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"
@@ -128,11 +137,14 @@
<script setup>
  import { ref } from "vue";
  import { onShow } from "@dcloudio/uni-app";
  import { ledgerListPage, delLedger, productList } from "@/api/salesManagement/salesLedger";
  import {
    ledgerListPage,
    delLedger,
    productList,
  } from "@/api/salesManagement/salesLedger";
    hasShippedProducts,
    getLedgerShippingLabel,
    getLedgerShippingTagType,
    canLedgerShip,
    executeSalesLedgerShip,
  } from "@/utils/salesLedgerShip";
  import useUserStore from "@/store/modules/user";
  import PageHeader from "@/components/PageHeader.vue";
  const userStore = useUserStore();
@@ -152,17 +164,7 @@
  // 销售台账数据
  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 handleShip = item => executeSalesLedgerShip(item);
  // 返回上一页
  const goBack = () => {
@@ -209,7 +211,7 @@
    if (hasShippedProducts(products)) {
      uni.showToast({
        title: "已发货/发货完成的销售订单不能删除",
        title: "已发货、部分发货或已有发货记录的销售订单不能删除",
        icon: "none",
      });
      return;