调整
This commit is contained in:
@@ -235,6 +235,7 @@
|
|||||||
total: 0,
|
total: 0,
|
||||||
isBegin: false,
|
isBegin: false,
|
||||||
choosedList: [],
|
choosedList: [],
|
||||||
|
choosedSnMallList: [],
|
||||||
arr: [],
|
arr: [],
|
||||||
robTotal: 0,
|
robTotal: 0,
|
||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
@@ -411,12 +412,19 @@
|
|||||||
Message.error('请添加备货单');
|
Message.error('请添加备货单');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.choosedSnMallList = this.choosedList.map(item => {
|
||||||
|
return {sn: item.subPurchaseOrderSn, mallId: item.mallId}
|
||||||
|
})
|
||||||
|
|
||||||
this.robTotal = this.choosedList.length
|
this.robTotal = this.choosedList.length
|
||||||
this.isBegin = true;
|
this.isBegin = true;
|
||||||
this.timer = [];
|
this.timer = [];
|
||||||
|
|
||||||
for (let i = 0;i < this.choosedList.length; i++) {
|
if (0 == this.robMode) {
|
||||||
|
this.rob()
|
||||||
|
}
|
||||||
|
|
||||||
|
/*for (let i = 0;i < this.choosedList.length; i++) {
|
||||||
if (0 == this.robMode) {
|
if (0 == this.robMode) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.rob(this.choosedList[i].subPurchaseOrderSn, this.choosedList[i].mallId)
|
this.rob(this.choosedList[i].subPurchaseOrderSn, this.choosedList[i].mallId)
|
||||||
@@ -427,7 +435,7 @@
|
|||||||
this.timer.push({id: this.choosedList[i].subPurchaseOrderSn, timer: t})
|
this.timer.push({id: this.choosedList[i].subPurchaseOrderSn, timer: t})
|
||||||
}, 100 * i)
|
}, 100 * i)
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
let _this = this;
|
let _this = this;
|
||||||
let tt = setInterval(function() {
|
let tt = setInterval(function() {
|
||||||
@@ -443,7 +451,13 @@
|
|||||||
_this.rob(sn, mallId);
|
_this.rob(sn, mallId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
rob(sn, mallId) {
|
rob() {
|
||||||
|
let obj = this.choosedSnMallList.shift()
|
||||||
|
if (!obj || !this.isBegin) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let sn = obj.sn
|
||||||
|
let mallId = obj.mallId
|
||||||
sendChromeAPIMessage({
|
sendChromeAPIMessage({
|
||||||
url: 'oms/bg/venom/api/supplier/purchase/manager/joinDeliveryGoodsOrderPlatform',
|
url: 'oms/bg/venom/api/supplier/purchase/manager/joinDeliveryGoodsOrderPlatform',
|
||||||
needMallId: true,
|
needMallId: true,
|
||||||
@@ -461,7 +475,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (let j = 0; j < this.choosedList.length; j++) {
|
for (let j = 0; j < this.choosedList.length; j++) {
|
||||||
if (this.choosedList[j].subPurchaseOrderSn == sn) {
|
if (this.choosedList[j].subPurchaseOrderSn == sn) {
|
||||||
this.successList.push(this.choosedList[j])
|
this.successList.push(this.choosedList[j])
|
||||||
@@ -477,23 +490,30 @@
|
|||||||
this.createDeliveryBill(sn, mallId)
|
this.createDeliveryBill(sn, mallId)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
this.choosedSnMallList.push(obj)
|
||||||
for (let j = 0; j < this.choosedList.length; j++) {
|
for (let j = 0; j < this.choosedList.length; j++) {
|
||||||
if (this.choosedList[j].subPurchaseOrderSn == sn) {
|
if (this.choosedList[j].subPurchaseOrderSn == sn) {
|
||||||
this.choosedList[j].robTotal ++;
|
this.choosedList[j].robTotal ++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (0 == this.robMode) {
|
/*if (0 == this.robMode) {
|
||||||
if (this.isBegin) {
|
if (this.isBegin) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.rob(sn, mallId)
|
this.rob(sn, mallId)
|
||||||
}, this.choosedList.length * this.step + Math.floor((Math.random() * this.randomValue) + 1))
|
}, this.choosedList.length * this.step)
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
if (!res.errorCode && res.error_code) {
|
if (!res.errorCode && res.error_code) {
|
||||||
this.networkErrorCount ++
|
this.networkErrorCount ++
|
||||||
}
|
}
|
||||||
|
if (0 == this.robMode) {
|
||||||
|
// 继续抢
|
||||||
|
setTimeout(() => {
|
||||||
|
this.rob()
|
||||||
|
}, this.step + Math.floor(Math.random() * this.randomValue))
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
createDeliveryBill(sn, mallId) {
|
createDeliveryBill(sn, mallId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user