合并代码

This commit is contained in:
szz
2025-07-31 13:54:37 +08:00
parent 97a53c200e
commit 7d94b0ddae
21 changed files with 479 additions and 688 deletions

View File

@@ -133,7 +133,7 @@
<span class="cycle">{{ allocation.cycle_number }}</span>
</div>
<div class="allocation-details">
<p>转账给: <strong>{{ allocation.to_user_name }}</strong></p>
<p>转账给: <strong>{{ allocation.to_user_real_name }}</strong></p>
<p>金额: <strong class="amount">¥{{ allocation.amount }}</strong></p>
<p>总金额: ¥{{ allocation.total_amount }}</p>
<p class="deadline-info">
@@ -158,13 +158,6 @@
>
{{ allocation.can_transfer ? '确认转账' : '无法转账' }}
</button>
<button
@click="rejectAllocation(allocation.id)"
class="reject-btn"
:disabled="processing"
>
拒绝
</button>
</div>
</div>
</div>
@@ -443,8 +436,32 @@ export default {
* 创建匹配订单
*/
async createOrder() {
this.creating = true
try {
// 构建确认信息
let confirmMessage = ''
if (this.matchingType === 'small') {
confirmMessage = '确定要开始小额匹配吗?\n\n匹配成功后将生成3笔转账分配。'
} else {
if (!this.isValidCustomAmount) {
this.$message.error('请输入有效的匹配金额5000-50000元')
return
}
const amount = parseFloat(this.customAmount)
const count = this.getLargeMatchingCount()
confirmMessage = `确定要开始大额匹配吗?\n\n匹配金额${amount}\n将生成${count}笔转账分配`
}
// 二次确认对话框
await this.$confirm(confirmMessage, '确认匹配', {
confirmButtonText: '确认匹配',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: false
})
this.creating = true
// 构建请求参数
const requestData = {
matchingType: this.matchingType
@@ -452,10 +469,6 @@ export default {
// 如果是大额匹配,添加自定义金额
if (this.matchingType === 'large') {
if (!this.isValidCustomAmount) {
this.$message.error('请输入有效的匹配金额5000-50000元')
return
}
requestData.customAmount = parseFloat(this.customAmount)
}
@@ -468,6 +481,11 @@ export default {
this.$message.success(successMessage)
await this.loadData()
} catch (error) {
// 如果用户取消确认,不显示错误信息
if (error === 'cancel') {
return
}
console.error('创建匹配订单失败:', error)
const errorMessage = error.response?.data?.message || '匹配失败,请稍后重试'
@@ -527,32 +545,7 @@ export default {
}
},
/**
* 拒绝分配
* @param {string} allocationId - 分配ID
*/
async rejectAllocation(allocationId) {
const reason = prompt('请输入拒绝原因(可选):')
// 用户点击取消时prompt返回null此时不执行后续操作
if (reason === null) {
return
}
this.processing = true
try {
await api.post(`/matching/reject-allocation/${allocationId}`, {
reason
})
this.$message.success('已拒绝分配')
await this.loadData()
} catch (error) {
console.error('拒绝分配失败:', error)
this.$message.error('拒绝分配失败')
} finally {
this.processing = false
}
},
async viewOrderDetail(orderId) {
try {
@@ -577,7 +570,6 @@ export default {
completed: '已完成',
cancelled: '已取消',
confirmed: '已确认',
rejected: '已拒绝',
failed: '匹配失败'
}
return statusMap[status] || status
@@ -587,7 +579,6 @@ export default {
const actionMap = {
join: '加入',
confirm: '确认',
reject: '拒绝',
complete: '完成'
}
return actionMap[action] || action
@@ -1062,8 +1053,7 @@ export default {
gap: 10px;
}
.confirm-btn,
.reject-btn {
.confirm-btn {
padding: 8px 16px;
border: none;
border-radius: 5px;
@@ -1080,14 +1070,7 @@ export default {
background: #229954;
}
.reject-btn {
background: #e74c3c;
color: white;
}
.reject-btn:hover {
background: #c0392b;
}
.order-card {
padding: 15px;