|
|
@ -31,12 +31,12 @@ Component({ |
|
|
{ icon: '/assets/image/ico_price.png', badge: 0, name: '实时价格' }, |
|
|
{ icon: '/assets/image/ico_price.png', badge: 0, name: '实时价格' }, |
|
|
{ icon: '/assets/image/ico_queue.png', badge: 0, name: '车辆排队' } |
|
|
{ icon: '/assets/image/ico_queue.png', badge: 0, name: '车辆排队' } |
|
|
], |
|
|
], |
|
|
tabList: [ '卖废纸', '买废纸', '代卖' ], |
|
|
|
|
|
|
|
|
tabList: [ '代卖', '卖废纸', '买废纸' ], |
|
|
tabIndex: 0, |
|
|
tabIndex: 0, |
|
|
loading: [true, true, true], |
|
|
loading: [true, true, true], |
|
|
requesting: [false, false, false], |
|
|
requesting: [false, false, false], |
|
|
finished: [false, false, false], |
|
|
finished: [false, false, false], |
|
|
form: [{ isOnlySupplyProduct: true, pageNum: 1 }, { pageNum: 1 }, { pageNum: 1, enableSalesAgent: 1 }], |
|
|
|
|
|
|
|
|
form: [{ pageNum: 1, enableSalesAgent: 1 },{ isOnlySupplyProduct: true, pageNum: 1 }, { pageNum: 1 }], |
|
|
orderList: [], |
|
|
orderList: [], |
|
|
orderList1: [], |
|
|
orderList1: [], |
|
|
orderList2: [] |
|
|
orderList2: [] |
|
|
@ -124,11 +124,11 @@ Component({ |
|
|
} else { |
|
|
} else { |
|
|
this.setData({ tabIndex: parseInt(detail.index) }) |
|
|
this.setData({ tabIndex: parseInt(detail.index) }) |
|
|
} |
|
|
} |
|
|
if(this.data.tabIndex == 0 && !this.data.orderList.length){ |
|
|
|
|
|
|
|
|
if(this.data.tabIndex == 1 && !this.data.orderList.length){ |
|
|
this.fetchGoodsList() |
|
|
this.fetchGoodsList() |
|
|
} else if(this.data.tabIndex == 1 && !this.data.orderList1.length){ |
|
|
|
|
|
|
|
|
} else if(this.data.tabIndex == 2 && !this.data.orderList1.length){ |
|
|
this.fetchPurchaseList() |
|
|
this.fetchPurchaseList() |
|
|
} else if(this.data.tabIndex == 2 && !this.data.orderList2.length){ |
|
|
|
|
|
|
|
|
} else if(this.data.tabIndex == 0 && !this.data.orderList2.length){ |
|
|
this.fetchAgentList() |
|
|
this.fetchAgentList() |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
@ -151,7 +151,7 @@ Component({ |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
onRefreshList: function () { |
|
|
onRefreshList: function () { |
|
|
if(this.data.tabIndex == 0){ |
|
|
|
|
|
|
|
|
if(this.data.tabIndex == 1){ |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
orderList: [], |
|
|
orderList: [], |
|
|
['form[' + this.data.tabIndex + '].pageNum']: 1, |
|
|
['form[' + this.data.tabIndex + '].pageNum']: 1, |
|
|
@ -159,7 +159,7 @@ Component({ |
|
|
['finished[' + this.data.tabIndex + ']']: false |
|
|
['finished[' + this.data.tabIndex + ']']: false |
|
|
}) |
|
|
}) |
|
|
this.fetchGoodsList() |
|
|
this.fetchGoodsList() |
|
|
} else if(this.data.tabIndex == 1){ |
|
|
|
|
|
|
|
|
} else if(this.data.tabIndex == 2){ |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
orderList1: [], |
|
|
orderList1: [], |
|
|
['form[' + this.data.tabIndex + '].pageNum']: 1, |
|
|
['form[' + this.data.tabIndex + '].pageNum']: 1, |
|
|
@ -167,7 +167,7 @@ Component({ |
|
|
['finished[' + this.data.tabIndex + ']']: false |
|
|
['finished[' + this.data.tabIndex + ']']: false |
|
|
}) |
|
|
}) |
|
|
this.fetchPurchaseList() |
|
|
this.fetchPurchaseList() |
|
|
} else if(this.data.tabIndex == 2){ |
|
|
|
|
|
|
|
|
} else if(this.data.tabIndex == 0){ |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
orderList2: [], |
|
|
orderList2: [], |
|
|
['form[' + this.data.tabIndex + '].pageNum']: 1, |
|
|
['form[' + this.data.tabIndex + '].pageNum']: 1, |
|
|
@ -179,25 +179,25 @@ Component({ |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
fetchMoreList: function(){ |
|
|
fetchMoreList: function(){ |
|
|
if(this.data.tabIndex == 0){ |
|
|
|
|
|
|
|
|
if(this.data.tabIndex == 1){ |
|
|
this.fetchGoodsList() |
|
|
this.fetchGoodsList() |
|
|
} else if(this.data.tabIndex == 1){ |
|
|
|
|
|
this.fetchPurchaseList() |
|
|
|
|
|
} else if(this.data.tabIndex == 2){ |
|
|
} else if(this.data.tabIndex == 2){ |
|
|
|
|
|
this.fetchPurchaseList() |
|
|
|
|
|
} else if(this.data.tabIndex == 0){ |
|
|
this.fetchAgentList() |
|
|
this.fetchAgentList() |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
//*************************************************fetchGoodsList************************************************//
|
|
|
//*************************************************fetchGoodsList************************************************//
|
|
|
fetchGoodsList: function () { |
|
|
fetchGoodsList: function () { |
|
|
if (this.data.requesting[this.data.tabIndex] || this.data.finished[this.data.tabIndex]) { |
|
|
|
|
|
|
|
|
if (this.data.requesting[1] || this.data.finished[1]) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
if (this.data.loading[this.data.tabIndex]) { |
|
|
|
|
|
this.data.requesting[this.data.tabIndex] = true |
|
|
|
|
|
|
|
|
if (this.data.loading[1]) { |
|
|
|
|
|
this.data.requesting[1] = true |
|
|
} else { |
|
|
} else { |
|
|
this.setData({ ['requesting[' + this.data.tabIndex + ']']: true }) |
|
|
|
|
|
|
|
|
this.setData({ ['requesting[' + 1 + ']']: true }) |
|
|
} |
|
|
} |
|
|
getMiniProxyList(this.data.form[0]).then(result => { |
|
|
|
|
|
|
|
|
getMiniProxyList(this.data.form[1]).then(result => { |
|
|
if (result.data.records.length) { |
|
|
if (result.data.records.length) { |
|
|
var respList = result.data.records |
|
|
var respList = result.data.records |
|
|
let nowList = `orderList[${this.data.orderList.length}]` |
|
|
let nowList = `orderList[${this.data.orderList.length}]` |
|
|
@ -205,37 +205,37 @@ Component({ |
|
|
var finished = result.data.current >= result.data.pages |
|
|
var finished = result.data.current >= result.data.pages |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
[nowList]: respList, |
|
|
[nowList]: respList, |
|
|
['form[0].pageNum']: (num + 1), |
|
|
|
|
|
['finished[0]']: finished, |
|
|
|
|
|
['requesting[0]']: false, |
|
|
|
|
|
['loading[0]']: false |
|
|
|
|
|
|
|
|
['form[1].pageNum']: (num + 1), |
|
|
|
|
|
['finished[1]']: finished, |
|
|
|
|
|
['requesting[1]']: false, |
|
|
|
|
|
['loading[1]']: false |
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
['finished[0]']: true, |
|
|
|
|
|
['requesting[0]']: false, |
|
|
|
|
|
['loading[0]']: false |
|
|
|
|
|
|
|
|
['finished[1]']: true, |
|
|
|
|
|
['requesting[1]']: false, |
|
|
|
|
|
['loading[1]']: false |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
['requesting[0]']: false, |
|
|
|
|
|
['finished[0]']: true, |
|
|
|
|
|
['loading[0]']: false |
|
|
|
|
|
|
|
|
['requesting[1]']: false, |
|
|
|
|
|
['finished[1]']: true, |
|
|
|
|
|
['loading[1]']: false |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
//*************************************************fetchPurchaseList************************************************//
|
|
|
//*************************************************fetchPurchaseList************************************************//
|
|
|
fetchPurchaseList: function () { |
|
|
fetchPurchaseList: function () { |
|
|
if (this.data.requesting[1] || this.data.finished[1]) { |
|
|
|
|
|
|
|
|
if (this.data.requesting[2] || this.data.finished[2]) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
if (this.data.loading[1]) { |
|
|
|
|
|
this.data.requesting[1] = true |
|
|
|
|
|
|
|
|
if (this.data.loading[2]) { |
|
|
|
|
|
this.data.requesting[2] = true |
|
|
} else { |
|
|
} else { |
|
|
this.setData({ ['requesting[1]']: true }) |
|
|
|
|
|
|
|
|
this.setData({ ['requesting[2]']: true }) |
|
|
} |
|
|
} |
|
|
getProductList(this.data.form[1]).then(result => { |
|
|
|
|
|
|
|
|
getProductList(this.data.form[2]).then(result => { |
|
|
//成功回调
|
|
|
//成功回调
|
|
|
if (result.data.records.length) { |
|
|
if (result.data.records.length) { |
|
|
var respList = result.data.records |
|
|
var respList = result.data.records |
|
|
@ -244,39 +244,39 @@ Component({ |
|
|
var finished = result.data.current >= result.data.pages |
|
|
var finished = result.data.current >= result.data.pages |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
[nowList]: respList, |
|
|
[nowList]: respList, |
|
|
['form[1].pageNum']: (num + 1), |
|
|
|
|
|
['finished[1]']: finished, |
|
|
|
|
|
['requesting[1]']: false, |
|
|
|
|
|
['loading[1]']: false |
|
|
|
|
|
|
|
|
['form[2].pageNum']: (num + 1), |
|
|
|
|
|
['finished[2]']: finished, |
|
|
|
|
|
['requesting[2]']: false, |
|
|
|
|
|
['loading[2]']: false |
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
['requesting[1]']: false, |
|
|
|
|
|
['finished[1]']: true, |
|
|
|
|
|
['loading[1]']: false |
|
|
|
|
|
|
|
|
['requesting[2]']: false, |
|
|
|
|
|
['finished[2]']: true, |
|
|
|
|
|
['loading[2]']: false |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
//异常回调
|
|
|
//异常回调
|
|
|
this.setData({ |
|
|
this.setData({ |
|
|
['requesting[1]']: false, |
|
|
|
|
|
['finished[1]']: true, |
|
|
|
|
|
['loading[1]']: false |
|
|
|
|
|
|
|
|
['requesting[2]']: false, |
|
|
|
|
|
['finished[2]']: true, |
|
|
|
|
|
['loading[2]']: false |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
//*************************************************fetchAgentList************************************************//
|
|
|
//*************************************************fetchAgentList************************************************//
|
|
|
// 获取特价列表
|
|
|
// 获取特价列表
|
|
|
fetchAgentList: function () { |
|
|
fetchAgentList: function () { |
|
|
if (this.data.requesting[2] || this.data.finished[2]) { |
|
|
|
|
|
|
|
|
if (this.data.requesting[0] || this.data.finished[0]) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
if (this.data.loading[2]) { |
|
|
|
|
|
this.data.requesting[2] = true |
|
|
|
|
|
|
|
|
if (this.data.loading[0]) { |
|
|
|
|
|
this.data.requesting[0] = true |
|
|
} else { |
|
|
} else { |
|
|
this.setData({ ['requesting[2]']: true }) |
|
|
|
|
|
|
|
|
this.setData({ ['requesting[0]']: true }) |
|
|
} |
|
|
} |
|
|
getFactoryPrice(this.data.form[2]).then(result => { |
|
|
|
|
|
|
|
|
getFactoryPrice(this.data.form[0]).then(result => { |
|
|
if (result.data.records.length) { |
|
|
if (result.data.records.length) { |
|
|
var respList = result.data.records |
|
|
var respList = result.data.records |
|
|
let nowList = `orderList2[${this.data.orderList2.length}]` |
|
|
let nowList = `orderList2[${this.data.orderList2.length}]` |
|
|
@ -284,24 +284,24 @@ Component({ |
|
|
var finished = result.data.current >= result.data.pages |
|
|
var finished = result.data.current >= result.data.pages |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
[nowList]: respList, |
|
|
[nowList]: respList, |
|
|
['form[2].pageNum']: (num + 1), |
|
|
|
|
|
['finished[2]']: finished, |
|
|
|
|
|
['requesting[2]']: false, |
|
|
|
|
|
['loading[2]']: false |
|
|
|
|
|
|
|
|
['form[0].pageNum']: (num + 1), |
|
|
|
|
|
['finished[0]']: finished, |
|
|
|
|
|
['requesting[0]']: false, |
|
|
|
|
|
['loading[0]']: false |
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
['requesting[2]']: false, |
|
|
|
|
|
['finished[2]']: true, |
|
|
|
|
|
['loading[2]']: false |
|
|
|
|
|
|
|
|
['requesting[0]']: false, |
|
|
|
|
|
['finished[0]']: true, |
|
|
|
|
|
['loading[0]']: false |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
//异常回调
|
|
|
//异常回调
|
|
|
this.setData({ |
|
|
this.setData({ |
|
|
['requesting[2]']: false, |
|
|
|
|
|
['finished[2]']: true, |
|
|
|
|
|
['loading[2]']: false |
|
|
|
|
|
|
|
|
['requesting[0]']: false, |
|
|
|
|
|
['finished[0]']: true, |
|
|
|
|
|
['loading[0]']: false |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|