reject trial authorization modal feature

dev_partners
p31729568 6 years ago
parent 859e3e9a62
commit 05cd6b874b

@ -3476,7 +3476,7 @@ end
type = params[:type] type = params[:type]
search = params[:search] search = params[:search]
if type == "0" if type == "0"
authentication_user = AuthenticationsUsers.where(:user_id => apply_action.user_id).first authentication_user = AuthenticationsUsers.where(user_id => apply_action.user_id).first
if authentication_user.blank? if authentication_user.blank?
AuthenticationsUsers.create(:user_id => apply_action.user_id, :authentication_id => 1) AuthenticationsUsers.create(:user_id => apply_action.user_id, :authentication_id => 1)
end end
@ -3507,7 +3507,8 @@ end
Tiding.create(:user_id => apply_action.user_id, :trigger_user_id => 0, :container_id => apply_action.id, :container_type => 'ApplyAction', Tiding.create(:user_id => apply_action.user_id, :trigger_user_id => 0, :container_id => apply_action.id, :container_type => 'ApplyAction',
:parent_container_id => apply_action.container_id, :parent_container_type => apply_action.container_type, :belong_container_id => apply_action.container_id, :belong_container_type => "User", :tiding_type => "System", :status => type == "0" ? 1 : 2) :parent_container_id => apply_action.container_id, :parent_container_type => apply_action.container_type, :belong_container_id => apply_action.container_id, :belong_container_type => "User", :tiding_type => "System", :status => type == "0" ? 1 : 2)
apply_action.update_attributes(:status => (params[:type] == "1" ? 2 : 1), :reason => params[:reject_reason], :dealer_id => User.current.id, :noticed => false) reject_reason = Array(params[:reasons]).join('')
apply_action.update_attributes(status: (params[:type] == "1" ? 2 : 1), reason: reject_reason, reject_description: params[:reject_description], dealer_id: User.current.id, noticed: false)
User.where(:id => apply_action.user_id).first.update_attributes(:certification => (params[:type] == "1" ? 2 : 1)) User.where(:id => apply_action.user_id).first.update_attributes(:certification => (params[:type] == "1" ? 2 : 1))
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'") user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'")

@ -4,7 +4,7 @@ module ManagementsHelper
def user_phone_addr phone def user_phone_addr phone
addr = "--" addr = "--"
unless phone.nil? unless phone.nil?
result = MobInfo.lookup(phone[0,7]) result = nil # MobInfo.lookup(phone[0,7])
if result.present? if result.present?
addr = "#{result[:province]}-#{result[:city]}" addr = "#{result[:province]}-#{result[:city]}"
end end
@ -15,7 +15,7 @@ module ManagementsHelper
def user_ip_addr ip def user_ip_addr ip
addr = "--" addr = "--"
unless ip.nil? unless ip.nil?
result = SM.find_by_ip(ip) result = nil # SM.find_by_ip(ip)
if result.present? if result.present?
addr = "#{result[:province]}-#{result[:city]}" addr = "#{result[:province]}-#{result[:city]}"
end end

@ -1,7 +1,7 @@
# status0 审核中 1 同意 2 拒绝 3 撤销 # status0 审核中 1 同意 2 拒绝 3 撤销
class ApplyAction < ActiveRecord::Base class ApplyAction < ActiveRecord::Base
default_scope :order => 'updated_at desc' default_scope :order => 'updated_at desc'
attr_accessible :container_id, :container_type, :dealer_id, :reason, :user_id, :status, :apply_reason, :noticed, :ip_addr attr_accessible :container_id, :container_type, :dealer_id, :reason, :user_id, :status, :apply_reason, :noticed, :ip_addr, :reject_description
belongs_to :user belongs_to :user
has_many :tidings, :as => :container, :dependent => :destroy has_many :tidings, :as => :container, :dependent => :destroy
after_create :send_tiding after_create :send_tiding

