diff --git a/pages/moment/attention/index.json b/pages/moment/attention/index.json index 8ec30eb..4da0581 100644 --- a/pages/moment/attention/index.json +++ b/pages/moment/attention/index.json @@ -3,6 +3,7 @@ "usingComponents": { "wux-skeleton": "/components/skeleton/index", "wux-skeleton-paragraph": "/components/skeleton-paragraph/index", - "moment-item": "/pages/moment/moment-item/index" + "moment-item": "/pages/moment/moment-item/index", + "wux-divider": "/components/divider/index" } } \ No newline at end of file diff --git a/pages/moment/fragment/index.js b/pages/moment/fragment/index.js index 1fd0592..312aac6 100644 --- a/pages/moment/fragment/index.js +++ b/pages/moment/fragment/index.js @@ -1,8 +1,10 @@ // pages/message/index.js -import { getSuccessNotices } from "../../../api/ztb" +import { getInformationList } from "../../../api/moment" const event = require('../../../utils/event') const util = require('../../../utils/util') +const math = require('../../../utils/math') const app = getApp() +var params = {byQueryType: 2, pageNum: 1} Component({ options: { @@ -45,6 +47,7 @@ Component({ tabIndex: 0, firstShow: true }) + params.date = util.formatDate(new Date(), 'Y-M-D') } this.data.firstShow = true if(!this.data.noticeList.length){ @@ -94,22 +97,37 @@ Component({ return } this.data.loopRequesting = true - getSuccessNotices().then(result => { + getInformationList(params).then(result => { this.data.loopRequesting = false 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}) } }).catch(err => { + console.log(err) 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){ var item = this.data.noticeList[e.currentTarget.dataset.index] - console.log(item) + util.navigateTo('/pages/agent/factory/index?id=' + item.paperMillId) }, onResume: function(){ var fragment = null diff --git a/pages/moment/fragment/index.wxml b/pages/moment/fragment/index.wxml index 2698714..4e0731d 100644 --- a/pages/moment/fragment/index.wxml +++ b/pages/moment/fragment/index.wxml @@ -21,7 +21,7 @@ - {{item}} + {{item.content}} diff --git a/pages/moment/information/index.json b/pages/moment/information/index.json index ded7dfb..7b890d8 100644 --- a/pages/moment/information/index.json +++ b/pages/moment/information/index.json @@ -4,6 +4,7 @@ "wux-tabi": "/components/tabi/index", "wux-skeleton": "/components/skeleton/index", "wux-skeleton-paragraph": "/components/skeleton-paragraph/index", - "info-item": "/pages/moment/info-item/index" + "info-item": "/pages/moment/info-item/index", + "wux-divider": "/components/divider/index" } } \ No newline at end of file diff --git a/pages/moment/theall/index.js b/pages/moment/theall/index.js index ad9edc1..4d656df 100644 --- a/pages/moment/theall/index.js +++ b/pages/moment/theall/index.js @@ -79,7 +79,7 @@ Component({ getInformationList(this.data.form).then(result => { if (result.data && result.data.records.length) { var respList = result.data.records - let nowList = `orderList[${this.data.orderList2.length}]` + let nowList = `orderList[${this.data.orderList.length}]` var num = this.data.form.pageNum var finished = this.data.form.pageNum >= result.data.pages this.setData({ [nowList]: respList, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false }) @@ -87,6 +87,7 @@ Component({ this.setData({ finished: true, requesting: false, loading: false }) } }).catch(err => { + console.log(err) this.setData({ requesting: false, loading: false }) util.showToast(err) }) diff --git a/pages/moment/theall/index.json b/pages/moment/theall/index.json index e18e23a..269298c 100644 --- a/pages/moment/theall/index.json +++ b/pages/moment/theall/index.json @@ -4,6 +4,7 @@ "wux-tabi": "/components/tabi/index", "wux-skeleton": "/components/skeleton/index", "wux-skeleton-paragraph": "/components/skeleton-paragraph/index", - "moment-item": "/pages/moment/moment-item/index" + "moment-item": "/pages/moment/moment-item/index", + "wux-divider": "/components/divider/index" } } \ No newline at end of file