充值记录和扣费记录

This commit is contained in:
jysperm
2014-05-30 14:43:12 +08:00
parent a3e467e505
commit 8cb0ace5b8
4 changed files with 21 additions and 17 deletions

View File

@@ -44,6 +44,7 @@ exports.runWebServer = ->
app.use (req, res, next) ->
res.locals.app = app
res.locals.moment = require 'moment'
res.locals.t = i18n.getTranslator 'zh_CN'
res.locals.mAccount = require './model/account'

View File

@@ -8,11 +8,17 @@ plugin = require '../plugin'
{requestAuthenticate, renderAccount} = require './middleware'
mAccount = require '../model/account'
mBalance = require '../model/balance'
module.exports = exports = express.Router()
exports.get '/pay', renderAccount, (req, res) ->
res.render 'panel/pay'
exports.get '/pay', requestAuthenticate, renderAccount, (req, res) ->
mBalance.find
account_id: req.account._id
.toArray (err, balance_log) ->
res.render 'panel/pay',
deposit_log: _.filter(balance_log, (i) -> i.type == 'deposit')
billing_log: _.filter(balance_log, (i) -> i.type == 'billing')
exports.get '/', requestAuthenticate, (req, res) ->
billing.checkBilling req.account, (account) ->

View File

@@ -58,16 +58,11 @@ block main
th 金额
th 方式
tbody
tr
td 2014-5-1 23:30:05
td 24 CNY
td 淘宝 62888888888
tr
td 2014-5-2 23:30:05
td 18.1 CNY
td
| 比特币  
a(href='https://blockchain.info/tx/a4178786707c3f4373be6ad1edb3761cbd4c6a5849c5981f7ceefb13b53cab64') 0.02 BTC
for item in deposit_log
tr
td= moment(item.created_at).format('YYYY-MM-DD HH:mm:ss')
td #{item.amount.toFixed(2)} CNY
td #{item.attribute.type} #{item.attribute.order_id}
.row
header 扣费记录
@@ -78,7 +73,8 @@ block main
td 金额
td 摘要
tbody
tr
td 2014-5-1 23:30:05
td 0.25 CNY
td all, 23 hours, force
for item in billing_log
tr
td= moment(item.created_at).format('YYYY-MM-DD HH:mm:ss')
td #{item.amount.toFixed(2)} CNY
td #{item.attribute.plans.join(', ')} | #{item.attribute.billing_time} hours #{item.attribute.is_force ? '| force' : ''}

View File

@@ -38,6 +38,7 @@
"harp": "*",
"middleware-injector": "*",
"tmp": "*",
"mysql": "*"
"mysql": "*",
"moment": "*"
}
}