@ -0,0 +1,95 @@
<div class="modal reject-auth-modal" style="position: fixed;left: 0;top: 0;width: 100%;height: 100%;z-index: 100;display: none;">
<div class="mask" style="position: absolute;width: 100%;height: 100%;background:rgba(0,0,0,1);opacity:0.5;"></div>
<div class="task-popup" style="width:600px;position: relative;margin: 100px auto 0;border-radius:10px;">
<div class=" task-popup-title clearfix task-popup-bggrey">
<%= title %>
</div>
<div class="mt15 ml30 pb20">
<div class="mr15">
<%= form_tag(path, remote: true, method: :post, id: 'reject-auth-form') do %>
<%= hidden_field_tag :reject_type, reject_type %>
<%= hidden_field_tag :type, 1 %>
<%= hidden_field_tag :apply_id, '' %>
<%= hidden_field_tag :status, params[:status] %>
<%= hidden_field_tag :search, params[:search] %>
<%= hidden_field_tag :page, params[:search] %>
<ul>
<li class="clearfix">
<label class="panel-form-label fl">撤销原因:</label>
</li>
<li class="ml20">
<span>
<input type="checkbox" name="reasons[]" value="请如实填写您的个人资料" id="reject-reason-1" class="ml-3 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="reject-reason-1" class="color4C4C4C">请如实填写您的个人资料</label>
</span>
<span>
<input type="checkbox" name="reasons[]" value="请如实填写您的学校/单位信息" id="reject-reason-2" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="reject-reason-2" class="color4C4C4C">请如实填写您的学校/单位信息</label>
</span>
<span>
<input type="checkbox" name="reasons[]" value="请在职业栏中修改正确的身份信息" id="reject-reason-3" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="reject-reason-3" class="color4C4C4C">请在职业栏中修改正确的身份信息</label>
</span>
<span>
<input type="checkbox" name="reasons[]" value="请填写您的推荐人信息" id="reject-reason-4" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="reject-reason-4" class="color4C4C4C">请填写您的推荐人信息</label>
</span>
<span>
<input type="checkbox" name="reasons[]" value="请告知获取平台资源的渠道,以及您的手机号,我们将主动联系您并授权使用" id="reject-reason-5" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="reject-reason-5" class="color4C4C4C">请告知获取平台资源的渠道,以及您的手机号,我们将主动联系您并授权使用</label>
</span>
<span>
<input type="checkbox" name="reasons[]" value="您好,您的账号试用期限已过" id="reject-reason-6" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="reject-reason-6" class="color4C4C4C">您好,您的账号试用期限已过</label>
</span>
<span>
<input type="checkbox" name="reasons[]" value="其他" id="reject-reason-7" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="reject-reason-7" class="color4C4C4C">其他</label>
</span>
</li>
<li class="clearfix mt10">
<label class="panel-form-label fl">备注说明:</label>
<textarea class="remarktextarea fl panel-box-sizing candiate_answer" name="reject_description" placeholder="为选择的撤销原因补充备注说明...."></textarea>
</li>
<li class="clearfix mt20 edu-txt-center mb20">
<a href="javascript:void(0);" class="task-btn mr10 cancel-btn">取消</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange ml20 submit-btn">确定</a>
</li>
</ul>
<% end %>
</div>
</div>
</div>
</div>
<script>
$(function(){
var modal = $(".modal.reject-auth-modal");
var form = modal.find("#reject-auth-form");
var applyIdInput = form.find("input[name='apply_id']");
modal.on('click', '.submit-btn', function(){
form.submit();
});
var hideRejectModalFunc = function(){
applyIdInput.val('');
form.find("textarea[name='reject_description']").val('');
form.find("input[name='reasons[]']").each(function(){this.checked=false;})
modal.hide();
};
// 隐藏弹窗
modal.on("click", '.mask', hideRejectModalFunc);
modal.on("click", '.cancel-btn', hideRejectModalFunc);
})
</script>

