封装函数
This commit is contained in:
@@ -50,10 +50,13 @@ export default new Vuex.Store({
|
|||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
getUserInfo (store) {
|
getUserInfo (store) {
|
||||||
request.post('/api/malluser/info').then(res => {
|
return new Promise(resolve => {
|
||||||
if (res.code === 0) {
|
request.post('/api/malluser/info').then(res => {
|
||||||
store.commit('setUserInfo', res.data)
|
if (res.code === 0) {
|
||||||
}
|
store.commit('setUserInfo', res.data)
|
||||||
|
resolve(res.data)
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import request from '../api'
|
import request from '../api'
|
||||||
|
import store from '../store'
|
||||||
|
import { Message } from 'element-ui'
|
||||||
|
|
||||||
const dict = {
|
const dict = {
|
||||||
url: "/dictionary/queryValsByCodeList",
|
url: "/dictionary/queryValsByCodeList",
|
||||||
@@ -88,9 +90,30 @@ const dateUtil = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const userCheck = () => {
|
||||||
|
store.dispatch('getUserInfo').then(res => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (res.data.flag != 1) {
|
||||||
|
Message.error('您的账号未激活或已失效,请激活后使用')
|
||||||
|
this.$store.commit('setActiveDlgShow', true)
|
||||||
|
reject('您的账号未激活或已失效,请激活后使用')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (res.data.type != 4 && this.$store.state.mallId != this.$store.state.userInfo.mallId) {
|
||||||
|
Message.error('您当前登录的TEMU账号与会员绑定账号不一致')
|
||||||
|
reject('您当前登录的TEMU账号与会员绑定账号不一致')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(res.data)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
dict,
|
dict,
|
||||||
dateUtil,
|
dateUtil,
|
||||||
|
userCheck
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,9 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
created () {
|
created () {
|
||||||
|
this.$store.dispatch('getUserInfo').then(e => {
|
||||||
|
console.log(e)
|
||||||
|
})
|
||||||
this.getCateList()
|
this.getCateList()
|
||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
@@ -89,7 +92,6 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
collection (id, isFavorite) {
|
collection (id, isFavorite) {
|
||||||
console.log(isFavorite)
|
|
||||||
this.$confirm(isFavorite === '0' ? '确定收藏该文章?' : '确定取消收藏?', '温馨提示', {
|
this.$confirm(isFavorite === '0' ? '确定收藏该文章?' : '确定取消收藏?', '温馨提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
callback: action => {
|
callback: action => {
|
||||||
|
|||||||
@@ -279,46 +279,50 @@
|
|||||||
}
|
}
|
||||||
return;
|
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.$userCheck.then(() => {
|
||||||
this.isBegin = true;
|
if (this.choosedList.length <= 0) {
|
||||||
this.timer = [];
|
Message.error('请选择备货单');
|
||||||
|
return;
|
||||||
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.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) {
|
robFunc(sn, mallId) {
|
||||||
let _this = this;
|
let _this = this;
|
||||||
|
|||||||
Reference in New Issue
Block a user