提交 ff90a660 authored 作者: haodaking's avatar haodaking

优化支付

上级 fd70082d
......@@ -8,7 +8,7 @@ export default class API {
// 让ajax携带cookie
axios.defaults.withCredentials = true
this._axios = axios.create({
timeout: config.timeout || 5 * 1000,
timeout: config.timeout || 60 * 1000,
/* 表示服务器响应的数据类型,可以是 'arraybuffer', 'blob', 'document', 'json', 'text', 'stream' */
responseType: config.resType || 'json',
/* 将自动加在 `url` 前面,除非 `url` 是一个绝对 URL */
......
<template>
<div class="h5pay">
<el-button type="primary" @click="handlePay">去支付</el-button>
<el-button type="primary" @click="handlePay" :disabled="disabled">去支付</el-button>
</div>
</template>
......@@ -9,7 +9,9 @@ import * as api from '@/api/my'
export default {
data() {
return {
openId: window.localStorage.getItem('open_id')
openId: window.localStorage.getItem('open_id'),
order: {},
disabled: false
}
},
computed: {
......@@ -20,7 +22,10 @@ export default {
methods: {
// 获取订单
getOrder(callback) {
api.getOrder({ wx_open_id: this.openId, payment_method: 'WX_PAY' }).then(response => {
this.disabled = true
api
.getOrder({ wx_open_id: this.openId, payment_method: 'WX_PAY' })
.then(response => {
const { data, error, message } = response
if (error.toString() === '0') {
this.order = data
......@@ -30,6 +35,9 @@ export default {
this.$message.error(message)
}
})
.finally(() => {
this.disabled = false
})
},
// 获取微信code
getCode() {
......
......@@ -106,7 +106,7 @@ export default {
return
}
this.orderList.forEach(order => this.checkPay(order))
}, 3000)
}, 10000)
},
// 填写个人资料
toApplication() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论