@ -10,7 +10,7 @@
<li class="clearfix mb5"> <li class="clearfix mb5">
<a href="<%= user_path(user) %>" class="fl"><%= user.try(:show_real_name) %></a> <a href="<%= user_path(user) %>" class="fl"><%= user.try(:show_real_name) %></a>
<span class="fl ml30 font-12 color-grey"><%= time_from_now(authorization.updated_at) %></span> <span class="fl ml30 font-12 color-grey"><%= time_from_now(authorization.updated_at) %></span>
<a href="javascript:void(0);" class="fr color-orange" data-type="reject" onclick="reject_authentication_reason(this);" >拒绝</a> <a href="javascript:void(0);" class="fr color-orange reject-btn" data-id="<%= authorization.id %>" data-type="reject" >拒绝</a>
<a href="javascript:void(0);" class="fr mr15 color-orange" data-remote="true" onclick="trial_authorization_gree('<%= authorization.id %>');">同意</a> <a href="javascript:void(0);" class="fr mr15 color-orange" data-remote="true" onclick="trial_authorization_gree('<%= authorization.id %>');">同意</a>
</li> </li>
<li class="clearfix mb5"> <li class="clearfix mb5">
@ -34,16 +34,6 @@
<li class="clearfix mb5"> <li class="clearfix mb5">
<span>申请理由:<%= authorization.apply_reason %></span> <span>申请理由:<%= authorization.apply_reason %></span>
</li> </li>
<div class="undis">
<li class="clearfix edu-form-border mb10">
<label class="edu-form-label fl">原因:</label>
<input type="text" class="task-form-90 task-height-40 panel-box-sizing fl edu-form-noborder" placeholder="我得说点儿什么最多200个字符">
</li>
<li class="clearfix">
<a href="javascript:void(0);" class="task-btn task-btn-orange fr" onclick="submit_reject_reason('<%= authorization.id %>', this);" >确定</a>
<a href="javascript:void(0);" class="task-btn fr mr10" onclick="hide_reject_reason(this);" >取消</a>
</li>
</div>
</ul> </ul>
</div> </div>
</div> </div>
@ -60,7 +50,17 @@
<%= render :partial => "welcome/no_data" %> <%= render :partial => "welcome/no_data" %>
<% end %> <% end %>
<%= render(partial: 'managements/reject_authorization_model', locals: { path: trial_authorization_operation_managements_path, title: '拒绝授权', reject_type: '' }) %>
<script type="text/javascript"> <script type="text/javascript">
$(function(){
$(".reject-btn").on("click", function(){
var applyId = $(this).data("id");
$(".modal.reject-auth-modal input[name='apply_id']").val(applyId);
$(".modal.reject-auth-modal").show();
});
});
function trial_authorization_gree(id){ function trial_authorization_gree(id){
var search = document.getElementById("search_name").value; var search = document.getElementById("search_name").value;
$.ajax({ $.ajax({

@ -1,69 +0,0 @@
<div class="task-popup" style="width:600px;">
<div class=" task-popup-title clearfix task-popup-bggrey">
撤销授权
</div>
<div class="mt15 ml30 pb20">
<div class="mr15">
<%= form_tag({:controller => 'courses', :action => 'join_course_multi_role'}, :remote => true, :method => :post, :id => 'new-watcher-form') do %>
<ul>
<li class="clearfix">
<label class="panel-form-label fl">撤销原因:</label>
</li>
<li class="ml20">
<span>
<input type="checkbox" name="role[]" value="1" id="join_course_role_1" class="ml-3 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="join_course_role_1" class="color4C4C4C">请如实填写您的个人资料</label>
</span>
<span>
<input type="checkbox" name="role[]" value="2" id="join_course_role_2" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="join_course_role_2" class="color4C4C4C">请如实填写您的学校/单位信息</label>
</span>
<span>
<input type="checkbox" name="role[]" value="3" id="join_course_role_3" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="join_course_role_3" class="color4C4C4C">请在职业栏中修改正确的身份信息</label>
</span>
<span>
<input type="checkbox" name="role[]" value="4" id="join_course_role_4" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="join_course_role_4" class="color4C4C4C">请填写您的推荐人信息</label>
</span>
<span>
<input type="checkbox" name="role[]" value="5" id="join_course_role_5" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="join_course_role_5" class="color4C4C4C">请告知获取平台资源的渠道,以及您的手机号,我们将主动联系您并授权使用</label>
</span>
<span>
<input type="checkbox" name="role[]" value="6" id="join_course_role_6" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="join_course_role_6" class="color4C4C4C">您好,您的账号试用期限已过</label>
</span>
<span>
<input type="checkbox" name="role[]" value="7" id="join_course_role_7" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="join_course_role_7" class="color4C4C4C">其他</label>
</span>
</li>
<li class="clearfix mt10">
<label class="panel-form-label fl">备注说明:</label>
<textarea class="remarktextarea fl panel-box-sizing candiate_answer" name="question_answer[]" placeholder="为选择的撤销原因补充备注说明...."></textarea>
</li>
<li class="clearfix mt20 edu-txt-center mb20">
<a href="javascript:void(0);" class="task-btn mr10" onclick="hideModal()">取消</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange ml20" onclick="submit_join_course();">确定</a>
</li>
</ul>
<% end %>
</div>
</div>
</div>
<script>
</script>

@ -12,7 +12,7 @@
<span class="fl ml30 font-12 color-grey"><%= time_from_now(authorization.updated_at) %></span> <span class="fl ml30 font-12 color-grey"><%= time_from_now(authorization.updated_at) %></span>
<a class=" task-btn <%= authorization.status == 1 ? 'task-btn-green' : '' %> fr "><%= authorization.status == 1 ? "已同意" : "已拒绝" %></a> <a class=" task-btn <%= authorization.status == 1 ? 'task-btn-green' : '' %> fr "><%= authorization.status == 1 ? "已同意" : "已拒绝" %></a>
<% if authorization.status == 1 %> <% if authorization.status == 1 %>
<a href="javascript:void(0)" class="white-btn edu-blueback-btn fr mr15" onclick="revokeAuthorization(this)">撤销授权</a> <a href="javascript:void(0)" data-id="<%= authorization.id %>" class="white-btn edu-blueback-btn fr mr15 reject-btn">撤销授权</a>
<% end %> <% end %>
</li> </li>
<li class="clearfix mb5"> <li class="clearfix mb5">
@ -37,19 +37,9 @@
<span>申请理由:<%= authorization.apply_reason %></span> <span>申请理由:<%= authorization.apply_reason %></span>
</li> </li>
<% if authorization.status == 2 %> <% if authorization.status == 2 %>
<li><span class="color-red">撤销原因:</span><span><%= authorization.reason.blank? ? "空" : authorization.reason %></span></li> <li><span class="color-red">原因:</span><span><%= authorization.reason.blank? ? "空" : authorization.reason %></span></li>
<li><span class="color-red">备注说明:</span><span><%= authorization.reason.blank? ? "空" : authorization.reason %></span></li> <li><span class="color-red">备注说明:</span><span><%= authorization.reject_description.blank? ? "空" : authorization.reject_description %></span></li>
<% end %> <% end %>
<div class="reason none">
<li class="clearfix edu-form-border mb10">
<label class="edu-form-label fl">原因:</label>
<input type="text" class="task-form-90 task-height-40 panel-box-sizing fl edu-form-noborder reasonInput" placeholder="我得说点儿什么最多200个字符">
</li>
<li class="clearfix">
<a href="javascript:void(0);" class="white-btn edu-blueback-btn fr" data-type="revocation" onclick="submit_reject_reason('<%= authorization.id %>', this);">确定</a>
<a href="javascript:void(0);" class="task-btn fr mr10" onclick="cancelOperation(this);">取消</a>
</li>
</div>
</ul> </ul>
</div> </div>
</div> </div>
@ -65,14 +55,15 @@
<% else %> <% else %>
<%= render :partial => "welcome/no_data" %> <%= render :partial => "welcome/no_data" %>
<% end %> <% end %>
<%= render(partial: 'managements/reject_authorization_model', locals: { path: trial_authorization_operation_managements_path, title: '撤销授权', reject_type: 'revocation' }) %>
<script> <script>
//撤销授权 $(function(){
function revokeAuthorization(item){ $(".reject-btn").on("click", function(){
$(item).parents("li").siblings(".reason").removeClass("none"); var applyId = $(this).data("id");
} $(".modal.reject-auth-modal input[name='apply_id']").val(applyId);
//取消撤销 $(".modal.reject-auth-modal").show();
function cancelOperation(item){ });
$(item).parents("li").siblings(".reasonInput").val(''); })
$(item).parents(".reason").addClass("none");
}
</script> </script>

@ -61,37 +61,6 @@
</div> </div>
</div> </div>
<script> <script>
/* -------------------------- 拒绝 ------------------------------------ */
function reject_authentication_reason(nThis){
var reason = $(nThis).parent().parent().find('div');
reason.find("input").val("");
reason.toggle();
}
/* -------------------------- 取消 ------------------------------------ */
function hide_reject_reason(nThis){
var reason = $(nThis).parent().parent();
reason.find("input").val("");
reason.hide();
}
/* ------------------------- 提交拒绝原因 --------------------------------- */
function submit_reject_reason(id, nThis){
var nReason = $(nThis).parent().parent();
var reason = nReason.find("input").val();
var reject_type = $(nThis).attr("data-type");
$.ajax({
url: '<%= trial_authorization_operation_managements_path %>'+".js",
data: {apply_id: id, reject_reason: reason, type: 1, reject_type: reject_type}
// success: function(data){
// if(data.success){
// alert(data.success);
// location.reload();
// }
// }
});
}
/* -------------------------- 按名字进行搜索(未审批) ----------------------------- */ /* -------------------------- 按名字进行搜索(未审批) ----------------------------- */
$("#search").live("click", function(){ $("#search").live("click", function(){
var iName = $("#search_name").val(); var iName = $("#search_name").val();

@ -6,11 +6,13 @@ var nAudit = $("#audit_all_authentication").parent();
<% if @status == 0 %> <% if @status == 0 %>
$("#authentication_list").html("<%= j( render :partial => "managements/trial_authorization_list" ) %>"); $("#authentication_list").html("<%= j( render :partial => "managements/trial_authorization_list" ) %>");
$("#audit_authentication_list").html("");
nTabNav_1.addClass("background-orange"); nTabNav_1.addClass("background-orange");
nTabNav_2.removeClass("background-orange"); nTabNav_2.removeClass("background-orange");
nTabIcon_1.show(); nTabIcon_1.show();
nTabIcon_2.hide(); nTabIcon_2.hide();
<% else %> <% else %>
$("#authentication_list").html('');
$("#audit_authentication_list").html("<%= j( render :partial => "managements/trial_authorization_passed_list" ) %>"); $("#audit_authentication_list").html("<%= j( render :partial => "managements/trial_authorization_passed_list" ) %>");
nTabNav_1.removeClass("background-orange"); nTabNav_1.removeClass("background-orange");
nTabNav_2.addClass("background-orange"); nTabNav_2.addClass("background-orange");

@ -0,0 +1,5 @@
class AddRejectDescriptionToApplyActions < ActiveRecord::Migration
def change
add_column :apply_actions, :reject_description, :string
end
end
Loading…
Cancel
Save