|
@@ -208,29 +208,29 @@ Page({
|
|
|
roomItem.isroom = count < roomItem.total;
|
|
|
return roomItem;
|
|
|
}));
|
|
|
-
|
|
|
|
|
|
- roomList.sort((a, b) => {
|
|
|
-
|
|
|
- if (a.isroom === b.isroom) {
|
|
|
-
|
|
|
- if (a.remaining === 0 && b.remaining !== 0) {
|
|
|
- return 1;
|
|
|
- }
|
|
|
- if (a.remaining !== 0 && b.remaining === 0) {
|
|
|
- return -1;
|
|
|
- }
|
|
|
-
|
|
|
- return a.remaining - b.remaining;
|
|
|
- }
|
|
|
- return a.isroom ? -1 : 1;
|
|
|
- });
|
|
|
+ roomList.sort(this.compareFunction);
|
|
|
|
|
|
this.setData({
|
|
|
roomList
|
|
|
});
|
|
|
console.log('房间', this.data.roomList);
|
|
|
},
|
|
|
+
|
|
|
+ compareFunction(a, b) {
|
|
|
+
|
|
|
+ if (a.isroom !== b.isroom) {
|
|
|
+ return a.isroom ? -1 : 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ const hasIndexA = a.index !== undefined;
|
|
|
+ const hasIndexB = b.index !== undefined;
|
|
|
+ if (hasIndexA !== hasIndexB) {
|
|
|
+ return hasIndexA ? -1 : 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ return (a.index || 0) - (b.index || 0);
|
|
|
+ },
|
|
|
async checkOrderCount(roomId, start, end) {
|
|
|
const startTime = new Date(start);
|
|
|
const endTime = new Date(end);
|
|
@@ -323,7 +323,7 @@ Page({
|
|
|
color: '#ffffff',
|
|
|
bgColor: '#7F56B2',
|
|
|
padding: 2,
|
|
|
- fontSize:12,
|
|
|
+ fontSize: 12,
|
|
|
borderRadius: 5,
|
|
|
display: 'ALWAYS'
|
|
|
}
|