first
This commit is contained in:
37
commons/utils/goodsUtil.js
Normal file
37
commons/utils/goodsUtil.js
Normal file
@@ -0,0 +1,37 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user