|
|
@ -1,8 +1,10 @@ |
|
|
// pages/message/index.js
|
|
|
// pages/message/index.js
|
|
|
import { getSuccessNotices } from "../../../api/ztb" |
|
|
|
|
|
|
|
|
import { getInformationList } from "../../../api/moment" |
|
|
const event = require('../../../utils/event') |
|
|
const event = require('../../../utils/event') |
|
|
const util = require('../../../utils/util') |
|
|
const util = require('../../../utils/util') |
|
|
|
|
|
const math = require('../../../utils/math') |
|
|
const app = getApp() |
|
|
const app = getApp() |
|
|
|
|
|
var params = {byQueryType: 2, pageNum: 1} |
|
|
|
|
|
|
|
|
Component({ |
|
|
Component({ |
|
|
options: { |
|
|
options: { |
|
|
@ -45,6 +47,7 @@ Component({ |
|
|
tabIndex: 0, |
|
|
tabIndex: 0, |
|
|
firstShow: true |
|
|
firstShow: true |
|
|
}) |
|
|
}) |
|
|
|
|
|
params.date = util.formatDate(new Date(), 'Y-M-D') |
|
|
} |
|
|
} |
|
|
this.data.firstShow = true |
|
|
this.data.firstShow = true |
|
|
if(!this.data.noticeList.length){ |
|
|
if(!this.data.noticeList.length){ |
|
|
@ -94,22 +97,37 @@ Component({ |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
this.data.loopRequesting = true |
|
|
this.data.loopRequesting = true |
|
|
getSuccessNotices().then(result => { |
|
|
|
|
|
|
|
|
getInformationList(params).then(result => { |
|
|
this.data.loopRequesting = false |
|
|
this.data.loopRequesting = false |
|
|
this.data.noticeList = [] |
|
|
this.data.noticeList = [] |
|
|
if(result.data && result.data.length){ |
|
|
|
|
|
for (let index = 0; index < result.data.length; index++) { |
|
|
|
|
|
this.data.noticeList.push(result.data[index].msg) |
|
|
|
|
|
|
|
|
if(result.data && result.data.records.length){ |
|
|
|
|
|
for (let index = 0; index < result.data.records.length; index++) { |
|
|
|
|
|
this.handResult(result.data.records[index]) |
|
|
} |
|
|
} |
|
|
this.setData({noticeList: this.data.noticeList}) |
|
|
this.setData({noticeList: this.data.noticeList}) |
|
|
} |
|
|
} |
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
|
|
|
console.log(err) |
|
|
this.data.loopRequesting = false |
|
|
this.data.loopRequesting = false |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
handResult: function(record){ |
|
|
|
|
|
console.log(record) |
|
|
|
|
|
// if(record.latestQuoteTime.indexOf(params.data) < 0){
|
|
|
|
|
|
// return
|
|
|
|
|
|
// }
|
|
|
|
|
|
if(record.typicalFloatingQuotedPrice > 0){ |
|
|
|
|
|
record.content = record.paperMillName + '上涨' + math.times(record.typicalFloatingQuotedPrice, 1000) + '元/吨' |
|
|
|
|
|
} else if(record.typicalFloatingQuotedPrice < 0){ |
|
|
|
|
|
record.content = record.paperMillName + '下降' + math.times(-record.typicalFloatingQuotedPrice, 1000) + '元/吨' |
|
|
|
|
|
} else if(record.typicalFloatingQuotedPrice == 0){ |
|
|
|
|
|
record.content = record.paperMillName + '最新收购价格:' + math.times(record.typicalFloatingQuotedPrice, 1000) + '元/吨' |
|
|
|
|
|
} |
|
|
|
|
|
this.data.noticeList.push(record) |
|
|
|
|
|
}, |
|
|
toNotice: function(e){ |
|
|
toNotice: function(e){ |
|
|
var item = this.data.noticeList[e.currentTarget.dataset.index] |
|
|
var item = this.data.noticeList[e.currentTarget.dataset.index] |
|
|
console.log(item) |
|
|
|
|
|
|
|
|
util.navigateTo('/pages/agent/factory/index?id=' + item.paperMillId) |
|
|
}, |
|
|
}, |
|
|
onResume: function(){ |
|
|
onResume: function(){ |
|
|
var fragment = null |
|
|
var fragment = null |
|
|
|