Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-h5-ailipay
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 15f0a917
authored
Oct 08, 2022
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
dev_v4.12.1 功能开发
1 parent
34ea879b
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
129 additions
and
103 deletions
README.md
package.json
src/api/alipayApi.js
src/main.js
src/router/router.js
src/router/routes.js
src/views/alipay/index.vue
src/views/userCollaboration/index.vue
vue.config.js
README.md
View file @
15f0a91
# 配置中心获取的对应环境的appid
开发环境 2021003146603701
测试环境 2021003142659655
线上环境 2021003142677540
# gh-hall
基于 vue-cli4.0 + webpack 4 + vant ui + sass+ rem 适配方案+axios 封装,构建手机端模板脚手架
...
...
package.json
View file @
15f0a91
...
...
@@ -5,7 +5,7 @@
"author"
:
"limin <limin.mail@qq.com>"
,
"private"
:
true
,
"scripts"
:
{
"serve"
:
"
set NODE_OPTIONS=--openssl-legacy-provider &&
vue-cli-service serve "
,
"serve"
:
" vue-cli-service serve "
,
"build"
:
"set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build"
,
"stage"
:
"set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --mode staging"
,
"lint"
:
"set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service lint --fix"
,
...
...
src/api/alipayApi.js
View file @
15f0a91
...
...
@@ -16,3 +16,8 @@ export function createWxPayH5(data) {
console
.
log
(
data
)
return
request
(
data
,
RequestMethods
.
POST
)
}
/** 获取用户协议配置 */
export
function
getTitleByModule
(
data
)
{
data
.
method
=
`
${
path
}
privacyAgreement.getTitleByModule`
return
request
(
data
,
RequestMethods
.
POST
)
}
src/main.js
View file @
15f0a91
...
...
@@ -51,21 +51,21 @@ import * as Sentry from '@sentry/vue'
import
{
BrowserTracing
}
from
'@sentry/tracing'
// 实例化
//
process.env.NODE_ENV === 'production' &&
Sentry
.
init
({
Vue
,
dsn
:
'https://f0db411905b541eebe6d591707f561a4@sentry.glsx.com.cn/26'
,
integrations
:
[
new
BrowserTracing
({
routingInstrumentation
:
Sentry
.
vueRouterInstrumentation
(
router
),
tracingOrigins
:
[
'localhost'
,
'my-site-url.com'
,
/^
\/
/
]
})
],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate
:
1.0
})
process
.
env
.
NODE_ENV
===
'production'
&&
Sentry
.
init
({
Vue
,
dsn
:
'https://f0db411905b541eebe6d591707f561a4@sentry.glsx.com.cn/26'
,
integrations
:
[
new
BrowserTracing
({
routingInstrumentation
:
Sentry
.
vueRouterInstrumentation
(
router
),
tracingOrigins
:
[
'localhost'
,
'my-site-url.com'
,
/^
\/
/
]
})
],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate
:
1.0
})
// const isMock = ['prod', 'production'].includes(process.env.NODE_ENV)
// 使用fetch 解决axios提前实例化导致sign里面的secret不能通过配置中心动态获取
...
...
src/router/router.js
View file @
15f0a91
...
...
@@ -26,7 +26,7 @@ function createRouter() {
// mode: 'history', // 如果是 history模式 需要配置vue.config.js publicPath
base
:
'dj-carlife-web-alipay'
,
// base: process.env.BASE_URL,
scrollBehavior
:
function
(
to
,
from
,
savedPosition
)
{
scrollBehavior
:
function
(
to
,
from
,
savedPosition
)
{
return
savedPosition
||
{
x
:
0
,
y
:
0
}
},
routes
...
...
@@ -36,8 +36,10 @@ function createRouter() {
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
// // 判断当前浏览器环境 不是支付宝就跳转提示页面
const
AlipayClient
=
/AlipayClient/
.
test
(
window
.
navigator
.
userAgent
)
// console.log(AlipayClient)
if
(
!
AlipayClient
&&
to
.
path
!==
'/tipsPage'
)
return
next
(
'/tipsPage'
)
// 开发调试用可以先把这个逻辑取消
// if (!AlipayClient && to.path !== '/tipsPage') return next('/tipsPage')
// if (/MicroMessenger/.test(window.navigator.userAgent)) {
// alert('微信客户端')
...
...
src/router/routes.js
View file @
15f0a91
...
...
@@ -101,6 +101,18 @@ const routes = [
component
:
()
=>
import
(
'@/views/tipsPage'
)
},
{
path
:
'/userCollaboration'
,
name
:
'userCollaboration'
,
meta
:
{
title
:
'车主协议'
},
// redirect: {
// name: 'index'
// },
// component: import('@/views/layouts/index')
component
:
()
=>
import
(
'@/views/userCollaboration'
)
},
{
// path: '/ailpay',
path
:
'/'
,
redirect
:
{
name
:
'index'
},
...
...
src/views/alipay/index.vue
View file @
15f0a91
<
template
>
<div>
<!--
<button
id=
"test"
@
click=
"getAuthCode"
>
getAuthCode
</button>
-->
<div
v-if=
"unpaid"
>
<div
class=
"pay-container"
@
click
.
stop=
"handleHiddenKey"
>
...
...
@@ -23,6 +21,21 @@
class=
"pay-cursor"
/>
<div
class=
"pay-after-icon"
>
元
</div>
</div>
<div
class=
"userCollaborationContainer"
v-if=
"userCollaborationName"
>
<!--
<label
class=
"radio"
>
value="
{{
userCollaborationCheck
}}
" -->
<input
type=
"radio"
@
click=
"handleRadio"
:checked=
"userCollaborationCheck"
/>
<!--
<radio
style=
"transform:scale(0.6)"
/>
-->
<div
class=
"label"
@
click=
"handleRadio"
>
我已阅读并同意
</div>
<!--
</label>
-->
<div
class=
"linkText"
@
click=
"navToUserCollaboration"
>
《
{{
userCollaborationName
}}
》
</div>
</div>
</div>
</div>
<div
class=
"keyboard "
...
...
@@ -90,7 +103,7 @@
</
template
>
<
script
>
import
{
alipayOauthToken
,
createWxPayH5
}
from
'@/api/alipayApi'
import
{
alipayOauthToken
,
createWxPayH5
,
getTitleByModule
}
from
'@/api/alipayApi'
import
{
baseConfig
}
from
'@/main'
export
default
{
name
:
'Alipay'
,
...
...
@@ -117,8 +130,10 @@ export default {
// openId: '',
userId
:
''
,
// 测试用数据
// userId: '2088012113317722' // 测试用数据
tradeNO
:
''
// 测试用数据
tradeNO
:
''
,
// 测试用数据
// tradeNO: '2022083122001417721446143547'// 测试用数据
userCollaborationName
:
''
,
userCollaborationCheck
:
false
}
},
mounted
()
{
...
...
@@ -159,8 +174,24 @@ export default {
// forbidClick: true,
// duration: 0
// })
// 获取用户协议配置
this
.
getTitleByModule
()
},
methods
:
{
getTitleByModule
()
{
getTitleByModule
({
module
:
'PrivacyAgreement'
}).
then
((
result
)
=>
{
// console.log(result)
this
.
userCollaborationName
=
result
}).
catch
((
err
)
=>
{
console
.
log
(
err
)
})
},
navToUserCollaboration
()
{
this
.
$router
.
push
({
name
:
'userCollaboration'
})
},
handleRadio
()
{
this
.
userCollaborationCheck
=
!
this
.
userCollaborationCheck
},
getOpenId
(
code
)
{
console
.
log
(
'getOpenId'
,
code
)
console
.
log
(
alipayOauthToken
)
...
...
@@ -188,53 +219,17 @@ export default {
console
.
log
(
'param'
,
obj
)
return
name
?
obj
[
name
]
:
obj
},
// 获取付款门店信息
getMerthcantInfo
(
id
)
{
// api.qrCodeScene(
// {
// id
// },
// res => {
// console.log(res)
// const { returnCode, data } = res
// const op = {}
// if (returnCode == '0') {
// if (data) {
// data.split('&').map(item => {
// const [key, val] = item.split('=')
// op[key] = val
// })
// this.setData({
// ...op
// })
// // util.showLoading('加载中...')
// console.log(op)
// // this.getInfo(op)
// }
// }
// }
// )
},
// 隐藏键盘
handleHiddenKey
()
{
// this.setData({
// })
this
.
keyHidden
=
true
},
// 显示键盘
handleShowKey
()
{
// this.setData({
// })
this
.
keyHidden
=
false
console
.
log
(
this
.
keyHidden
)
},
// 键盘输入
handleKey
(
key
)
{
// const that = this
// const { key } = e.currentTarget.dataset
// console.log(this)
// console.log(this)
const
{
payMoney
,
unPayMoneyList
}
=
this
// 删除金额
if
(
key
===
'X'
)
{
...
...
@@ -273,8 +268,11 @@ export default {
// 支付
handlePay
()
{
// const _this = this
const
{
payMoney
,
merchantId
,
unPayMoneyList
,
userId
}
=
this
const
{
payMoney
,
merchantId
,
unPayMoneyList
,
userId
,
userCollaborationName
,
userCollaborationCheck
}
=
this
if
(
payMoney
===
''
||
unPayMoneyList
.
includes
(
payMoney
))
return
if
(
userCollaborationName
&&
!
userCollaborationCheck
)
{
return
this
.
showToast
(
`请先阅读并勾选《
${
userCollaborationName
}
》`
)
}
// this.wxPayment(payMoney)
// console.log(Number(payMoney), '付款')
// if (userId) {
...
...
@@ -295,10 +293,6 @@ export default {
forbidClick
:
true
,
duration
:
0
})
// util.showLoading('加载中...')
// 调用支付接口生成对应的微信支付参数
// console.log(params)
// return
createWxPayH5
(
params
).
then
((
result
)
=>
{
const
{
tradeNO
}
=
JSON
.
parse
(
result
.
jsapiPayInfo
)
this
.
tradeNO
=
tradeNO
...
...
@@ -333,37 +327,13 @@ export default {
},
// 支付成功获取订单回调信息
successInfo
()
{
const
{
outTradeNo
,
orderInfoList
,
showOrderInfo
}
=
this
// api.queryPayOrderStatus(
// { outTradeNo },
// res => {
// util.hideLoading()
// console.log(res)
// const { data, returnCode } = res
// if (returnCode == 0) {
// data &&
// orderInfoList.forEach(element => {
// element['info'] = data[element['name']]
// })
// this.setData({
// unpaid: false,
// showOrderInfo: !!data,
// orderInfoList
// })
// }
// // let { returnCode, data } = res
// },
// rej => {
// console.log(rej)
// util.hideLoading()
// }
// )
}
}
}
</
script
>
<
style
scoped
>
<
style
scoped
lang=
"scss"
>
*
{
-webkit-touch-callout
:
none
;
-webkit-user-select
:
none
;
...
...
@@ -390,7 +360,19 @@ export default {
/* flex-direction: column; */
/* flex-wrap: wrap; */
}
.userCollaborationContainer
{
display
:
flex
;
align-items
:
center
;
margin-top
:
30px
;
//
font-size
:
28px
;
.label
{
margin-left
:
10px
;
}
}
.linkText
{
color
:
#3582ee
;
}
.pay-header
.shopIcon
{
height
:
88px
;
width
:
88px
;
...
...
src/views/userCollaboration/index.vue
0 → 100644
View file @
15f0a91
<
template
>
<iframe
class=
"userCollaboration"
src=
"https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/userCollaboration.html"
frameborder=
"0"
></iframe>
</
template
>
<
script
>
export
default
{
}
</
script
>
<
style
>
.userCollaboration
{
width
:
100vw
;
height
:
100vh
;
}
</
style
>
vue.config.js
View file @
15f0a91
...
...
@@ -141,20 +141,20 @@ module.exports = {
// config.externals = externals
// }
// sentry 配置
//
process.env.NODE_ENV === 'production' &&
Object
.
assign
(
config
,
{
plugins
:
[
...
config
.
plugins
,
new
SentryWebpackPlugin
({
// webpack specific configuration
release
:
'0.0.1'
,
include
:
'./dist'
,
// 需要上传到sentry服务器的资源目录,会自动匹配js 以及map文件
ignore
:
[
'node_modules'
,
'vue.config.js'
],
// 忽略文件目录,当然我们在inlcude中制定了文件路径,这个忽略目录可以不加
configFile
:
'.sentryclirc'
,
urlPrefix
:
'~/dj-car-alipay/'
})
]
})
process
.
env
.
NODE_ENV
===
'production'
&&
Object
.
assign
(
config
,
{
plugins
:
[
...
config
.
plugins
,
new
SentryWebpackPlugin
({
// webpack specific configuration
release
:
'0.0.1'
,
include
:
'./dist'
,
// 需要上传到sentry服务器的资源目录,会自动匹配js 以及map文件
ignore
:
[
'node_modules'
,
'vue.config.js'
],
// 忽略文件目录,当然我们在inlcude中制定了文件路径,这个忽略目录可以不加
configFile
:
'.sentryclirc'
,
urlPrefix
:
'~/dj-car-alipay/'
})
]
})
},
chainWebpack
:
config
=>
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment