Merge branch 'develop' into educoder

dev_library
p31729568 6 years ago
commit 1a8e13367f

@ -4161,7 +4161,7 @@ end
sheet1 = book.create_worksheet :name => "sheet" sheet1 = book.create_worksheet :name => "sheet"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue sheet1.row(0).default_format = blue
sheet1.row(0).concat(["姓名", "手机号","邮箱","单位名称", "职位","专业", "学号", '授课/研究领域' "支付方式","支付状态","支付时间", "发票类型", "发票抬头","税务登记号", "发票内容", "备注", "微信支付单号", "报名时间"]) sheet1.row(0).concat(["姓名", "手机号","邮箱","单位名称", "职位","专业", "学号", '授课/研究领域', "支付方式","支付状态","支付时间", "发票类型", "发票抬头","税务登记号", "发票内容", "备注", "微信支付单号", "报名时间"])
count_row = 1 count_row = 1
trainings.find_each do |t| trainings.find_each do |t|
sheet1[count_row, 0] = t.name sheet1[count_row, 0] = t.name

@ -10,7 +10,7 @@ class TrainingsController < ApplicationController
before_filter :authenticate, except: [:auth, :auth_callback, :pay_callback] before_filter :authenticate, except: [:auth, :auth_callback, :pay_callback]
before_filter :find_tag_id, only: [:show, :create, :update, :enroll, :test] before_filter :find_tag_id, except: [:auth, :auth_callback, :pay_callback]
before_filter :find_training, only: [:show, :test] before_filter :find_training, only: [:show, :test]
@ -44,18 +44,24 @@ class TrainingsController < ApplicationController
end end
def pay def pay
_pay_params
@training = current_training @training = current_training
if @training.blank?
redirect_to enroll_training_path(id: @tag_id)
return
end
# 防止重复支付,对于已支付过的,不应该再到这个页来 # 防止重复支付,对于已支付过的,不应该再到这个页来
if @training.payed? if @training.payed?
redirect_to result_training_path(id: @tag_id) redirect_to result_training_path(id: @tag_id)
return return
end end
@training.training_payinfo ||= TrainingPayinfo.new @training.training_payinfo ||= begin
payinfo = TrainingPayinfo.new
payinfo.fee = @training.registration_fee # 默认值价格不对
payinfo
end
end end
def pay_callback def pay_callback
@ -98,11 +104,9 @@ class TrainingsController < ApplicationController
end end
def result def result
_pay_params
@training = current_training @training = current_training
end end
def create def create
@training = current_training || Training.new(params) @training = current_training || Training.new(params)
@training.training_type = @training_type @training.training_type = @training_type
@ -113,15 +117,15 @@ class TrainingsController < ApplicationController
@training.save! @training.save!
flash[:message] = '提交成功' flash[:message] = '提交成功'
redirect_to enroll_training_path(id: @tag_id)
# redirect_to pay_training_path(id: @tag_id) redirect_to pay_training_path(id: @tag_id)
end end
def update def update
@training = current_training @training = current_training
unless @training if @training.blank?
render_404 redirect_to enroll_training_path(id: @tag_id)
return return
end end
@ -132,8 +136,8 @@ class TrainingsController < ApplicationController
@training.save! @training.save!
flash[:message] = '提交成功' flash[:message] = '提交成功'
redirect_to enroll_training_path(id: @tag_id)
# redirect_to pay_training_path(id: @tag_id) redirect_to pay_training_path(id: @tag_id)
end end
@ -143,13 +147,11 @@ class TrainingsController < ApplicationController
# 采用ajax调用方式返回支付参数 # 采用ajax调用方式返回支付参数
def update_payinfo def update_payinfo
@training = current_training @training = current_training
unless @training if @training.blank?
render_404 redirect_to enroll_training_path(id: @tag_id)
return return
end end
_pay_params
attachment = nil attachment = nil
if params[:image] if params[:image]
attachment = Attachment.create!(file: params[:image], author: User.first) attachment = Attachment.create!(file: params[:image], author: User.first)
@ -163,17 +165,17 @@ class TrainingsController < ApplicationController
training_info = TrainingPayinfo.new(params) training_info = TrainingPayinfo.new(params)
end end
training_info.num = params[:enlistN].to_i training_info.num = params[:enlistNum].to_i < 1 ? 1 : params[:enlistNum].to_i
if training_info.num < 1
training_info.num = 1
end
training_info.fee = (training_info.num * @pay_fee).to_i training_info.fee = @training.registration_fee(training_info.num)
training_info.attachment = attachment if attachment.present? training_info.attachment = attachment if attachment.present?
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
@ -183,7 +185,8 @@ class TrainingsController < ApplicationController
training_info.save! training_info.save!
if params[:js] == 'true' if params[:js] == 'true'
_pay_js(training_info.fee) Rails.logger.info("### start wechat pay => fee: #{training_info.fee}")
_pay_js(0.01 || training_info.fee)
else else
redirect_to url = result_training_path(id: @tag_id) redirect_to url = result_training_path(id: @tag_id)
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
@ -218,7 +222,7 @@ class TrainingsController < ApplicationController
# #
# 写入wechat_pay付费表 # 写入wechat_pay付费表
WechatPay.create!(training_id: @training.id, out_trade_no: out_trade_no) WechatPay.create!(training_id: @training.id, out_trade_no: out_trade_no)
render json: {status: 0, data: unifiedorder(out_trade_no, fee)} render json: {status: 0, data: unifiedorder(out_trade_no, fee, @training.pay_order_title)}
end end
end end
@ -248,9 +252,6 @@ class TrainingsController < ApplicationController
end end
private private
def _pay_params
@pay_fee = Redmine::Configuration['training_fee'].to_f || 5000
end
def authenticate def authenticate
if Rails.env.development? if Rails.env.development?
@ -279,7 +280,7 @@ class TrainingsController < ApplicationController
def current_training def current_training
Rails.logger.info("##########openid:#{session[:wechat_open_id]}, training_type: #{@training_type}") Rails.logger.info("##########openid:#{session[:wechat_open_id]}, training_type: #{@training_type}")
Training.where(openid: session[:wechat_open_id], training_type: @training_type).first @_current_training ||= Training.where(openid: session[:wechat_open_id], training_type: @training_type).first
end end
def valid_training def valid_training
@ -326,14 +327,10 @@ class TrainingsController < ApplicationController
end end
def unifiedorder(out_trade_no, fee) def unifiedorder(out_trade_no, fee, title)
@config = {} @config = {}
output = Wechat.pay.unifiedorder('湖南警察学院大数据培训会-报名费', output = Wechat.pay.unifiedorder(title, (fee * 100).to_i, session[:wechat_open_id], client_ip, out_trade_no)
(fee * 100).to_i,
session[:wechat_open_id],
client_ip,
out_trade_no)
data = output.fetch("xml") data = output.fetch("xml")
if data.nil? if data.nil?
raise "获取微信统一单错误" raise "获取微信统一单错误"
@ -361,5 +358,4 @@ class TrainingsController < ApplicationController
@config @config
end end
end end

