You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pgfqe6ch8/app/views/trainings/result.html.erb

233 lines
8.0 KiB

6 years ago
<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>
6 years ago
</p>
<p class="clearfix">
<label>职位</label>
<span><%= @training.position %></span>
6 years ago
</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>
6 years ago
<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">
6 years ago
<p class="clearfix">
<label>发票类型</label>
<span><%= @training.training_payinfo.invoice_title.present? ? '普通发票' : '不需要' %></span>
6 years ago
</p>
<% if @training.training_payinfo.invoice_title.present? %>
6 years ago
<p class="clearfix">
<label>发票内容</label>
<span><%= @training.training_payinfo.invoice_content %></span>
6 years ago
</p>
<p class="clearfix">
<label>发票抬头</label>
<span><%= @training.training_payinfo.invoice_title %></span>
6 years ago
</p>
<p class="clearfix">
<label>税务登记号</label>
<span><%= @training.training_payinfo.invoice_no %></span>
6 years ago
</p>
<% end %>
</div>
6 years ago
<div class="showPanel">
<p class="clearfix mb5"><label>其他信息</label></p>
<p class="mb5 line20"><%= @training.training_payinfo.info %></p>
<% if @training.training_payinfo.attachment_id.to_i > 0 || @training.training_payinfo.pay_type != TrainingPayinfo::PayType_Wechat %>
<!--图片上传-->
<%= render :partial => 'upload_img', :locals => {:training => @training} %>
<% 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>-->
6 years ago
</div>
<br/>
<br/>
6 years ago
<!-- <p class="clearfix enrollNum">
<%#= link_to '查看会议信息', training_path(id: 'bigdata_hnjcxy_2019', force: true), class:'fl meetInfo' %>
<span class="fr">已报名人数:<%#= TrainingPayinfo.total_num %>人</span>
</p>
<p style="height: 50px;"></p>-->
<% if @training.payed? %>
<a href="javascript:void(0);" onclick="closeWx();" class="submitForm">完成</a>
<% else %>
<% if @training.training_payinfo.wechat_wait_pay? %>
<div class="bottomBtn">
<%= link_to "返回", pay_training_path(id: @tag_id), class: 'leftbtn' %>
6 years ago
<a href="javascript:void(0)" class="rightbtn" id="wechatPayBtn">立即支付</a>
</div>
<% elsif !@training.payed? %>
<%= link_to "返回", pay_training_path(id: @tag_id), class: 'returnBtn' %>
6 years ago
<% end %>
<% end %>
</div>
</div>
<script>
function closeWx(){
window.close();
WeixinJSBridge.call('closeWindow');
}
$(function () {
// eruda.init();
function wechatPay() {
$.ajax({
url: '<%= pay_js_trainings_path %>',
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/<% @tag_id %>/result";
6 years ago
}, 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('tag_id', '<%= @tag_id %>');
6 years ago
$.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>