优化下支付
This commit is contained in:
@ -112,20 +112,26 @@
|
||||
const storeMoney = ref<number>(0)
|
||||
const comboId = ref<number>(0) // 套餐ID
|
||||
|
||||
// 一键续订
|
||||
// 一键续订支付
|
||||
const renew = ref<string>('')
|
||||
const renewPrice = ref<number>(0)
|
||||
|
||||
// 是否是购买套餐
|
||||
// 购买套餐支付
|
||||
const isGroupBuying = ref<number>(0)
|
||||
const groupCouponId = ref<number>(0)
|
||||
|
||||
// 预约茶艺师支付
|
||||
const reserveTeaSpecialist = ref<boolean>(false)
|
||||
|
||||
// 防止重复提交
|
||||
const isSubmitting = ref(false)
|
||||
|
||||
onLoad(async (args) => {
|
||||
// 订单
|
||||
orderId.value = Number(args.orderId)
|
||||
comboId.value = Number(args.cmoboId) || 0
|
||||
|
||||
// 套餐购买
|
||||
groupCouponId.value = Number(args.groupCouponId) || 0
|
||||
isGroupBuying.value = Number(args.isGroupBuying) || 0
|
||||
console.log("🚀 ~ isGroupBuying.value:", isGroupBuying.value)
|
||||
@ -151,6 +157,10 @@
|
||||
title.value = `茶室套餐购买-${args.name}`
|
||||
hideStoreBalance.value = true // 隐藏门店余额支付
|
||||
}
|
||||
} else if (from.value === OrderType.TeaSpecialist) {
|
||||
// 预约茶艺师
|
||||
reserveTeaSpecialist.value = true
|
||||
title.value = `预约茶艺师-${args.teaSpecialistName || ''}`
|
||||
}
|
||||
|
||||
// 用户信息
|
||||
@ -181,7 +191,11 @@
|
||||
})
|
||||
|
||||
const Cashier = {
|
||||
// 获取茶艺师详情
|
||||
/**获取茶艺师详情
|
||||
*
|
||||
* @param id
|
||||
* @param user_id
|
||||
*/
|
||||
handleGetTeaSpecialistDetails: async (id: number, user_id: number) => {
|
||||
const res = await getTeaSpecialistDetails({
|
||||
id,
|
||||
@ -220,7 +234,10 @@
|
||||
money.value = Number(res.details.discount_price)
|
||||
},
|
||||
|
||||
// 获取支付方式
|
||||
/**
|
||||
* 获取支付方式
|
||||
* @param value 支付value
|
||||
*/
|
||||
handleGetPayValue: (value: number) => {
|
||||
pay.value = value
|
||||
console.log("🚀 ~ pay.value:", pay.value)
|
||||
@ -244,22 +261,12 @@
|
||||
uni.showLoading({ title: '支付中...' })
|
||||
try {
|
||||
// 预支付
|
||||
let ordeType = PayOrderType.TeaRoom
|
||||
if (isGroupBuying.value) {
|
||||
// 购买团购套餐
|
||||
ordeType = PayOrderType.BuyCombo
|
||||
} else if (renew.value) {
|
||||
// 续订包间
|
||||
ordeType = PayOrderType.RenewRoom
|
||||
}
|
||||
console.log("🚀 ~ PayValueMap[pay.value]:", PayValueMap[pay.value])
|
||||
|
||||
const res = await prePay({
|
||||
from: PayValueMap[pay.value],
|
||||
order_id: orderId.value,
|
||||
pay_way: pay.value,
|
||||
order_source: PayOrderSource.MINI, //订单来源:1-小程序; 2-h5; 3app
|
||||
order_type: ordeType, // 0为茶艺师 1为茶室包间 2为茶室套餐
|
||||
order_type: Cashier.handleGetOrderType(), // 0为茶艺师 1为茶室包间 2为茶室套餐
|
||||
store_id: storeId.value || 0
|
||||
})
|
||||
|
||||
@ -318,7 +325,25 @@
|
||||
router.navigateBack(1, 500)
|
||||
return
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 订单类型
|
||||
*/
|
||||
handleGetOrderType: () => {
|
||||
if (isGroupBuying.value) {
|
||||
// 购买团购套餐
|
||||
return PayOrderType.BuyCombo
|
||||
} else if (renew.value) {
|
||||
// 续订包间
|
||||
return PayOrderType.RenewRoom
|
||||
} else if (reserveTeaSpecialist.value) {
|
||||
// 预约茶艺师
|
||||
return PayOrderType.TeaSpecialis
|
||||
} else {
|
||||
// 默认是购买茶室
|
||||
return PayOrderType.TeaRoom
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user