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.
162 lines
5.7 KiB
162 lines
5.7 KiB
// pages/index/index.js
|
|
import { getStatisticsInfo } from "../../../api/saas"
|
|
import util from '../../../utils/util'
|
|
const event = require('../../../utils/event')
|
|
const app = getApp()
|
|
|
|
Component({
|
|
options: {
|
|
addGlobalClass: true,
|
|
multipleSlots: true
|
|
},
|
|
/** 页面的初始数据 */
|
|
data: {
|
|
height: app.globalData.safeFragmentHeight,
|
|
tabList: [
|
|
{ status: 1, badge: '', name: '定价', icon: '/assets/image/icon_pricing.png' },
|
|
{ status: 2, badge: '', name: '过磅审核', icon: '/assets/image/icon_checking.png' },
|
|
{ status: 3, badge: '', name: '待付款', icon: '/assets/image/icon_payment.png' },
|
|
{ status: 4, badge: '', name: '已完成', icon: '/assets/image/icon_finish.png' }
|
|
],
|
|
tabList1: [
|
|
{ status: 0, badge: '', name: '待收货', icon: '/assets/image/icon-dsh.png' },
|
|
{ status: 1, badge: '', name: '待定价', icon: '/assets/image/icon_pricing.png' },
|
|
{ status: 4, badge: '', name: '待付款', icon: '/assets/image/icon_payment.png' },
|
|
{ status: 5, badge: '', name: '已完成', icon: '/assets/image/icon_finish.png' }
|
|
],
|
|
show: false,
|
|
totalInfo: {
|
|
totalMoney: 0,
|
|
totalWeight: 0,
|
|
availableCreditLine: 0,
|
|
usedCreditLine: 0
|
|
},
|
|
form: {
|
|
type: 3,
|
|
startTime: '',
|
|
endTime: '',
|
|
},
|
|
vdate: [],
|
|
vdateString: '',
|
|
actions: [
|
|
{ id: 1, name: '厂内收货' },
|
|
{ id: 2, name: '厂外收货' },
|
|
{ id: '', name: '全部' }
|
|
],
|
|
sheetStr: '全部',
|
|
sheet: false
|
|
},
|
|
lifetimes: {
|
|
attached: function () {
|
|
wx.showLoading({ title: '加载中', mask: true })
|
|
event.on('EventMessage', this, this.onEvent)
|
|
},
|
|
detached: function () {
|
|
event.remove('EventMessage', this)
|
|
}
|
|
},
|
|
methods: {
|
|
onRestart: function () {
|
|
if(!this.data.firstShow) {
|
|
var min = new Date()
|
|
var max = new Date(min.getTime() + 24 * 60 * 60 * 1000)
|
|
var vdateString = util.formatDate(min, 'Y-M-D')
|
|
this.data.form.startTime = util.formatDate(min, 'Y-M-D') + ' 00:00:00'
|
|
this.data.form.endTime = util.formatDate(max, 'Y-M-D') + ' 00:00:00'
|
|
this.setData({ height: app.globalData.safeFragmentHeight - 100, vdateString })
|
|
// const worker = wx.createWorker('/workers/process.js')
|
|
// worker.postMessage({ x : 10, y : 2 })
|
|
// worker.onMessage(function(res){
|
|
// console.log('这是主线程打印的')
|
|
// console.log(res)
|
|
// })
|
|
wx.hideLoading()
|
|
}
|
|
this.data.firstShow = true
|
|
this.fetchStatisticsInfo()
|
|
},
|
|
onEvent: function (message) {
|
|
if (message.what == 888) {
|
|
}
|
|
},
|
|
orderList: function (e) {
|
|
wx.navigateTo({ url: '/pages/process/order-list/index' })
|
|
},
|
|
agentList: function (e) {
|
|
wx.navigateTo({ url: '/pages/process/agent-list/index' })
|
|
},
|
|
checkList: function (e) {
|
|
if(e.currentTarget.dataset.status == 3){
|
|
wx.navigateTo({ url: '/pages/process/payment-list/index?status=' + e.currentTarget.dataset.status })
|
|
} else if(e.currentTarget.dataset.status == 4){
|
|
wx.navigateTo({ url: '/pages/process/order-list/index?status=' + e.currentTarget.dataset.status })
|
|
} else {
|
|
wx.navigateTo({ url: '/pages/process/check-list/index?status=' + e.currentTarget.dataset.status })
|
|
}
|
|
},
|
|
outsideList: function(e){
|
|
if(!util.isEmpty(e.currentTarget.dataset.status) || Number(e.currentTarget.dataset.status) == 0){
|
|
wx.navigateTo({ url: `/pages/process/outside-list/index?status=${e.currentTarget.dataset.status}` })
|
|
} else {
|
|
wx.navigateTo({ url: `/pages/process/outside-list/index` })
|
|
}
|
|
},
|
|
fetchStatisticsInfo: function(loading){
|
|
getStatisticsInfo(this.data.form).then(result => {
|
|
if(Number(result.data.priceOrderNum) > 0){
|
|
this.data.tabList[0].badge = Number(result.data.priceOrderNum)
|
|
} else {
|
|
this.data.tabList[0].badge = ''
|
|
}
|
|
if(Number(result.data.waitAuditOrderNum) > 0){
|
|
this.data.tabList[1].badge = Number(result.data.waitAuditOrderNum)
|
|
} else {
|
|
this.data.tabList[1].badge = ''
|
|
}
|
|
if(Number(result.data.waitPayOrderNum) > 0){
|
|
this.data.tabList[2].badge = Number(result.data.waitPayOrderNum)
|
|
} else {
|
|
this.data.tabList[2].badge = ''
|
|
}
|
|
|
|
if(Number(result.data.offsiteWaitReceiptNum) > 0){
|
|
this.data.tabList1[0].badge = Number(result.data.offsiteWaitReceiptNum)
|
|
} else {
|
|
this.data.tabList1[0].badge = ''
|
|
}
|
|
if(Number(result.data.offsiteWaitPriceNum) > 0){
|
|
this.data.tabList1[1].badge = Number(result.data.offsiteWaitPriceNum)
|
|
} else {
|
|
this.data.tabList1[1].badge = ''
|
|
}
|
|
if(Number(result.data.offsiteWaitPayOrderNum) > 0){
|
|
this.data.tabList1[2].badge = Number(result.data.offsiteWaitPayOrderNum)
|
|
} else {
|
|
this.data.tabList1[2].badge = ''
|
|
}
|
|
if(Number(result.data.offsiteCompleted) > 0){
|
|
this.data.tabList1[3].badge = Number(result.data.offsiteCompleted)
|
|
} else {
|
|
this.data.tabList1[3].badge = ''
|
|
}
|
|
if(util.isEmpty(result.data.availableCreditLine)){
|
|
result.data.availableCreditLine = app.userInfo.availableCreditLine
|
|
}
|
|
if(util.isEmpty(result.data.usedCreditLine)){
|
|
result.data.usedCreditLine = app.userInfo.usedCreditLine
|
|
}
|
|
this.setData({ tabList: this.data.tabList, tabList1: this.data.tabList1, totalInfo: result.data })
|
|
if(loading){
|
|
wx.hideLoading()
|
|
}
|
|
}).catch(err => {
|
|
if(loading){
|
|
wx.hideLoading()
|
|
}
|
|
})
|
|
},
|
|
report: function(){
|
|
wx.navigateTo({ url: `/xtends/statics/index/index` })
|
|
}
|
|
}
|
|
})
|