提交 68bef430 authored 作者: pengxiaohui's avatar pengxiaohui

update: 修改beforeRequest错误处理

上级 95e712a5
......@@ -23,7 +23,7 @@ const routes = [
component: () => import('./views/h5/Invoice.vue')
},
{
path: '/h5/payment/Details',
path: '/h5/payment/details',
component: () => import('./views/h5/details.vue')
}
]
......
......@@ -140,15 +140,9 @@ export default {
const params = Object.assign({}, this.form)
params.id = this.id
createInvoice(params).then(res => {
console.log(res)
if (res.code === 0) {
Toast.success('开具发票成功')
} else {
// this.$message.error(res.message || '开具发票失败')
Toast.fail(res.message || '开具发票失败')
}
}).catch(() => {
Toast.fail('开具发票失败')
Toast.success('开具发票成功')
}).catch(err => {
Toast.fail(err.message || '开具发票失败')
})
}
}
......
......@@ -100,6 +100,10 @@ export default {
this.finished = true
}
this.loading = false
}).catch(() => {
this.list = []
this.finished = true
this.loading = false
})
}
}
......
......@@ -6,7 +6,7 @@
</template>
<!-- 操作 -->
<template v-slot:table-operate="{ row }">
<el-button v-if="['2', '6'].includes(row.invoice_status)" type="text" @click="handleInvoice(row)" size="mini">开具发票</el-button>
<el-button v-if="['1', '2', '6'].includes(row.invoice_status)" type="text" @click="handleInvoice(row)" size="mini">开具发票</el-button>
<el-button type="text" @click="handleInvoiceQR(row)" size="mini">开票二维码</el-button>
</template>
</app-list>
......@@ -97,13 +97,9 @@ export default {
fetchCreateInvoice(val) {
val.payment_id = this.payment_id
createInvoice(val).then(res => {
if (res.code === 0) {
this.$message.success('开具发票成功')
} else {
this.$message.error(res.message || '开具发票失败')
}
}).catch(() => {
this.$message.error('开具发票失败')
this.$message.success('开具发票成功')
}).catch((err) => {
this.$message.error(err.message || '开具发票失败')
})
}
}
......@@ -115,7 +111,6 @@ export default {
padding:14px;
background:#f7f7f7;
box-sizing:border-box;
height:100vh;
}
.table-list{
background:#fff;
......
......@@ -32,9 +32,9 @@ httpRequest.interceptors.request.use(
httpRequest.interceptors.response.use(
function (response) {
const { data } = response
// if (data.code) {
// return Promise.reject(data)
// }
if (data.code) {
return Promise.reject(data)
}
return data
},
function (error) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论