|
@@ -1,112 +1,120 @@
|
|
|
import { getDeliverDetail } from '@/api/supply/deliver'
|
|
|
import { addPrints } from '@/api/supply/pickup'
|
|
|
import { getCompanyList } from '@/api/user'
|
|
|
-
|
|
|
- const detailArr = []
|
|
|
- let detailData = []
|
|
|
- let company = ''
|
|
|
- // 获取详情
|
|
|
- getCompanyLists()
|
|
|
- function getDetail(ids) {
|
|
|
- let newIds =[]
|
|
|
- newIds =ids
|
|
|
- for (let i = 0; i < newIds.length; i++) {
|
|
|
|
|
|
- getDeliverDetail({ id: newIds[i].id }).then(res => {
|
|
|
- detailData = res.data
|
|
|
- const item = res.data
|
|
|
- const table = []
|
|
|
-
|
|
|
- item.invoicePickBeans.length=5
|
|
|
- item.invoicePickBeans.forEach(e => {
|
|
|
- table.push({
|
|
|
- salesId:e.salesId,
|
|
|
- invoiceId:e.invoiceId,
|
|
|
- id:e.id,
|
|
|
- enginOrderType:e.enginOrderType =='HOME' || e.enginOrderType =='TRADE'? e.enginOrderNo :e.mainOrderId ,
|
|
|
- materialName:e.materialName || '',
|
|
|
- specification:e.specification || '',
|
|
|
- refundableQty:100,
|
|
|
- // headerRemark:e.headerRemark,
|
|
|
- pjxh1Text:e.pjxh1Text || ''
|
|
|
- })
|
|
|
- });
|
|
|
-
|
|
|
- // table.push({},{},{},{},{})
|
|
|
- console.log(company);
|
|
|
- detailArr.push({
|
|
|
- type:item.type,
|
|
|
- company:item.type === 2 ? `${company}销售退货单`:`${company}销售发货单`,
|
|
|
- pickOrderWater:item.pickOrderWater,
|
|
|
- customerNumber:item.customerNumber,
|
|
|
- nowDate:nowDate(),
|
|
|
- customerName:item.customerName || '',
|
|
|
- correspondName:item.correspondName || '',
|
|
|
- createBy:item.createBy,
|
|
|
- table
|
|
|
+let detailArr = []
|
|
|
+let detailData = []
|
|
|
+let company = ''
|
|
|
+// 获取详情
|
|
|
+getCompanyLists()
|
|
|
+function getDetail(ids) {
|
|
|
+
|
|
|
+ detailArr = []
|
|
|
+ // detailData = ids
|
|
|
+ let newIds = []
|
|
|
+ newIds = ids
|
|
|
+ for (let i = 0; i < newIds.length; i++) {
|
|
|
+ getDeliverDetail({ id: newIds[i].id }).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: 100,
|
|
|
+ // 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(detailArr);
|
|
|
-
|
|
|
- function nowDate() {
|
|
|
- var date = new Date();
|
|
|
- var seperator1 = "-";
|
|
|
- var year = date.getFullYear();
|
|
|
- var month = date.getMonth() + 1;
|
|
|
- var strDate = date.getDate();
|
|
|
- if (month >= 1 && month <= 9) {
|
|
|
- month = "0" + month;
|
|
|
- }
|
|
|
- if (strDate >= 0 && strDate <= 9) {
|
|
|
- strDate = "0" + strDate;
|
|
|
- }
|
|
|
- var currentdate = year + seperator1 + month + seperator1 + strDate;
|
|
|
- return currentdate;
|
|
|
+}
|
|
|
+
|
|
|
+function nowDate() {
|
|
|
+ var date = new Date();
|
|
|
+ var seperator1 = "-";
|
|
|
+ var year = date.getFullYear();
|
|
|
+ var month = date.getMonth() + 1;
|
|
|
+ var strDate = date.getDate();
|
|
|
+ if (month >= 1 && month <= 9) {
|
|
|
+ month = "0" + month;
|
|
|
}
|
|
|
+ if (strDate >= 0 && strDate <= 9) {
|
|
|
+ strDate = "0" + strDate;
|
|
|
+ }
|
|
|
+ var currentdate = year + seperator1 + month + seperator1 + strDate;
|
|
|
+ console.log(currentdate);
|
|
|
+ return currentdate;
|
|
|
+}
|
|
|
|
|
|
+function dateToDayFilter(date) {
|
|
|
+ if (!date) { return '' }
|
|
|
+ return date.slice(0, 10)
|
|
|
+}
|
|
|
|
|
|
- function getCompanyLists() {
|
|
|
- getCompanyList().then(res => {
|
|
|
- company = res.data ? res.data[0].companyName : ''
|
|
|
-
|
|
|
- })
|
|
|
- return company
|
|
|
- }
|
|
|
-
|
|
|
- // 添加次数
|
|
|
- function addPrint() {
|
|
|
- console.log('add',999,detailData);
|
|
|
- const ids = detailData.map(item => {
|
|
|
+function getCompanyLists() {
|
|
|
+ getCompanyList().then(res => {
|
|
|
+ company = res.data ? res.data[0].companyName : ''
|
|
|
+ })
|
|
|
+ return company
|
|
|
+}
|
|
|
+
|
|
|
+// 添加次数
|
|
|
+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];
|
|
|
- return item.invoiceOrderId || element.invoiceOrderId || element.id
|
|
|
+ // console.log(element.id ,'element.id ');
|
|
|
+ return element.id
|
|
|
}
|
|
|
} else {
|
|
|
+ // console.log(item.invoiceOrderId ,'item.invoiceOrderId ');
|
|
|
return item.invoiceOrderId || item.id
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
})
|
|
|
- console.log(ids);
|
|
|
+ ids = [...new Set(ids)]
|
|
|
// console.log(document.execCommand('print'),'4545');
|
|
|
addPrints({ ids: ids.join(',') }).then(res => {
|
|
|
- console.log('chenggong ');
|
|
|
+ console.log('chenggong ');
|
|
|
// this.$successMsg('提交成功');
|
|
|
// this.$parent.getList()
|
|
|
+
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- const myData = detailArr
|
|
|
|
|
|
|
|
|
- export {
|
|
|
- getDetail ,getCompanyLists,
|
|
|
- myData,
|
|
|
- detailArr,
|
|
|
- addPrint
|
|
|
+export {
|
|
|
+ getDetail, getCompanyLists,
|
|
|
+ detailArr,
|
|
|
+ addPrint
|
|
|
}
|