feat: 接入payjs支付
This commit is contained in:
@@ -27,6 +27,8 @@ const Detail = () => {
|
|||||||
if (newId) {
|
if (newId) {
|
||||||
setid(newId);
|
setid(newId);
|
||||||
}
|
}
|
||||||
|
let newjoinMeetup=window.localStorage.getItem('joinMeetup')
|
||||||
|
setjoinMeetup(newjoinMeetup)
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleClick = (value) => {
|
const handleClick = (value) => {
|
||||||
@@ -67,17 +69,19 @@ const Detail = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const joinmeet = () => {
|
const joinmeet = () => {
|
||||||
console.log("111");
|
// console.log("111");
|
||||||
Taro.request({
|
Taro.request({
|
||||||
method:'POST',
|
method:'POST',
|
||||||
url: "/api//payh5", //仅为示例,并非真实的接口地址
|
url: "/api/payh5", //仅为示例,并非真实的接口地址
|
||||||
data: {},
|
data: {
|
||||||
|
callback_url:window.location.href
|
||||||
|
},
|
||||||
header: {
|
header: {
|
||||||
"content-type": "application/json", // 默认值
|
"content-type": "application/json", // 默认值
|
||||||
},
|
},
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
console.log(res.data);
|
console.log(res.data);
|
||||||
window.alert(res.data);
|
// window.alert(res.data.jsapi);
|
||||||
WeixinJSBridge.invoke(
|
WeixinJSBridge.invoke(
|
||||||
"getBrandWCPayRequest",
|
"getBrandWCPayRequest",
|
||||||
{
|
{
|
||||||
@@ -88,10 +92,12 @@ const Detail = () => {
|
|||||||
// package: "prepay_id=wx01113404850024729b35f4d69b73500000",
|
// package: "prepay_id=wx01113404850024729b35f4d69b73500000",
|
||||||
// signType: "MD5",
|
// signType: "MD5",
|
||||||
// paySign: "2A823C8D47CCF871C6C65A56DC228CF8",
|
// paySign: "2A823C8D47CCF871C6C65A56DC228CF8",
|
||||||
...res.data,
|
...res?.data?.jsapi??{},
|
||||||
},
|
},
|
||||||
function (res) {
|
function (res) {
|
||||||
if (res.err_msg == "get_brand_wcpay_request:ok") {
|
if (res.err_msg == "get_brand_wcpay_request:ok") {
|
||||||
|
setjoinMeetup(true)
|
||||||
|
window.localStorage.setItem('joinMeetup',true)
|
||||||
WeixinJSBridge.call("closeWindow");
|
WeixinJSBridge.call("closeWindow");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,8 +150,9 @@ const Detail = () => {
|
|||||||
className="bottomBtn"
|
className="bottomBtn"
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={() => joinmeet()}
|
onClick={() => joinmeet()}
|
||||||
|
disabled={joinMeetup}
|
||||||
>
|
>
|
||||||
立即报名
|
{!!joinMeetup?'已报名':'立即报名'}
|
||||||
</AtButton>
|
</AtButton>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user