|
|
@ -91,7 +91,34 @@ Scene({ |
|
|
this.setData({ requesting: true }) |
|
|
this.setData({ requesting: true }) |
|
|
} |
|
|
} |
|
|
getFactoryOrderList(this.data.form).then(result => { |
|
|
getFactoryOrderList(this.data.form).then(result => { |
|
|
this.handResult(result) |
|
|
|
|
|
|
|
|
if (result.data && result.data.records && result.data.records.length) { |
|
|
|
|
|
var respList = result.data.records |
|
|
|
|
|
// 对返回的消息列表进行处理,将同一天的消息显示在一起
|
|
|
|
|
|
for (let i = 0; i < respList.length; i++) { |
|
|
|
|
|
if (util.isEmpty(this.data.lastTime)) { |
|
|
|
|
|
this.data.lastTime = respList[i].createTime |
|
|
|
|
|
if (this.data.lastTime.length > 10) { |
|
|
|
|
|
this.data.lastTime = this.data.lastTime.substring(0, 10) |
|
|
|
|
|
} |
|
|
|
|
|
respList[i].tipsTime = this.data.lastTime |
|
|
|
|
|
} else { |
|
|
|
|
|
var itemTime = respList[i].createTime |
|
|
|
|
|
if (itemTime.length > 10) { |
|
|
|
|
|
itemTime = itemTime.substring(0, 10) |
|
|
|
|
|
} |
|
|
|
|
|
if (this.data.lastTime !== itemTime) { |
|
|
|
|
|
respList[i].tipsTime = itemTime |
|
|
|
|
|
} |
|
|
|
|
|
this.data.lastTime = itemTime |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
let nowList = `orderList[${this.data.orderList.length}]` |
|
|
|
|
|
var num = this.data.form.pageNum |
|
|
|
|
|
var finished = ((num - 1) * this.data.form.pageSize + respList.length) >= result.data.total |
|
|
|
|
|
this.setData({ [nowList]: respList, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false }) |
|
|
|
|
|
} else { |
|
|
|
|
|
this.setData({ finished: true, requesting: false, loading: false }) |
|
|
|
|
|
} |
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
this.setData({ requesting: false, loading: false }) |
|
|
this.setData({ requesting: false, loading: false }) |
|
|
util.showToast(err) |
|
|
util.showToast(err) |
|
|
@ -100,36 +127,6 @@ Scene({ |
|
|
this.refresh.setRefresh(false) |
|
|
this.refresh.setRefresh(false) |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
handResult: function(result){ |
|
|
|
|
|
if (result.data && result.data.records && result.data.records.length) { |
|
|
|
|
|
var respList = result.data.records |
|
|
|
|
|
// 对返回的消息列表进行处理,将同一天的消息显示在一起
|
|
|
|
|
|
for (let i = 0; i < respList.length; i++) { |
|
|
|
|
|
if (util.isEmpty(this.data.lastTime)) { |
|
|
|
|
|
this.data.lastTime = respList[i].createTime |
|
|
|
|
|
if (this.data.lastTime.length > 10) { |
|
|
|
|
|
this.data.lastTime = this.data.lastTime.substring(0, 10) |
|
|
|
|
|
} |
|
|
|
|
|
respList[i].tipsTime = this.data.lastTime |
|
|
|
|
|
} else { |
|
|
|
|
|
var itemTime = respList[i].createTime |
|
|
|
|
|
if (itemTime.length > 10) { |
|
|
|
|
|
itemTime = itemTime.substring(0, 10) |
|
|
|
|
|
} |
|
|
|
|
|
if (this.data.lastTime !== itemTime) { |
|
|
|
|
|
respList[i].tipsTime = itemTime |
|
|
|
|
|
} |
|
|
|
|
|
this.data.lastTime = itemTime |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
let nowList = `orderList[${this.data.orderList.length}]` |
|
|
|
|
|
var num = this.data.form.pageNum |
|
|
|
|
|
var finished = ((num - 1) * this.data.form.pageSize + respList.length) >= result.data.total |
|
|
|
|
|
this.setData({ [nowList]: respList, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false }) |
|
|
|
|
|
} else { |
|
|
|
|
|
this.setData({ finished: true, requesting: false, loading: false }) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
cancelOrder: function(e){ |
|
|
cancelOrder: function(e){ |
|
|
Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => { |
|
|
Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => { |
|
|
wx.showLoading({ title: '正在获取', mask: true }) |
|
|
wx.showLoading({ title: '正在获取', mask: true }) |
|
|
|