Commit 7abaf6b4 authored by Facius's avatar Facius

fix: 订单管理排序

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