下单退款相关更新
This commit is contained in:
@@ -251,11 +251,12 @@
|
||||
returnProductCoupAllPrice,
|
||||
returnProductCanUseNum
|
||||
} from '../quan_util.js'
|
||||
import { mathFloorPrice } from '@/commons/utils/goodsUtil.js'
|
||||
|
||||
import { getCouponList } from '@/http/api/coupon.js'
|
||||
import { getHistoryOrder } from '@/http/api/order.js'
|
||||
import { getPayTypeList } from '@/http/api/payType.js'
|
||||
import { scanPay,microPay,cashPay,vipPay,creditPay,getOrderPayUrl } from '@/http/api/pay.js'
|
||||
import { scanPay,microPay,cashPay,vipPay,creditPay,getOrderPayUrl,queryOrderStatus } from '@/http/api/pay.js'
|
||||
import { shopUserDetail } from '@/http/api/shopUser.js'
|
||||
import { calcUsablePoints,calcDeductionAmount,payedDeductPoints,consumeAwardPoints } from '@/http/api/points.js'
|
||||
|
||||
@@ -390,22 +391,45 @@
|
||||
const packAmount = computed(() => {
|
||||
if(pageData.goodsList){
|
||||
let price = pageData.goodsList.filter(v => v.packNumber > 0 && v.status !== "return").reduce((a, b) => {
|
||||
return a + (b.packNumber * b.packAmount)
|
||||
console.log(b)
|
||||
return a + ((b.packAmount||0)*b.packNumber).toFixed(2)*1
|
||||
}, 0)
|
||||
console.log(price)
|
||||
return price
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 订单金额
|
||||
* 桌位费
|
||||
*/
|
||||
const tableFee = computed(() => {
|
||||
return order.seatNum > 0 ? order.seatNum*order.seatAmount : 0
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 菜品金额
|
||||
*/
|
||||
const originPrice = computed(() => {
|
||||
console.log("order===",order)
|
||||
if(pageData.goodsList){
|
||||
let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => {
|
||||
return a + (b.num * b.price)
|
||||
return a + parseFloat(mathFloorPrice(b.num * b.unitPrice,b))
|
||||
}, 0)
|
||||
return (goodsPrice + (pageData.seatNum*uni.getStorageSync("shopInfo").tableFee||0) + packAmount.value).toFixed(2)
|
||||
console.log("菜品原金额===",goodsPrice)
|
||||
return (parseFloat(goodsPrice) + parseFloat(tableFee.value) + parseFloat(packAmount.value)).toFixed(2)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const newOriginPrice = computed(() => {
|
||||
if(pageData.goodsList){
|
||||
let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => {
|
||||
return a + parseFloat(mathFloorPrice(b.num * b.unitPrice,b) - mathFloorPrice(b.returnNum*b.unitPrice,b) - mathFloorPrice(b.refundNum*b.unitPrice,b))
|
||||
}, 0)
|
||||
console.log("减去退款退费的菜品金额===",goodsPrice)
|
||||
console.log("桌位费===", tableFee.value)
|
||||
return (goodsPrice + tableFee.value + packAmount.value).toFixed(2)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -468,7 +492,7 @@
|
||||
* 支付金额
|
||||
*/
|
||||
const payPrice = computed(() => {
|
||||
console.log("originPrice===",originPrice.value)
|
||||
console.log("originPrice===",newOriginPrice.value)
|
||||
console.log("vipDiscount===",vipDiscount.value)
|
||||
console.log("discountSaleAmount===",discountSaleAmount.value)
|
||||
console.log("pointCanDicountPrice===",pointCanDicountPrice.value)
|
||||
@@ -476,7 +500,7 @@
|
||||
console.log("discount===",discount.value)
|
||||
console.log("fullCouponDiscountAmount===",fullCouponDiscountAmount.value)
|
||||
console.log("accountPoints===",accountPoints)
|
||||
let total = (originPrice.value*1) - discountSaleAmount.value - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount
|
||||
let total = (newOriginPrice.value*1) - discountSaleAmount.value - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount
|
||||
.value - fullCouponDiscountAmount.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
|
||||
console.log("payPrice===",total)
|
||||
return (total < 0 ? 0 : total).toFixed(2)
|
||||
@@ -486,13 +510,12 @@
|
||||
* 积分使用前金额
|
||||
*/
|
||||
const orderAmount = computed(() => {
|
||||
let total = (originPrice.value*1) - discountSaleAmount.value - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount
|
||||
let total = (newOriginPrice.value*1) - discountSaleAmount.value - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount
|
||||
.value - fullCouponDiscountAmount.value
|
||||
console.log(total)
|
||||
return (total < 0 ? 0 : total).toFixed(2)
|
||||
})
|
||||
|
||||
|
||||
watch(() => accountPoints.sel, (newval) => {
|
||||
if (newval) {
|
||||
calcDeDuctionPoints()
|
||||
@@ -943,12 +966,27 @@
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
let res;
|
||||
let timer;
|
||||
if( error.code == 211 && error.msg == '等待用户付款'){
|
||||
uni.showLoading({
|
||||
title: '支付中...'
|
||||
})
|
||||
timer = setInterval(async ()=>{
|
||||
res = await queryOrderStatus({orderId: pars.orderId})
|
||||
if ( res == 'done') {
|
||||
clearInterval(timer)
|
||||
uni.hideLoading()
|
||||
paySuccess()
|
||||
}
|
||||
console.log(res)
|
||||
},1000)
|
||||
}
|
||||
payStatus = '';
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
paySuccess()
|
||||
}
|
||||
|
||||
@@ -959,13 +997,14 @@
|
||||
infoBox.showToast('支付成功')
|
||||
payStatus = 'success'
|
||||
setTimeout(() => {
|
||||
uni.removeStorageSync("table_code")
|
||||
// uni.$emit('orderDetail:update')
|
||||
uni.$emit('get:table')
|
||||
uni.$emit('update:orderDetail')
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
}, 500)
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user