Merge branch 'feature/admin_optimize' into release

master
liuweiwen 5 years ago
commit 5949542b70

@ -522,4 +522,22 @@ class AjaxController extends ThinkController{
# 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;">
<option value="">请选择合作公司</option>
<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>
</select>
</div>
@ -201,6 +201,31 @@
$(".select_gallery").select2();
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()
{
var game_name = $('#game_name').val();
@ -228,9 +253,13 @@
})
}
$(function(){
get_company_list();
$("#partner_id").change(function(){
get_game_list();
});
$("#company_type").change(function(){
get_company_list();
});
//搜索功能
$("#search").click(function(){
var url = $(this).attr('url');

Loading…
Cancel
Save