Commit b76dfb0c by cen

fix: 添加审批按钮加载状态

- 在定金和尾款审批按钮中添加加载状态,以提升用户体验
- 更新审批逻辑,确保在请求期间按钮状态正确显示
1 parent ee440928
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
type="primary" type="primary"
size="small" size="small"
v-preventReClick v-preventReClick
:loading="approveLoading.deposit"
v-if="item.infoData && detailInfo.paymentType == 1 && activeStep == 0" v-if="item.infoData && detailInfo.paymentType == 1 && activeStep == 0"
@click="approve(1)"> @click="approve(1)">
发起定金审批 发起定金审批
...@@ -21,6 +22,7 @@ ...@@ -21,6 +22,7 @@
type="primary" type="primary"
size="small" size="small"
v-preventReClick v-preventReClick
:loading="approveLoading.final"
v-if="item.infoData && detailInfo.paymentType == 1 && activeStep == 2" v-if="item.infoData && detailInfo.paymentType == 1 && activeStep == 2"
@click="approve(2)"> @click="approve(2)">
发起尾款审批 发起尾款审批
...@@ -30,6 +32,7 @@ ...@@ -30,6 +32,7 @@
type="primary" type="primary"
size="small" size="small"
v-preventReClick v-preventReClick
:loading="approveLoading.final"
v-if="item.infoData && detailInfo.paymentType == 2 && activeStep == 2" v-if="item.infoData && detailInfo.paymentType == 2 && activeStep == 2"
@click="approve(2)"> @click="approve(2)">
发起全款审批 发起全款审批
...@@ -401,6 +404,10 @@ export default { ...@@ -401,6 +404,10 @@ export default {
videoStr: "?x-oss-process=video/snapshot,t_7000,f_jpg,w_800,h_600,m_fast", videoStr: "?x-oss-process=video/snapshot,t_7000,f_jpg,w_800,h_600,m_fast",
btnLoding: false, btnLoding: false,
loading: false, loading: false,
approveLoading: {
deposit: false, // 定金审批loading
final: false // 尾款/全款审批loading
},
id: this.$route.query.id, id: this.$route.query.id,
rules: { rules: {
description: [ description: [
...@@ -1065,6 +1072,8 @@ export default { ...@@ -1065,6 +1072,8 @@ export default {
if (res.data.code == 0 && res.data.data == 2) { if (res.data.code == 0 && res.data.data == 2) {
const params = { contractNo: this.detailInfo.contractNo, evalOrderNo: this.detailInfo.evalOrderNo } const params = { contractNo: this.detailInfo.contractNo, evalOrderNo: this.detailInfo.evalOrderNo }
if (type == 1) { if (type == 1) {
this.approveLoading.deposit = true
try {
const res1 = await webPayDepositApplication(params) const res1 = await webPayDepositApplication(params)
console.log(res1, '78787') console.log(res1, '78787')
if (res1.data.code == 0) { if (res1.data.code == 0) {
...@@ -1073,7 +1082,14 @@ export default { ...@@ -1073,7 +1082,14 @@ export default {
} else { } else {
this.$message.error(res1.data.msg) this.$message.error(res1.data.msg)
} }
} catch (error) {
this.$message.error("操作失败")
} finally {
this.approveLoading.deposit = false
}
} else if (type == 2) { } else if (type == 2) {
this.approveLoading.final = true
try {
const res2 = await webPayFinalApplication(params) const res2 = await webPayFinalApplication(params)
if (res2.data.code == 0) { if (res2.data.code == 0) {
this.handleCancel() this.handleCancel()
...@@ -1081,6 +1097,11 @@ export default { ...@@ -1081,6 +1097,11 @@ export default {
} else { } else {
this.$message.error(res2.data.msg) this.$message.error(res2.data.msg)
} }
} catch (error) {
this.$message.error("操作失败")
} finally {
this.approveLoading.final = false
}
} }
} else { } else {
this.$message.error('暂时无法审批') this.$message.error('暂时无法审批')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!