From c8b348525b94cc1d202eb95c71abd8a89f115a71 Mon Sep 17 00:00:00 2001 From: mutoe Date: Tue, 24 Jul 2018 09:24:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(currency):=20#457=20=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=85=85=E5=80=BC=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/currency/CurrencyRecharge.vue | 53 +++++++++++++++++++------- src/stores/module/currency.js | 39 +++++++++++++++---- 2 files changed, 71 insertions(+), 21 deletions(-) diff --git a/src/page/currency/CurrencyRecharge.vue b/src/page/currency/CurrencyRecharge.vue index f8faa57c..087bcbca 100644 --- a/src/page/currency/CurrencyRecharge.vue +++ b/src/page/currency/CurrencyRecharge.vue @@ -25,7 +25,7 @@ :key="item" :class="{ active: ~~amount === ~~item && !customAmount }" class="m-pinned-amount-btn" - @click="chooseDefaultAmount(item)">{{ item.toFixed(2) }} + @click="chooseDefaultAmount(item)">{{ ~~item.toFixed(2) }}
@@ -54,17 +54,6 @@
- -
@@ -82,24 +71,57 @@ 确定
+ + + + +

+ + diff --git a/src/stores/module/currency.js b/src/stores/module/currency.js index b6da67d7..e49fcacd 100644 --- a/src/stores/module/currency.js +++ b/src/stores/module/currency.js @@ -2,15 +2,25 @@ import * as api from "@/api/currency"; const state = { list: [], // 充值纪录 - items: [], // 充值建议金额 - ratio: 100, // 充值比率 - type: [], // 充值类型 - rule: "" // 充值提现规则 + rule: "", // 充值提现规则 + recharge: { + rule: "", + ratio: 1, + type: [], // 充值类型 + items: [], // 充值建议金额 + min: 100, + max: 10000000 + }, + cash: { + rule: "", + min: 100, + max: 10000000 + } }; const getters = { rechargeItems: state => { - return state.items.map(item => item / state.ratio); + return state.recharge.items.map(item => item / 100); } }; @@ -26,8 +36,23 @@ const mutations = { const actions = { async getCurrencyInfo({ commit }) { - let { data } = await api.getCurrencyInfo(); - commit(TYPES.UPDATE_CURRENCY, data); + const { data } = await api.getCurrencyInfo(); + commit(TYPES.UPDATE_CURRENCY, { + rule: data.rule, + recharge: { + rule: data["recharge-rule"], + type: data["recharge-type"], + ratio: data["recharge-ratio"], + items: data["recharge-options"].split(",").map(v => ~~v), + min: data["recharge-min"], + max: data["recharge-max"] + }, + cash: { + rule: data["cash-rule"], + min: data["cash-min"], + max: data["cash-max"] + } + }); } };