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.
100 lines
3.6 KiB
100 lines
3.6 KiB
import Scene from '../../../pages/index/scene'
|
|
import { getSalesReport } from "../../../api/saas"
|
|
import util from '../../../utils/util'
|
|
|
|
const app = getApp()
|
|
const columns1 = [
|
|
{ prop: 'productCategoryName', width: 200, label: '品类', color: '#55C355' },
|
|
{ prop: 'outboundDeliveryNetWeight', width: 180, label: '出货重量(吨)' },
|
|
{ prop: 'settleWeight', width: 180, label: '结算重量(吨)' },
|
|
{ prop: 'settleAvgPrice ', width: 220, label: '结算均价(元/吨)' },
|
|
{ prop: 'settlePrice', width: 180, label: '结算金额(元)' }
|
|
]
|
|
const columns2 = [
|
|
{ prop: 'productCategoryName', width: 200, label: '品类', color: '#55C355' },
|
|
{ prop: 'outboundDeliveryNetWeight ', width: 185, label: '出货重量(吨)' },
|
|
{ prop: 'netWeight', width: 180, label: '纸厂净重(吨)' },
|
|
{ prop: 'differenceWeight ', width: 185, label: '差异重量(吨)' }
|
|
]
|
|
const columns3 = [
|
|
{ prop: 'productCategoryName', width: 200, label: '品类', color: '#55C355' },
|
|
{ prop: 'netWeight', width: 185, label: '纸厂净重(吨)' },
|
|
{ prop: 'settleWeight', width: 185, label: '结算重量(吨)' },
|
|
{ prop: 'avgDeductPercent ', width: 180, label: '平均扣点(%)' }
|
|
]
|
|
|
|
Scene({
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
height: app.globalData.fragmentHeight,
|
|
form: {},
|
|
columnsList: [ columns1, columns2, columns3 ],
|
|
columns: columns1,
|
|
reportInfo:{
|
|
productSalesDailyReportList: [],
|
|
carNumber: 0,
|
|
totalOutboundDeliveryNetWeight: 0,
|
|
totalSettlePrice: 0,
|
|
totalSettleWeight: 0
|
|
},
|
|
show: false
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
wx.showLoading({ title: '加载中', mask: true })
|
|
var min = new Date()
|
|
min.setFullYear(min.getFullYear() - 1, min.getMonth(), min.getDate())
|
|
min.setHours(0, 0, 0)
|
|
var minDate = min.getTime()
|
|
var max = new Date(new Date().getTime() + 24 * 60 * 60 * 1000)
|
|
max.setHours(0, 0, 0)
|
|
var maxDate = max.getTime()
|
|
var today = new Date()
|
|
today.setHours(0, 0, 0)
|
|
var vdate = [today.getTime(), maxDate]
|
|
var vdateString = util.formatDate(new Date(), 'Y-M-D') + '至' + util.formatDate(max, 'Y-M-D')
|
|
this.data.form.dimensionDateStart = util.formatDate(today, 'Y-M-D')
|
|
this.data.form.dimensionDateEnd = util.formatDate(max, 'Y-M-D')
|
|
this.setData({ height: app.globalData.fragmentHeight - 494, minDate, maxDate, vdate, vdateString })
|
|
this.fetchStatisticsInfo()
|
|
},
|
|
showCalendar: function(){
|
|
this.setData({ show: true })
|
|
},
|
|
onClose: function() {
|
|
this.setData({ show: false })
|
|
},
|
|
onTabChange: function ({ detail }) {
|
|
if (this.data.tabIndex == Number(detail.index)) {
|
|
return
|
|
}
|
|
this.setData({ columns: this.data.columnsList[detail.index] })
|
|
this.data.tabIndex = Number(detail.index)
|
|
},
|
|
onSelect: function({detail}) {
|
|
var start = new Date(detail[0])
|
|
var end = new Date(detail[1])
|
|
var vdateString = util.formatDate(start, 'Y-M-D') + '至' + util.formatDate(end, 'Y-M-D')
|
|
this.data.form.dimensionDateStart = util.formatDate(start, 'Y-M-D')
|
|
this.data.form.dimensionDateEnd = util.formatDate(end, 'Y-M-D')
|
|
this.setData({ show: false, vdateString })
|
|
wx.showLoading({ title: '加载中', mask: true })
|
|
this.fetchStatisticsInfo()
|
|
},
|
|
fetchStatisticsInfo: function(){
|
|
getSalesReport(this.data.form).then(result => {
|
|
wx.hideLoading()
|
|
if(result.data){
|
|
this.setData({reportInfo: result.data})
|
|
} else {
|
|
this.setData({ reportInfo: { productSalesDailyReportList: [], totalOutboundDeliveryNetWeight: 0, totalSettlePrice: 0, totalSettleWeight: 0 } })
|
|
}
|
|
}).catch(err => {
|
|
wx.hideLoading()
|
|
})
|
|
}
|
|
})
|