推广员-》奖罚记录管理-》上下游公司与公司类型联动,解决未显示下游公司问题

master
liuweiwen 5 years ago
parent e243675bcc
commit 6d91ec7c60

@ -522,4 +522,22 @@ class AjaxController extends ThinkController{
# code... # code...
} }
/**
*获取上下游公司
*/
public function getCompanyList()
{
$company_type = I('company_type');//公司类型
if ($company_type ==1) {//上游公司
$data = M('partner','tab_')->field('id, partner as name,1 as type')->where(['status' => 1])->select();
} elseif ($company_type ==2) {//下游公司
$data = M('promote_company','tab_')->field('id, company_name as name,2 as type')->where(['status' => 1])->select();
} else {
$partner = M('partner','tab_')->field('id, partner as name,1 as type')->where(['status' => 1])->select();
$promote_company = M('promote_company','tab_')->field('id, company_name as name, 2 as type')->where(['status' => 1])->select();
$data = array_merge($partner, $promote_company);
}
$this->ajaxReturn($data);
}
} }

@ -77,7 +77,7 @@
<select id="partner_id" name="partner_id" class="select_gallery" style="width:120px;"> <select id="partner_id" name="partner_id" class="select_gallery" style="width:120px;">
<option value="">请选择合作公司</option> <option value="">请选择合作公司</option>
<volist name=":getPartner()" id="vo"> <volist name=":getPartner()" id="vo">
<option partner-id="{$vo.id}" value="{$vo.id}" <if condition="$vo.id eq $_GET['partner_id']">selected=selected</if>>{$vo.partner}</option> <option partner-id="{$vo.id}" value="{$vo.id}" data-type="{$vo.type}" <if condition="$vo.id eq $_GET['partner_id']">selected=selected</if>>{$vo.partner}</option>
</volist> </volist>
</select> </select>
</div> </div>
@ -201,6 +201,31 @@
$(".select_gallery").select2(); $(".select_gallery").select2();
highlight_subnav("{:U('StatementMangement/rewardManageList')}"); highlight_subnav("{:U('StatementMangement/rewardManageList')}");
function get_company_list()
{
var id = $('#partner_id').val();
var company_type = $("#company_type option:selected").val();
$.ajax({
url:"{:U('Ajax/getCompanyList')}",
type:"post",
data:{
company_type:company_type,
},
dataType:'json',
success:function(data){
var str = "<option value=''>请选择合作公司</option>";
for (var i in data){
str += "<option value='"+data[i].id+"'"+"data-type='"+data[i].type+"'"+(id && data[i].id == id?'selected':'')+">"+data[i].name+"</option>"
}
// console.log(str);
$("#partner_id").empty();
$("#partner_id").append(str);
$("#partner_id").select2();
}
})
}
function get_game_list() function get_game_list()
{ {
var game_name = $('#game_name').val(); var game_name = $('#game_name').val();
@ -228,9 +253,13 @@
}) })
} }
$(function(){ $(function(){
get_company_list();
$("#partner_id").change(function(){ $("#partner_id").change(function(){
get_game_list(); get_game_list();
}); });
$("#company_type").change(function(){
get_company_list();
});
//搜索功能 //搜索功能
$("#search").click(function(){ $("#search").click(function(){
var url = $(this).attr('url'); var url = $(this).attr('url');

Loading…
Cancel
Save