From 3bf2f3171f41c661c7dc36cae4a601cf7dc9b8eb Mon Sep 17 00:00:00 2001 From: "zhonghua.li" Date: Mon, 1 Jun 2026 00:26:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8A=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/lb-buy-account.js | 10 +++ .../lb-business/rush-order-account/index.vue | 74 ++++++++++++++++++- 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/src/api/lb-buy-account.js b/src/api/lb-buy-account.js index 03711cb..be80002 100644 --- a/src/api/lb-buy-account.js +++ b/src/api/lb-buy-account.js @@ -30,3 +30,13 @@ export function deleteLbBuyAccount(id) { method: 'delete' }) } + +/** 按选中抢单账号批量抢购,可能较慢 */ +export function rushBuyLbBuyAccount(data) { + return request({ + url: '/lbBuyAccount/rush-buy', + method: 'post', + data, + timeout: 120000 + }) +} diff --git a/src/views/lb-business/rush-order-account/index.vue b/src/views/lb-business/rush-order-account/index.vue index 5ffd191..4882327 100644 --- a/src/views/lb-business/rush-order-account/index.vue +++ b/src/views/lb-business/rush-order-account/index.vue @@ -55,16 +55,34 @@ 新增 + + 开始抢单 + - + + + @@ -158,6 +176,14 @@ + + + @@ -243,6 +269,7 @@ import { addLbBuyAccount, deleteLbBuyAccount, getLbBuyAccountList, + rushBuyLbBuyAccount, updateLbBuyAccount } from '@/api/lb-buy-account' import { getAllTenantList } from '@/api/tenant' @@ -258,6 +285,7 @@ const DEFAULT_FORM = () => ({ referrerPhone: '', referrerName: '', loginUrl: '', + tokenFront: '', maxGrabAmount: undefined, maxGrabCount: undefined, latestRechargePoints: undefined, @@ -278,8 +306,10 @@ export default { return { loading: false, submitLoading: false, + rushBuyLoading: false, tenantLoading: false, list: [], + multipleSelection: [], total: 0, tenantOptions: [], createTimeRange: [], @@ -341,6 +371,45 @@ export default { this.tenantLoading = false }) }, + handleSelectionChange(selection) { + this.multipleSelection = selection + }, + handleRushBuy() { + if (!this.multipleSelection.length) { + this.$message.warning('请先勾选要抢单的账号') + return + } + const ids = this.multipleSelection.map((row) => row.id).filter(Boolean) + if (!ids.length) { + this.$message.warning('所选账号缺少有效 ID') + return + } + const accountLabels = this.multipleSelection + .map((row) => row.loginAccount || row.nickname || row.id) + .join('、') + this.$confirm( + `确定对以下 ${ids.length} 个账号发起抢单吗?\n${accountLabels}`, + '开始抢单', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + } + ).then(() => { + this.rushBuyLoading = true + return rushBuyLbBuyAccount({ ids }) + }).then((res) => { + const isSuccess = res && (res.success === true || res.code === 200 || res.code === 20000) + if (!isSuccess) { + this.$message.error((res && res.message) || '抢单失败') + return + } + this.$message.success((res && res.message) || '抢单完成') + this.fetchList() + }).catch(() => {}).finally(() => { + this.rushBuyLoading = false + }) + }, handleTenantChange(tenantId) { const option = this.tenantOptions.find((item) => item.value === tenantId) if (option && option.tenantName) { @@ -367,6 +436,9 @@ export default { }) .finally(() => { this.loading = false + this.$nextTick(() => { + this.$refs.dataTable && this.$refs.dataTable.clearSelection() + }) }) }, buildListParams() {