let arguments =[
{
"shipmentNum": "ck1588440413242994690",
"pageNumber": "第1/1页",
"receivingAddress": "广州市",
"hab": "广州市盈信纸业有限公司",
"productCount": 22,
"operator": "admin",
"allPage": 1,
"planNum": "1100023",
"total": 6057.6,
"allProductCount": 22,
"companyPhone": "02084305189",
"routeBz": null,
"bz": "",
"allSquareNum": 4176,
"lines": 6,
"day": "2022-11-04",
"qq": "196113390",
"address": "广东省广州市白云区钟落潭镇马新路140号301",
"printSum": 0,
"signatoryPhone": "15999999999",
"list": [{
"companyAlias": null,
"unit2": "平方",
"units": "m²",
"productCount": 2,
"specifications": "330mm * 100m * 2R",
"productName": "DTF-transferfilm(单面)75U",
"number": null,
"sizeOther1": null,
"bz": "",
"planId": "1590948879909937153",
"brand": null,
"sizeLength": 100,
"sizeWidth": 330,
"productBz": null,
"sizeWeight": null,
"associatedPo": "",
"subtotal": "343.2",
"squareUnitPrice": 5.2,
"salesman": "老黄",
"squareNum": "66",
"additionalAttributes": null
}
],
"companyContacts": "王",
"allTotal": 6057.6,
"contactsPhone": "15999999999",
"capitalChineseAllTotal": "陆仟零伍拾柒元陆角",
"associatedPo": "",
"capitalChineseTotal": "陆仟零伍拾柒元陆角",
"customerTo": "烫画材料测试",
"shippingAddress": "广州市",
"signatory": "王",
"currentPage": 1,
"totalSquareNum": 4176,
"customer": "烫画材料测试"
}
]
let data = arguments[0];
let dataList = data['list'];
for (let i = 0;i < dataList.length;i++)
{
let row = data['行'+(i+1)]
let base = dataList[i];
let spe = '';
let sizeLength = base.sizeLength;
let sizeWidth = base.sizeWidth;
let sizeOther1 = base.sizeOther1;
let productCount = base.productCount;
let sizeWeight = base.sizeWeight;
if(sizeLength == 1 ){
data['list'][i].unit2 = "米"
spe = parseFloat((sizeWidth/10).toFixed(2)) + "cm * "
}else if(sizeWidth == 1000){
data['list'][i].unit2 = "米"
spe = parseFloat((sizeLength*100).toFixed(2)) + "cm * "
}
if(sizeOther1){
if(sizeLength == 1 || sizeWidth == 1000){
spe = spe + "" + (sizeOther1*productCount) + "张"
}else{
spe = parseFloat((sizeWidth/10).toFixed(2)) + "cm * " + parseFloat((sizeLength*100).toFixed(2)) + "cm * " + (sizeOther1*productCount) + "张"
}
}else{
spe = parseFloat((sizeWidth/10).toFixed(2)) + "cm * " + parseFloat((sizeLength*100).toFixed(2)) + "cm * "
}
if(sizeWeight){
spe = spe + (sizeWeight*productCount) + "张"
data['list'][i].unit2 = "张"
}else if(sizeOther1){
}else{
spe = spe + productCount +"卷"
}
let productName = base.productName
data['list'][i].pmgg = productName + '*' + spe
if(productName == '其他费用'){
data['list'][i].unit2 = "元"
data['list'][i].pmgg = productName
}else if (productName == ''){
spe = ''
data['list'][i].pmgg = ''
}
data['list'][i].specifications = spe
}
function hasText(text,name){
return text.indexOf(name)!== -1
}
console.log(data['list']);
console