Переглянути джерело

[更改需求] 仓库打印

Howie 3 роки тому
батько
коміт
3ff2b06162

+ 9 - 1
src/api/supply/pickup.js

@@ -28,7 +28,7 @@ export function getDetail(params) {
   })
 }
 
-// 获取详情
+// 获取打印详情
 export function getPrintDetail(params) {
   return request({
     url: '/pick/detailPrint',
@@ -36,6 +36,14 @@ export function getPrintDetail(params) {
     params
   })
 }
+// 获取打印详情
+export function getDtailPrintDis(params) {
+  return request({
+    url: '/pick/detailPrintDis',
+    method: 'post',
+    data:params
+  })
+}
 
 // 获取仓库列表
 export function getWarehouseList(params) {

+ 62 - 2
src/views/supply/pickup/components/design/print-data.js

@@ -1,5 +1,5 @@
 
-import { getDetail, addPrint } from "@/api/supply/pickup";
+import { getDetail, addPrint,getDtailPrintDis} from "@/api/supply/pickup";
 // import { addPrints } from '@/api/supply/pickup'
 import { getCompanyList } from '@/api/user'
 
@@ -18,12 +18,72 @@ function getDetails(ids, nickName) {
   let newIds = []
   newIds = ids
   let filterId = []
+  const obj = []
   filterId = newIds.map(k => {
+    obj.push(
+      {
+        id:k.id,
+        invoiceId:k.invoiceId
+      }
+    )
     return k.id
   })
-
   filterId = [...new Set(filterId)]
   cNewIds =JSON.parse(JSON.stringify(filterId)) 
+  getDtailPrintDis(obj).then(res=>{
+    const item = res.data
+      item.forEach(k=>{
+        detailData.push(JSON.parse(JSON.stringify(k)))
+        invoicePickBeans = k.invoicePickBeans
+        let len = Math.ceil(invoicePickBeans.length / 5)
+        console.log(len, '长度');
+        for (let index = 0; index < len; index++) {
+          const table = []
+          if (invoicePickBeans.length) {
+            invoicePickBeans.splice(0, 5).forEach(e => {
+              table.push({
+                salesId: e.salesOrderId,
+                invoiceId: e.invoiceId,
+                id: e.id,
+                createTime: e.id ? dateToDayFilter(k.createTime) : '',
+                enginOrderType: e.enginOrderType == 'HOME' || e.enginOrderType == 'TRADE' ? e.enginOrderNo : e.mainOrderId,
+                materialName: e.materialName || '',
+                specification: e.specification || '',
+                refundableQty: e.refundableQty || 0,
+                // headerRemark:e.headerRemark,
+                pjxh1Text: e.pjxh1Text || ''
+              })
+    
+            });
+          }
+          detailArr.push({
+            pageNumber:`${len}-${index+1}`,
+            type: k.type,
+            tiTui: k.type === 2 ? `退货人` : `提货人`,
+            takerPhone: k.takerPhone || '',
+            headerRemark: k.remark,
+            total_num: k.total_num,
+            company: k.type === 2 ? `${company}销售退货单` : `${company}销售发货单`,
+            pickOrderWater: k.pickOrderWater,
+            customerNumber: k.customerNumber,
+            takerDa: '',
+            nowDate: nowDate(),
+            takerName: k.type === 2 ? `退货人:${k.takerName || ''}` : `提货人:${k.takerName || ''}`,
+            customerName: k.customerName || '',
+            correspondName: k.correspondName,
+            correspondNames:'',
+            pickCar: k.pickCar || '',
+            createBy: JSON.parse(
+              localStorage.getItem("supply_user")
+            ).nickName,
+            table
+          })
+        }
+      })
+  })
+
+
+  return
   for (let i = 0; i < filterId.length; i++) {
     getDetail({ id: filterId[i] }).then(res => {
       const item = res.data