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

update: 修改beforeRequest错误处理

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