纸通宝小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

62 lines
1.4 KiB

function isEmpty(val) {
return typeof val === 'undefined' || val === '' || val === null
}
function orderStatus(status) {
if (status == 2) {
return '待确认'
} else if (status == 3 || status == 30) {
return '待审核'
} else if (status == 23 || status == 31) {
return '待审核'
} else if (status == 4) {
return '已完成'
} else if (status == 5) {
return '已取消'
} else if (status == 6) {
return '不通过'
}
return ''
}
function cateString(cateList) {
return cateList.toString()
}
function numberFormat(value, fix) {
if (value) {
return value.toFixed(fix)
}
return ''
}
function orderOperated(status) {
return status in [2, 3, 4]
}
function settleOrder(orderInfo, type) {
if (type == 1) {
if (parseFloat(orderInfo.settleWeight) > 0) {
return numberFormat(orderInfo.settleWeight, 3)
}
if (parseFloat(orderInfo.allSettleWeight) > 0) {
return numberFormat(orderInfo.allSettleWeight, 3)
}
} else if (type == 2) {
if (parseFloat(orderInfo.settlePrice) > 0) {
return numberFormat(orderInfo.settlePrice, 2)
}
if (!isEmpty(orderInfo.allTotalPrice) && parseFloat(orderInfo.allTotalPrice) > 0) {
return numberFormat(orderInfo.allTotalPrice, 2)
}
}
return ''
}
module.exports = {
orderStatus: orderStatus,
cateString: cateString,
numberFormat: numberFormat,
orderOperated: orderOperated,
settleOrder: settleOrder
}