提交 fbffce48 authored 作者: matian's avatar matian

update:代码优化

上级 09d17da0
<template> <template>
<div> <div>
<template v-if="dealList.payment_status === '70'"> <!-- 财务 -->
<el-button <el-button
@click="fetchConfirmTicketDetail('FINANCE')" type="danger"
type="danger" v-if="
v-if="isFINANCE && dealList.finance_confirm_status === 0" isFINANCE &&
>财务确认足额支付</el-button ((this.dealList.finance_confirm_status === 0 && this.dealList.payment_status === '70') ||
> (this.dealList.finance_confirm_status === 1 && this.dealList.payment_status === '80'))
<el-button "
@click="fetchConfirmTicketDetail('BUSINESS')" @click="fetchToTicketDetail('FINANCE')"
type="danger" >{{ btnText1 }}</el-button>
v-if="isBUSINESS && dealList.business_confirm_status === 0" <!-- 业务 -->
>业务确认足额支付</el-button <el-button
> type="danger"
</template> v-if="
<template v-if="dealList.payment_status === '80'"> isBUSINESS &&
<el-button ((this.dealList.business_confirm_status === 0 && this.dealList.payment_status === '70') ||
@click="fetchCancelTicketDetail('FINANCE')" (this.dealList.business_confirm_status === 1 && this.dealList.payment_status === '80'))
type="danger" "
v-if="isFINANCE && dealList.finance_confirm_status === 1" @click="fetchToTicketDetail('BUSINESS')"
>财务取消足额支付</el-button >{{ btnText2 }}</el-button>
>
<el-button
@click="fetchCancelTicketDetail('BUSINESS')"
type="danger"
v-if="isBUSINESS && dealList.business_confirm_status === 1"
>业务取消足额支付</el-button
>
</template>
<app-card title="订单信息" style="margin-top: 20px"> <app-card title="订单信息" style="margin-top: 20px">
<Order :dealList="dealList" /> <Order :dealList="dealList" />
</app-card> </app-card>
...@@ -88,6 +80,22 @@ export default { ...@@ -88,6 +80,22 @@ export default {
this.roles.includes('dean_of_admissions') || this.roles.includes('dean_of_admissions') ||
this.roles.includes('developer') this.roles.includes('developer')
) )
},
// eslint-disable-next-line vue/return-in-computed-property
btnText1() {
if (this.dealList.finance_confirm_status === 0 && this.dealList.payment_status === '70') {
return '财务确认足额支付'
} else if (this.dealList.finance_confirm_status === 1 && this.dealList.payment_status === '80') {
return '财务取消足额支付'
}
},
// eslint-disable-next-line vue/return-in-computed-property
btnText2() {
if (this.dealList.business_confirm_status === 0 && this.dealList.payment_status === '70') {
return '业务确认足额支付'
} else if (this.dealList.business_confirm_status === 1 && this.dealList.payment_status === '80') {
return '业务取消足额支付'
}
} }
}, },
beforeMount() { beforeMount() {
...@@ -107,25 +115,23 @@ export default { ...@@ -107,25 +115,23 @@ export default {
this.$message.error(error.message) this.$message.error(error.message)
}) })
}, },
// 确认 // 财务(业务)确认(取消)支付
fetchConfirmTicketDetail(val) { fetchToTicketDetail(val) {
const params = { const params = {
confirm_type: val, confirm_type: val,
id: this.id id: this.id
} }
confirmPayDetail(params).then(res => { if (this.dealList.payment_status === '70') {
this.fetchTicketDetail() // 确认
}) confirmPayDetail(params).then(res => {
}, this.fetchTicketDetail()
// 取消 })
fetchCancelTicketDetail(val) { } else {
const params = { // 取消
confirm_type: val, cancelPayDetail(params).then(res => {
id: this.id this.fetchTicketDetail()
})
} }
cancelPayDetail(params).then(res => {
this.fetchTicketDetail()
})
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论