You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
108 lines
4.2 KiB
108 lines
4.2 KiB
// pages/index/index.js
|
|
import { getStatisticsInfo } from "../../../api/saas"
|
|
const event = require('../../../utils/event')
|
|
const app = getApp()
|
|
|
|
Component({
|
|
options: {
|
|
addGlobalClass: true,
|
|
multipleSlots: true
|
|
},
|
|
/** 页面的初始数据 */
|
|
data: {
|
|
height: app.globalData.safeFragmentHeight,
|
|
tabList2: [
|
|
{ status: 1, badge: '', name: '磅单信息', icon: '/assets/image/icon_pound.png' },
|
|
{ status: 2, badge: '', name: '出货审核', icon: '/assets/image/icon_outcheck.png' },
|
|
{ status: 3, badge: '', name: '待收款', icon: '/assets/image/icon_payback.png' },
|
|
{ status: 4, badge: '', name: '已完成', icon: '/assets/image/icon_complete.png' }
|
|
],
|
|
form: { startTime: '', endTime: ''}
|
|
},
|
|
lifetimes: {
|
|
attached: function () {
|
|
event.on('EventMessage', this, this.onEvent)
|
|
},
|
|
detached: function () {
|
|
event.remove('EventMessage', this)
|
|
}
|
|
},
|
|
methods: {
|
|
onRestart: function () {
|
|
if(!this.data.firstShow) {
|
|
var height = app.globalData.safeFragmentHeight - 100
|
|
if(app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0){
|
|
var tabList2 = [
|
|
{ status: 1, badge: '', name: '磅单信息', icon: '/assets/image/icon_pound.png' },
|
|
{ status: 2, badge: '', name: '出货审核', icon: '/assets/image/icon_outcheck.png' },
|
|
{ status: 3, badge: '', name: '待收款', icon: '/assets/image/icon_payback.png' },
|
|
{ status: 4, badge: '', name: '已完成', icon: '/assets/image/icon_complete.png' }
|
|
]
|
|
this.setData({height, tabList2})
|
|
} else {
|
|
var tabList2 = [
|
|
{ status: 1, badge: '', name: '磅单信息', icon: '/assets/image/icon_pound.png' },
|
|
{ status: 3, badge: '', name: '待收款', icon: '/assets/image/icon_payback.png' },
|
|
{ status: 4, badge: '', name: '已完成', icon: '/assets/image/icon_complete.png' }
|
|
]
|
|
this.setData({height, tabList2 })
|
|
}
|
|
}
|
|
this.fetchStatisticsInfo()
|
|
this.data.firstShow = true
|
|
},
|
|
onEvent: function (message) {
|
|
if (message.what == 888) {
|
|
}
|
|
},
|
|
outList: function(e){
|
|
if(e.currentTarget.dataset.status == 1){
|
|
wx.navigateTo({ url: '/pages/storage/pound-list/index' })
|
|
} else if(e.currentTarget.dataset.status == 2){
|
|
wx.navigateTo({ url: '/pages/storage/order-list/index?status=0' })
|
|
} else if(e.currentTarget.dataset.status == 3){
|
|
wx.navigateTo({ url: '/pages/storage/order-list/index?status=1' })
|
|
} else if(e.currentTarget.dataset.status == 4){
|
|
wx.navigateTo({ url: '/pages/storage/order-list/index?status=2' })
|
|
} else {
|
|
wx.navigateTo({ url: '/pages/storage/order-list/index' })
|
|
}
|
|
},
|
|
fetchStatisticsInfo: function(loading){
|
|
getStatisticsInfo(this.data.form).then(result => {
|
|
if(Number(result.data.weightNoteNum) > 0){
|
|
this.data.tabList2[0].badge = Number(result.data.weightNoteNum)
|
|
} else {
|
|
this.data.tabList2[0].badge = ''
|
|
}
|
|
if(app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0){
|
|
if(Number(result.data.outboundDeliveryOrderAuditNum) > 0){
|
|
this.data.tabList2[1].badge = Number(result.data.outboundDeliveryOrderAuditNum)
|
|
} else {
|
|
this.data.tabList2[1].badge = ''
|
|
}
|
|
if(Number(result.data.outboundDeliveryOrderWaitReceiptNum) > 0){
|
|
this.data.tabList2[2].badge = Number(result.data.outboundDeliveryOrderWaitReceiptNum)
|
|
} else {
|
|
this.data.tabList2[2].badge = ''
|
|
}
|
|
} else {
|
|
if(Number(result.data.outboundDeliveryOrderWaitReceiptNum) > 0){
|
|
this.data.tabList2[1].badge = Number(result.data.outboundDeliveryOrderWaitReceiptNum)
|
|
} else {
|
|
this.data.tabList2[1].badge = ''
|
|
}
|
|
}
|
|
// var vdateString = util.formatDate(new Date(vdate[0]), 'Y-M-D') + '至' + util.formatDate(new Date(vdate[1]), 'Y-M-D')
|
|
this.setData({ tabList2: this.data.tabList2 })
|
|
if(loading){
|
|
wx.hideLoading()
|
|
}
|
|
}).catch(err => {
|
|
if(loading){
|
|
wx.hideLoading()
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|