@ -25,4 +25,22 @@ class Training < ActiveRecord::Base
research_field.present? && research_field.split(',').include?(str) research_field.present? && research_field.split(',').include?(str)
end end
def pay_order_title
case training_type
when 3 then '全国高校大数据和人工智能暑期师资培训会-报名费'
when 4 then '工程教育认证培训会-报名费'
end
end
def registration_fee(num = 1)
case training_type
when 3 then
# 三人以上 8折
num >= 3 ? 3000.0 * 0.8 * num : 3000.0 * num
when 4 then
1200.0 * num
else
raise ArgumentError
end
end
end end

@ -15,7 +15,12 @@ class TrainingPayinfo < ActiveRecord::Base
PayType_bank = 3 #银行卡支付 PayType_bank = 3 #银行卡支付
def pay_type_str def pay_type_str
pay_type==PayType_Wechat ? '微信支付' : (pay_type==PayType_alipay ? '支付宝支付' : (pay_type==PayType_bank ? '银行卡支付' : '')) case pay_type
when PayType_Wechat then '微信支付'
when PayType_alipay then '支付宝支付'
when PayType_bank then '银行卡支付'
else ''
end
end end
def pay_status_str def pay_status_str
@ -30,7 +35,7 @@ class TrainingPayinfo < ActiveRecord::Base
end end
def pay_time def pay_time
WechatPay.where(:out_trade_no => self.out_trade_no).first.try(:created_at) WechatPay.where(out_trade_no: out_trade_no).first.try(:created_at)
end end
def wechat_wait_pay? def wechat_wait_pay?

