封装函数

This commit is contained in:
yanran200730
2023-08-08 11:08:09 +08:00
parent aea8585182
commit 3b1de45fbf
4 changed files with 74 additions and 42 deletions

View File

@@ -279,46 +279,50 @@
}
return;
}
this.$http.post('/api/malluser/info').then(res => {
if (res.code == 0) {
this.$store.commit('setUserInfo', res.data)
if (res.data.flag != 1) {
Message.error('您的账号未激活或已失效,请激活后使用')
this.$store.commit('setActiveDlgShow', true)
return;
}
if (res.data.type != 4 && this.$store.state.mallId != this.$store.state.userInfo.mallId) {
Message.error('您当前登录的TEMU账号与会员绑定账号不一致')
return;
}
if (this.choosedList.length <= 0) {
Message.error('请选择备货单');
return;
}
this.robTotal = this.choosedList.length
this.isBegin = true;
this.timer = [];
for (let i = 0;i < this.choosedList.length; i++) {
setTimeout(() => {
let t = setInterval(this.robFunc(this.choosedList[i].subPurchaseOrderSn, this.choosedList[i].mallId), 1000);
this.timer.push({id: this.choosedList[i].subPurchaseOrderSn, timer: t})
}, 100 * i)
}
let _this = this;
let tt = setInterval(function() {
if (_this.choosedList.length == 0) {
_this.isBegin = false;
clearInterval(tt);
}
}, 1000)
} else {
console.log("获取用户信息失败")
this.$userCheck.then(() => {
if (this.choosedList.length <= 0) {
Message.error('请选择备货单');
return;
}
});
this.robTotal = this.choosedList.length
this.isBegin = true;
this.timer = [];
for (let i = 0;i < this.choosedList.length; i++) {
setTimeout(() => {
let t = setInterval(this.robFunc(this.choosedList[i].subPurchaseOrderSn, this.choosedList[i].mallId), 1000);
this.timer.push({id: this.choosedList[i].subPurchaseOrderSn, timer: t})
}, 100 * i)
}
let _this = this;
let tt = setInterval(function() {
if (_this.choosedList.length == 0) {
_this.isBegin = false;
clearInterval(tt);
}
}, 1000)
}).catch((err) => {
console.log(err)
})
// this.$http.post('/api/malluser/info').then(res => {
// if (res.code == 0) {
// this.$store.commit('setUserInfo', res.data)
// if (res.data.flag != 1) {
// Message.error('您的账号未激活或已失效,请激活后使用')
// this.$store.commit('setActiveDlgShow', true)
// return;
// }
// if (res.data.type != 4 && this.$store.state.mallId != this.$store.state.userInfo.mallId) {
// Message.error('您当前登录的TEMU账号与会员绑定账号不一致')
// return;
// }
// } else {
// console.log("获取用户信息失败")
// }
// });
},
robFunc(sn, mallId) {
let _this = this;