yusheng 7 meses atrás
pai
commit
ae9caf021d

+ 57 - 29
src/views/salesServiceManagement/components/invoiceDialog.vue

@@ -125,7 +125,8 @@ import {
 } from '@/api/saleManage/saleordersendrecord';
 import { reviewStatus } from '@/enum/dict';
 import { lbjtList } from '@/enum/dict.js';
-import { getByIdSplit } from '@/api/wms';
+import { getInfoBySourceBizNoAll } from '@/api/wms';
+
 const dayjs = require('dayjs');
 
 export default {
@@ -370,7 +371,7 @@ export default {
         this.getInfo(row);
       } else {
         // 调用修改后的接口,传入id参数
-        this._getInfo(row.id);
+       this._getInfo(row.docNo);
       }
     },
     handleClose() {
@@ -405,33 +406,60 @@ export default {
       this.packingList = list;
     },
 
-    // 修改后的接口调用方法,使用getByIdSplit并传入id
-    async _getInfo(id) {
-      console.log('调用getByIdSplit接口,id:', id);
-      // 调用新接口,传入id参数
-      const res = await getByIdSplit(id);
-
-      // 处理返回数据,使其格式与第二个页面一致
-      let list = res.productList.map((el) => {
-        return {
-          categoryCode: el.productCode || el.categoryCode,
-          categoryName: el.productName || el.categoryName,
-          categoryModel: el.modelType || el.categoryModel,
-          measureQuantity: el.totalCount || el.measureQuantity,
-          barcodes: el.carCode || el.barcodes,
-          packingSpecification: el.specification || el.packingSpecification,
-          productBrand: el.brandNum || el.productBrand,
-          batchNo: el.batchNo,
-          singlePrice: el.singlePrice,
-          productCategoryName: el.productCategoryName,
-          shipmentDate: res.createTime || null,
-          guaranteePeriodDeadline: this.getTime(res.createTime)[0],
-          warrantyStatus: this.getTime(res.createTime)[1]
-        };
-      });
-
-      this.packingList = list;
-    },
+       async _getInfo(sourceBizNo) {
+        console.log('zzz');
+        const dataArray = await getInfoBySourceBizNoAll(sourceBizNo);
+        let res = {};
+        if (dataArray && dataArray.length > 0) {
+          res = JSON.parse(JSON.stringify(dataArray[0]));
+          res['outInDetailList'] = [];
+          dataArray.forEach((item) => {
+            item.outInDetailList.forEach((val) => {
+              res['outInDetailList'].push(val);
+            });
+          });
+        }
+        this.init(res);
+      },
+      init(res) {
+        this.infoData = res;
+        this.productList = res?.outInDetailList?.map(
+          (productItem, productIndex) => {
+            console.log(productItem);
+            return {
+              ...productItem,
+              outInDetailRecordRequestList:
+                productItem.outInDetailRecordRequestList.map((packingItem) => {
+                  return {
+                    ...packingItem,
+                    componentAttribute: productItem.componentAttribute,
+                    productCategoryName:packingItem.categoryLevelName,
+                    singlePrice: productItem.singlePrice,
+                    categoryName: productItem.categoryName,
+                    categoryCode: productItem.categoryCode,
+                    productBrand: productItem.brandNum,
+                    categoryModel: productItem.categoryModel,
+                    packingSpecification: productItem.specification,
+                    produceTime: packingItem.produceTime || null,
+                    shipmentDate: res.createTime || null,
+                    guaranteePeriodDeadline: this.getTime(res.createTime)[0],
+                    warrantyStatus: this.getTime(res.createTime)[1]
+                  };
+                })
+            };
+          }
+        );
+        // 获取包装维度数据
+        const arr = [];
+        for (const key in this.productList) {
+          for (const k in this.productList[key].outInDetailRecordRequestList) {
+            arr.push({
+              ...this.productList[key].outInDetailRecordRequestList[k]
+            });
+          }
+        }
+        this.packingList = arr;
+      },
 
     getTime(createTime) {
       if (!createTime) return ['', 1];