diff --git a/src/page/wallet/WalletDetail.vue b/src/page/wallet/WalletDetail.vue index f52edee6..7ad06145 100644 --- a/src/page/wallet/WalletDetail.vue +++ b/src/page/wallet/WalletDetail.vue @@ -48,8 +48,8 @@ export default { }, computed: { after() { - const len = this.list.length; - return len ? this.list[len - 1].id : 0; + const last = _.last(this.list); + return last.id || 0; } }, watch: { @@ -65,28 +65,22 @@ export default { meta: { data: val } }); }, - onRefresh() { - this.$store - .dispatch("wallet/getWalletOrders", { action: this.currAction }) - .then(data => { - if (data.length > 0) - this.list = _.unionBy([...data, ...this.list], "id"); + async onRefresh() { + const data = await this.$store.dispatch("wallet/getWalletOrders", { + action: this.currAction + }); + + if (data.length > 0) this.list = data; - this.$refs.loadmore.topEnd(!(data.length < 15)); - }); + this.$refs.loadmore.topEnd(data.length < 15); }, - onLoadMore() { - this.$store - .dispatch("wallet/getWalletOrders", { - action: this.currAction, - after: this.after - }) - .then(data => { - if (data.length > 0) { - this.list = [...this.list, ...data]; - } - this.$refs.loadmore.bottomEnd(!(data.length < 15)); - }); + async onLoadMore() { + const data = await this.$store.dispatch("wallet/getWalletOrders", { + action: this.currAction, + after: this.after + }); + if (data.length > 0) this.list = [...this.list, ...data]; + this.$refs.loadmore.bottomEnd(data.length < 15); } } }; diff --git a/src/page/wallet/WalletInfo.vue b/src/page/wallet/WalletInfo.vue index 892ecc7a..207cb354 100644 --- a/src/page/wallet/WalletInfo.vue +++ b/src/page/wallet/WalletInfo.vue @@ -4,21 +4,22 @@ 账单详情
-

交易{{ detail.state > 0 ? '成功' : '失败' }}

+

审核中

+

交易{{ detail.state === 1 ? '成功' : '失败' }}

{{ detail.type > 0 ? '+' : '-' }}{{ detail.amount / 100 | postfix(2) }}

-
+
- {{ detail.body }} + {{ detail.body || detail.title }}
@@ -108,6 +109,12 @@ export default { color: #999; padding: 0 1em; } + + .user-avatar { + display: flex; + align-items: center; + height: 80%; + } } } } diff --git a/src/page/wallet/components/WalletDetailItem.vue b/src/page/wallet/components/WalletDetailItem.vue index d0a3c930..b6498285 100644 --- a/src/page/wallet/components/WalletDetailItem.vue +++ b/src/page/wallet/components/WalletDetailItem.vue @@ -1,13 +1,10 @@ @@ -25,7 +22,7 @@ function splitYMD(date) { const w = week[date.getDay()]; const h = (date.getHours() + "").padStart(2, 0); const m = (date.getMinutes() + "").padStart(2, 0); - const d = (M + "").padStart(2, 0) + "/" + (D + "").padStart(2, 0); + const d = (M + "").padStart(2, 0) + "." + (D + "").padStart(2, 0); const t = h + ":" + m; return { Y, M, D, w, d, t }; } @@ -55,7 +52,7 @@ export default { } else if (now.D - time.D === 0) { D = "今天"; } - return `

${D}

${time.t}

`; + return `

${D}

${time.d}

`; } }, methods: { @@ -67,25 +64,41 @@ export default { diff --git a/src/page/wallet/components/WalletWithdrawDetailItem.vue b/src/page/wallet/components/WalletWithdrawDetailItem.vue index 3b33e69e..cf7e6f4c 100644 --- a/src/page/wallet/components/WalletWithdrawDetailItem.vue +++ b/src/page/wallet/components/WalletWithdrawDetailItem.vue @@ -28,7 +28,7 @@ function splitYMD(date) { const w = week[date.getDay()]; const h = (date.getHours() + "").padStart(2, 0); const m = (date.getMinutes() + "").padStart(2, 0); - const d = (M + "").padStart(2, 0) + "/" + (D + "").padStart(2, 0); + const d = (M + "").padStart(2, 0) + "." + (D + "").padStart(2, 0); const t = h + ":" + m; return { Y, M, D, w, d, t }; } @@ -58,7 +58,7 @@ export default { } else if (now.D - time.D === 0) { D = "今天"; } - return `

${D}

${time.t}

`; + return `

${D}

${time.d}

`; }, typeText() { return typeMap[this.detail.type] || ""; diff --git a/src/stores/module/wallet.js b/src/stores/module/wallet.js index 4aa6e4e0..f32350ba 100644 --- a/src/stores/module/wallet.js +++ b/src/stores/module/wallet.js @@ -1,4 +1,5 @@ import * as api from "@/api/wallet"; +import _ from "lodash"; const state = { list: [], // 充值纪录 @@ -39,8 +40,8 @@ const actions = { */ async getWalletOrders({ commit, state }, params) { let { data } = await api.getWalletOrders(params); - if (params && params.after) data = [...state.list, ...data]; - commit(TYPES.UPDATE_WALLET, { list: data }); + const unionList = _.unionBy([...state.list, ...data], "id"); + commit(TYPES.UPDATE_WALLET, { list: unionList }); return data || []; },