增加支付
This commit is contained in:
86
pages/pays/pays.vue
Normal file
86
pages/pays/pays.vue
Normal file
@@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<view style="width: 100%;">
|
||||
<web-view id="webview" :src="state.url" style="width: 100%;"></web-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive
|
||||
} from 'vue'
|
||||
import {
|
||||
onShow,onHide,onUnload,onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
getOrderInfo
|
||||
} from '@/api/video/index.js'
|
||||
const state = reactive({
|
||||
orderId: '',
|
||||
timer: null,
|
||||
maxAjaxNum: 5,
|
||||
ajaxNum: 0,
|
||||
url: null, //要打开的外部链接
|
||||
viewerUrl: '/hybrid/html/web/viewer.html',
|
||||
webviewStyles: {
|
||||
width: '750px',
|
||||
height: '100%',
|
||||
}
|
||||
})
|
||||
|
||||
function getOrder() {
|
||||
getOrderInfo({
|
||||
orderId: state.orderId
|
||||
}).then(res => {
|
||||
console.log(res.data);
|
||||
if (res.data == 1) {
|
||||
uni.hideLoading()
|
||||
const sysInfo = uni.getSystemInfoSync();
|
||||
let isIos = sysInfo.platform == 'ios'
|
||||
if (isIos) {
|
||||
uni.navigateBack()
|
||||
uni.showToast({
|
||||
title: '支付成功',
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '支付成功',
|
||||
icon: 'none'
|
||||
})
|
||||
state.timer = setTimeout(() => {
|
||||
clearTimeout(state.timer)
|
||||
uni.navigateBack()
|
||||
}, 500)
|
||||
}
|
||||
} else {
|
||||
// #ifdef APP
|
||||
uni.showLoading({
|
||||
title: '支付中'
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
});
|
||||
}
|
||||
onShow(() => {
|
||||
getOrder()
|
||||
})
|
||||
onHide(() => {
|
||||
uni.hideLoading()
|
||||
})
|
||||
onUnload(() => {
|
||||
uni.hideLoading()
|
||||
})
|
||||
onLoad((option) => {
|
||||
state.url = option.url
|
||||
state.orderId = option.orderId
|
||||
})
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.webview {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user