Howie 3 лет назад
Родитель
Сommit
9d6b8e5d54

+ 3 - 0
public/index.html

@@ -6,6 +6,9 @@
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
     <link rel="icon" href="<%= BASE_URL %>favicon.png">
     <title><%= webpackConfig.name %></title>
+    <style>
+      
+    </style>
   </head>
   <body>
     <noscript>

+ 8 - 8
src/views/supply/deliver/components/design/panel.js

@@ -4,6 +4,7 @@ export default {
     "index": 0,
     "height": 140,
     "width": 241,
+    "paperCount":222,
     "printElements": [{
       "options": {
         "left": 0,
@@ -221,7 +222,7 @@ export default {
         "fontSize": 13,
         "title": "",
         "fontFamily": '黑体',
-        "field": "tiTui",
+        "field": "takerName",
         "testData": "",
         "color": "#000",
         "textAlign": "left"
@@ -252,7 +253,7 @@ export default {
         "fontSize": 13,
         "title": "提单",
         "fontFamily": '黑体',
-        "field": "",
+        "field": "takerDa",
         "testData": "",
         "color": "#000",
         "textAlign": "left"
@@ -267,7 +268,7 @@ export default {
         "fontSize": 13,
         "title": "联系方式",
         "fontFamily": '黑体',
-        "field": "",
+        "field": "takerPhone",
         "testData": "",
         "color": "#000",
         "textAlign": "left"
@@ -282,7 +283,7 @@ export default {
         "fontSize": 13,
         "title": "车辆",
         "fontFamily": '黑体',
-        "field": "",
+        "field": "pickCar",
         "testData": "",
         "color": "#000",
         "textAlign": "left"
@@ -297,14 +298,13 @@ export default {
         "fontSize": 13,
         "title": "仓库",
         "fontFamily": '黑体',
-        "field": "",
+        "field": "correspondName",
         "testData": "",
         "color": "#000",
         "textAlign": "left"
       }, "printElementType": { "title": "", "type": "text" }
     }],
-
-    "paperNumberLeft": 0,
-    "paperNumberTop": 380
+   
+   
   }]
 }

+ 2 - 4
src/views/supply/deliver/components/design/preview.vue

@@ -104,6 +104,7 @@ export default {
 }
 
 </script>
+
 <style scoped>
 ::v-deep .el-dialog__body {
   padding: 0;
@@ -138,7 +139,7 @@ export default {
 }
 
 @media print {
-
+   
   td {
     border: none !important;
   }
@@ -205,9 +206,6 @@ export default {
     height: 529px !important; */
   }
 
-  ::v-deep .hiprint-paperNumber {
-    display: none;
-  }
 
   .ant-modal-body {
     padding: 0px;

+ 55 - 37
src/views/supply/deliver/components/design/print-data.js

@@ -4,15 +4,20 @@ import { getCompanyList } from '@/api/user'
 
 let detailArr = []
 let detailData = []
+let cids = []
 let company = ''
 // 获取详情
 getCompanyLists()
-function getDetail(ids) {
+function getDetail(ids,nickName) {
 
+  let  invoicePickBeans = []
+  let  start = 0
+  let  end = 5
   detailArr = []
   // detailData = ids 
   let newIds = []
       newIds = ids
+      cids = JSON.parse(JSON.stringify(ids))
   let  filterId =[]
       filterId = newIds.map(k=>{
               return k.id
@@ -21,39 +26,52 @@ function getDetail(ids) {
   for (let i = 0; i < filterId.length; i++) {
     getDeliverDetail({ id: filterId[i] }).then(res => {
       const item = res.data
-      detailData.push(item)
-      const table = []
-      item.invoicePickBeans.length = 5
-      item.invoicePickBeans.forEach(e => {
-        table.push({
-          salesId: e.salesOrderId,
-          invoiceId: e.invoiceId,
-          id: e.id,
-          createTime: e.id ? dateToDayFilter(item.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 || ''
-        })
-      });
-
-      console.log(company);
-      detailArr.push({
-        type: item.type,
-        tiTui:item.type === 2 ? `退货人` : `提货人`,
-        headerRemark:item.remark,
-        total_num: item.total_num,
-        company: item.type === 2 ? `${company}销售退货单` : `${company}销售发货单`,
-        pickOrderWater: item.pickOrderWater,
-        customerNumber: item.customerNumber,
-        nowDate: nowDate(),
-        customerName: item.customerName || '',
-        correspondName: item.correspondName || '',
-        createBy: item.createBy,
-        table
-      })
+      console.log(item,'887899');
+      detailData.push(JSON.parse(JSON.stringify(item)))
+ 
+      invoicePickBeans = item.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(item.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({
+            type: item.type,
+            tiTui:item.type === 2 ? `退货人` : `提货人`,
+            takerPhone:item.takerPhone || '',
+            headerRemark:item.remark,
+            total_num: item.total_num,
+            company: item.type === 2 ? `${company}销售退货单` : `${company}销售发货单`,
+            pickOrderWater: item.pickOrderWater,
+            customerNumber: item.customerNumber,
+            takerDa:'',
+            nowDate: nowDate(),
+            takerName:item.type === 2 ? `退货人:${item.takerName || ''}` : `提货人:${item.takerName || ''}` ,
+            customerName: item.customerName || '',
+            correspondName: '',
+            pickCar:item.pickCar || '',
+            createBy: JSON.parse(
+              localStorage.getItem("supply_user")
+            ).nickName,
+            table
+          })
+        }
     })
   }
 }
@@ -89,9 +107,9 @@ function getCompanyLists() {
 
 // 添加次数
 function addPrint() {
-        // console.log(detailData);
+
   let ids = detailData.map(item => {
-    console.log(item.invoicePickBeans);
+
     if (item.invoicePickBeans && item.invoicePickBeans.length) {
       for (let index = 0; index < item.invoicePickBeans.length; index++) {
         const element = item.invoicePickBeans[index];
@@ -104,7 +122,7 @@ function addPrint() {
     }
   
   })
-    ids = [...new Set(ids)]
+ 
   // console.log(document.execCommand('print'),'4545');
   addPrints({ ids: ids.join(',') }).then(res => {
       console.log('chenggong ');

+ 6 - 5
src/views/supply/deliver/sum_list.vue

@@ -630,7 +630,9 @@ export default {
       if (!this.tableSelection[0].printNum) {
         this.queryItem = this.tableSelection;
         // this.isShowPrint = true;
-        getDetail(this.tableSelection)
+        getDetail(this.tableSelection,JSON.parse(
+          localStorage.getItem("supply_user")
+        ).nickName)
         this.$refs.preView.show(this.hiprintTemplate, detailArr)
       } else {
         this.queryItem = this.tableSelection;
@@ -658,7 +660,9 @@ export default {
           };
           checkPassword(params).then((res) => {
             this.cancelDialogForm();
-            getDetail(this.tableSelection)
+            getDetail(this.tableSelection,JSON.parse(
+          localStorage.getItem("supply_user")
+        ).nickName)
              this.$refs.preView.show(this.hiprintTemplate, detailArr)
           });
         }
@@ -679,9 +683,6 @@ export default {
       }
       var currentdate = year + seperator1 + month + seperator1 + strDate;
       return currentdate;
-
-
-
     },
 
     backList() {

+ 1 - 0
src/views/supply/pickup/check.vue

@@ -536,6 +536,7 @@ export default {
 
     // 点击打印
     toPrint() {
+    
       if (!this.isAllEqual(this.tableSelection)) {
         return this.$errorMsg("只能选择同一个提货订单");
       }

+ 8 - 8
src/views/supply/pickup/components/design/panel.js

@@ -4,6 +4,7 @@ export default {
     "index": 0,
     "height": 140,
     "width": 241,
+     "paperNumber":0,
     "printElements": [{
       "options": {
         "left": 0,
@@ -221,7 +222,7 @@ export default {
         "fontSize": 13,
         "title": "",
         "fontFamily": '黑体',
-        "field": "tiTui",
+        "field": "takerName",
         "testData": "",
         "color": "#000",
         "textAlign": "left"
@@ -252,7 +253,7 @@ export default {
         "fontSize": 13,
         "title": "提单",
         "fontFamily": '黑体',
-        "field": "",
+        "field": "takerDa",
         "testData": "",
         "color": "#000",
         "textAlign": "left"
@@ -267,7 +268,7 @@ export default {
         "fontSize": 13,
         "title": "联系方式",
         "fontFamily": '黑体',
-        "field": "",
+        "field": "takerPhone",
         "testData": "",
         "color": "#000",
         "textAlign": "left"
@@ -282,7 +283,7 @@ export default {
         "fontSize": 13,
         "title": "车辆",
         "fontFamily": '黑体',
-        "field": "",
+        "field": "pickCar",
         "testData": "",
         "color": "#000",
         "textAlign": "left"
@@ -297,14 +298,13 @@ export default {
         "fontSize": 13,
         "title": "仓库",
         "fontFamily": '黑体',
-        "field": "",
+        "field": "correspondName",
         "testData": "",
         "color": "#000",
         "textAlign": "left"
       }, "printElementType": { "title": "", "type": "text" }
     }],
-
-    "paperNumberLeft": 0,
-    "paperNumberTop": 380
+   
+  
   }]
 }

+ 61 - 47
src/views/supply/pickup/components/design/print-data.js

@@ -8,53 +8,67 @@ let detailData = []
 let company = ''
 // 获取详情
 getCompanyLists()
-function getDetails(ids) {
-
+function getDetails(ids, nickName) {
+  let invoicePickBeans = []
+  let start = 0
+  let end = 5
   detailArr = []
   // detailData = ids 
   let newIds = []
-      newIds = ids
-  let  filterId =[]
-      filterId = newIds.map(k=>{
-              return k.id
-            })
-        filterId = [...new Set(filterId)]    
+  newIds = ids
+  let filterId = []
+  filterId = newIds.map(k => {
+    return k.id
+  })
+  filterId = [...new Set(filterId)]
   for (let i = 0; i < filterId.length; i++) {
     getDetail({ id: filterId[i] }).then(res => {
       const item = res.data
-      detailData.push(item)
-      const table = []
-      item.invoicePickBeans.length = 5
-      item.invoicePickBeans.forEach(e => {
-        table.push({
-          salesId: e.salesOrderId,
-          invoiceId: e.invoiceId,
-          id: e.id,
-          createTime: e.id ? dateToDayFilter(item.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 || ''
+      detailData.push(JSON.parse(JSON.stringify(item)))
+
+      invoicePickBeans = item.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(item.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({
+          type: item.type,
+          tiTui: item.type === 2 ? `退货人` : `提货人`,
+          takerPhone: item.takerPhone || '',
+          headerRemark: item.remark,
+          total_num: item.total_num,
+          company: item.type === 2 ? `${company}销售退货单` : `${company}销售发货单`,
+          pickOrderWater: item.pickOrderWater,
+          customerNumber: item.customerNumber,
+          takerDa: '',
+          nowDate: nowDate(),
+          takerName: item.type === 2 ? `退货人:${item.takerName || ''}` : `提货人:${item.takerName || ''}`,
+          customerName: item.customerName || '',
+          correspondName: '',
+          pickCar: item.pickCar || '',
+          createBy: JSON.parse(
+            localStorage.getItem("supply_user")
+          ).nickName,
+          table
         })
-      });
-
-      console.log(company);
-      detailArr.push({
-        type: item.type,
-        tiTui:item.type === 2 ? `退货人` : `提货人`,
-        headerRemark:item.remark,
-        total_num: item.total_num,
-        company: item.type === 2 ? `${company}销售退货单` : `${company}销售发货单`,
-        pickOrderWater: item.pickOrderWater,
-        customerNumber: item.customerNumber,
-        nowDate: nowDate(),
-        customerName: item.customerName || '',
-        correspondName: item.correspondName || '',
-        createBy: item.createBy,
-        table
-      })
+      }
     })
   }
 }
@@ -90,28 +104,28 @@ function getCompanyLists() {
 
 // 添加次数
 function addPrints() {
-        // console.log(detailData);
+  // console.log(detailData);
   let ids = detailData.map(item => {
     console.log(item.invoicePickBeans);
     if (item.invoicePickBeans && item.invoicePickBeans.length) {
       for (let index = 0; index < item.invoicePickBeans.length; index++) {
         const element = item.invoicePickBeans[index];
-            // console.log(element.id ,'element.id ');
-        return  element.invoiceOrderId
+        // console.log(element.id ,'element.id ');
+        return element.invoiceOrderId
       }
     } else {
       // console.log(item.invoiceOrderId ,'item.invoiceOrderId ');
       return item.invoiceOrderId || item.id
     }
-  
+
   })
-    ids = [...new Set(ids)]
+
   // console.log(document.execCommand('print'),'4545');
   addPrint({ ids: ids.join(',') }).then(res => {
-      console.log('chenggong ');
+    console.log('chenggong ');
     // this.$successMsg('提交成功');
     // this.$parent.getList()
- 
+
   })
 }