提交 3b594a25 authored 作者: matian's avatar matian

updates

上级 3bdada40
......@@ -41,15 +41,15 @@ const emit = defineEmits<{
const checkdChange = (val: string) => {
currentCheck.value = val
}
// const optionParams = reactive({
// shop_id: '6998523899570814976',
// spu_id: '6998525810348916736',
// sku_id: '6998525810365693952',
// redirect_url: '',
// buy_count: '1',
// payment_method: '',
// notify_url: `https://ep-lms-api.ezijing.com/v2/student/push?tenant=paa&sso_id=${user.user?.id}&class_id=${props.shopItem?.class_id}&course_flag=1&course_id=${props.shopItem?.course_id}`
// })
const optionParams = reactive({
shop_id: '6998523899570814976',
spu_id: '6998525810348916736',
sku_id: '6998525810365693952',
redirect_url: '',
buy_count: '1',
payment_method: '',
notify_url: `https://ep-lms-api.ezijing.com/v2/student/push?tenant=paa&sso_id=${user.user?.id}&class_id=${props.shopItem?.class_id}&course_flag=1&course_id=${props.shopItem?.course_id}`
})
// 点击立即购买
const handlePay = () => {
......@@ -79,70 +79,70 @@ const handlePay = () => {
}
// 去支付
// const pay = () => {
// createOrderHandle().then((order: any) => {
// orderInfo.value = order
// if (wechat) {
// wxJSPay(order, payCallback(optionParams))
// } else {
// location.href = order.payment_url // '4' \ '12'
// getOrder()
// }
// })
// }
const pay = () => {
createOrderHandle().then((order: any) => {
orderInfo.value = order
if (wechat) {
wxJSPay(order, payCallback(optionParams))
} else {
location.href = order.payment_url // '4' \ '12'
getOrder()
}
})
}
// // 支付回调
// const payCallback = async (options: any) => {
// const { callback } = options
// const order = await getOrder()
// callback && callback(order)
// 支付回调
const payCallback = async (options: any) => {
const { callback } = options
const order = await getOrder()
callback && callback(order)
// const params = {
// status: 'success',
// orderId: order.order_id,
// payPrice: order.payment_money,
// payStatus: order.order_status
// }
// orderInfoDetail.value = order.order_status
// emit('success', params)
// }
const params = {
status: 'success',
orderId: order.order_id,
payPrice: order.payment_money,
payStatus: order.order_status
}
orderInfoDetail.value = order.order_status
emit('success', params)
}
// // 创建订单
// const createOrderHandle = () => {
// let defaultParams = {}
// // 微信内
// if (wechat) {
// const openId = localStorage.getItem('openId')
// if (!openId) {
// getOpenId(
// queryString.parse(location.search, { parseBooleans: true }).code,
// pay
// )
// return Promise.reject('openId不存在')
// }
// defaultParams = { open_id: openId, payment_method: '3' }
// }
// 创建订单
const createOrderHandle = () => {
let defaultParams = {}
// 微信内
if (wechat) {
const openId = localStorage.getItem('openId')
if (!openId) {
getOpenId(
queryString.parse(location.search, { parseBooleans: true }).code,
pay
)
return Promise.reject('openId不存在')
}
defaultParams = { open_id: openId, payment_method: '3' }
}
// // 支付宝网页支付
// if (currentCheck.value === '12') {
// defaultParams = { payment_method: '12' }
// }
// //微信外微信h5支付
// if (currentCheck.value === '4') {
// defaultParams = { payment_method: '4' }
// }
// const params = Object.assign(optionParams, defaultParams)
// return createOrder(params).then((resp: any) => resp.data)
// }
// 支付宝网页支付
if (currentCheck.value === '12') {
defaultParams = { payment_method: '12' }
}
//微信外微信h5支付
if (currentCheck.value === '4') {
defaultParams = { payment_method: '4' }
}
const params = Object.assign(optionParams, defaultParams)
return createOrder(params).then((resp: any) => resp.data)
}
// // 获取订单
// function getOrder() {
// return getOrderList({
// order_detail_id: orderInfo.value.order_detail_id
// }).then((resp) => {
// return resp.data[0]
// })
// }
// 获取订单
function getOrder() {
return getOrderList({
order_detail_id: orderInfo.value.order_detail_id
}).then((resp) => {
return resp.data[0]
})
}
const handlePrev = () => {
router.push({
path: `/shop/detail/${props.shopItem?.id}`,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论