@ -152,57 +152,25 @@
name="position" name="position"
value="<%= @training.position %>"/> value="<%= @training.position %>"/>
</li> </li>
<li class="clearfix infoBar">
<span class="left_tag fl">手机号码</span>
<input type="text" class="right_input" placeholder="请输入手机号" id="userphone"
name="phone"
value="<%= @training.phone %>"/>
</li>
<% if @training_type == 3 %> <% if @training_type == 3 %>
<p class="subtitle">您的授课/研究领域最少选1项</p> <p class="subtitle">您关注的课程类型最少选1项</p>
<li class="clearfix infoBar">
<span class="left_tag fl">机器学习/深度学习</span> <% %w(程序设计 操作系统 数据库 软件工程 云计算 大数据 人工智能 计算机网络 物联网 信息安全 其他).each_with_index do |name, index| %>
<span class="fr"> <li class="clearfix infoBar">
<input type="checkbox" name="research_field[]" value="机器学习/深度学习" <%= @training.research_field_include?("机器学习/深度学习") ? "checked" : "" %> id="check_1" class="magic-checkbox"> <span class="left_tag fl"><%= name %></span>
<label for="check_1" style="top:8px">&nbsp;</label> <span class="fr">
</span> <input type="checkbox" name="research_field[]" value="<%= name %>" <%= @training.research_field_include?(name) ? "checked" : "" %> id="check_<%= index %>" class="magic-checkbox">
</li> <label for="check_<%= index %>" style="top:8px">&nbsp;</label>
<li class="clearfix infoBar"> </span>
<span class="left_tag fl">计算机结构与组成</span> </li>
<span class="fr"> <% end %>
<input type="checkbox" name="research_field[]" value="计算机结构与组成" <%= @training.research_field_include?("计算机结构与组成") ? "checked" : "" %> id="check_2" class="magic-checkbox">
<label for="check_2" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">计算机系统</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="计算机系统" <%= @training.research_field_include?("计算机系统") ? "checked" : "" %> id="check_3" class="magic-checkbox">
<label for="check_3" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">计算机软件技术和应用</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="计算机软件技术和应用" <%= @training.research_field_include?("计算机软件技术和应用") ? "checked" : "" %> id="check_4" class="magic-checkbox">
<label for="check_4" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">计算机理论</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="计算机理论" <%= @training.research_field_include?("计算机理论") ? "checked" : "" %> id="check_5" class="magic-checkbox">
<label for="check_5" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">计算机应用与学科交叉</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="计算机应用与学科交叉" <%= @training.research_field_include?("计算机应用与学科交叉") ? "checked" : "" %> id="check_6" class="magic-checkbox">
<label for="check_6" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">其他</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="其他" <%= @training.research_field_include?("其他") ? "checked" : "" %> id="check_7" class="magic-checkbox">
<label for="check_7" style="top:8px">&nbsp;</label>
</span>
</li>
<% end %> <% end %>
<!-- <p class="subtitle">通讯地址</p>--> <!-- <p class="subtitle">通讯地址</p>-->
@ -214,12 +182,6 @@
<!-- </div>--> <!-- </div>-->
<!-- <textarea class="DetailAddress" placeholder="请输入详细地址" name="address" id="DetailAdd" style="margin-top: 15px;"><%#= @training.address %></textarea>--> <!-- <textarea class="DetailAddress" placeholder="请输入详细地址" name="address" id="DetailAdd" style="margin-top: 15px;"><%#= @training.address %></textarea>-->
<!-- </li>--> <!-- </li>-->
<li class="clearfix infoBar">
<span class="left_tag fl">手机号码</span>
<input type="text" class="right_input" placeholder="请输入手机号" id="userphone"
name="phone"
value="<%= @training.phone %>"/>
</li>
<!-- <li class="clearfix infoBar">--> <!-- <li class="clearfix infoBar">-->
<!-- <span class="left_tag fl">Email</span>--> <!-- <span class="left_tag fl">Email</span>-->
<!-- <input type="text" class="right_input" placeholder="请输入Email" id="userEmail" name="email" value="<%#= @training.email %>"/>--> <!-- <input type="text" class="right_input" placeholder="请输入Email" id="userEmail" name="email" value="<%#= @training.email %>"/>-->
@ -258,40 +220,40 @@
//下一步 //下一步
function NextStep() { function NextStep() {
var username = $("#username").val(); var username = $("#username").val();
var userMajor = $("#userMajor").val(); var userUnit = $("#userUnit").val();
var userphone = $("#userphone").val(); var userPositional = $("#userPositional").val();
var userID = $("#userID").val(); var userphone = $("#userphone").val();
if (username == '') { if (username == '') {
alert("请输入真实姓名"); alert("请输入姓名");
return; return;
} }
if (userMajor == '') { if (userUnit == '') {
alert("请输入专业"); alert("请输入单位名称或者学校");
return; return;
} }
if (userID == '') { if (userPositional == '') {
alert("请输入学号"); alert("请输入职称");
return; return;
} }
if (userphone == '') {
alert("请输入手机号码");
return;
} else if (!/^1\d{10}$/.test(userphone) && !/^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(userphone)) {
alert("请输入正确的手机号码");
return;
}
<% if @training_type == 3 %> <% if @training_type == 3 %>
if ($("input[type='checkbox'][name='research_field[]']:checked").length == 0) { if ($("input[type='checkbox'][name='research_field[]']:checked").length == 0) {
alert('请选择授课类型/研究领域'); alert('请选择您关注的课程类型');
return; return;
} }
<% end %> <% end %>
if (userphone == '') {
alert("请输入手机号码");
return;
} else if (!/^1\d{10}$/.test(userphone) && !/^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(userphone)) {
alert("请输入正确的手机号码");
return;
}
$('form').submit(); $('form').submit();
} }

