| | |
| | | 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"> |
| | |
| | | <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"> |
| | |
| | | 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" |
| | |
| | | <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(); |
| | |
| | | // 销售台账数据 |
| | | 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 = () => { |
| | |
| | | |
| | | if (hasShippedProducts(products)) { |
| | | uni.showToast({ |
| | | title: "已发货/发货完成的销售订单不能删除", |
| | | title: "已发货、部分发货或已有发货记录的销售订单不能删除", |
| | | icon: "none", |
| | | }); |
| | | return; |