|
@@ -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()
|
|
|
-
|
|
|
+
|
|
|
})
|
|
|
}
|
|
|
|