提交 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="isFINANCE && dealList.finance_confirm_status === 0" v-if="
>财务确认足额支付</el-button isFINANCE &&
> ((this.dealList.finance_confirm_status === 0 && this.dealList.payment_status === '70') ||
(this.dealList.finance_confirm_status === 1 && this.dealList.payment_status === '80'))
"
@click="fetchToTicketDetail('FINANCE')"
>{{ btnText1 }}</el-button>
<!-- 业务 -->
<el-button <el-button
@click="fetchConfirmTicketDetail('BUSINESS')"
type="danger" type="danger"
v-if="isBUSINESS && dealList.business_confirm_status === 0" v-if="
>业务确认足额支付</el-button isBUSINESS &&
> ((this.dealList.business_confirm_status === 0 && this.dealList.payment_status === '70') ||
</template> (this.dealList.business_confirm_status === 1 && this.dealList.payment_status === '80'))
<template v-if="dealList.payment_status === '80'"> "
<el-button @click="fetchToTicketDetail('BUSINESS')"
@click="fetchCancelTicketDetail('FINANCE')" >{{ btnText2 }}</el-button>
type="danger"
v-if="isFINANCE && dealList.finance_confirm_status === 1"
>财务取消足额支付</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,26 +115,24 @@ export default { ...@@ -107,26 +115,24 @@ 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
} }
if (this.dealList.payment_status === '70') {
// 确认
confirmPayDetail(params).then(res => { confirmPayDetail(params).then(res => {
this.fetchTicketDetail() this.fetchTicketDetail()
}) })
}, } else {
// 取消 // 取消
fetchCancelTicketDetail(val) {
const params = {
confirm_type: val,
id: this.id
}
cancelPayDetail(params).then(res => { cancelPayDetail(params).then(res => {
this.fetchTicketDetail() this.fetchTicketDetail()
}) })
} }
} }
}
} }
</script> </script>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论