From e5a1bd5fc88acd025622cdda4f99ce2f0e206b3f Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 14 Jun 2019 16:13:46 +0800 Subject: [PATCH] training: add offline later pay --- app/controllers/trainings_controller.rb | 4 ++++ app/views/trainings/pay.html.erb | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/controllers/trainings_controller.rb b/app/controllers/trainings_controller.rb index 0f291f4e..029b4a31 100644 --- a/app/controllers/trainings_controller.rb +++ b/app/controllers/trainings_controller.rb @@ -173,6 +173,9 @@ class TrainingsController < ApplicationController if training_info.pay_type.to_i == TrainingPayinfo::PayType_Wechat training_info.status = TrainingPayinfo::Status_None + elsif params[:offline_later_pay].to_s == 'true' + # 线下支付-稍后支付 + training_info.status = TrainingPayinfo::Status_None else training_info.status = TrainingPayinfo::Status_Wait end @@ -197,6 +200,7 @@ class TrainingsController < ApplicationController attachment = Attachment.create!(file: params[:image], author: User.first) training_payinfo = @training.training_payinfo training_payinfo.attachment = attachment + training_payinfo.status = TrainingPayinfo::Status_Wait if training_payinfo.status == TrainingPayinfo::Status_None training_payinfo.save! render json: {status: 0} end diff --git a/app/views/trainings/pay.html.erb b/app/views/trainings/pay.html.erb index 8474233f..4ef654fb 100644 --- a/app/views/trainings/pay.html.erb +++ b/app/views/trainings/pay.html.erb @@ -1,6 +1,8 @@
<%= hidden_field_tag(:tag_id, params[:id]) %> + <%= hidden_field_tag(:offline_later_pay, 'false') %> +

@@ -77,7 +79,7 @@

" id="offlinePaySubmitBtn"> - 稍后支付 + 稍后支付 立即支付
@@ -235,6 +237,14 @@ } $('form').submit(); }); + $('#laterSubmitFormBtn').on('click', function () { + if($("#billDemand").attr("status")==2){ + $(".billInput").val(''); + } + $('#offline_later_pay').val('true'); + $('form').submit(); + }); + //上传头像 InitPhoto();