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.
134 lines
4.0 KiB
134 lines
4.0 KiB
// pages/stock/index.js
|
|
const util = require('../../../utils/util')
|
|
const math = require('../../../utils/math') //导入模块
|
|
const app = getApp()
|
|
|
|
import { getPaperMillOfInformationList } from "../../../api/ztb"
|
|
import { getPreferList } from "../../../api/moment"
|
|
Component({
|
|
options: {
|
|
addGlobalClass: true,
|
|
multipleSlots: true
|
|
},
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
height: app.globalData.safeFragmentHeight - 190,
|
|
safeBottom: app.globalData.safeBottom,
|
|
orderList: [],
|
|
tableSgin: null,
|
|
loading:false,
|
|
pximg:'/assets/info/px-sx.png',
|
|
curDate: util.formatDate(new Date(), 'Y-M-D'),
|
|
querFrom:{
|
|
curDate: util.formatDate(new Date(), 'Y-M-D'),
|
|
queryWay: 0,
|
|
priceSort:1
|
|
},
|
|
factoryList:[],
|
|
scorllHeight:app.globalData.safeFragmentHeight
|
|
},
|
|
methods: {
|
|
onRestart: function () {
|
|
this.setData({
|
|
StatusBar: app.globalData.StatusBar || 40,
|
|
CustomBar: app.globalData.CustomBar || (app.globalData.isIos ? 64 : 80),
|
|
scorllHeight:app.globalData.safeFragmentHeight - 100
|
|
})
|
|
this.data.querFrom.queryWay=0
|
|
this.getPaperMillOfInformationListFct(this.data.querFrom)
|
|
this.fetchMomentList()
|
|
},
|
|
toPage: function (e) {
|
|
if (e.currentTarget.id == 'toqb') {
|
|
util.navigateTo('/pakageInfo/pages/article/index/index')
|
|
}
|
|
if (e.currentTarget.id == 'toAllFactory') {
|
|
util.navigateTo('/pakageInfo/pages/article/allNewInfo/index')
|
|
}
|
|
if(e.currentTarget.id == 'toAttentionFactory'){
|
|
util.navigateTo('/pages/home/attentionPaperList/index')
|
|
}
|
|
if(e.currentTarget.id == 'tofeedback'){
|
|
util.navigateTo('/pakageInfo/pages/article/feedback/index')
|
|
}
|
|
if(e.currentTarget.id == 'toFactoryDetails'){
|
|
util.navigateTo('/pages/agent/factory/index?id='+e.currentTarget.dataset.factoryid)
|
|
}
|
|
if(e.currentTarget.id == 'toDmai'){
|
|
if (!app.globalData.userInfo) {
|
|
wx.navigateTo({ url: '/pages/login/index' })
|
|
return
|
|
}
|
|
if(!e.currentTarget.dataset.operations){
|
|
util.showToast(e.currentTarget.dataset.msg)
|
|
return
|
|
}
|
|
util.navigateTo('/pages/agent/edit/index?id='+e.currentTarget.dataset.fcid+'&categoryId='+e.currentTarget.dataset.paperid)
|
|
}
|
|
},
|
|
toPageDetails:function(e){
|
|
util.navigateTo('/pakageInfo/pages/article/detail/index?id='+e.currentTarget.id)
|
|
},
|
|
changeTable: function (e) {
|
|
if (e.currentTarget.id === this.data.tableSgin) {
|
|
this.setData({ tableSgin: null })
|
|
} else {
|
|
this.setData({ tableSgin: e.currentTarget.id })
|
|
}
|
|
},
|
|
getPaperMillOfInformationListFct:function(model) {
|
|
this.setData({
|
|
loading:true
|
|
})
|
|
getPaperMillOfInformationList(model).then(res => {
|
|
this.setData({
|
|
orderList: res.data
|
|
})
|
|
this.setData({
|
|
loading:false
|
|
})
|
|
})
|
|
},
|
|
changeSort:function(){
|
|
if(this.data.pximg=='/assets/info/px-jx.png'){
|
|
this.setData({
|
|
pximg:'/assets/info/px-sx.png'
|
|
})
|
|
this.data.querFrom.priceSort=1
|
|
this.getPaperMillOfInformationListFct(this.data.querFrom)
|
|
return
|
|
}
|
|
if(this.data.pximg=='/assets/info/px-sx.png'){
|
|
this.setData({
|
|
pximg:'/assets/info/px-jx.png'
|
|
})
|
|
this.data.querFrom.priceSort=0
|
|
this.getPaperMillOfInformationListFct(this.data.querFrom)
|
|
return
|
|
}
|
|
},
|
|
curDateChange(e) {
|
|
this.setData({
|
|
curDate: e.detail.value
|
|
})
|
|
this.data.querFrom.curDate=e.detail.value
|
|
this.getPaperMillOfInformationListFct(this.data.querFrom)
|
|
},
|
|
fetchMomentList: function(){
|
|
getPreferList().then(result => {
|
|
this.setData({ factoryList: result.data.records.slice(0, 3) })
|
|
})
|
|
},
|
|
toMill(e){
|
|
util.navigateTo('/pages/agent/factory/index?id=' + e.currentTarget.id)
|
|
},
|
|
|
|
mathTimesRtrun:function(text){
|
|
return math.times(text, 1000)
|
|
},
|
|
|
|
}
|
|
|
|
})
|