积分问题修复

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

@@ -470,22 +470,16 @@
shopUserId: props.orderVIP.id,
orderAmount: maxMoney.value
})
console.log(res);
Object.assign(pointsRes, res)
const maxUsablePoints = res.maxUsablePoints
maxPointDiscount.value = res.maxDeductionAmount
// props.listinfo.pointsDiscountAmount = await APImemberPointscalcDeductionAmount({
// points: maxUsablePoints,
// shopUserId: props.orderVIP.id,
// orderAmount: maxMoney
// })
if (usePoints.value) {
cartStore.setUserPoints(maxUsablePoints)
}
cartStore.setUserPoints(res.maxUsablePoints||0)
console.log('getMaxPointsDiscount:cartStore.orderCostSummary.pointUsed', cartStore.orderCostSummary.pointUsed);
}
watch(() => maxMoney.value, (newval) => {
console.log('maxMoney.value', newval);
getMaxPointsDiscount()
if (usePoints.value) {
getMaxPointsDiscount()
}
})
watch(() => usePoints.value, (newval) => {
if (newval) {
@@ -493,6 +487,7 @@
} else {
cartStore.setUserPoints(0)
}
})
const handleConfirm = async (integral) => {
@@ -532,7 +527,7 @@
calcUsablePointsData.integral = null
props.listinfo.pointsDiscountAmount = 0
calcUsablePointsData.showModal = false
cartStore.setUserPoints(0);
// cartStore.setUserPoints(0);
}
// * 复制订单号

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;

View File

@@ -207,10 +207,10 @@ function showDetailHandle(item) {
ruleList.push(otherCouponRule);
}
const shareRuleText = `${ruleList.join('、')}`;
let foods=item.foods;
selectListItemDetails.value = [
`可适用门店:${item.useShops}`,
`可适用商品:${item.foods}`,
`可适用商品:${foods}`,
`可使用类型:${convertValuesToLabels(item.useType)}`,
`可用时间段:${item.useTimeType == 'all' ? '全段时间可用' : `${item.useStartTime} - ${item.useEndTime}`}`,
`限量规则:每人限领${item.getLimit == -10086 ? `无限张` : `${item.getLimit}`},每日最多可使用${item.useLimit == -10086 ? `无限张` : `${item.useLimit}`}`,

View File

@@ -47,8 +47,8 @@
</view>
<view class="flex-colum">
<view class="Box_bottom" :class="(form.checkCode!=''&&form.password!=''&&form.payPassword!='')?'active':''"
@click="userInfosavePayPassword">确定</view>
<view class="Box_bottom active"
@click="userInfosavePayPassword">重置密码</view>
</view>
</view>
</template>
@@ -271,14 +271,14 @@
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #5082fd;
z-index: 1;
z-index: 100;
.yzm {
padding: 8rpx 20rpx;
background: #E5E5E5;
background: #FFD158;
border-radius: 24rpx;
font-weight: 500;
font-size: 24rpx;
color: #333333;
color: #5F2E0F;
}
}
}
@@ -303,18 +303,15 @@
width: 100%;
height: 96rpx;
line-height: 96rpx;
background-color: #999;
background-color: #FFD158;
border-radius: 48rpx;
font-size: 32rpx;
font-size: 36rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #ffffff;
font-weight: 500;
color: #333;
text-align: center;
}
.Box_bottom.active {
background-color: #E3AD7F;
}
}
.getPhone {