modify trainings

dev_trainings
p31729568 6 years ago
parent 92c7dd4ead
commit d8e3214a16

@ -18,7 +18,7 @@ class TrainingsController < ApplicationController
def show
@training = current_training
if @training.training_payinfo.present? && params[:disable_redirect].blank?
if @training.training_payinfo.present? && !@training.training_payinfo.not_payed? && params[:disable_redirect].blank?
redirect_to result_training_path(id: friendly_id)
return
end
@ -125,7 +125,7 @@ class TrainingsController < ApplicationController
attachment = nil
attachment = Attachment.create!(file: params[:image], author: User.first) if params[:image]
if attachment.blank? && training_info.not_payed?
if training_info.attachment.blank? && attachment.blank? && training_info.not_payed?
flash[:message] = '请先上传支付凭证'
render 'pay'
return

@ -248,7 +248,7 @@
$('#submitFormBtn').on('click', function () {
if(!checkBillInfo()){ return; }
<% if @training.training_payinfo.not_payed? %>
<% if @training.training_payinfo.blank? || (@training.training_payinfo.not_payed? && @training.training_payinfo.attachment.blank?) %>
var image = $("input[name='image']").val()
if (!image || image.length < 0) {
alert('请先上传支付凭证');

@ -38,7 +38,7 @@
<%= link_to('修改资料', enroll_training_path(id: @friendly_id, disable_redirect: true), class: 'info_updateBtn') %>
<% if @training.training_payinfo.blank? %>
<% if @training.training_payinfo.blank? || @training.training_payinfo.not_payed? %>
<div class="bottomBtn">
<%= link_to '转账支付', pay_training_path(id: @friendly_id, pay_type: 3), class: 'leftbtn' %>
<%#= link_to '微信支付', pay_training_path(id: @friendly_id, pay_type: 1), class: 'rightbtn' %>

Loading…
Cancel
Save