finish create payment

This commit is contained in:
Yudong
2014-05-30 15:49:00 +08:00
parent 881f58cee0
commit 9e8d0b6df6
3 changed files with 38 additions and 5 deletions

View File

@@ -0,0 +1,27 @@
$ ->
$(document).ajaxError (e, reply) ->
if reply.status is 400
error = reply.responseJSON.error
ErrorHandle.flushInfo 'alert', error
$.ajaxSetup {
contentType: 'application/json; charset=UTF-8'
}
#充值记录
$ '.create-payment'
.on 'click', (e) ->
e.preventDefault()
$('#account_id').html $(this).closest('tr').data 'id'
$('#crate_payment_modal').modal 'show'
$ '#create_payment_button'
.on 'click', (e) ->
e.preventDefault()
$.post '/admin/create_payment/', JSON.stringify {
account_id: ($ '#account_id').html()
type: 'taobao'
amount: ($ '#amont').val()
order_id: ($ '#order_id').val()
}
.success ->
location.reload()

View File

@@ -1,6 +1,5 @@
$ ->
$(document).ajaxError (e, reply) ->
console.log reply
if reply.status is 400
error = reply.responseJSON.error
ErrorHandle.flushInfo 'alert', error

View File

@@ -6,7 +6,7 @@ prepend head
block main
header= t('admin.admin_panel')
.modal.fade#crate_payment
.modal.fade#crate_payment_modal
.modal-dialog
.modal-content
.modal-header
@@ -14,6 +14,10 @@ block main
h4.modal-title 创建充值记录
.modal-body
form.form-horizontal(method='post', role='form')
.form-group
label.col-sm-2.col-md-offset-1.control-label(for='account_id') ID
.col-sm-5
p#account_id.form-control-static
.form-group
label.col-sm-2.col-md-offset-1.control-label(for='amont') 金额
.col-sm-5
@@ -25,7 +29,7 @@ block main
.modal-footer
button.btn.btn-danger(type='button', data-dismiss='modal') 关闭
button.btn.btn-success(type='button') 创建
button.btn.btn-success#create_payment_button(type='button') 创建
table.table.table-hover
thead
@@ -37,7 +41,7 @@ block main
th 操作
tbody
for account in accounts
tr
tr(data-id='#{account._id}')
td= account.username
td= account.email
td= account.attribute.plans.join(', ')
@@ -49,8 +53,11 @@ block main
spann.caret
ul.dropdown-menu
li
a(href='#', data-toggle='modal', data-target='#crate_payment') 创建充值记录
a.create-payment(href='#') 创建充值记录
prepend sidebar
.row
a.btn.btn-lg.btn-success(href='/admin/ticket/')= t('ticket.ticket_list')
append footer
script(src='/script/admin/index.js')