@ -1,12 +1,18 @@
<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">
<div class="showPanel" id="payTypeLine" NavShow> <%= 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">
<p class="clearfix pr"> <p class="clearfix pr">
<label>支付方式</label> <label>支付方式</label>
<span class="mr5" style="margin-right: 24px;" id="payTypeName"><%= @training.training_payinfo.pay_type.to_i == 3 ? "线下支付" : "微信支付" %></span> <!-- <span class="mr5" style="margin-right: 24px;" id="payTypeName"><%#= @training.training_payinfo.pay_type.to_i == 3 ? "线下支付" : "微信支付" %></span>-->
<span class="mr5" style="margin-right: 24px;">线下支付</span>
<i class="iconfont icon-gengduo1 rightArrow" style="color: #323232;right: 4px"></i> <i class="iconfont icon-gengduo1 rightArrow" style="color: #323232;right: 4px"></i>
</p> </p>
<div class="<%= @training.training_payinfo.pay_type.to_i == 3 ? "" : "none" %> mt5" id="payInfos"> <!-- <div class="<%#= @training.training_payinfo.pay_type.to_i == 3 ? "" : "none" %> mt5" id="payInfos">-->
<div class="mt5" id="payInfos">
<div class="payInfo df"> <div class="payInfo df">
<span class="fl accountIcon"> <span class="fl accountIcon">
<i class="iconfont icon-yinhangqia blue"></i> <i class="iconfont icon-yinhangqia blue"></i>
@ -39,7 +45,7 @@
<p class="clearfix" id="billRemark"> <p class="clearfix" id="billRemark">
<span class="grey fl">发票内容</span> <span class="grey fl">发票内容</span>
<input type="text" name="invoice_content" class="right_input" <input type="text" name="invoice_content" class="right_input"
value="<%#= @training.training_payinfo.invoice_content.presence || '会议注册费' %>"/> value="<%= @training.training_payinfo.try(:invoice_content).presence || '研讨会' %>"/>
</p> </p>
</div> </div>
<div class="infoBar mb10"> <div class="infoBar mb10">
@ -49,32 +55,36 @@
<%= render :partial => 'upload_img', :locals => {:training => @training} %> <%= render :partial => 'upload_img', :locals => {:training => @training} %>
</div> </div>
<div class="infoBar mb10"> <div class="infoBar mb10">
<p>费用明细<span class="color-orange" id="percentPay">3人及以上8折优惠)</span></p> <p>费用明细
<% if @training.training_type == 3 %>
<span class="color-orange" id="percentPay">3人及以上8折优惠)</span>
<% end %>
</p>
<p class="break-word justify moneyDetail">含会议注册费、场地费、培训费、教材资料费、餐费、专家差率费等</p> <p class="break-word justify moneyDetail">含会议注册费、场地费、培训费、教材资料费、餐费、专家差率费等</p>
<p class="clearfix"> <p class="clearfix">
<input type="hidden" name="enlistNum" value="1"/> <input type="hidden" name="enlistNum" value="<%= @training.training_payinfo.num || 1 %>"/>
<input type="hidden" name="enlistMoney" value="3000"/> <input type="hidden" name="enlistMoney" value="<%= @training.training_payinfo.fee || @training.registration_fee %>"/>
<span class="fl red mr5 font-16">¥<span id="enlistM">3000</span></span> <span class="fl red mr5 font-16">¥<span id="enlistM"><%= @training.training_payinfo.fee || @training.registration_fee %></span></span>
<span class="lastPrice"></span> <span class="lastPrice"></span>
<span class="fr font-16"> <span class="fr font-16">
<a href="javascript:void(0)" class="minusNum" onclick="minusNum(this)"> <a href="javascript:void(0)" class="minusNum" onclick="minusNum(this)">
<i class="iconfont icon-default sky_blue font-18"></i> <i class="iconfont icon-default sky_blue font-18"></i>
</a> </a>
<span class="mr5 ml5 font-14"><span id="enlistN">1</span>人</span> <span class="mr5 ml5 font-14"><span id="enlistN"><%= @training.training_payinfo.num || 1 %></span>人</span>
<a href="javascript:void(0)" class="plusNum" onclick="plusNum(this)"> <a href="javascript:void(0)" class="plusNum" onclick="plusNum(this)">
<i class="iconfont icon-roundaddfill blue font-18"></i> <i class="iconfont icon-roundaddfill blue font-18"></i>
</a> </a>
</span> </span>
</p> </p>
</div> </div>
<p style="height: 44px;"></p> <p style="height: 44px;"></p>
<div class="bottomBtn <%= @training.training_payinfo.pay_type.to_i ==3 ? "" : "none" %>" id="offlinePaySubmitBtn"> <div class="bottomBtn <%= @training.training_payinfo.pay_type.to_i == 1 ? "none" : "" %>" id="offlinePaySubmitBtn">
<a href="<%= enroll_training_path(id: 'bigdata_hnjcxy_2019') %>" 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>
<div class="bottomBtn <%= @training.training_payinfo.pay_type.to_i ==3 ? "none" : "" %>" id="paySubmitBtn"> <div class="bottomBtn <%= @training.training_payinfo.pay_type.to_i == 1 ? "" : "none" %>" id="paySubmitBtn">
<a href="<%= enroll_training_path(id: 'bigdata_hnjcxy_2019') %>" class="leftbtn">返回</a> <a href="<%= enroll_training_path(id: @tag_id) %>" class="leftbtn">返回</a>
<a href="javascript:void(0)" class="rightbtn" id="payBtn">立即支付</a> <a href="javascript:void(0)" class="rightbtn" id="payBtn">立即支付</a>
</div> </div>
@ -115,7 +125,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<input type="hidden" id="pay_type" name="pay_type" value="<%= @training.training_payinfo.pay_type.presence || 1 %>"> <input type="hidden" id="pay_type" name="pay_type" value="<%= @training.training_payinfo.pay_type.presence || 3 %>">
</form> </form>
<!--<script src="https://cdn.jsdelivr.net/npm/eruda" type="text/javascript"></script>--> <!--<script src="https://cdn.jsdelivr.net/npm/eruda" type="text/javascript"></script>-->
@ -124,22 +134,21 @@
// //
// eruda.init(); // eruda.init();
// var userInfo = { var userInfo = {
// name: '<%= @training.name %>', name: '<%= @training.name %>',
// school: '<%= @training.school %>', school: '<%= @training.school %>',
// //支付方式默认为0 //支付方式默认为0
// // 1 微信支付 // 1 微信支付
// // 2 支付宝支付 // 2 支付宝支付
// // 3 银行卡支付 // 3 银行卡支付
// payType: <%#= @training.training_payinfo.pay_type.to_i %>, // payType: <%#= @training.training_payinfo.pay_type.to_i %>,
// payType: 3,
// //发票抬头 //发票抬头
// //为空则代表不需要发票 //为空则代表不需要发票
// invoiceTitle: '<%#= @training.training_payinfo.invoice_title %>', invoiceTitle: '<%= @training.training_payinfo.invoice_title %>',
// //税号
// //税号 invoiceNo: '<%= @training.training_payinfo.invoice_no %>'
// invoiceNo: '<%#= @training.training_payinfo.invoice_no %>' };
// };
//点击弹出发票弹框 //点击弹出发票弹框
aboutBillType(userInfo); aboutBillType(userInfo);
@ -147,13 +156,13 @@
aboutPayType(); aboutPayType();
//初始化发票类型 //初始化发票类型
//InitBill(userInfo); InitBill(userInfo);
//切换发票类型 //切换发票类型
$(".billType li").on("click", function () { $(".billType li").on("click", function () {
$(".billType li").removeClass("active"); $(".billType li").removeClass("active");
$(this).addClass("active"); $(this).addClass("active");
billTypeShowFun(parseInt($(this).index())); billTypeShowFun(parseInt($(this).index()), userInfo);
}) })
//关闭弹窗 //关闭弹窗
$(".billClose").on("click", function () { $(".billClose").on("click", function () {
@ -205,7 +214,7 @@
// 使用以上方式判断前端返回,微信团队郑重提示: // 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok但并不保证它绝对可靠。 //res.err_msg将在用户支付成功后返回ok但并不保证它绝对可靠。
setTimeout(function () { setTimeout(function () {
window.location.href = "/trainings/bigdata_hnjcxy_2019/result"; window.location.href = "/trainings/<%= @tag_id %>/result";
}, 500); }, 500);
} else if (res.err_msg == 'get_brand_wcpay_request:cancel') { } else if (res.err_msg == 'get_brand_wcpay_request:cancel') {
@ -228,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();
@ -236,7 +253,7 @@
//加减报名人数 //加减报名人数
function minusNum(item){ function minusNum(item){
var num=parseInt($("#enlistN").html()); var num=parseInt($("#enlistN").html());
var money=parseFloat(3000).toFixed(2); var money=parseFloat(<%= @training.registration_fee %>).toFixed(2);
var percent=$("#percentPay"); var percent=$("#percentPay");
if(num>1){ if(num>1){
num=num-1; num=num-1;
@ -259,7 +276,7 @@
} }
function plusNum(item){ function plusNum(item){
var num=parseInt($("#enlistN").html()); var num=parseInt($("#enlistN").html());
var money=parseFloat(3000).toFixed(2); var money=parseFloat(<%= @training.registration_fee %>).toFixed(2);
var percent=$("#percentPay"); var percent=$("#percentPay");
num=num+1; num=num+1;
@ -297,7 +314,7 @@
$(".billType li").eq(index).addClass("active"); $(".billType li").eq(index).addClass("active");
billTypeShowFun(index,userInfo); billTypeShowFun(index,userInfo);
} }
function billTypeShowFun(index){ function billTypeShowFun(index, userInfo){
if (parseInt(index) == 0) { if (parseInt(index) == 0) {
$(".needWrite").removeClass("none"); $(".needWrite").removeClass("none");
$(".billUnit").attr("placeholder", "请填写公司单位名称").val(userInfo.school); $(".billUnit").attr("placeholder", "请填写公司单位名称").val(userInfo.school);
@ -353,7 +370,7 @@
//提交发票信息 //提交发票信息
/*function submitBillInfo() { function submitBillInfo() {
var type = $(".billType li.active").html(); var type = $(".billType li.active").html();
var unit = $(".billUnit").val(); var unit = $(".billUnit").val();
var tax = $(".taxNumber").val(); var tax = $(".taxNumber").val();
@ -386,7 +403,7 @@
//记录选中的发票类型 //记录选中的发票类型
$("#billDemand").attr("status",$(".billType li.active").index()); $("#billDemand").attr("status",$(".billType li.active").index());
hideNav($(".billDownNav")); hideNav($(".billDownNav"));
}*/ }
function InitPhoto() { function InitPhoto() {
var tmpl = '<li class="weui-uploader__file" style="background-image:url(#url#)"></li>', var tmpl = '<li class="weui-uploader__file" style="background-image:url(#url#)"></li>',

@ -10,12 +10,12 @@
<span><%= @training.sex == 1 ? '男' : '女' %></span> <span><%= @training.sex == 1 ? '男' : '女' %></span>
</p> </p>
<p class="clearfix"> <p class="clearfix">
<label>专业</label> <label>单位</label>
<span><%= @training.major %></span> <span><%= @training.school %></span>
</p> </p>
<p class="clearfix"> <p class="clearfix">
<label>学号</label> <label>职位</label>
<span><%= @training.student_id %></span> <span><%= @training.position %></span>
</p> </p>
<p class="clearfix"> <p class="clearfix">
<label>手机号</label> <label>手机号</label>
@ -29,6 +29,14 @@
</div>--> </div>-->
<div class="showPanel"> <div class="showPanel">
<p class="clearfix">
<label>报名人数</label>
<span><%= @training.training_payinfo.num %>人 </span>
</p>
<p class="clearfix">
<label>支付金额</label>
<span class="red" style="font-weight: bold;">¥<%= @training.training_payinfo.fee %> </span>
</p>
<p class="clearfix"> <p class="clearfix">
<label>支付状态</label> <label>支付状态</label>
<span class="red" style="font-weight: bold;"><%= @training.training_payinfo.pay_status_str %> </span> <span class="red" style="font-weight: bold;"><%= @training.training_payinfo.pay_status_str %> </span>
@ -55,27 +63,27 @@
<% end %> <% end %>
<% end %> <% end %>
<!--发票<div class="showPanel"> <div class="showPanel">
<p class="clearfix"> <p class="clearfix">
<label>发票类型</label> <label>发票类型</label>
<span><%#= @training.training_payinfo.invoice_title.present? ? '普通发票' : '不需要' %></span> <span><%= @training.training_payinfo.invoice_title.present? ? '普通发票' : '不需要' %></span>
</p> </p>
<%# if @training.training_payinfo.invoice_title.present? %> <% if @training.training_payinfo.invoice_title.present? %>
<p class="clearfix"> <p class="clearfix">
<label>发票内容</label> <label>发票内容</label>
<span><%#= @training.training_payinfo.invoice_content %></span> <span><%= @training.training_payinfo.invoice_content %></span>
</p> </p>
<p class="clearfix"> <p class="clearfix">
<label>发票抬头</label> <label>发票抬头</label>
<span><%#= @training.training_payinfo.invoice_title %></span> <span><%= @training.training_payinfo.invoice_title %></span>
</p> </p>
<p class="clearfix"> <p class="clearfix">
<label>税务登记号</label> <label>税务登记号</label>
<span><%#= @training.training_payinfo.invoice_no %></span> <span><%= @training.training_payinfo.invoice_no %></span>
</p> </p>
<%# end %> <% end %>
</div>--> </div>
<div class="showPanel"> <div class="showPanel">
<p class="clearfix mb5"><label>其他信息</label></p> <p class="clearfix mb5"><label>其他信息</label></p>
@ -85,8 +93,10 @@
<!--图片上传--> <!--图片上传-->
<%= render :partial => 'upload_img', :locals => {:training => @training} %> <%= render :partial => 'upload_img', :locals => {:training => @training} %>
<% end %> <% end %>
<p class="sendMoney clearfix"><span class="red font-16 fr">¥<%= @training.training_payinfo.fee %></span><span class="mr5 font-12 fr"><%= @training.training_payinfo.num %>人</span></p> <!-- <p class="sendMoney clearfix"><span class="red font-16 fr">¥<%#= @training.training_payinfo.fee %></span><span class="mr5 font-12 fr"><%#= @training.training_payinfo.num %>人</span></p>-->
</div> </div>
<br/>
<br/>
<!-- <p class="clearfix enrollNum"> <!-- <p class="clearfix enrollNum">
<%#= link_to '查看会议信息', training_path(id: 'bigdata_hnjcxy_2019', force: true), class:'fl meetInfo' %> <%#= link_to '查看会议信息', training_path(id: 'bigdata_hnjcxy_2019', force: true), class:'fl meetInfo' %>
<span class="fr">已报名人数:<%#= TrainingPayinfo.total_num %>人</span> <span class="fr">已报名人数:<%#= TrainingPayinfo.total_num %>人</span>
@ -98,11 +108,11 @@
<% else %> <% else %>
<% if @training.training_payinfo.wechat_wait_pay? %> <% if @training.training_payinfo.wechat_wait_pay? %>
<div class="bottomBtn"> <div class="bottomBtn">
<%= link_to "返回", pay_training_path(id: 'bigdata_hnjcxy_2019'), class: 'leftbtn' %> <%= link_to "返回", pay_training_path(id: @tag_id), class: 'leftbtn' %>
<a href="javascript:void(0)" class="rightbtn" id="wechatPayBtn">立即支付</a> <a href="javascript:void(0)" class="rightbtn" id="wechatPayBtn">立即支付</a>
</div> </div>
<% elsif !@training.payed? %> <% elsif !@training.payed? %>
<%= link_to "返回", pay_training_path(id: 'bigdata_hnjcxy_2019'), class: 'returnBtn' %> <%= link_to "返回", pay_training_path(id: @tag_id), class: 'returnBtn' %>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
@ -144,7 +154,7 @@
// 使用以上方式判断前端返回,微信团队郑重提示: // 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok但并不保证它绝对可靠。 //res.err_msg将在用户支付成功后返回ok但并不保证它绝对可靠。
setTimeout(function () { setTimeout(function () {
window.location.href = "/trainings/bigdata_hnjcxy_2019/result"; window.location.href = "/trainings/<% @tag_id %>/result";
}, 500); }, 500);
} else if (res.err_msg == 'get_brand_wcpay_request:cancel') { } else if (res.err_msg == 'get_brand_wcpay_request:cancel') {

Loading…
Cancel
Save