From 3edb55bc6d57b18e0ddf1b99409b65b230c429ee Mon Sep 17 00:00:00 2001 From: mutoe Date: Fri, 27 Jul 2018 14:28:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(wallet):=20#456=20=E6=8F=90=E7=8E=B0?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E5=86=85=E5=AE=B9=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/filters.js | 4 + src/page/wallet/WalletWithdrawDetail.vue | 8 +- src/page/wallet/WalletWithdrawInfo.vue | 112 +++++++++++++++++ .../components/WalletWithdrawDetailItem.vue | 114 ++++++++++++++++++ src/routers/wallet.js | 9 ++ src/stores/module/wallet.js | 7 +- 6 files changed, 249 insertions(+), 5 deletions(-) create mode 100644 src/page/wallet/WalletWithdrawInfo.vue create mode 100644 src/page/wallet/components/WalletWithdrawDetailItem.vue diff --git a/src/filters.js b/src/filters.js index bea62317..8d660f7b 100644 --- a/src/filters.js +++ b/src/filters.js @@ -90,6 +90,10 @@ export const time2txt = str => { * @returns {number} timezone offset */ export const timeOffset = new Date().getTimezoneOffset() * 60 * 1000; +export const addTimeOffset = date => { + date = new Date(date).getTime() - timeOffset; + return new Date(date).toLocaleString("chinese", { hour12: false }); +}; export const time2tips = date => { const time = new Date(date); diff --git a/src/page/wallet/WalletWithdrawDetail.vue b/src/page/wallet/WalletWithdrawDetail.vue index 0567b3dc..bde364d3 100644 --- a/src/page/wallet/WalletWithdrawDetail.vue +++ b/src/page/wallet/WalletWithdrawDetail.vue @@ -8,7 +8,7 @@ :on-refresh="onRefresh" :on-load-more="onLoadMore" class="m-wallet-list"> - import _ from "lodash"; -import walletDetailItem from "./WalletDetailItem.vue"; +import walletWithdrawDetailItem from "./components/WalletWithdrawDetailItem.vue"; export default { name: "WalletWithdrawDetail", - components: { walletDetailItem }, + components: { walletWithdrawDetailItem }, data() { return { currAction: "out", @@ -45,7 +45,7 @@ export default { }, methods: { showDetail(id) { - this.$router.push({ path: "/wallet/detail", params: { id } }); + this.$router.push({ path: `/wallet/withdraw/detail/${id}` }); }, async onRefresh() { const data = await this.$store.dispatch("wallet/fetchWithdrawList"); diff --git a/src/page/wallet/WalletWithdrawInfo.vue b/src/page/wallet/WalletWithdrawInfo.vue new file mode 100644 index 00000000..67033f58 --- /dev/null +++ b/src/page/wallet/WalletWithdrawInfo.vue @@ -0,0 +1,112 @@ + + + + + diff --git a/src/page/wallet/components/WalletWithdrawDetailItem.vue b/src/page/wallet/components/WalletWithdrawDetailItem.vue new file mode 100644 index 00000000..3b33e69e --- /dev/null +++ b/src/page/wallet/components/WalletWithdrawDetailItem.vue @@ -0,0 +1,114 @@ + + + + + diff --git a/src/routers/wallet.js b/src/routers/wallet.js index d4b71ef0..dcf29206 100644 --- a/src/routers/wallet.js +++ b/src/routers/wallet.js @@ -9,6 +9,8 @@ const WalletWithdraw = () => import(/* webpackChunkName: 'wallet' */ "@/page/wallet/WalletWithdraw.vue"); const WalletWithdrawDetail = () => import(/* webpackChunkName: 'wallet' */ "@/page/wallet/WalletWithdrawDetail.vue"); +const WalletWithdrawInfo = () => + import(/* webpackChunkName: 'wallet' */ "@/page/wallet/WalletWithdrawInfo.vue"); const WalletDetail = () => import(/* webpackChunkName: 'wallet' */ "@/page/wallet/WalletDetail.vue"); const WalletInfo = () => @@ -44,6 +46,13 @@ export default [ title: "提现明细" } }, + { + path: "/wallet/withdraw/detail/:id", + component: WalletWithdrawInfo, + meta: { + title: "提现明细" + } + }, { path: "/wallet/detail", component: WalletDetail, diff --git a/src/stores/module/wallet.js b/src/stores/module/wallet.js index c57a7bef..4aa6e4e0 100644 --- a/src/stores/module/wallet.js +++ b/src/stores/module/wallet.js @@ -2,6 +2,7 @@ import * as api from "@/api/wallet"; const state = { list: [], // 充值纪录 + cashes: [], // 提现记录 items: [], // 充值建议金额 ratio: 100, // 充值比率 type: [], // 充值类型 @@ -12,6 +13,9 @@ const getters = { getWalletById: state => id => { return state.list.filter(wallet => wallet.id === id).pop() || {}; }, + getCashesById: state => id => { + return state.cashes.filter(wallet => wallet.id === id).pop() || {}; + }, rechargeItems: state => { return state.items.map(item => item / 100); } @@ -75,8 +79,9 @@ const actions = { * @author mutoe * @returns {Promise} */ - async fetchWithdrawList(state, payload) { + async fetchWithdrawList({ commit }, payload) { const { data } = await api.getWithdrawList(payload); + commit(TYPES.UPDATE_WALLET, { cashes: data }); return data; } };