|
|
|
|
|
<div style="padding-top: 10px">
|
|
|
<div class="showPanel">
|
|
|
<p class="clearfix">
|
|
|
<label>姓名</label>
|
|
|
<span><%= @training.name %></span>
|
|
|
</p>
|
|
|
<p class="clearfix">
|
|
|
<label>性别</label>
|
|
|
<span><%= @training.sex == 1 ? '男' : '女' %></span>
|
|
|
</p>
|
|
|
<p class="clearfix">
|
|
|
<label>单位</label>
|
|
|
<span><%= @training.school %></span>
|
|
|
</p>
|
|
|
<p class="clearfix">
|
|
|
<label>职位</label>
|
|
|
<span><%= @training.position %></span>
|
|
|
</p>
|
|
|
<p class="clearfix">
|
|
|
<label>手机号</label>
|
|
|
<span><%= @training.phone %></span>
|
|
|
</p>
|
|
|
</div>
|
|
|
|
|
|
<!-- 地址<div class="df showPanel">
|
|
|
<i class="iconfont icon-zuobiao" style="margin-right: 5px"></i>
|
|
|
<p class="flex1 line20 mt5"><%#= @training.address %></p>
|
|
|
</div>-->
|
|
|
|
|
|
<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">
|
|
|
<label>支付状态</label>
|
|
|
<span class="red" style="font-weight: bold;"><%= @training.training_payinfo.pay_status_str %> </span>
|
|
|
</p>
|
|
|
</div>
|
|
|
|
|
|
<%# 线下支付且未支付时把银行卡 %>
|
|
|
<% if false %>
|
|
|
<% if @training.training_payinfo.pay_type== TrainingPayinfo::PayType_bank && !@training.payed? %>
|
|
|
<div class="showPanel">
|
|
|
<p class="clearfix">
|
|
|
<label>账号</label>
|
|
|
<span>800190320609016</span>
|
|
|
</p>
|
|
|
<p class="clearfix">
|
|
|
<label>户名</label>
|
|
|
<span>湖南酷得网络科技有限公司</span>
|
|
|
</p>
|
|
|
<p class="clearfix">
|
|
|
<label>开户行</label>
|
|
|
<span>长沙银行股份有限公司四方支行</span>
|
|
|
</p>
|
|
|
</div>
|
|
|
<% end %>
|
|
|
<% end %>
|
|
|
|
|
|
<div class="showPanel">
|
|
|
<p class="clearfix">
|
|
|
<label>发票类型</label>
|
|
|
<span><%= @training.training_payinfo.invoice_title.present? ? '普通发票' : '不需要' %></span>
|
|
|
</p>
|
|
|
|
|
|
<% if @training.training_payinfo.invoice_title.present? %>
|
|
|
<p class="clearfix">
|
|
|
<label>发票内容</label>
|
|
|
<span><%= @training.training_payinfo.invoice_content %></span>
|
|
|
</p>
|
|
|
<p class="clearfix">
|
|
|
<label>发票抬头</label>
|
|
|
<span><%= @training.training_payinfo.invoice_title %></span>
|
|
|
</p>
|
|
|
<p class="clearfix">
|
|
|
<label>税务登记号</label>
|
|
|
<span><%= @training.training_payinfo.invoice_no %></span>
|
|
|
</p>
|
|
|
<% end %>
|
|
|
</div>
|
|
|
|
|
|
<div class="showPanel">
|
|
|
<% if @training.training_payinfo.info.present? %>
|
|
|
<p class="clearfix mb5"><label>备注信息</label></p>
|
|
|
<p class="mb5 line20"><%= @training.training_payinfo.info %></p>
|
|
|
<% end %>
|
|
|
|
|
|
<% if @training.training_payinfo.attachment_id.to_i > 0 || @training.training_payinfo.pay_type != TrainingPayinfo::PayType_Wechat %>
|
|
|
<p class="clearfix mb5"><label>支付凭证</label></p>
|
|
|
<!--图片上传-->
|
|
|
<%= render partial: 'upload_img', locals: { training: @training, disabled: true } %>
|
|
|
<% end %>
|
|
|
</div>
|
|
|
<br/>
|
|
|
<br/>
|
|
|
|
|
|
<div class="bottomBtn">
|
|
|
<% if @training.training_payinfo.wechat_wait_pay? %>
|
|
|
<%= link_to "返回", training_path(id: @friendly_id, disable_redirect: true), class: 'leftbtn' %>
|
|
|
<a href="javascript:void(0)" class="rightbtn" id="wechatPayBtn">立即支付</a>
|
|
|
<% else%>
|
|
|
<%= link_to "返回", pay_training_path(id: @friendly_id, disable_redirect: true), class: 'rightbtn', style: 'width: 100%' %>
|
|
|
<% end %>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
<script>
|
|
|
function closeWx(){
|
|
|
window.close();
|
|
|
WeixinJSBridge.call('closeWindow');
|
|
|
}
|
|
|
|
|
|
$(function () {
|
|
|
// eruda.init();
|
|
|
function wechatPay() {
|
|
|
$.ajax({
|
|
|
url: '<%= pay_js_trainings_path(friendly_id: @friendly_id) %>',
|
|
|
type: "POST",
|
|
|
data: '{}'
|
|
|
}
|
|
|
).done(function (data) {
|
|
|
console.log(data);
|
|
|
if (data.status != 0) {
|
|
|
alert(data.msg);
|
|
|
return;
|
|
|
}
|
|
|
var config = data.data;
|
|
|
|
|
|
WeixinJSBridge.invoke(
|
|
|
'getBrandWCPayRequest', {
|
|
|
"appId": config.appid, //公众号名称,由商户传入
|
|
|
"timeStamp": "" + config.time, //时间戳,自1970年以来的秒数
|
|
|
"nonceStr": config.nonce, //随机串
|
|
|
"package": "prepay_id=" + config.prepay_id,
|
|
|
"signType": "MD5", //微信签名方式:
|
|
|
"paySign": config.sign //微信签名
|
|
|
},
|
|
|
function (res) {
|
|
|
if (res.err_msg == "get_brand_wcpay_request:ok") {
|
|
|
// 使用以上方式判断前端返回,微信团队郑重提示:
|
|
|
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
|
|
|
setTimeout(function () {
|
|
|
window.location.href = "/trainings/<% @friendly_id %>/result";
|
|
|
}, 500);
|
|
|
} else if (res.err_msg == 'get_brand_wcpay_request:cancel') {
|
|
|
|
|
|
} else if (res.err_msg == 'get_brand_wcpay_request:fail') {
|
|
|
alert("支付失败");
|
|
|
} else {
|
|
|
alert("支付失败:" + res.err_msg);
|
|
|
}
|
|
|
console.log(res);
|
|
|
});
|
|
|
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$('#wechatPayBtn').on('click', wechatPay);
|
|
|
|
|
|
|
|
|
function InitPhoto() {
|
|
|
var tmpl = '<li class="weui-uploader__file" style="background-image:url(#url#)"></li>',
|
|
|
$gallery = $("#gallery"), $galleryImg = $("#galleryImg"),
|
|
|
$uploaderInput = $("#uploaderInput"),
|
|
|
$uploaderFiles = $("#uploaderFiles")
|
|
|
;
|
|
|
|
|
|
$uploaderInput.on("change", function (e) {
|
|
|
var src, url = window.URL || window.webkitURL || window.mozURL, files = e.target.files;
|
|
|
for (var i = 0, len = files.length; i < len; ++i) {
|
|
|
var file = files[i];
|
|
|
|
|
|
if (url) {
|
|
|
src = url.createObjectURL(file);
|
|
|
} else {
|
|
|
src = e.target.result;
|
|
|
}
|
|
|
|
|
|
$uploaderFiles.html($(tmpl.replace('#url#', src)));
|
|
|
}
|
|
|
if(!files || files.length<=0) return;
|
|
|
|
|
|
var data = new FormData();
|
|
|
data.append('image', files[0]);
|
|
|
data.append('friendly_id', '<%= @friendly_id %>');
|
|
|
|
|
|
$.ajax({
|
|
|
url: '<%= update_picture_trainings_path %>',
|
|
|
type: 'POST',
|
|
|
data: data,
|
|
|
cache: false,
|
|
|
processData: false,
|
|
|
contentType: false
|
|
|
}).done(function (data) {
|
|
|
console.log(data);
|
|
|
if (data.status != 0) {
|
|
|
alert('上传失败:' + data.msg);
|
|
|
return;
|
|
|
}
|
|
|
alert("上传成功");
|
|
|
});
|
|
|
|
|
|
});
|
|
|
$uploaderFiles.on("click", "li", function () {
|
|
|
$galleryImg.attr("style", this.getAttribute("style"));
|
|
|
$gallery.fadeIn(100);
|
|
|
});
|
|
|
$gallery.on("click", function () {
|
|
|
$gallery.fadeOut(100);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
InitPhoto();
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
</script>
|