hurx 3 hafta önce
ebeveyn
işleme
3f46c6d3e2

+ 1 - 1
src/views/order/saleOrder/index.vue

@@ -623,7 +623,7 @@ const getButtonsByStatus = (orderStatus: string, checkStatus: string): ActionBut
   }
 
   // 发货完成或已完成:显示查看物流按钮
-  if (orderStatus === OrderStatus.SHIPMENT_COMPLETED || orderStatus === OrderStatus.COMPLETED) {
+  if (orderStatus === OrderStatus.PARTIAL_SHIPMENT || orderStatus === OrderStatus.SHIPMENT_COMPLETED || orderStatus === OrderStatus.COMPLETED) {
     buttons.push({ label: '查看物流', handler: handleViewLogistics });
   }
 

+ 55 - 13
src/views/order/saleOrder/sendDetail.vue

@@ -159,21 +159,21 @@
     <el-card shadow="never" class="mb-2" v-show="orderDetail.orderStatus != '0'">
       <template #header>
         <div class="card-header">
-          <span>发货信息:共{{ 0 }}个包裹</span>
-          <el-button type="primary" style="float: right" @click="handleAddDeliver(orderDetail)">添加发货信息</el-button>
+          <span>发货信息:共{{ orderDeliverList.length }}个包裹</span>
+          <el-button type="primary" @click="handleAddDeliver(orderDetail)">添加发货信息</el-button>
         </div>
       </template>
-      <div v-show="totalQuantitySent > 0">
+      <div v-for="deliver in orderDeliverList" :key="deliver.id" class="mb-4">
         <div style="white-space: nowrap" class="mb-2">
-          <span style="margin-right: 16px">发货单号:--</span>
-          <span style="margin-right: 16px">发货时间:--</span>
-          <span style="margin-right: 16px">发货方式:--</span>
-          <span style="margin-right: 16px">送货人:--</span>
-          <span style="margin-right: 16px">手机:--</span>
-          <span style="margin-right: 16px">物流状态:--</span>
-          <span>发货备注:--</span>
+          <span style="margin-right: 16px">发货单号:{{ (deliver as any).deliverCode || '--' }}</span>
+          <span style="margin-right: 16px">发货时间:{{ (deliver as any).createTime || '--' }}</span>
+          <span style="margin-right: 16px">发货方式:{{ getDictLabel(deliver_method, deliver.deliverMethod || '--') }}</span>
+          <span style="margin-right: 16px">送货人:{{ deliver.deliverMan || '--' }}</span>
+          <span style="margin-right: 16px">手机:{{ deliver.phone || '--' }}</span>
+          <span style="margin-right: 16px">物流状态:{{ deliver.logisticsStatus || '--' }}</span>
+          <span>发货备注:{{ deliver.deliverRemark || '--' }}</span>
         </div>
-        <el-table :data="deliverProductList" border style="width: 100%">
+        <el-table :data="deliver.deliverProductList" border style="width: 100%">
           <el-table-column label="产品编号" prop="productNo" align="center" />
           <el-table-column label="商品名称" prop="productName" align="center" />
           <el-table-column label="单位" prop="productUnit" align="center" />
@@ -219,6 +219,9 @@ import { OrderMainVO } from '@/api/order/orderMain/types';
 import { listOrderProduct } from '@/api/order/orderProduct';
 import { OrderProductVO } from '@/api/order/orderProduct/types';
 import { DeliverProductVO } from '@/api/order/deliverProduct/types';
+import { listOrderDeliver } from '@/api/order/orderDeliver';
+import { OrderDeliverVO } from '@/api/order/orderDeliver/types';
+import { listDeliverProduct } from '@/api/order/deliverProduct';
 import { getShippingAddress } from '@/api/customer/customerFile/shippingAddress';
 import { ShippingAddressVO } from '@/api/customer/customerFile/shippingAddress/types';
 import { getWarehouse } from '@/api/company/warehouse';
@@ -231,8 +234,8 @@ import { getInvoiceType } from '@/api/customer/invoiceType';
 import { InvoiceTypeVO } from '@/api/customer/invoiceType/types';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
-const { order_status, payment_status, fee_type, pay_method } = toRefs<any>(
-  proxy?.useDict('order_status', 'payment_status', 'fee_type', 'pay_method')
+const { order_status, payment_status, fee_type, pay_method, deliver_method } = toRefs<any>(
+  proxy?.useDict('order_status', 'payment_status', 'fee_type', 'pay_method', 'deliver_method')
 );
 const route = useRoute();
 const router = useRouter();
@@ -255,6 +258,8 @@ const invoiceTypeInfo = ref<InvoiceTypeVO>({} as InvoiceTypeVO);
 // 商品明细列表
 const productList = ref<OrderProductVO[]>([]);
 
+// 发货包裹列表
+const orderDeliverList = ref<OrderDeliverVO[]>([]);
 const deliverProductList = ref<DeliverProductVO[]>([]);
 
 // 收货地址信息
@@ -308,6 +313,11 @@ const getOrderDetail = async () => {
       await getDeliverProductList(orderDetail.value);
     }
 
+    // 获取发货单及关联的物流商品信息
+    if (orderDetail.value.id) {
+      await getOrderDeliverListData(orderDetail.value.id);
+    }
+
     // 获取收货地址
     if (orderDetail.value.shippingAddressId) {
       await getShippingAddressDetail(orderDetail.value.shippingAddressId);
@@ -367,6 +377,31 @@ const getDeliverProductList = async (orderDetail: OrderMainVO) => {
   }
 };
 
+// 获取发货单列表
+const getOrderDeliverListData = async (orderId: string | number) => {
+  try {
+    const res = await listOrderDeliver({ orderId, pageNum: 1, pageSize: 100 });
+    const deliverList = (res as any).rows || res.data || [];
+
+    // 为每条发货记录获取商品明细
+    for (const deliver of deliverList) {
+      if (deliver.id) {
+        try {
+          const productRes = await listDeliverProduct({ deliverId: deliver.id, pageNum: 1, pageSize: 100 });
+          deliver.deliverProductList = (productRes as any).rows || productRes.data || [];
+        } catch (error) {
+          console.error(`获取发货单${deliver.id}的商品明细失败:`, error);
+          deliver.deliverProductList = [];
+        }
+      }
+    }
+
+    orderDeliverList.value = deliverList;
+  } catch (error) {
+    console.error('获取发货单列表失败:', error);
+  }
+};
+
 // 获取收货地址详情
 const getShippingAddressDetail = async (addressId: string | number) => {
   try {
@@ -496,6 +531,13 @@ onMounted(() => {
   flex: 1;
 }
 
+.card-header {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  min-height: 40px;
+}
+
 @media print {
   .el-button {
     display: none;