在抢购包时,指定货物包日期。
This commit is contained in:
@@ -157,6 +157,24 @@
|
|||||||
/>
|
/>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
|
<el-dialog title="选择货物包开始时间" :visible.sync="rushBuyTimeDialogVisible" width="500px" top="20vh">
|
||||||
|
<el-form label-width="120px">
|
||||||
|
<el-form-item label="货物包开始时间">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="rushBuyTime"
|
||||||
|
type="datetime"
|
||||||
|
placeholder="请选择货物包开始时间"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="rushBuyTimeDialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" :loading="rushBuyLoading" @click="handleConfirmRushBuyTime">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="760px" top="5vh" @close="resetForm">
|
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="760px" top="5vh" @close="resetForm">
|
||||||
<el-form ref="dataForm" :model="form" :rules="formRules" label-width="120px">
|
<el-form ref="dataForm" :model="form" :rules="formRules" label-width="120px">
|
||||||
<el-row :gutter="16">
|
<el-row :gutter="16">
|
||||||
@@ -349,6 +367,8 @@ export default {
|
|||||||
syncLoading: false,
|
syncLoading: false,
|
||||||
rushBuyLoading: false,
|
rushBuyLoading: false,
|
||||||
tenantLoading: false,
|
tenantLoading: false,
|
||||||
|
rushBuyTimeDialogVisible: false,
|
||||||
|
rushBuyTime: '',
|
||||||
list: [],
|
list: [],
|
||||||
selectedRowKeys: [],
|
selectedRowKeys: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
@@ -475,6 +495,15 @@ export default {
|
|||||||
this.syncLoading = false
|
this.syncLoading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getYesterdayStart() {
|
||||||
|
const date = new Date()
|
||||||
|
date.setDate(date.getDate() - 1)
|
||||||
|
date.setHours(0, 0, 0, 0)
|
||||||
|
const year = date.getFullYear()
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||||
|
const day = String(date.getDate()).padStart(2, '0')
|
||||||
|
return `${year}-${month}-${day} 00:00:00`
|
||||||
|
},
|
||||||
handleRushBuy() {
|
handleRushBuy() {
|
||||||
if (!this.multipleSelection.length) {
|
if (!this.multipleSelection.length) {
|
||||||
this.$message.warning('请先勾选要抢单的账号')
|
this.$message.warning('请先勾选要抢单的账号')
|
||||||
@@ -485,11 +514,20 @@ export default {
|
|||||||
this.$message.warning('所选账号缺少有效 ID')
|
this.$message.warning('所选账号缺少有效 ID')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.rushBuyTime = this.getYesterdayStart()
|
||||||
|
this.rushBuyTimeDialogVisible = true
|
||||||
|
},
|
||||||
|
handleConfirmRushBuyTime() {
|
||||||
|
if (!this.rushBuyTime) {
|
||||||
|
this.$message.warning('请选择货物包时间')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const ids = this.multipleSelection.map((row) => row.id).filter(Boolean)
|
||||||
const accountLabels = this.multipleSelection
|
const accountLabels = this.multipleSelection
|
||||||
.map((row) => row.loginAccount || row.nickname || row.id)
|
.map((row) => row.loginAccount || row.nickname || row.id)
|
||||||
.join('、')
|
.join('、')
|
||||||
this.$confirm(
|
this.$confirm(
|
||||||
`确定对以下 ${ids.length} 个账号发起抢单吗?\n${accountLabels}`,
|
`确定对以下 ${ids.length} 个账号发起抢单吗?\n${accountLabels}\n货物包开始时间:${this.rushBuyTime}`,
|
||||||
'开始抢单',
|
'开始抢单',
|
||||||
{
|
{
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
@@ -498,7 +536,7 @@ export default {
|
|||||||
}
|
}
|
||||||
).then(() => {
|
).then(() => {
|
||||||
this.rushBuyLoading = true
|
this.rushBuyLoading = true
|
||||||
return rushBuyLbBuyAccount({ ids })
|
return rushBuyLbBuyAccount({ ids, goodsBeginTime: this.rushBuyTime })
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
const isSuccess = res && (res.success === true || res.code === 200 || res.code === 20000)
|
const isSuccess = res && (res.success === true || res.code === 200 || res.code === 20000)
|
||||||
if (!isSuccess) {
|
if (!isSuccess) {
|
||||||
@@ -506,6 +544,7 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.$message.success((res && res.message) || '抢单完成')
|
this.$message.success((res && res.message) || '抢单完成')
|
||||||
|
this.rushBuyTimeDialogVisible = false
|
||||||
this.fetchList()
|
this.fetchList()
|
||||||
}).catch(() => {}).finally(() => {
|
}).catch(() => {}).finally(() => {
|
||||||
this.rushBuyLoading = false
|
this.rushBuyLoading = false
|
||||||
|
|||||||
Reference in New Issue
Block a user