积分问题修复

This commit is contained in:
2025-09-30 17:42:28 +08:00
parent 31e386bd3c
commit b2cb18b114
7 changed files with 141 additions and 135 deletions

View File

@@ -36,7 +36,7 @@
</view>
{{cartStore.orderCostSummary}}
<!-- {{cartStore.orderCostSummary}} -->
<!-- 详情 -->
<orderInfo :useVipPrice="cartStore.useVipPrice" :packfee="packfee" :shifu="shifu" :nowCarts="cartStore.carts"
@@ -215,7 +215,6 @@
}
function updateChargeSel(newval) {
console.log('updateChargeSel', newval);
rechargeItem.value = newval
//充值并付款时只能微信支付
if (newval && newval.id) {
@@ -231,7 +230,6 @@
if (paymentMethodref.value) {
paymentMethodref.value.groupChanges(2)
}
console.log('watch: cartStore.orderCostSummary.finalPayAmount', disablePayType.value);
return
}
if (shopUserInfo.value.amount < newval) {
@@ -239,11 +237,9 @@
if (paymentMethodref.value) {
paymentMethodref.value.groupChanges(2)
}
console.log('watch: cartStore.orderCostSummary.finalPayAmount', disablePayType.value);
return
}
disablePayType.value = []
console.log('watch: cartStore.orderCostSummary.finalPayAmount', disablePayType.value);
}
async function onMessage(Message) {
@@ -430,6 +426,7 @@
//拿到订单数据后续初始化处理
function getOrderInfoAfterCalcInit(res) {
console.log('getOrderInfoAfterCalcInit',res);
if (res && res.id) {
Object.assign(listinfo, res);
// 历史订单
@@ -666,7 +663,7 @@
}
// 生成订单
const createOrder = async () => {
cartStore.carts = [];
// cartStore.carts = [];
const res = await storeMemberpay.actionscreateOrder({
dineMode: is_type.value == 0 ? 'dine-in' : 'take-out', //堂食 dine-in 外带 take-out 外卖 take-away
seatNum: uni.cache.get('dinersNum') ? uni.cache.get('dinersNum') : '', //用餐人数
@@ -733,7 +730,35 @@
}
let payStatusTimer = null
let orderIsLock = true;
let usePoints=ref(0)
let checkOrderPay = {}
const istoricalorders = async () => {
checkOrderPay = {
orderId:'',
vipPrice: cartStore.useVipPrice ? 1 : 0, //是否使用会员价0否1是
userAllPack: is_type.value == 0 ? 0 : 1, //是否整单打包
seatNum: is_type.value == 0 ? cartStore.seatFeeConfig.personCount : 0, //用餐人数
originAmount: cartStore.orderCostSummary.goodsRealAmount, //订单原金额(包含打包费+餐位费) 不含折扣价格
discountRatio: 1, //折扣比例(计算时 向上取整保留 两位小数) 写死1
discountAmount: 0, //手动优惠金额 写死0
productCouponDiscountAmount: cartStore.orderCostSummary.productCouponDeduction, //商品优惠券抵扣金额
otherCouponDiscountAmount: cartStore.orderCostSummary.fullCouponDeduction, //其他优惠券抵扣金额
couponList: cartStore.backendCoupons.map(v => v.id), //用户使用的卡券
orderAmount: cartStore.orderCostSummary.finalPayAmount, // 最终订单金额
roundAmount: 0, //抹零金额 减免多少钱
pointsDiscountAmount: cartStore.orderCostSummary
.pointDeductionAmount, //积分抵扣金额(tb_points_basic_setting表)
pointsNum: cartStore.orderCostSummary.pointUsed, //(扣除各类折扣 enable_deduction后使用)
newCustomerDiscountAmount: cartStore.orderCostSummary.newUserDiscount, //新客立减
newCustomerDiscountId: cartStore.orderCostSummary.newUserDiscount > 0 ? cartStore
.consumeDiscount.id : '',
remark: orderRemarker.value, //用户备注
}
//先付
if (isPayBefor()) {
console.log('isPayBefor');
@@ -741,16 +766,19 @@
console.log('cartStore.carts', cartStore.carts);
// 购物车有数据
if (!cartStore.isEmpty) {
usePoints=cartStore.orderCostSummary.pointUsed
const res = await createOrder()
//历史订单数据
const res1 = await APIgetOrderById({
orderId: res.id
})
console.log('历史订单数据',res1);
orderRemarker.value=res1.remark;
cartStore.setOldOrder(res1)
}
nextTick(goToPay)
console.log('istoricalorderscartStore.orderCostSummary.pointUsed',cartStore.orderCostSummary.pointUsed);
console.log('istoricalorderscartStore.userPoints',cartStore.userPoints);
goToPay()
// goToPay()
} else {
@@ -815,7 +843,6 @@
})
return
}
console.log('userInfo.usePayPwd',userInfo.usePayPwd);
if(userInfo.usePayPwd){
ispws.value = true
return
@@ -825,9 +852,7 @@
}
const canPayRes = await search_pay_lock()
console.log('canPayRes', canPayRes);
const canPay = canPayRes.status == 1 ? true : false;
console.log('canPay', canPay);
if (!canPay) {
uni.showToast({
title: '有人正在付款中!',
@@ -855,32 +880,12 @@
orderorderInfo()
return false;
} else {
console.log(' ordershopUserInfo.value', ordershopUserInfo.value);
let checkOrderPay = {
orderId: listinfo.id,
vipPrice: cartStore.useVipPrice ? 1 : 0, //是否使用会员价0否1是
userAllPack: is_type.value == 0 ? 0 : 1, //是否整单打包
seatNum: is_type.value == 0 ? cartStore.seatFeeConfig.personCount : 0, //用餐人数
originAmount: cartStore.orderCostSummary.goodsRealAmount, //订单原金额(包含打包费+餐位费) 不含折扣价格
discountRatio: 1, //折扣比例(计算时 向上取整保留 两位小数) 写死1
discountAmount: 0, //手动优惠金额 写死0
productCouponDiscountAmount: cartStore.orderCostSummary.productCouponDeduction, //商品优惠券抵扣金额
otherCouponDiscountAmount: cartStore.orderCostSummary.fullCouponDeduction, //其他优惠券抵扣金额
couponList: cartStore.backendCoupons.map(v => v.id), //用户使用的卡券
orderAmount: cartStore.orderCostSummary.finalPayAmount, // 最终订单金额
roundAmount: 0, //抹零金额 减免多少钱
pointsDiscountAmount: cartStore.orderCostSummary
.pointDeductionAmount, //积分抵扣金额(tb_points_basic_setting表)
pointsNum: cartStore.orderCostSummary.pointUsed, //(扣除各类折扣 enable_deduction后使用)
newCustomerDiscountAmount: cartStore.orderCostSummary.newUserDiscount, //新客立减
newCustomerDiscountId: cartStore.orderCostSummary.newUserDiscount > 0 ? cartStore
.consumeDiscount.id : '',
remark: orderRemarker.value, //用户备注
}
checkOrderPay.orderId=listinfo.id;
console.log('cartStore.orderCostSummary',cartStore.orderCostSummary);
console.log('topay checkOrderPay', checkOrderPay);
try {
if (rechargeItem.value.id && rechargeId.value) {
//充值支付
//充值并且支付
const payRes = await rechargePayOrder({
checkOrderPay: {
...checkOrderPay,
@@ -936,29 +941,18 @@
// 余额支付
const accountPayevent = async (pwd) => {
ispws.value = false;
let checkOrderPay = {
userId: uni.cache.get('userInfo').id,
orderId: listinfo.id,
vipPrice: cartStore.useVipPrice ? 1 : 0, //是否使用会员价0否1是
userAllPack: is_type.value == 0 ? 0 : 1, //是否整单打包
seatNum: is_type.value == 0 ? cartStore.seatFeeConfig.personCount : 0, //用餐人数
originAmount: cartStore.orderCostSummary.goodsRealAmount, //订单原金额(包含打包费+餐位费) 不含折扣价格
discountRatio: 1, //折扣比例(计算时 向上取整保留 两位小数) 写死1
discountAmount: 0, //手动优惠金额 写死0
productCouponDiscountAmount: cartStore.orderCostSummary.productCouponDeduction, //商品优惠券抵扣金额
otherCouponDiscountAmount: cartStore.orderCostSummary.fullCouponDeduction, //其他优惠券抵扣金额
couponList: cartStore.backendCoupons.map(v => v.id), //用户使用的卡券
orderAmount: cartStore.orderCostSummary.finalPayAmount, // 最终订单金额
roundAmount: 0, //抹零金额 减免多少钱
pointsDiscountAmount: cartStore.orderCostSummary
.pointDeductionAmount, //积分抵扣金额(tb_points_basic_setting表)
pointsNum: cartStore.orderCostSummary.pointUsed, //(扣除各类折扣 enable_deduction后使用)
newCustomerDiscountAmount: cartStore.orderCostSummary.newUserDiscount, //新客立减
newCustomerDiscountId: cartStore.orderCostSummary.newUserDiscount > 0 ? cartStore.consumeDiscount
.id : '',
remark: orderRemarker.value, //用户备注
}
checkOrderPay.userId=uni.cache.get('userInfo').id
checkOrderPay.orderId=listinfo.id
console.log('余额支付本地计算',cartStore.orderCostSummary);
console.log('余额支付提交参数',{
checkOrderPay,
payType: paymentmethod.payType,
pwd: pwd,
shopUserId: orderVIP.value.id,
buyerRemark: '',
returnUrl: ''
});
console.log('积分',checkOrderPay.pointsNum);
try {
await storeMemberpay.balancePayOrder({
checkOrderPay,
@@ -1064,6 +1058,7 @@
})
async function init(opt) {
console.log('init');
cartStore.clearOrderConfig()
Object.assign(options, opt)
listinfo.id = options.orderId;