增加抢单
This commit is contained in:
@@ -30,3 +30,13 @@ export function deleteLbBuyAccount(id) {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 按选中抢单账号批量抢购,可能较慢 */
|
||||||
|
export function rushBuyLbBuyAccount(data) {
|
||||||
|
return request({
|
||||||
|
url: '/lbBuyAccount/rush-buy',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
timeout: 120000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -55,16 +55,34 @@
|
|||||||
|
|
||||||
<el-card class="action-container" shadow="never">
|
<el-card class="action-container" shadow="never">
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
icon="el-icon-shopping-cart-full"
|
||||||
|
:loading="rushBuyLoading"
|
||||||
|
:disabled="!multipleSelection.length"
|
||||||
|
style="margin-left: 12px"
|
||||||
|
@click="handleRushBuy"
|
||||||
|
>
|
||||||
|
开始抢单
|
||||||
|
</el-button>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<el-card class="table-container" shadow="never">
|
<el-card class="table-container" shadow="never">
|
||||||
<el-table v-loading="loading" :data="list" style="width: 100%">
|
<el-table
|
||||||
|
ref="dataTable"
|
||||||
|
v-loading="loading"
|
||||||
|
:data="list"
|
||||||
|
style="width: 100%"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column label="租户ID" prop="tenantId" min-width="180" show-overflow-tooltip />
|
<el-table-column label="租户ID" prop="tenantId" min-width="180" show-overflow-tooltip />
|
||||||
<el-table-column label="租户名称" prop="tenantName" min-width="120" show-overflow-tooltip />
|
<el-table-column label="租户名称" prop="tenantName" min-width="120" show-overflow-tooltip />
|
||||||
<el-table-column label="登录账号" prop="loginAccount" min-width="120" show-overflow-tooltip />
|
<el-table-column label="登录账号" prop="loginAccount" min-width="120" show-overflow-tooltip />
|
||||||
<el-table-column label="昵称" prop="nickname" min-width="100" show-overflow-tooltip />
|
<el-table-column label="昵称" prop="nickname" min-width="100" show-overflow-tooltip />
|
||||||
<el-table-column label="抢购单数" prop="maxGrabCount" width="90" align="center" />
|
<el-table-column label="抢购单数" prop="maxGrabCount" width="90" align="center" />
|
||||||
<el-table-column label="最大金额" prop="maxGrabAmount" width="90" align="center" />
|
<el-table-column label="最大金额" prop="maxGrabAmount" width="90" align="center" />
|
||||||
|
<el-table-column label="前端Token" prop="tokenFront" min-width="160" show-overflow-tooltip />
|
||||||
<el-table-column label="推荐人手机" prop="referrerPhone" min-width="120" show-overflow-tooltip />
|
<el-table-column label="推荐人手机" prop="referrerPhone" min-width="120" show-overflow-tooltip />
|
||||||
<el-table-column label="推荐人姓名" prop="referrerName" min-width="100" show-overflow-tooltip />
|
<el-table-column label="推荐人姓名" prop="referrerName" min-width="100" show-overflow-tooltip />
|
||||||
<el-table-column label="登录网址" prop="loginUrl" min-width="160" show-overflow-tooltip />
|
<el-table-column label="登录网址" prop="loginUrl" min-width="160" show-overflow-tooltip />
|
||||||
@@ -158,6 +176,14 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<el-form-item label="前端token" prop="tokenFront">
|
||||||
|
<el-input
|
||||||
|
v-model="form.tokenFront"
|
||||||
|
type="textarea"
|
||||||
|
:rows="2"
|
||||||
|
placeholder="前端 token"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<el-row :gutter="16">
|
<el-row :gutter="16">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="推荐人手机" prop="referrerPhone">
|
<el-form-item label="推荐人手机" prop="referrerPhone">
|
||||||
@@ -243,6 +269,7 @@ import {
|
|||||||
addLbBuyAccount,
|
addLbBuyAccount,
|
||||||
deleteLbBuyAccount,
|
deleteLbBuyAccount,
|
||||||
getLbBuyAccountList,
|
getLbBuyAccountList,
|
||||||
|
rushBuyLbBuyAccount,
|
||||||
updateLbBuyAccount
|
updateLbBuyAccount
|
||||||
} from '@/api/lb-buy-account'
|
} from '@/api/lb-buy-account'
|
||||||
import { getAllTenantList } from '@/api/tenant'
|
import { getAllTenantList } from '@/api/tenant'
|
||||||
@@ -258,6 +285,7 @@ const DEFAULT_FORM = () => ({
|
|||||||
referrerPhone: '',
|
referrerPhone: '',
|
||||||
referrerName: '',
|
referrerName: '',
|
||||||
loginUrl: '',
|
loginUrl: '',
|
||||||
|
tokenFront: '',
|
||||||
maxGrabAmount: undefined,
|
maxGrabAmount: undefined,
|
||||||
maxGrabCount: undefined,
|
maxGrabCount: undefined,
|
||||||
latestRechargePoints: undefined,
|
latestRechargePoints: undefined,
|
||||||
@@ -278,8 +306,10 @@ export default {
|
|||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
submitLoading: false,
|
submitLoading: false,
|
||||||
|
rushBuyLoading: false,
|
||||||
tenantLoading: false,
|
tenantLoading: false,
|
||||||
list: [],
|
list: [],
|
||||||
|
multipleSelection: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
tenantOptions: [],
|
tenantOptions: [],
|
||||||
createTimeRange: [],
|
createTimeRange: [],
|
||||||
@@ -341,6 +371,45 @@ export default {
|
|||||||
this.tenantLoading = false
|
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) {
|
handleTenantChange(tenantId) {
|
||||||
const option = this.tenantOptions.find((item) => item.value === tenantId)
|
const option = this.tenantOptions.find((item) => item.value === tenantId)
|
||||||
if (option && option.tenantName) {
|
if (option && option.tenantName) {
|
||||||
@@ -367,6 +436,9 @@ export default {
|
|||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.dataTable && this.$refs.dataTable.clearSelection()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
buildListParams() {
|
buildListParams() {
|
||||||
|
|||||||
Reference in New Issue
Block a user