Commit 7abaf6b4 authored by Facius's avatar Facius

fix: 订单管理排序

parent 40bd9692
...@@ -353,7 +353,7 @@ export default { ...@@ -353,7 +353,7 @@ export default {
if (this.needSort) { if (this.needSort) {
self.orderList[this.curNow][this.current[this.curNow]].sort( self.orderList[this.curNow][this.current[this.curNow]].sort(
(x, y) => { (x, y) => {
return x.currentOverTime <= y.currentOverTime ? 1 : -1 return x.currentOverTime < y.currentOverTime ? 1 : -1
} }
) )
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
enable-back-to-top enable-back-to-top
refresher-background="#F4F5F7" refresher-background="#F4F5F7"
> >
<view class="loading-view" v-if="!loaded && !_freshing"> <view class="loading-view" v-if="!loaded">
<u-loading mode="flower"></u-loading> <u-loading mode="flower"></u-loading>
</view> </view>
<NoOrder <NoOrder
...@@ -63,8 +63,6 @@ export default { ...@@ -63,8 +63,6 @@ export default {
loadStatus: 'loading', loadStatus: 'loading',
dataValue: [], dataValue: [],
loaded: false, loaded: false,
triggered: true,
_freshing: false,
title: '', title: '',
orderType: '', orderType: '',
timeParam: {}, timeParam: {},
...@@ -80,10 +78,19 @@ export default { ...@@ -80,10 +78,19 @@ export default {
noOrderCustomStyle() { noOrderCustomStyle() {
return 'margin-top: 100rpx;background-color: #F4F5F7' return 'margin-top: 100rpx;background-color: #F4F5F7'
}, },
sortType() {
return {
take: 'acceptOrderDateTime',
checkin: 'checkInDateTime',
finish: 'orderFinishDatetime',
}
},
currentSorttype() {
return this.sortType[this.orderType]
},
}, },
onLoad(e) { onLoad(e) {
getApp().trackPage('订单首页') getApp().trackPage('订单首页')
this._freshing = false
if (e && e.title) { if (e && e.title) {
this.title = decodeURIComponent(e.title) this.title = decodeURIComponent(e.title)
} }
...@@ -116,34 +123,30 @@ export default { ...@@ -116,34 +123,30 @@ export default {
type: this.orderType, type: this.orderType,
...this.timeParam, ...this.timeParam,
} }
var self = this this.$u.api.manageOrderList(param).then((res) => {
self.$u.api.manageOrderList(param).then((res) => {
if (res.code == 200) { if (res.code == 200) {
if (self.pageNumber == 1) { if (this.pageNumber == 1) {
self.orderList = [] this.orderList = []
} }
if (res.data.list) { if (res.data.list) {
self.orderList.push(...res.data.list) this.orderList.push(...res.data.list)
self.orderList.sort((x, y) => { this.orderList.sort((x, y) => {
return x.currentOverTime <= y.currentOverTime ? 1 : -1 return (x[this.currentSorttype] || 0) <
(y[this.currentSorttype] || 0)
? 1
: -1
}) })
self.loadStatus = this.loadStatus =
res.data.total > self.orderList.length && res.data.total > this.orderList.length &&
res.data.list.length == self.pageSize res.data.list.length == this.pageSize
? 'loadmore' ? 'loadmore'
: 'nomore' : 'nomore'
} }
} else { } else {
console.log(res.message, '获取订单数量失败!') console.log(res.message, '获取订单数量失败!')
} }
self.$nextTick(() => {
if (self._freshing) {
self.triggered = false
self._freshing = false
}
})
this.loaded = true this.loaded = true
}) })
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment