修改部分功公共方法
This commit is contained in:
parent
5a63a8324d
commit
d5dbd51c80
|
|
@ -2,7 +2,7 @@ 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))
|
||||
return arr.filter(v => canComputedPackFee(v))
|
||||
}
|
||||
export function returnPackFee(arr) {
|
||||
return arr.reduce((prve, cur) => {
|
||||
|
|
@ -10,22 +10,26 @@ export function returnPackFee(arr) {
|
|||
}, 0).toFixed(2)
|
||||
}
|
||||
|
||||
export function canTuicai(orderInfo,item){
|
||||
return orderInfo.status=='unpaid'&&orderInfo.useType!='dine-in-before'&& item.status!='return'
|
||||
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!='unpaid'&& item.status!='return'&&item.status!='refund'&&item.status!='refunding'&&!item.userCouponId
|
||||
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 isTui(item) {
|
||||
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
|
||||
}
|
||||
export function isGift(item){
|
||||
return !isTui(item)&&item.gift
|
||||
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 numSum(arr) {
|
||||
const sum = arr.reduce((a, b) => {
|
||||
return a + b * 100
|
||||
}, 0)
|
||||
return (sum / 100).toFixed(2)
|
||||
}
|
||||
|
|
@ -1,23 +1,32 @@
|
|||
import {
|
||||
getCurrentInstance,
|
||||
} from 'vue';
|
||||
export function getElRect(elClass, dataVal) {
|
||||
const instance = getCurrentInstance();
|
||||
return new Promise((resolve, reject) => {
|
||||
const query = uni.createSelectorQuery().in(instance.proxy);
|
||||
export async function getElRect(elClass, instance,option) {
|
||||
instance = instance ? instance : getCurrentInstance();
|
||||
const query = uni.createSelectorQuery().in(instance.proxy);
|
||||
try{
|
||||
const res= await getEle(query,elClass,option)
|
||||
return res
|
||||
}catch(e){
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async function getEle(query,elClass,option){
|
||||
return new Promise((resolve, reject)=>{
|
||||
query.select('.' + elClass).fields({
|
||||
size: true
|
||||
size: true,
|
||||
...option
|
||||
}, res => {
|
||||
// 如果节点尚未生成,res值为null,循环调用执行
|
||||
if (!res) {
|
||||
setTimeout(() => {
|
||||
getElRect(elClass);
|
||||
return setTimeout(() => {
|
||||
getEle(query,elClass,option);
|
||||
}, 10);
|
||||
return;
|
||||
}
|
||||
resolve(res);
|
||||
}).exec();
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
export async function getSafeBottomHeight(className, height = 16) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue