|
|
|
@ -1,5 +1,8 @@ |
|
|
|
// pages/stock/index.js
|
|
|
|
const util = require('../../../utils/util') |
|
|
|
import { userPushFollowMill } from "../../../api/ztb" |
|
|
|
import { getMillPaperList } from "../../../api/moment" |
|
|
|
var requesting = false |
|
|
|
|
|
|
|
Component({ |
|
|
|
options: { |
|
|
|
@ -12,21 +15,45 @@ Component({ |
|
|
|
}, |
|
|
|
data: { |
|
|
|
unflod: false, |
|
|
|
loading: false, |
|
|
|
itemList: [2] |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
onFlodTap: function(){ |
|
|
|
this.setData({ unflod: !this.data.unflod }) |
|
|
|
if(!this.data.itemList.length){ |
|
|
|
|
|
|
|
this.fetchItemList() |
|
|
|
} |
|
|
|
}, |
|
|
|
onAttentionChange: function(){ |
|
|
|
|
|
|
|
if (this.data.loading) { |
|
|
|
return |
|
|
|
} |
|
|
|
this.setData({ loading: true }) |
|
|
|
userPushFollowMill({ paperMillId: 1, follow: true }).then(result => { |
|
|
|
this.setData({ loading: false }) |
|
|
|
}).catch(err => { |
|
|
|
this.setData({ loading: false }) |
|
|
|
}) |
|
|
|
}, |
|
|
|
lookItem: function(e){ |
|
|
|
util.navigateTo('/pages/article/detail/index?id=' + this.data.item.id) |
|
|
|
}, |
|
|
|
fetchItemList: function(){ |
|
|
|
if (requesting) { |
|
|
|
return |
|
|
|
} |
|
|
|
requesting = true |
|
|
|
getMillPaperList({ paperMillId: 1, date: '' }).then(result => { |
|
|
|
if (result.data.records.length) { |
|
|
|
this.setData({ orderList: result.data.records }) |
|
|
|
} else { |
|
|
|
requesting = false |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
requesting = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
agentOrder: function(e){ |
|
|
|
|
|
|
|
} |
|
|
|
|