会员,充值,明细,下单问题修复
This commit is contained in:
@@ -118,7 +118,10 @@
|
||||
BigNumber
|
||||
} from 'bignumber.js';
|
||||
import ChargeVue from './components/charge.vue';
|
||||
import {pay} from '@/utils/pay.js'
|
||||
import {
|
||||
pay
|
||||
} from '@/utils/pay.js'
|
||||
|
||||
function onback() {
|
||||
closeSocket()
|
||||
back()
|
||||
@@ -149,7 +152,8 @@
|
||||
import {
|
||||
APIgetOrderById,
|
||||
APIputuserorder,
|
||||
APIhistoryOrder,rechargePayOrder
|
||||
APIhistoryOrder,
|
||||
rechargePayOrder
|
||||
} from '@/common/api/order/index.js'
|
||||
import {
|
||||
APIusershopInfodetail,
|
||||
@@ -166,19 +170,22 @@
|
||||
useWebSocket
|
||||
} from '@/stores/carts-websocket.js';
|
||||
const cartStore = useCartsStore()
|
||||
|
||||
|
||||
|
||||
|
||||
//充值相关
|
||||
const rechargeItem=ref({id:''})
|
||||
const rechargeId=ref(null)
|
||||
|
||||
function updateRechargeId(e){
|
||||
rechargeId.value=e
|
||||
const rechargeItem = ref({
|
||||
id: ''
|
||||
})
|
||||
const rechargeId = ref(null)
|
||||
|
||||
function updateRechargeId(e) {
|
||||
rechargeId.value = e
|
||||
}
|
||||
function updateChargeSel(e){
|
||||
rechargeItem.value=e
|
||||
|
||||
function updateChargeSel(e) {
|
||||
rechargeItem.value = e
|
||||
}
|
||||
|
||||
|
||||
async function onMessage(Message) {
|
||||
cartStore.onMessage(Message, cartsSocket)
|
||||
listinfo.totalPrices = historyTotalPrices * 1 + cartStore.totalPrice * 1
|
||||
@@ -192,8 +199,8 @@
|
||||
let res = await APIgetOrderById({
|
||||
orderId: listinfo.id
|
||||
})
|
||||
console.log('onMessage:APIgetOrderById',res);
|
||||
if(res){
|
||||
console.log('onMessage:APIgetOrderById', res);
|
||||
if (res) {
|
||||
// cartStore.carts=[];
|
||||
// cartStore.setOldOrder(res)
|
||||
}
|
||||
@@ -590,7 +597,7 @@
|
||||
// cartStore.carts=[];
|
||||
// cartStore.setOldOrder(res)
|
||||
getOrderInfoAfterCalcInit(res)
|
||||
|
||||
|
||||
cartsSocket.sendMessage({
|
||||
type: 'shopping',
|
||||
table_code: uni.cache.get('tableCode'),
|
||||
@@ -647,12 +654,12 @@
|
||||
if (!cartStore.isEmpty) {
|
||||
const res = await createOrder()
|
||||
//历史订单数据
|
||||
const res1= await APIgetOrderById({
|
||||
const res1 = await APIgetOrderById({
|
||||
orderId: res.id
|
||||
})
|
||||
cartStore.setOldOrder(res1)
|
||||
}
|
||||
|
||||
|
||||
goToPay()
|
||||
|
||||
} else {
|
||||
@@ -700,22 +707,26 @@
|
||||
const goToPay = async (isCreateOrder = false) => {
|
||||
// 余额支付
|
||||
if (paymentmethod.payType == 'accountPay') {
|
||||
if (orderVIP.value.isVip == 0) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您还不是会员,是否去注册会员?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.pro.navigateTo('user/member/index', {
|
||||
shopId: orderVIP.value.shopId,
|
||||
type: 'detail'
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if (orderVIP.value.payPwd == '') {
|
||||
// if (orderVIP.value.isVip == 0) {
|
||||
// uni.showModal({
|
||||
// title: '提示',
|
||||
// content: '您还不是会员,是否去注册会员?',
|
||||
// success: (res) => {
|
||||
// if (res.confirm) {
|
||||
// uni.pro.navigateTo('user/member/index', {
|
||||
// shopId: orderVIP.value.shopId,
|
||||
// type: 'detail'
|
||||
// })
|
||||
// } else if (res.cancel) {
|
||||
// console.log('用户点击取消');
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// return
|
||||
|
||||
// }
|
||||
|
||||
if (orderVIP.value.payPwd == '') {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您还未设置支付密码,是否去设置?',
|
||||
@@ -779,7 +790,7 @@
|
||||
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 , //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
originAmount: cartStore.orderCostSummary.goodsRealAmount, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
discountRatio: 1, //折扣比例(计算时 向上取整保留 两位小数) 写死1
|
||||
discountAmount: 0, //手动优惠金额 写死0
|
||||
productCouponDiscountAmount: cartStore.orderCostSummary.productCouponDeduction, //商品优惠券抵扣金额
|
||||
@@ -789,25 +800,29 @@
|
||||
roundAmount: 0, //抹零金额 减免多少钱
|
||||
pointsDiscountAmount: cartStore.orderCostSummary
|
||||
.pointDeductionAmount, //积分抵扣金额(tb_points_basic_setting表)
|
||||
pointsNum: listinfo.pointsNum, //(扣除各类折扣 enable_deduction后使用)
|
||||
pointsNum: cartStore.orderCostSummary.pointUsed, //(扣除各类折扣 enable_deduction后使用)
|
||||
newCustomerDiscountAmount: cartStore.orderCostSummary.newUserDiscount, //新客立减
|
||||
newCustomerDiscountId: cartStore.orderCostSummary.newUserDiscount > 0 ? cartStore
|
||||
.consumeDiscount.id : '',
|
||||
remark: '', //用户备注
|
||||
}
|
||||
console.log('topay checkOrderPay', checkOrderPay);
|
||||
try {
|
||||
if(rechargeItem.value.id&&rechargeId.value){
|
||||
if (rechargeItem.value.id && rechargeId.value) {
|
||||
//充值支付
|
||||
const payRes= await rechargePayOrder({
|
||||
const payRes = await rechargePayOrder({
|
||||
checkOrderPay,
|
||||
payType: paymentmethod.payType,
|
||||
buyerRemark: '',
|
||||
returnUrl: '',
|
||||
rechargeId:rechargeId.value,
|
||||
rechargeDetailId:rechargeItem.value.id,
|
||||
shopUserId:orderVIP.value.id,
|
||||
rechargeId: rechargeId.value,
|
||||
rechargeDetailId: rechargeItem.value.id,
|
||||
shopUserId: orderVIP.value.id,
|
||||
shopId: orderVIP.value.shopId,
|
||||
})
|
||||
pay(payRes)
|
||||
}else{
|
||||
await pay(payRes)
|
||||
pay_unlock()
|
||||
} else {
|
||||
console.log('微信支付');
|
||||
await storeMemberpay.actionsltPayOrder({
|
||||
checkOrderPay,
|
||||
@@ -815,15 +830,17 @@
|
||||
buyerRemark: '',
|
||||
returnUrl: ''
|
||||
})
|
||||
pay_unlock()
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.log('error',error);
|
||||
console.log('error', error);
|
||||
pay_unlock()
|
||||
//TODO handle the exception
|
||||
}
|
||||
}
|
||||
pay_unlock()
|
||||
console.log('orderorderInfo');
|
||||
orderorderInfo()
|
||||
}
|
||||
|
||||
@@ -853,7 +870,7 @@
|
||||
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 , //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
originAmount: cartStore.orderCostSummary.goodsRealAmount, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
discountRatio: 1, //折扣比例(计算时 向上取整保留 两位小数) 写死1
|
||||
discountAmount: 0, //手动优惠金额 写死0
|
||||
productCouponDiscountAmount: cartStore.orderCostSummary.productCouponDeduction, //商品优惠券抵扣金额
|
||||
@@ -863,7 +880,10 @@
|
||||
roundAmount: 0, //抹零金额 减免多少钱
|
||||
pointsDiscountAmount: cartStore.orderCostSummary
|
||||
.pointDeductionAmount, //积分抵扣金额(tb_points_basic_setting表)
|
||||
pointsNum: listinfo.pointsNum, //(扣除各类折扣 enable_deduction后使用)
|
||||
pointsNum: cartStore.orderCostSummary.pointUsed, //(扣除各类折扣 enable_deduction后使用)
|
||||
newCustomerDiscountAmount: cartStore.orderCostSummary.newUserDiscount, //新客立减
|
||||
newCustomerDiscountId: cartStore.orderCostSummary.newUserDiscount > 0 ? cartStore.consumeDiscount
|
||||
.id : '',
|
||||
remark: '', //用户备注
|
||||
}
|
||||
try {
|
||||
@@ -934,7 +954,7 @@
|
||||
url: '/pages/product/index'
|
||||
})
|
||||
}
|
||||
const packfee=computed(()=>{
|
||||
const packfee = computed(() => {
|
||||
return cartStore.orderCostSummary.packFee
|
||||
})
|
||||
//不计算各种折扣前的实付金额
|
||||
|
||||
Reference in New Issue
Block a user