更新
This commit is contained in:
@@ -162,9 +162,9 @@
|
||||
this.TowerSwiper('swiperList');
|
||||
},
|
||||
onLoad(option) {
|
||||
this.getCards()
|
||||
this.getTotalOilCardInfo()
|
||||
this.TowerSwiper('swiperList');
|
||||
// this.getCards()
|
||||
// this.getTotalOilCardInfo()
|
||||
// this.TowerSwiper('swiperList');
|
||||
// 初始化towerSwiper 传已有的数组名即可
|
||||
},
|
||||
onReachBottom() {
|
||||
@@ -180,14 +180,6 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
getAmount() {
|
||||
accountApi.getTotalOilCardInfo().then(res => {
|
||||
if (res.code == 20000) {
|
||||
this.userTotal = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
getTotalOilCardInfo() {
|
||||
accountApi.getTotalOilCardInfo().then(res => {
|
||||
if (res.code == 20000) {
|
||||
@@ -233,15 +225,17 @@
|
||||
await accountApi.getUserAccount().then(res => {
|
||||
if (res.code == 20000) {
|
||||
if (res.data.length > 0) {
|
||||
this.cardList = res.data
|
||||
this.cardList = this.cardList.filter(item => !this.hideCard.includes(item
|
||||
|
||||
let staging = res.data.filter(item => !this.hideCard.includes(item
|
||||
.companyId))
|
||||
this.cardList.forEach(item => {
|
||||
staging.forEach(item => {
|
||||
this.$set(item, 'currentPage', 1)
|
||||
this.$set(item, 'loadStatus', 'more')
|
||||
this.$set(item, 'historyList', [])
|
||||
})
|
||||
console.log(this.cardList)
|
||||
let target = this.sortHandler(staging)
|
||||
this.cardList = target
|
||||
|
||||
setTimeout(() => {
|
||||
this.getMoneyDetail(this.cardList[0], 0)
|
||||
}, 100)
|
||||
@@ -249,6 +243,41 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
sortHandler(arr) {
|
||||
let internalArr = arr.filter(item => item.oilCardType == 2)
|
||||
let externalArr = arr.filter(item => item.oilCardType == 3)
|
||||
// let internalTarget = this.sortParticulars(internalArr, 'shareCompanyQuota')
|
||||
let externalTarget = this.sortParticulars(externalArr, 'balance')
|
||||
if (internalArr.length || externalTarget.length) return [...internalArr, ...externalTarget]
|
||||
else return arr
|
||||
},
|
||||
sortParticulars(arr, field) {
|
||||
let target = []
|
||||
let map = new Map()
|
||||
let keys = [],
|
||||
values = []
|
||||
arr.forEach(item => {
|
||||
map.set(item, item[field])
|
||||
})
|
||||
for (let key of map.keys()) {
|
||||
keys.push(key)
|
||||
}
|
||||
for (let value of map.values()) {
|
||||
values.push(value)
|
||||
}
|
||||
values.sort()
|
||||
values.reverse()
|
||||
values.forEach(value => {
|
||||
keys.forEach(key => {
|
||||
if (map.get(key) == value) {
|
||||
target.push(key)
|
||||
map.set(key, new Date().getTime())
|
||||
}
|
||||
})
|
||||
})
|
||||
return target
|
||||
},
|
||||
|
||||
DotStyle(e) {
|
||||
this.dotStyle = e.detail.value
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user