|
|
@ -262,50 +262,63 @@ const cancelset = () => { |
|
|
|
|
|
|
|
// 确定设置初始数据 |
|
|
|
// 确定设置初始数据 |
|
|
|
const confirmInitialData = async () => { |
|
|
|
try { |
|
|
|
const id = activityStone.selectactivityId |
|
|
|
const time = setinitiaData.value |
|
|
|
|
|
|
|
if (!id) { |
|
|
|
ElMessage.warning('未获取到活动ID') |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if (time === null || time <= 0) { |
|
|
|
ElMessage.warning('请输入有效的分钟数') |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
const response = await setTime( |
|
|
|
{ |
|
|
|
activityId: id, |
|
|
|
time: time |
|
|
|
} |
|
|
|
) |
|
|
|
|
|
|
|
if (response.code === 200) { |
|
|
|
await fetchData() |
|
|
|
showInitialConfirmDialog.value = false |
|
|
|
setinitiaData.value=0 |
|
|
|
ElMessage.success('设置成功') |
|
|
|
ifshow(); |
|
|
|
|
|
|
|
} else { |
|
|
|
ElMessage.error(response.message || '设置失败') |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error('设置初始数据失败:', error) |
|
|
|
ElMessage.error('请求失败,请重试') |
|
|
|
} |
|
|
|
} |
|
|
|
// const confirmInitialData = async () => { |
|
|
|
// try { |
|
|
|
// const id = activityStone.selectactivityId |
|
|
|
// const time = setinitiaData.value |
|
|
|
|
|
|
|
// if (!id) { |
|
|
|
// ElMessage.warning('未获取到活动ID') |
|
|
|
// return |
|
|
|
// } |
|
|
|
|
|
|
|
// if (time === null || time <= 0) { |
|
|
|
// ElMessage.warning('请输入有效的分钟数') |
|
|
|
// return |
|
|
|
// } |
|
|
|
|
|
|
|
// const response = await setTime( |
|
|
|
// { |
|
|
|
// activityId: id, |
|
|
|
// time: time |
|
|
|
// } |
|
|
|
// ) |
|
|
|
|
|
|
|
// if (response.code === 200) { |
|
|
|
// await fetchData() |
|
|
|
// showInitialConfirmDialog.value = false |
|
|
|
// setinitiaData.value=0 |
|
|
|
// ElMessage.success('设置成功') |
|
|
|
// ifshow(); |
|
|
|
|
|
|
|
// } else { |
|
|
|
// ElMessage.error(response.message || '设置失败') |
|
|
|
// } |
|
|
|
// } catch (error) { |
|
|
|
// console.error('设置初始数据失败:', error) |
|
|
|
// ElMessage.error('请求失败,请重试') |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
// 确定添加 |
|
|
|
// 添加防抖标志 |
|
|
|
const isAdding = ref(false); |
|
|
|
const addCooldown = 1500; // 1.5秒冷却时间 |
|
|
|
|
|
|
|
const confirmAdd = async () => { |
|
|
|
// 防抖检查 |
|
|
|
if (isAdding.value) { |
|
|
|
ElMessage.warning('操作过于频繁,请稍后再试'); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const type = pendingAction.value; |
|
|
|
|
|
|
|
// 修改市场一的验证逻辑,移除 > 0 的检查 |
|
|
|
if (type === 'one' && addCountOne.value !== null && addCountOne.value !== 0) { |
|
|
|
// 设置防抖标志 |
|
|
|
isAdding.value = true; |
|
|
|
|
|
|
|
markerOneTotal.value += parseInt(addCountOne.value); |
|
|
|
showOne.value = markerOneTotal.value; |
|
|
|
|
|
|
@ -334,12 +347,20 @@ const confirmAdd = async () => { |
|
|
|
// 回滚操作 |
|
|
|
markerOneTotal.value -= parseInt(addCountOne.value); |
|
|
|
showOne.value = markerOneTotal.value; |
|
|
|
} finally { |
|
|
|
// 无论成功或失败,都需要在1.5秒后重置防抖标志 |
|
|
|
setTimeout(() => { |
|
|
|
isAdding.value = false; |
|
|
|
}, addCooldown); |
|
|
|
} |
|
|
|
|
|
|
|
addCountOne.value = null; |
|
|
|
|
|
|
|
// 修改市场二的验证逻辑,移除 > 0 的检查 |
|
|
|
} else if (type === 'two' && addCountTwo.value !== null && addCountTwo.value !== 0) { |
|
|
|
// 设置防抖标志 |
|
|
|
isAdding.value = true; |
|
|
|
|
|
|
|
markerTwoTotal.value += parseInt(addCountTwo.value); |
|
|
|
showTwo.value = markerTwoTotal.value; |
|
|
|
|
|
|
@ -367,6 +388,11 @@ const confirmAdd = async () => { |
|
|
|
// 回滚 |
|
|
|
markerTwoTotal.value -= parseInt(addCountTwo.value); |
|
|
|
showTwo.value = markerTwoTotal.value; |
|
|
|
} finally { |
|
|
|
// 无论成功或失败,都需要在1.5秒后重置防抖标志 |
|
|
|
setTimeout(() => { |
|
|
|
isAdding.value = false; |
|
|
|
}, addCooldown); |
|
|
|
} |
|
|
|
|
|
|
|
addCountTwo.value = null; |
|
|
|