training: add offline later pay

dev_trainings
p31729568 6 years ago
parent 3ac89e3f65
commit e5a1bd5fc8

@ -173,6 +173,9 @@ class TrainingsController < ApplicationController
if training_info.pay_type.to_i == TrainingPayinfo::PayType_Wechat if training_info.pay_type.to_i == TrainingPayinfo::PayType_Wechat
training_info.status = TrainingPayinfo::Status_None training_info.status = TrainingPayinfo::Status_None
elsif params[:offline_later_pay].to_s == 'true'
# 线下支付-稍后支付
training_info.status = TrainingPayinfo::Status_None
else else
training_info.status = TrainingPayinfo::Status_Wait training_info.status = TrainingPayinfo::Status_Wait
end end
@ -197,6 +200,7 @@ class TrainingsController < ApplicationController
attachment = Attachment.create!(file: params[:image], author: User.first) attachment = Attachment.create!(file: params[:image], author: User.first)
training_payinfo = @training.training_payinfo training_payinfo = @training.training_payinfo
training_payinfo.attachment = attachment training_payinfo.attachment = attachment
training_payinfo.status = TrainingPayinfo::Status_Wait if training_payinfo.status == TrainingPayinfo::Status_None
training_payinfo.save! training_payinfo.save!
render json: {status: 0} render json: {status: 0}
end end

@ -1,6 +1,8 @@
<form action="/trainings/update_payinfo" method="post" accept-charset="UTF-8" enctype="multipart/form-data"> <form action="/trainings/update_payinfo" method="post" accept-charset="UTF-8" enctype="multipart/form-data">
<div style="padding-top: 10px"> <div style="padding-top: 10px">
<%= hidden_field_tag(:tag_id, params[:id]) %> <%= hidden_field_tag(:tag_id, params[:id]) %>
<%= hidden_field_tag(:offline_later_pay, 'false') %>
<!-- <div class="showPanel" id="payTypeLine" NavShow>--> <!-- <div class="showPanel" id="payTypeLine" NavShow>-->
<div class="showPanel" id="payTypeLine"> <div class="showPanel" id="payTypeLine">
<p class="clearfix pr"> <p class="clearfix pr">
@ -77,7 +79,7 @@
</div> </div>
<p style="height: 44px;"></p> <p style="height: 44px;"></p>
<div class="bottomBtn <%= @training.training_payinfo.pay_type.to_i == 1 ? "none" : "" %>" id="offlinePaySubmitBtn"> <div class="bottomBtn <%= @training.training_payinfo.pay_type.to_i == 1 ? "none" : "" %>" id="offlinePaySubmitBtn">
<a href="<%= enroll_training_path(id: @tag_id) %>" class="leftbtn">稍后支付</a> <a href="javascript:void(0)" class="leftbtn" id="laterSubmitFormBtn">稍后支付</a>
<a href="javascript:void(0)" class="rightbtn" id="submitFormBtn">立即支付</a> <a href="javascript:void(0)" class="rightbtn" id="submitFormBtn">立即支付</a>
</div> </div>
@ -235,6 +237,14 @@
} }
$('form').submit(); $('form').submit();
}); });
$('#laterSubmitFormBtn').on('click', function () {
if($("#billDemand").attr("status")==2){
$(".billInput").val('');
}
$('#offline_later_pay').val('true');
$('form').submit();
});
//上传头像 //上传头像
InitPhoto(); InitPhoto();

Loading…
Cancel
Save