Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
project-online-fi
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
project-online-fi
Commits
3b594a25
提交
3b594a25
authored
11月 22, 2022
作者:
matian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
updates
上级
3bdada40
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
68 行增加
和
68 行删除
+68
-68
Confirm.vue
src/modules/pay/components/Confirm.vue
+68
-68
没有找到文件。
src/modules/pay/components/Confirm.vue
浏览文件 @
3b594a25
...
@@ -41,15 +41,15 @@ const emit = defineEmits<{
...
@@ -41,15 +41,15 @@ const emit = defineEmits<{
const
checkdChange
=
(
val
:
string
)
=>
{
const
checkdChange
=
(
val
:
string
)
=>
{
currentCheck
.
value
=
val
currentCheck
.
value
=
val
}
}
//
const optionParams = reactive({
const
optionParams
=
reactive
({
//
shop_id: '6998523899570814976',
shop_id
:
'6998523899570814976'
,
//
spu_id: '6998525810348916736',
spu_id
:
'6998525810348916736'
,
//
sku_id: '6998525810365693952',
sku_id
:
'6998525810365693952'
,
//
redirect_url: '',
redirect_url
:
''
,
//
buy_count: '1',
buy_count
:
'1'
,
//
payment_method: '',
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}`
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 = () => {
const handlePay = () => {
...
@@ -79,70 +79,70 @@ const handlePay = () => {
...
@@ -79,70 +79,70 @@ const handlePay = () => {
}
}
// 去支付
// 去支付
//
const pay = () => {
const pay = () => {
//
createOrderHandle().then((order: any) => {
createOrderHandle().then((order: any) => {
//
orderInfo.value = order
orderInfo.value = order
//
if (wechat) {
if (wechat) {
//
wxJSPay(order, payCallback(optionParams))
wxJSPay(order, payCallback(optionParams))
//
} else {
} else {
//
location.href = order.payment_url // '4' \ '12'
location.href = order.payment_url // '4' \ '12'
//
getOrder()
getOrder()
//
}
}
//
})
})
//
}
}
//
//
支付回调
// 支付回调
//
const payCallback = async (options: any) => {
const payCallback = async (options: any) => {
//
const { callback } = options
const { callback } = options
//
const order = await getOrder()
const order = await getOrder()
//
callback && callback(order)
callback && callback(order)
//
const params = {
const params = {
//
status: 'success',
status: 'success',
//
orderId: order.order_id,
orderId: order.order_id,
//
payPrice: order.payment_money,
payPrice: order.payment_money,
//
payStatus: order.order_status
payStatus: order.order_status
//
}
}
//
orderInfoDetail.value = order.order_status
orderInfoDetail.value = order.order_status
//
emit('success', params)
emit('success', params)
//
}
}
//
//
创建订单
// 创建订单
//
const createOrderHandle = () => {
const createOrderHandle = () => {
//
let defaultParams = {}
let defaultParams = {}
//
// 微信内
// 微信内
//
if (wechat) {
if (wechat) {
//
const openId = localStorage.getItem('openId')
const openId = localStorage.getItem('openId')
//
if (!openId) {
if (!openId) {
//
getOpenId(
getOpenId(
//
queryString.parse(location.search, { parseBooleans: true }).code,
queryString.parse(location.search, { parseBooleans: true }).code,
//
pay
pay
//
)
)
//
return Promise.reject('openId不存在')
return Promise.reject('openId不存在')
//
}
}
//
defaultParams = { open_id: openId, payment_method: '3' }
defaultParams = { open_id: openId, payment_method: '3' }
//
}
}
//
// 支付宝网页支付
// 支付宝网页支付
//
if (currentCheck.value === '12') {
if (currentCheck.value === '12') {
//
defaultParams = { payment_method: '12' }
defaultParams = { payment_method: '12' }
//
}
}
//
//微信外微信h5支付
//微信外微信h5支付
//
if (currentCheck.value === '4') {
if (currentCheck.value === '4') {
//
defaultParams = { payment_method: '4' }
defaultParams = { payment_method: '4' }
//
}
}
//
const params = Object.assign(optionParams, defaultParams)
const params = Object.assign(optionParams, defaultParams)
//
return createOrder(params).then((resp: any) => resp.data)
return createOrder(params).then((resp: any) => resp.data)
//
}
}
//
//
获取订单
// 获取订单
//
function getOrder() {
function getOrder() {
//
return getOrderList({
return getOrderList({
//
order_detail_id: orderInfo.value.order_detail_id
order_detail_id: orderInfo.value.order_detail_id
//
}).then((resp) => {
}).then((resp) => {
//
return resp.data[0]
return resp.data[0]
//
})
})
//
}
}
const handlePrev = () => {
const handlePrev = () => {
router.push({
router.push({
path: `
/
shop
/
detail
/
$
{
props
.
shopItem
?.
id
}
`,
path: `
/
shop
/
detail
/
$
{
props
.
shopItem
?.
id
}
`,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论