Files
RootPanel/core/static/script/admin.coffee
2014-08-10 18:47:36 +08:00

42 lines
1.2 KiB
CoffeeScript

$ ->
$('.action-create-payment').click ->
$('#account_id').html $(@).parents('tr').data 'id'
$('#create-payment-modal').modal 'show'
$('.action-delete-account').click (e) ->
e.preventDefault()
$.post '/admin/delete_account/', JSON.stringify
account_id: $(@).parents('tr').data 'id'
.success ->
location.reload()
$('.action-disable-site').click (e) ->
e.preventDefault()
$.post '/admin/update_site/', JSON.stringify
site_id: $(@).parents('tr').data 'id'
is_enable: false
.success ->
location.reload()
$('.action-enable-site').click (e) ->
e.preventDefault()
$.post '/admin/update_site/', JSON.stringify
site_id: $(@).parents('tr').data 'id'
is_enable: true
.success ->
location.reload()
$('#create-payment-modal .action-create-payment').click ->
$.post '/admin/create_payment/', JSON.stringify
account_id: $('#account_id').html()
type: 'taobao'
amount: $('#amont').val()
order_id: $('#order_id').val()
.fail (jqXHR) ->
if jqXHR.responseJSON?.error
alert jqXHR.responseJSON.error
else
alert jqXHR.statusText
.success ->
location.reload()