Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
98428123
Commit
98428123
authored
Aug 08, 2024
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "
✨
feat: app微信支付后返回app"
This reverts commit
73a7e442
.
parent
73a7e442
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
77 deletions
+4
-77
src/pages/wxPay/index.vue
+4
-77
No files found.
src/pages/wxPay/index.vue
View file @
98428123
<
template
>
<
template
>
<div>
<div>
<div
class=
"domain"
>
{{
message
}}
</div>
<div
class=
"domain"
>
{{
message
}}
</div>
<div
class=
"isApp"
v-if=
"showAppModule"
>
<button
open-type=
"launchApp"
@
error=
"launchAppError"
>
返回APP
</button>
</div>
<van-dialog
use-slot
:show=
"isShow"
@
confirm=
"handleConfirm"
>
<van-dialog
use-slot
:show=
"isShow"
@
confirm=
"handleConfirm"
>
<div
class=
"dialog-content__wrapper"
>
<div
class=
"dialog-content__wrapper"
>
<div>
当前订单处在支付中,可能是以下情况:
</div>
<div>
当前订单处在支付中,可能是以下情况:
</div>
...
@@ -18,20 +15,10 @@
...
@@ -18,20 +15,10 @@
<
script
>
<
script
>
import
{
formatTime
,
serialize
}
from
"@/utils/index"
;
import
{
formatTime
,
serialize
}
from
"@/utils/index"
;
import
wxPay
from
"@/api/wxPay"
;
import
wxPay
from
"@/api/wxPay"
;
import
login
from
"@/api/login"
;
const
app
=
getApp
();
const
app
=
getApp
();
const
{
log
}
=
app
;
const
{
log
}
=
app
;
function
fn
(
_this
)
{
function
fn
(
_this
)
{
wx
.
showToast
({
icon
:
'none'
,
title
:
_this
.
options
.
isXhApp
,
});
if
(
_this
.
options
.
isXhApp
==
1
)
{
// 返回App
_this
.
showAppModule
=
true
;
return
;
}
// _this.message = "支付成功";
// _this.message = "支付成功";
if
(
!
_this
.
options_isCard
)
{
if
(
!
_this
.
options_isCard
)
{
let
query
;
let
query
;
...
@@ -119,7 +106,6 @@ export default {
...
@@ -119,7 +106,6 @@ export default {
scene
:
""
,
//sso
scene
:
""
,
//sso
backUrl
:
""
,
backUrl
:
""
,
isShow
:
false
,
isShow
:
false
,
showAppModule
:
false
,
};
};
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
...
@@ -155,21 +141,11 @@ export default {
...
@@ -155,21 +141,11 @@ export default {
// }
// }
log
.
info
(
this
.
totalMoney
,
"totalMoney"
);
log
.
info
(
this
.
totalMoney
,
"totalMoney"
);
}
else
{
}
else
{
let
ordercode
=
{};
this
.
options
=
JSON
.
parse
(
options
.
ordercode
);
try
{
ordercode
=
JSON
.
parse
(
options
.
ordercode
.
replace
(
/
\\\"
/g
,
'"'
));
this
.
options
=
ordercode
;
options
.
scene
&&
(
this
.
scene
=
options
.
scene
);
options
.
scene
&&
(
this
.
scene
=
options
.
scene
);
options
.
backUrl
&&
(
this
.
backUrl
=
options
.
backUrl
);
options
.
backUrl
&&
(
this
.
backUrl
=
options
.
backUrl
);
this
.
totalMoney
=
Number
(
ordercode
.
totalAmount
).
toFixed
(
2
);
this
.
totalMoney
=
Number
(
JSON
.
parse
(
options
.
ordercode
).
totalAmount
).
toFixed
(
2
);
}
catch
(
error
)
{
wx
.
showToast
({
icon
:
'none'
,
title
:
JSON
.
stringify
(
error
),
});
}
}
}
console
.
log
(
'wxPay-onLoad->'
,
this
.
options
);
this
.
options_orderType
=
options
.
orderType
;
this
.
options_orderType
=
options
.
orderType
;
this
.
options_isCard
=
options
.
isCard
;
this
.
options_isCard
=
options
.
isCard
;
...
@@ -179,21 +155,6 @@ export default {
...
@@ -179,21 +155,6 @@ export default {
wx
.
setStorageSync
(
"sessionid"
,
options
.
sessionid
);
wx
.
setStorageSync
(
"sessionid"
,
options
.
sessionid
);
}
catch
(
e
)
{}
}
catch
(
e
)
{}
}
}
this
.
getOpenId
();
},
methods
:
{
launchAppError
(
e
)
{
console
.
log
(
'launchAppError->'
,
e
);
wx
.
showToast
({
icon
:
'none'
,
title
:
'error'
,
});
// wx.showToast({
// icon: 'none',
// title: JSON.stringify(e.target.errMsg),
// });
},
getOpenId
()
{
let
that
=
this
;
let
that
=
this
;
wx
.
getStorage
({
wx
.
getStorage
({
key
:
"openid"
,
key
:
"openid"
,
...
@@ -207,28 +168,10 @@ export default {
...
@@ -207,28 +168,10 @@ export default {
},
},
fail
(
err
)
{
fail
(
err
)
{
log
.
info
(
"获取err"
,
err
);
log
.
info
(
"获取err"
,
err
);
that
.
setOpenId
(
res
=>
{
that
.
getOpenId
();
});
},
},
});
});
},
},
setOpenId
(
callback
)
{
methods
:
{
wx
.
login
({
success
:
res
=>
{
let
code
=
res
.
code
;
login
.
get_open_id_by_code
({
code
}).
then
(
res1
=>
{
if
(
res1
.
data
.
code
==
200
)
{
wx
.
setStorage
({
key
:
"openid"
,
data
:
res1
.
data
.
data
});
callback
();
}
})
},
})
},
testToPaySuccess
()
{
testToPaySuccess
()
{
let
_this
=
this
;
let
_this
=
this
;
let
params
=
`?orderSn=
${
_this
.
options
.
orderSn
}
`
;
let
params
=
`?orderSn=
${
_this
.
options
.
orderSn
}
`
;
...
@@ -317,10 +260,6 @@ export default {
...
@@ -317,10 +260,6 @@ export default {
});
});
}
}
// fn(this);
// fn(this);
if
(
this
.
options
.
isXhApp
==
1
)
{
this
.
showAppModule
=
true
;
return
;
}
this
.
toPage
();
this
.
toPage
();
};
};
...
@@ -334,7 +273,6 @@ export default {
...
@@ -334,7 +273,6 @@ export default {
};
};
wx
.
requestPayment
(
payData
);
wx
.
requestPayment
(
payData
);
}
else
if
([
'504'
,
'505'
].
includes
(
res
.
data
.
code
))
{
}
else
if
([
'504'
,
'505'
].
includes
(
res
.
data
.
code
))
{
this
.
message
=
res
.
data
.
msg
;
this
.
isShow
=
true
;
this
.
isShow
=
true
;
}
else
{
}
else
{
wx
.
showToast
({
title
:
res
.
data
.
msg
,
icon
:
"none"
});
wx
.
showToast
({
title
:
res
.
data
.
msg
,
icon
:
"none"
});
...
@@ -380,11 +318,6 @@ export default {
...
@@ -380,11 +318,6 @@ export default {
});
});
},
},
handleConfirm
()
{
handleConfirm
()
{
if
(
this
.
options
.
isXhApp
==
1
)
{
// 返回App
this
.
showAppModule
=
true
;
return
;
}
// 如果是代付进入,直接退出小程序
// 如果是代付进入,直接退出小程序
if
(
this
.
options
.
isPayReplace
==
1
)
{
if
(
this
.
options
.
isPayReplace
==
1
)
{
wx
.
exitMiniProgram
({
wx
.
exitMiniProgram
({
...
@@ -400,17 +333,11 @@ export default {
...
@@ -400,17 +333,11 @@ export default {
};
};
</
script
>
</
script
>
<
style
lang=
"scss"
>
<
style
>
.domain
{
.domain
{
text-align
:
center
;
text-align
:
center
;
padding-top
:
50%
;
padding-top
:
50%
;
}
}
.isApp
{
button{
width
:
50%
;
margin-top
:
20px
;
}
}
.dialog-content__wrapper
{
.dialog-content__wrapper
{
padding
:
16px
;
padding
:
16px
;
...
...
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