|
@@ -16,11 +16,14 @@
|
|
<van-row>
|
|
<van-row>
|
|
请选择微信、支付宝或云闪付进行充值。
|
|
请选择微信、支付宝或云闪付进行充值。
|
|
</van-row>
|
|
</van-row>
|
|
|
|
+ <van-loading size="24px" v-if = "loading" vertical style="z-index:999999;position:fixed;top:40%;left:0;right:0;" >加载中...</van-loading>
|
|
|
|
+ <van-overlay :show="loading" style="z-index:100;position:fixed"/>
|
|
</van-row>
|
|
</van-row>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
import { Dialog, Notify } from "vant";
|
|
import { Dialog, Notify } from "vant";
|
|
|
|
+import { getTokenApi, getPayApi } from '@/plugins/common'
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
[Notify.Component.name]: Notify.Component,
|
|
[Notify.Component.name]: Notify.Component,
|
|
@@ -29,59 +32,75 @@ export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
iosApp: "",
|
|
iosApp: "",
|
|
- token:'',
|
|
|
|
url:'',
|
|
url:'',
|
|
|
|
+ loading: false,
|
|
money:null
|
|
money:null
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
- if (this.isWeixin()) {
|
|
|
|
- this.iosApp = true;
|
|
|
|
- } else {
|
|
|
|
- //显示手动打开外置浏览器提示
|
|
|
|
- this.iosApp = false;
|
|
|
|
- }
|
|
|
|
|
|
+ // if (this.isWeixin()) {
|
|
|
|
+ // this.iosApp = true;
|
|
|
|
+ // } else {
|
|
|
|
+ // //显示手动打开外置浏览器提示
|
|
|
|
+ // this.iosApp = false;
|
|
|
|
+ // }
|
|
},
|
|
},
|
|
created(){
|
|
created(){
|
|
this.money = this.$route.query.money
|
|
this.money = this.$route.query.money
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- isWeixin() {
|
|
|
|
- return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
|
|
|
|
|
|
+ // isWeixin() {
|
|
|
|
+ // return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
|
|
|
|
+ // },
|
|
|
|
+ // async getTokenApi(){
|
|
|
|
+ // await this.$axios.post('/login' ,{"username":"admin","password":"admin123"})
|
|
|
|
+ // .then(res=>{
|
|
|
|
+ // window.localStorage.setItem('token',res.data.token)
|
|
|
|
+ // this.getPayApi(this.money)
|
|
|
|
+ // }).catch(()=>{
|
|
|
|
+
|
|
|
|
+ // })
|
|
|
|
+ // },
|
|
|
|
+ // async getPayApi(money){
|
|
|
|
+ // await this.$axios.post('/dxtop/order/callUnifiedPay' , { "money":money,"topPayType":"A01","payType":'3'}
|
|
|
|
+ // ,{
|
|
|
|
+ // headers: {
|
|
|
|
+ // "Authorization":window.localStorage.getItem('token') //token换成从缓存获取
|
|
|
|
+ // }
|
|
|
|
+ // }).then(res=>{
|
|
|
|
+ // window.location.href = res.data.msg
|
|
|
|
+ // }).catch(()=>{
|
|
|
|
+
|
|
|
|
+ // })
|
|
|
|
+ // },
|
|
|
|
+ async pay(money, topPayType, payType){
|
|
|
|
+ if(window.localStorage.getItem('token')){
|
|
|
|
+ getPayApi(money, topPayType, payType)
|
|
|
|
+ }else{
|
|
|
|
+ getTokenApi(money, topPayType, payType)
|
|
|
|
+ }
|
|
},
|
|
},
|
|
async openApp(url = "") {
|
|
async openApp(url = "") {
|
|
- console.log(url.app)
|
|
|
|
if (!url) return;
|
|
if (!url) return;
|
|
|
|
+ this.loading = true
|
|
//if (url.app === 'ysf') return Notify({ type: 'primary', message: '暂不可用' });
|
|
//if (url.app === 'ysf') return Notify({ type: 'primary', message: '暂不可用' });
|
|
//if (this.iosApp) return Notify({ type: 'primary', message: '请使用浏览器打开' });
|
|
//if (this.iosApp) return Notify({ type: 'primary', message: '请使用浏览器打开' });
|
|
//非微信浏览器
|
|
//非微信浏览器
|
|
-
|
|
|
|
window.navigator.userAgent.toLowerCase();
|
|
window.navigator.userAgent.toLowerCase();
|
|
if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
|
|
if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
|
|
if (url.app === 'alipayqr'){
|
|
if (url.app === 'alipayqr'){
|
|
- let res1 = await this.$axios.post('http://172.16.120.104:8085/login' ,{"username":"admin","password":"admin123"}).then(res=>{
|
|
|
|
- this.token = res.data.token
|
|
|
|
- console.log(res1)
|
|
|
|
- }).then(()=>{
|
|
|
|
- let res2 = this.$axios.post('http://172.16.120.104:8085/dxtop/order/callUnifiedPay' , { "money":this.money,"topPayType":"A01","payType":'3'}
|
|
|
|
- ,{
|
|
|
|
- headers: {
|
|
|
|
- "Authorization":this.token //token换成从缓存获取
|
|
|
|
- }
|
|
|
|
- }).then(res=>{
|
|
|
|
- console.log(res2)
|
|
|
|
- window.location.href = res.data.msg
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
|
|
+ this.pay(this.money, "A01", "3")
|
|
|
|
+ this.loading = false
|
|
}
|
|
}
|
|
const loadDateTime = +new Date();
|
|
const loadDateTime = +new Date();
|
|
window.setTimeout( ()=> {
|
|
window.setTimeout( ()=> {
|
|
const timeOutDateTime = +new Date();
|
|
const timeOutDateTime = +new Date();
|
|
if (timeOutDateTime - loadDateTime > 2000) {
|
|
if (timeOutDateTime - loadDateTime > 2000) {
|
|
window.location.href = url.downI;
|
|
window.location.href = url.downI;
|
|
|
|
+ this.loading = false
|
|
} else {
|
|
} else {
|
|
window.close();
|
|
window.close();
|
|
|
|
+ this.loading = false
|
|
Dialog.confirm({
|
|
Dialog.confirm({
|
|
title: '提示',
|
|
title: '提示',
|
|
message: '是否已完成充值?',
|
|
message: '是否已完成充值?',
|
|
@@ -95,25 +114,13 @@ export default {
|
|
} else if (navigator.userAgent.match(/android/i)) {
|
|
} else if (navigator.userAgent.match(/android/i)) {
|
|
try {
|
|
try {
|
|
if (url.app === 'alipayqr'){
|
|
if (url.app === 'alipayqr'){
|
|
- let res1 = await this.$axios.post('http://172.16.120.104:8085/login' ,{"username":"admin","password":"admin123"}).then(res=>{
|
|
|
|
- this.token = res.data.token
|
|
|
|
- console.log(res1)
|
|
|
|
- }).then(()=>{
|
|
|
|
- let res2 = this.$axios.post('http://172.16.120.104:8085/dxtop/order/callUnifiedPay' , { "money":this.money,"topPayType":"A01","payType":'3'}
|
|
|
|
- ,{
|
|
|
|
- headers: {
|
|
|
|
- "Authorization":this.token //token换成从缓存获取
|
|
|
|
- }
|
|
|
|
- }).then(res=>{
|
|
|
|
- console.log(res2)
|
|
|
|
- window.location.href = res.data.msg
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ this.pay(this.money, "A01", "3")
|
|
|
|
+ this.loading = false
|
|
|
|
+ }
|
|
window.location.href = this.url;
|
|
window.location.href = this.url;
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
window.location.href = url.downA;
|
|
window.location.href = url.downA;
|
|
|
|
+ this.loading = false
|
|
}, 500);
|
|
}, 500);
|
|
} catch (e) {
|
|
} catch (e) {
|
|
console.log(e)
|
|
console.log(e)
|
|
@@ -158,6 +165,7 @@ export default {
|
|
width: 86px;
|
|
width: 86px;
|
|
height: 86px;
|
|
height: 86px;
|
|
background-size: 100% 100%;
|
|
background-size: 100% 100%;
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
&>.van-row:nth-child(2){
|
|
&>.van-row:nth-child(2){
|
|
@@ -167,4 +175,7 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+.van-loading--vertical{
|
|
|
|
+ color:#fff
|
|
|
|
+}
|
|
</style>
|
|
</style>
|