From 87cd5e210f50657ac6eb8f9053c08bfa68cb5a5d Mon Sep 17 00:00:00 2001 From: xiaozhiyong Date: Tue, 13 Jun 2023 11:53:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BagMoney/pages/oilCards/oilCards.vue | 2 +- BagStation/pages/makeOrder/orderPaying.vue | 6 ++- BagStation/pages/stationDetail/stieQr.vue | 45 +++++++++++++++++++--- 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/BagMoney/pages/oilCards/oilCards.vue b/BagMoney/pages/oilCards/oilCards.vue index 5127a55..6ca5178 100644 --- a/BagMoney/pages/oilCards/oilCards.vue +++ b/BagMoney/pages/oilCards/oilCards.vue @@ -226,7 +226,7 @@ if (res.code == 20000) { if (res.data.length > 0) { - let staging = res.data.filter(item => !this.hideCard.includes(item + let staging = res.data.filter(item => item.companyType != 5).filter(item => !this.hideCard.includes(item .companyId)) staging.forEach(item => { this.$set(item, 'currentPage', 1) diff --git a/BagStation/pages/makeOrder/orderPaying.vue b/BagStation/pages/makeOrder/orderPaying.vue index c601ce5..1e22ea2 100644 --- a/BagStation/pages/makeOrder/orderPaying.vue +++ b/BagStation/pages/makeOrder/orderPaying.vue @@ -312,13 +312,15 @@ computed: { companyList() { if (this.isCompany) { - return this.order.companyAccounts + let filterData = this.order.companyAccounts.filter(item => item.companyType != 5) + return filterData } }, companyOtherList() { if (this.isCompany) { // return this.order.otherAccounts - let target = this.sortParticulars(this.order.otherAccounts,'balance') + let filterData = this.order.otherAccounts.filter(item => item.companyType != 5) + let target = this.sortParticulars(filterData,'balance') return target } } diff --git a/BagStation/pages/stationDetail/stieQr.vue b/BagStation/pages/stationDetail/stieQr.vue index 85457b2..812a910 100644 --- a/BagStation/pages/stationDetail/stieQr.vue +++ b/BagStation/pages/stationDetail/stieQr.vue @@ -125,7 +125,7 @@ - + 共享余额 @@ -235,13 +235,12 @@ }, cards() { if (this.cardList.length) { - let cards = [] - // console.log(this.cardList,'---------------------') - this.cardList.forEach((e) => { - // cards.push(e.accountCardCode) + let staging = this.cardList.filter(item => item.companyType != 5) + let target = this.sortHandler(staging) + target.forEach((e) => { e.companyName = e.companyName + '('+( e.companyType==0?`柴油账户:${e.balance}元`:e.companyType==1?`汽油账户:${e.balance}元`:e.companyType==2?`LNG账户:${e.balance}元`:`尿素:${e.balance}元`) + ')' }) - return this.cardList + return target } }, }, @@ -267,6 +266,40 @@ this.getSiteInfo(option.siteId) }, methods: { + 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 + }, qrR() { },