Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
transport-show-h5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
transport-show-h5
Commits
988b5318
提交
988b5318
authored
7月 03, 2020
作者:
zyx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加 小程序支付
上级
f95fefa0
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
97 行增加
和
39 行删除
+97
-39
index.js
src/modules/pay-module/index.js
+5
-2
PayH5.vue
src/modules/pay-module/src/PayH5.vue
+1
-37
PayWeChart.vue
src/modules/pay-module/src/PayWeChart.vue
+91
-0
没有找到文件。
src/modules/pay-module/index.js
浏览文件 @
988b5318
import
'./index.scss'
import
'./index.scss'
import
PayH5
from
'./src/PayH5.vue'
import
PayH5
from
'./src/PayH5.vue'
import
PayWeChart
from
'./src/PayWeChart.vue'
const
components
=
[
const
components
=
[
PayH5
PayH5
,
PayWeChart
]
]
const
install
=
function
(
Vue
,
opts
=
{})
{
const
install
=
function
(
Vue
,
opts
=
{})
{
...
@@ -26,5 +28,6 @@ if (typeof window !== 'undefined' && window.Vue) {
...
@@ -26,5 +28,6 @@ if (typeof window !== 'undefined' && window.Vue) {
export
default
{
export
default
{
install
,
install
,
PayH5
PayH5
,
PayWeChart
}
}
src/modules/pay-module/src/PayH5.vue
浏览文件 @
988b5318
...
@@ -3,45 +3,10 @@
...
@@ -3,45 +3,10 @@
<div
class=
"pay-box"
></div>
<div
class=
"pay-box"
></div>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
Toast
}
from
'vant'
import
Pay
from
'../action'
import
Pay
from
'../action'
export
default
{
export
default
{
name
:
'PayH5'
,
name
:
'PayH5'
,
components
:
{
data
()
{},
[
Toast
.
name
]:
Toast
},
data
()
{
const
_this
=
this
return
{
isCard
:
false
,
opaKey
:
[
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
],
remainingTime
:
'01:00:00'
,
currentNum
:
1
,
isAnalysis
:
false
,
swiperOptions
:
{
observer
:
true
,
on
:
{
slideChangeTransitionStart
:
function
()
{
document
.
getElementById
(
'bottom-view'
).
scrollTop
=
0
_this
.
isAnalysis
=
false
_this
.
currentNum
=
this
.
activeIndex
+
1
}
}
},
questionsData
:
{
questions
:
[]
},
requestData
:
{},
requestData2
:
{},
clockCount
:
null
,
isExamEnd
:
true
,
// examIsShow: false,
isExamSubPop
:
false
,
timePopIsShow
:
false
,
initTime
:
null
,
cache
:
null
}
},
props
:
{
props
:
{
requestParam
:
{
requestParam
:
{
type
:
Object
,
type
:
Object
,
...
@@ -125,7 +90,6 @@ export default {
...
@@ -125,7 +90,6 @@ export default {
})
})
},
},
wxWakeUpToPay
(
obj
)
{
wxWakeUpToPay
(
obj
)
{
Toast
(
obj
)
if
(
typeof
WeixinJSBridge
===
'undefined'
)
{
if
(
typeof
WeixinJSBridge
===
'undefined'
)
{
obj
.
code
=
4001
obj
.
code
=
4001
obj
.
msg
=
'缺少微信api'
obj
.
msg
=
'缺少微信api'
...
...
src/modules/pay-module/src/PayWeChart.vue
0 → 100644
浏览文件 @
988b5318
<
template
>
<!-- 暂时无用 -->
<div
class=
"pay-box"
></div>
</
template
>
<
script
>
import
Pay
from
'../action'
export
default
{
name
:
'PayWeChart'
,
data
()
{},
props
:
{
requestParam
:
{
type
:
Object
,
required
:
false
,
default
()
{
return
{
product_id
:
''
,
// 提前设定
open_id
:
''
,
// 通过微信授权获取
prepay_id
:
''
,
// 通过调用接口获取
app_id
:
''
,
// 提前设定
app_secret
:
''
,
// 提前设定
// 新增字段 接口返回
timeStamp
:
''
,
nonceStr
:
''
,
signType
:
''
,
paySign
:
''
}
}
}
},
beforeDestroy
()
{
},
mounted
()
{
this
.
onReady
()
},
methods
:
{
onBridgeReady
()
{
this
.
VueEvent
.
$off
(
'pay-wx-chart'
).
$on
(
'pay-wx-chart'
,
(
obj
)
=>
{
this
.
goToPay
()
})
},
goToPay
()
{
const
obj
=
{
code
:
0
,
msg
:
''
,
data
:
{}
}
if
(
!
this
.
requestParam
.
product_id
)
{
obj
.
code
=
3001
obj
.
msg
=
'没有商品ID'
this
.
VueEvent
.
$emit
(
'pay-wx-chart-callback'
,
obj
)
return
false
}
if
(
!
this
.
requestParam
.
open_id
)
{
obj
.
code
=
3002
obj
.
msg
=
'没有小程序用户openid'
this
.
VueEvent
.
$emit
(
'pay-wx-chart-callback'
,
obj
)
return
false
}
Pay
.
getOrderId
(
this
.
requestParam
).
then
(
res
=>
{
if
(
res
.
code
)
{
// this.requestParam.product_id
// this.requestParam.open_id
this
.
requestParam
.
prepay_id
=
res
.
data
.
prepay_id
this
.
requestParam
.
app_id
=
res
.
data
.
options
.
appId
// this.requestParam.app_secret
this
.
requestParam
.
timeStamp
=
res
.
data
.
options
.
timeStamp
this
.
requestParam
.
nonceStr
=
res
.
data
.
options
.
nonceStr
this
.
requestParam
.
signType
=
res
.
data
.
options
.
signType
this
.
requestParam
.
paySign
=
res
.
data
.
options
.
paySign
this
.
wxWakeUpToPay
(
obj
)
}
else
{
obj
.
code
=
3003
obj
.
msg
=
'获取订单ID失败'
this
.
VueEvent
.
$emit
(
'pay-wx-chart-callback'
,
obj
)
}
}).
catch
(
e
=>
{
obj
.
code
=
5001
obj
.
msg
=
e
.
message
this
.
VueEvent
.
$emit
(
'pay-wx-chart-callback'
,
obj
)
return
obj
})
},
wxWakeUpToPay
(
obj
)
{
obj
.
code
=
200
obj
.
data
=
this
.
requestParam
this
.
VueEvent
.
$emit
(
'pay-wx-chart-callback'
,
obj
)
}
}
}
</
script
>
<
style
lang=
"scss"
>
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论