export function canComputedPackFee(v) {
	return v.pack && v.status != 'return' && v.status != 'refund' && v.status != 'refunding'
}
export function returnCanComputedGoodsArr(arr) {
	return arr.filter(v => canComputedPackFee(v))
}
export function returnPackFee(arr) {
	return arr.reduce((prve, cur) => {
		return prve + cur.packAmount
	}, 0).toFixed(2)
}

export function canTuicai(orderInfo, item) {
	if (orderInfo.status == 'unpaid' && orderInfo.isPostpaid !== null && orderInfo.isPostpaid == 0) {
		return false
	}
	return orderInfo.status == 'unpaid' && orderInfo.useType != 'dine-in-before' && item.status != 'return'
}
export function canTuiKuan(orderInfo, item) {
	return orderInfo.status == 'closed' && item.status != 'return' && item.status != 'refund' && item.status !=
		'refunding' 
}
export function isTuiCai(item) {
	return item.status == 'return' 
}
export function isTui(item) {
	return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
}
export function isGift(item) {
	return !isTui(item) && item.gift
}
export function numSum(arr) {
	const sum = arr.reduce((a, b) => {
		return a + b * 100
	}, 0)
	return (sum / 100).toFixed(2)
}
export function mathFloorPrice(price,item) {
	if( item ){
		if( item.productType == 'weight' || item.type == 'weight'){
			return (Math.floor(price * 100)/100).toFixed(2)
		} else {
			return parseFloat(price).toFixed(2)
		}
	} else {
		return parseFloat(price).toFixed(2)
	}
}