This commit is contained in:
liushiwei
2023-08-18 10:03:50 +08:00
parent 27f9c7a874
commit e7200de6a0
4 changed files with 160 additions and 6 deletions

View File

@@ -19,7 +19,7 @@
<!--<el-button type="primary" :disabled="isBegin" @click="isShow = true">添加备货单</el-button>
<el-button type="primary" :disabled="isBegin" @click="loadAll">一键加载全部</el-button>-->
</el-dropdown>
<el-button v-if="!isBegin" type="button" :class="'el-button el-button--primary'" @click="handleRobClick('normal')">开始抢仓</el-button>
<el-button v-if="!isBegin" type="button" :class="'el-button el-button--primary'" @click="robDlgShow = true">开始抢仓</el-button>
<!--<el-dropdown @command="handleRobClick" v-if="!isBegin">
<el-button type="button" :class="'el-button el-button--primary'">开始抢仓</el-button>
<el-dropdown-menu slot="dropdown">
@@ -192,6 +192,38 @@
<el-button @click="successDlgShow = false"> </el-button>
</span>
</AiDialog>
<AiDialog
title="抢仓设置"
:visible.sync="robDlgShow"
:close-on-click-modal="false"
customFooter
width="600px">
<el-alert
title="抢仓速度 = 频率 + 0~变动值之间的随机数如频率设置为1.5秒变动值为500毫秒则抢仓速度为1.5秒~2秒。"
type="success"
:closable="false">
</el-alert>
<el-form :model="robForm" ref="robForm" label-width="120px" class="form">
<el-form-item
prop="step"
label="频率:"
:rules="[{ required: true, message: '请选择抢仓频率', trigger: 'blur' }]">
<ai-select :selectList="$dict.getDict('rob_frequency')" v-model="robForm.step"></ai-select>
</el-form-item>
<el-form-item
prop="randomValue"
label="变动值(毫秒)"
:rules="[{ required: true, message: '请输入变动值', trigger: 'blur' }]">
<el-input size="small" placeholder="请输入变动值" type="number" v-model="robForm.randomValue"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="robDlgShow = false"> </el-button>
<el-button type="primary" @click="beforeBegin"> </el-button>
</span>
</AiDialog>
</template>
</ai-list>
</div>
@@ -240,8 +272,10 @@
robTotal: 0,
pageSize: 100,
currentPage: 1,
step: 500,
randomValue: 500,
robForm: {
step: "1000",
randomValue: 1000
},
timer: [],
loadMallIndex: 0,
loadMode: 0, // 加载模式0表示单个店铺加载1表示一键加载
@@ -254,6 +288,8 @@
successDlgShow: false,
successMallId: '',
successList: [],
robDlgShow: false,
}
},
@@ -270,6 +306,7 @@
},
created () {
this.$dict.load('rob_frequency');
},
methods: {
@@ -323,6 +360,14 @@
this.loadAll()
}
},
beforeBegin() {
this.$refs.robForm.validate((valid) => {
if (valid) {
this.handleRobClick('normal')
this.robDlgShow = false
}
})
},
handleRobClick (e) {
this.networkErrorCount = 0
@@ -513,7 +558,7 @@
// 继续抢
setTimeout(() => {
this.rob()
}, this.step + Math.floor(Math.random() * this.randomValue))
}, parseInt(this.robForm.step) + Math.floor(Math.random() * parseInt(this.robForm.randomValue)))
}
})
},