Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
phobos-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
phobos-ui
Commits
bf475a3c
Commit
bf475a3c
authored
Oct 25, 2021
by
郭志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(pay): 路由调整完成
parent
9373addb
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
100 additions
and
41 deletions
+100
-41
main.js
src/main.js
+1
-1
routes.js
src/router/routes.js
+28
-0
httpDecorator.js
src/service/httpDecorator.js
+8
-1
utils.service.js
src/service/utils.service.js
+19
-0
extends.js
src/views/pay/extends.js
+3
-14
index.vue
src/views/pay/index.vue
+27
-17
payResult.vue
src/views/pay/payResult.vue
+11
-6
payWaiting.vue
src/views/pay/payWaiting.vue
+3
-2
No files found.
src/main.js
View file @
bf475a3c
...
@@ -12,7 +12,7 @@ import Raven from 'raven-js';
...
@@ -12,7 +12,7 @@ import Raven from 'raven-js';
import
RavenVue
from
'
raven-js/plugins/vue
'
;
import
RavenVue
from
'
raven-js/plugins/vue
'
;
import
{
release
}
from
'
../.sentryclirc
'
;
import
{
release
}
from
'
../.sentryclirc
'
;
if
(
process
.
env
.
SENTRY_ENV
!==
'
test
'
&&
process
.
env
.
NODE_ENV
===
'
production
'
)
{
if
(
process
.
env
.
SENTRY_ENV
!==
'
test
'
&&
process
.
env
.
NODE_ENV
===
'
production
'
)
{
Raven
.
config
(
'
//
21779c2dcb594299bdc803c5560cfecd@sentry.q-gp.com/60
'
,
{
Raven
.
config
(
'
//
7b09a4aeffca4a49b37328da6a5468a9@sentry.q-gp.com/83
'
,
{
release
,
release
,
environment
:
process
.
env
.
NODE_ENV
environment
:
process
.
env
.
NODE_ENV
})
})
...
...
src/router/routes.js
View file @
bf475a3c
...
@@ -11,6 +11,34 @@ export default [
...
@@ -11,6 +11,34 @@ export default [
},
},
component
:
()
=>
import
(
'
../views/pay
'
)
component
:
()
=>
import
(
'
../views/pay
'
)
},
},
{
path
:
'
/payFail
'
,
name
:
'
payFail
'
,
alias
:
[
'
/payFail
'
],
meta
:
{
title
:
'
支付失败
'
},
component
:
()
=>
import
(
'
../views/pay/payResult
'
)
},
{
path
:
'
/paySuccess
'
,
name
:
'
paySuccess
'
,
alias
:
[
'
/paySuccess
'
],
meta
:
{
title
:
'
支付成功
'
,
success
:
true
},
component
:
()
=>
import
(
'
../views/pay/payResult
'
)
},
{
path
:
'
/payWaiting
'
,
name
:
'
payWaiting
'
,
meta
:
{
title
:
'
支付中
'
,
success
:
true
},
component
:
()
=>
import
(
'
../views/pay/payWaiting
'
)
},
{
{
path
:
'
/error
'
,
path
:
'
/error
'
,
name
:
'
error
'
,
name
:
'
error
'
,
...
...
src/service/httpDecorator.js
View file @
bf475a3c
import
HttpRequest
from
'
@qg/ui-request
'
;
import
HttpRequest
from
'
@qg/ui-request
'
;
import
{
Toast
}
from
'
@qg/cherry-ui
'
;
import
{
Toast
}
from
'
@qg/cherry-ui
'
;
import
store
from
'
@/store
'
;
import
store
from
'
@/store
'
;
import
router
from
'
@/router
'
;
import
{
appVersion
,
isWxMp
}
from
'
@/service/validation.service
'
;
import
{
appVersion
,
isWxMp
}
from
'
@/service/validation.service
'
;
import
{
getVccChannel
}
from
'
./userInfo.service
'
;
import
{
getVccChannel
}
from
'
./userInfo.service
'
;
import
{
parseSearch
}
from
'
./utils.service
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
import
sessionStorage
from
'
@/service/sessionStorage.service
'
;
import
sessionStorage
from
'
@/service/sessionStorage.service
'
;
...
@@ -42,7 +44,12 @@ const http = new HttpRequest(
...
@@ -42,7 +44,12 @@ const http = new HttpRequest(
sessionStorage
.
remove
(
'
vccToken
'
);
sessionStorage
.
remove
(
'
vccToken
'
);
const
toast
=
Toast
(
'
未登录!
'
);
const
toast
=
Toast
(
'
未登录!
'
);
toast
.
onClose
=
()
=>
{
toast
.
onClose
=
()
=>
{
window
.
location
.
href
=
document
.
referrer
;
const
{
returnUrl
}
=
parseSearch
(
window
.
location
.
href
);
if
(
returnUrl
)
{
window
.
location
.
href
=
returnUrl
;
}
else
{
router
.
replace
({
name
:
'
error
'
});
}
};
};
}
}
...
...
src/service/utils.service.js
View file @
bf475a3c
...
@@ -92,6 +92,25 @@ export function onKeyboardStateChange(callback = () => {}, off = false) {
...
@@ -92,6 +92,25 @@ export function onKeyboardStateChange(callback = () => {}, off = false) {
}
}
}
}
export
function
json2Query
(
json
)
{
function
cleanArray
(
actual
)
{
const
newArray
=
[];
for
(
let
i
=
0
;
i
<
actual
.
length
;
i
++
)
{
if
(
actual
[
i
])
{
newArray
.
push
(
actual
[
i
]);
}
}
return
newArray
;
}
if
(
!
json
)
return
''
;
return
cleanArray
(
Object
.
keys
(
json
).
map
(
key
=>
{
if
(
json
[
key
]
===
undefined
)
return
''
;
return
encodeURIComponent
(
key
)
+
'
=
'
+
encodeURIComponent
(
json
[
key
]);
})
).
join
(
'
&
'
);
}
export
function
throttle
(
fn
,
wait
)
{
export
function
throttle
(
fn
,
wait
)
{
let
flag
=
true
;
let
flag
=
true
;
return
function
()
{
return
function
()
{
...
...
src/views/pay/extends.js
View file @
bf475a3c
import
cookies
from
'
@/service/cookie
Storage.service
'
;
import
localStorage
from
'
@/service/local
Storage.service
'
;
export
const
goUrlExtends
=
{
export
const
goUrlExtends
=
{
methods
:
{
methods
:
{
goHome
()
{
goHome
()
{
// 商城地址
// 商城地址
setTimeout
(()
=>
{
setTimeout
(()
=>
{
window
.
location
.
href
=
document
.
referrer
;
localStorage
.
remove
(
'
redirectUrl
'
);
window
.
location
.
href
=
localStorage
.
get
(
'
redirectUrl
'
);
},
500
);
},
500
);
},
goOrderList
()
{
setTimeout
(()
=>
{
this
.
$router
.
replace
({
name
:
'
orderList
'
,
params
:
{
status
:
0
}
});
},
500
);
},
goOrderDetail
()
{
const
orderNo
=
cookies
.
get
(
'
orderNo
'
)?.
orderNo
;
this
.
$router
.
push
({
name
:
'
orderDetail
'
,
query
:
{
orderNo
}
});
}
}
}
}
};
};
src/views/pay/index.vue
View file @
bf475a3c
...
@@ -54,9 +54,6 @@
...
@@ -54,9 +54,6 @@
</cr-button>
</cr-button>
</p>
</p>
<p
v-if=
"overtime"
class=
"btn"
>
<p
v-if=
"overtime"
class=
"btn"
>
<!--
<cr-button
v-if=
"isOrder"
type=
"default"
class=
"btn-default"
@
click=
"goOrderList"
>
我的订单
</cr-button
>
-->
<cr-button
type=
"primary"
class=
"btn-primary"
@
click=
"navigateBack"
>
返回
</cr-button>
<cr-button
type=
"primary"
class=
"btn-primary"
@
click=
"navigateBack"
>
返回
</cr-button>
</p>
</p>
<p
class=
"placeholder"
/>
<p
class=
"placeholder"
/>
...
@@ -104,7 +101,7 @@ import crSmsCodeModal from './components/SmsModal.vue';
...
@@ -104,7 +101,7 @@ import crSmsCodeModal from './components/SmsModal.vue';
import
{
isWechat
}
from
'
@/service/validation.service
'
;
import
{
isWechat
}
from
'
@/service/validation.service
'
;
import
{
encryptByDESModeEBC
}
from
'
@/service/encrypt
'
;
import
{
encryptByDESModeEBC
}
from
'
@/service/encrypt
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
import
{
throttle
}
from
'
@/service/utils.service
'
;
import
{
throttle
,
json2Query
}
from
'
@/service/utils.service
'
;
// import { goUrlExtends } from './extends';
// import { goUrlExtends } from './extends';
import
cookies
from
'
@/service/cookieStorage.service
'
;
import
cookies
from
'
@/service/cookieStorage.service
'
;
// import { saTrackEvent } from '@/service/sa.service';
// import { saTrackEvent } from '@/service/sa.service';
...
@@ -192,7 +189,8 @@ export default {
...
@@ -192,7 +189,8 @@ export default {
isCheckAgreement
:
false
,
isCheckAgreement
:
false
,
mergePayPretreatmentInfo
:
{},
mergePayPretreatmentInfo
:
{},
tradeType
:
isWechat
?
'
JSAPI
'
:
'
MWEB
'
,
tradeType
:
isWechat
?
'
JSAPI
'
:
'
MWEB
'
,
amountInfo
:
{}
amountInfo
:
{},
redirectUrl
:
''
};
};
},
},
computed
:
{
computed
:
{
...
@@ -227,6 +225,12 @@ export default {
...
@@ -227,6 +225,12 @@ export default {
mounted
()
{
mounted
()
{
this
.
getQuery
();
this
.
getQuery
();
this
.
setIsOrder
();
this
.
setIsOrder
();
if
(
this
.
$route
.
query
.
redirectUrl
)
{
localStorage
.
set
(
'
redirectUrl
'
,
this
.
redirectUrl
);
this
.
redirectUrl
=
this
.
$route
.
query
.
redirectUrl
;
}
else
{
this
.
redirectUrl
=
localStorage
.
get
(
'
redirectUrl
'
);
}
this
.
orderNo
=
this
.
$route
.
query
.
orderNo
;
this
.
orderNo
=
this
.
$route
.
query
.
orderNo
;
cookies
.
set
(
'
orderNo
'
,
this
.
orderNo
);
cookies
.
set
(
'
orderNo
'
,
this
.
orderNo
);
if
(
this
.
$route
?.
query
?.
ocrflag
)
{
if
(
this
.
$route
?.
query
?.
ocrflag
)
{
...
@@ -237,7 +241,8 @@ export default {
...
@@ -237,7 +241,8 @@ export default {
this
.
pay
(
this
.
payInfo
?.
paramsData
,
'
ocr
'
,
cookies
.
get
(
'
ocrflag
'
));
this
.
pay
(
this
.
payInfo
?.
paramsData
,
'
ocr
'
,
cookies
.
get
(
'
ocrflag
'
));
}
}
const
vccToken
=
localStorage
.
get
(
'
vccToken
'
);
const
vccToken
=
localStorage
.
get
(
'
vccToken
'
);
Current_Url
=
`
${
window
.
location
.
origin
}
/payWaiting?vccToken=
${
vccToken
}
&orderNo=
${
this
.
orderNo
}
`
;
Current_Url
=
`
${
this
.
redirectUrl
||
window
.
location
.
origin
}
/payWaiting?vccToken=
${
vccToken
}
&orderNo=
${
this
.
orderNo
}
`
;
this
.
queryPayInfo
();
this
.
queryPayInfo
();
this
.
getCouponList
(
this
.
orderNo
);
this
.
getCouponList
(
this
.
orderNo
);
},
},
...
@@ -532,17 +537,22 @@ export default {
...
@@ -532,17 +537,22 @@ export default {
}
}
},
},
payResult
(
type
,
error
)
{
payResult
(
type
,
error
)
{
/* 跳转支付结果页面 */
const
params
=
{
this
.
$router
.
replace
({
name
:
`pay
${
type
}
`
,
query
:
{
reason
:
error
,
reason
:
error
,
orderNo
:
this
.
orderNo
,
orderNo
:
this
.
orderNo
,
payType
:
this
.
payType
,
payType
:
this
.
payType
,
amount
:
this
.
amountInfo
.
finalAmt
||
''
,
amount
:
this
.
amountInfo
.
finalAmt
||
''
,
freeAmount
:
this
.
amountInfo
.
freeAmount
||
''
freeAmount
:
this
.
amountInfo
.
freeAmount
||
''
}
};
if
(
this
.
redirectUrl
)
{
localStorage
.
remove
(
'
redirectUrl
'
);
window
.
location
.
replace
(
`
${
this
.
redirectUrl
}
/pay
${
type
}
?
${
json2Query
(
params
)}
`
);
}
else
{
this
.
$router
.
replace
({
name
:
`pay
${
type
}
`
,
query
:
params
});
});
}
},
},
/* 选择支付方式 */
/* 选择支付方式 */
changePayType
(
type
,
mergePayPretreatmentInfo
)
{
changePayType
(
type
,
mergePayPretreatmentInfo
)
{
...
...
src/views/pay/payResult.vue
View file @
bf475a3c
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<p
v-if=
"freeAmount > 0"
class=
"info__text info__free"
>
已优惠¥
{{
freeAmount
}}
</p>
<p
v-if=
"freeAmount > 0"
class=
"info__text info__free"
>
已优惠¥
{{
freeAmount
}}
</p>
</div>
</div>
</div>
</div>
<div
:class=
"['actions', 'no-order']"
>
<div
v-if=
"hasRedirectUrl"
:class=
"['actions', 'no-order']"
>
<cr-button
shape=
"circle"
type=
"primary"
@
click=
"goHome"
>
返回
</cr-button>
<cr-button
shape=
"circle"
type=
"primary"
@
click=
"goHome"
>
返回
</cr-button>
</div>
</div>
</div>
</div>
...
@@ -31,21 +31,25 @@
...
@@ -31,21 +31,25 @@
<p
class=
"tips"
>
<p
class=
"tips"
>
{{
reason
}}
{{
reason
}}
</p>
</p>
<cr-button
type=
"primary"
shape=
"circle"
class=
"info_button"
@
click=
"goPay"
<cr-button
>
重新支付
</cr-button
v-if=
"hasRedirectUrl"
type=
"primary"
shape=
"circle"
class=
"info_button"
@
click=
"goPay"
>
>
重新支付
</cr-button>
</div>
</div>
<RecoGoods
v-if=
"!getReturnUrl()"
/>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
RecoGoods
from
'
@/components/RecoGoods.vue
'
;
import
cookies
from
'
@/service/cookieStorage.service
'
;
import
cookies
from
'
@/service/cookieStorage.service
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
import
{
isApp
}
from
'
@/service/validation.service
'
;
import
{
isApp
}
from
'
@/service/validation.service
'
;
import
{
goUrlExtends
}
from
'
./extends
'
;
import
{
goUrlExtends
}
from
'
./extends
'
;
import
{
payTypeMap
}
from
'
./STATIC_DATA
'
;
import
{
payTypeMap
}
from
'
./STATIC_DATA
'
;
export
default
{
export
default
{
components
:
{
RecoGoods
},
extends
:
goUrlExtends
,
extends
:
goUrlExtends
,
data
()
{
data
()
{
return
{
return
{
...
@@ -54,6 +58,7 @@ export default {
...
@@ -54,6 +58,7 @@ export default {
isSuccess
:
false
,
isSuccess
:
false
,
freeAmount
:
0
,
freeAmount
:
0
,
payStatus
:
''
,
payStatus
:
''
,
hasRedirectUrl
:
!!
localStorage
.
get
(
'
redirectUrl
'
),
returnUrl
:
''
returnUrl
:
''
};
};
},
},
...
...
src/views/pay/payWaiting.vue
View file @
bf475a3c
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
width=
"63px"
width=
"63px"
height=
"63px"
height=
"63px"
class=
"info__image"
class=
"info__image"
src=
"
../../assets/images
/paying.png"
src=
"
@/assets/images/pay
/paying.png"
/>
/>
<div
v-if=
"init"
class=
"info__desc"
>
<div
v-if=
"init"
class=
"info__desc"
>
<p
class=
"info__text"
>
<p
class=
"info__text"
>
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
<p
class=
"tips"
>
<p
class=
"tips"
>
努力返回支付结果中,请留心查看!
努力返回支付结果中,请留心查看!
</p>
</p>
<div
:class=
"['actions', 'no-order']"
>
<div
v-if=
"hasRedirectUrl"
:class=
"['actions', 'no-order']"
>
<cr-button
shape=
"circle"
type=
"primary"
@
click=
"goHome"
>
返回
</cr-button>
<cr-button
shape=
"circle"
type=
"primary"
@
click=
"goHome"
>
返回
</cr-button>
</div>
</div>
</div>
</div>
...
@@ -34,6 +34,7 @@ export default {
...
@@ -34,6 +34,7 @@ export default {
timer
:
null
,
timer
:
null
,
time
:
10
,
time
:
10
,
init
:
false
,
init
:
false
,
hasRedirectUrl
:
!!
localStorage
.
get
(
'
redirectUrl
'
),
returnUrl
:
''
returnUrl
:
''
};
};
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment