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' && !item.userCouponId
}
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)
}