112 lines
2.5 KiB
JavaScript
112 lines
2.5 KiB
JavaScript
import _ from '../../commons/js/commons'
|
|
const app = getApp()
|
|
Page({
|
|
data: {
|
|
imgUrl: _.config.imgUrl,
|
|
isShowReport:false,//是否显示调拨盘点弹框
|
|
},
|
|
onLoad: function (options) {
|
|
this.getUserInfo()
|
|
},
|
|
onShow: function () {
|
|
this.setData({
|
|
isShowReport:false,//是否显示调拨盘点弹框
|
|
remindMsg:[],
|
|
});
|
|
this.getAppTransferRemind()
|
|
this.getAppInventoryRemind()
|
|
this.getAppGoodsRemind()
|
|
},
|
|
//获取用户信息
|
|
getUserInfo(){
|
|
_.apiQuery.getUserInfo().then(res => {
|
|
this.setData({
|
|
userInfo: res
|
|
})
|
|
});
|
|
},
|
|
|
|
//调拨提醒
|
|
getAppTransferRemind(){
|
|
_.apiQuery.getAppTransferRemind().then(res => {
|
|
if(res.data.total>0){
|
|
let remindMsg = this.data.remindMsg
|
|
remindMsg.push({
|
|
title:'调拨提醒',
|
|
content:'您有新的车辆调拨,需要您进行确认操作。',
|
|
img:'https://qs.haodian.cn/wechat_app/dongfeng/allot/car.gif?v=220224',
|
|
btn:{
|
|
title:'前往操作',
|
|
url:'/pages/allot/list/index',
|
|
},
|
|
})
|
|
this.setData({
|
|
remindMsg,
|
|
isShowReport:true,
|
|
})
|
|
}
|
|
});
|
|
},
|
|
|
|
//盘点提醒
|
|
getAppInventoryRemind(){
|
|
_.apiQuery.getAppInventoryRemind().then(res => {
|
|
if(res.data.total>0){
|
|
let remindMsg = this.data.remindMsg
|
|
remindMsg.push({
|
|
title:'盘点提醒',
|
|
content:'您有新的车辆盘点,需要您进行确认操作。',
|
|
img:'https://qs.haodian.cn/wechat_app/dongfeng/inventory/animation.gif',
|
|
btn:{
|
|
title:'前往操作',
|
|
url:'/pages/inventory/list/index',
|
|
},
|
|
})
|
|
this.setData({
|
|
remindMsg,
|
|
isShowReport:true,
|
|
})
|
|
}
|
|
});
|
|
},
|
|
|
|
//库存提醒/预警
|
|
getAppGoodsRemind(){
|
|
let params = {};
|
|
params['type'] = 1;
|
|
_.apiQuery.getAppGoodsRemind(params).then(res => {
|
|
this.setData({
|
|
stock:res.data,
|
|
})
|
|
wx.stopPullDownRefresh()
|
|
});
|
|
},
|
|
|
|
//推送链接
|
|
pushLink(e) {
|
|
if(e.currentTarget.dataset.url){
|
|
_.$router.openUrlScheme(e.currentTarget.dataset.url)
|
|
}
|
|
},
|
|
|
|
//显示隐藏调拨盘点弹窗
|
|
optShowReport(e){
|
|
this.setData({
|
|
isShowReport:!this.data.isShowReport,
|
|
})
|
|
},
|
|
|
|
//退出登录
|
|
logout(){
|
|
wx.clearStorage()
|
|
wx.reLaunch({
|
|
url: '/pages/login/index'
|
|
})
|
|
},
|
|
|
|
//页面相关事件处理函数--监听用户下拉动作
|
|
onPullDownRefresh: function () {
|
|
this.getAppGoodsRemind()
|
|
},
|
|
|
|
}) |