123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- $('#c-pay_method').change(function(){
- var sval = $(this).val();
- if (sval<3){ //银行卡
- $('.c-card_bank').show();
- $('.c-card_holder').html('* 收款人:');
- $('.c-card_num').html('* 收款账号:');
- }else if(sval==3){ //微信
- $('.c-card_bank').hide();
- $('.c-card_holder').html('* 姓名:');
- $('.c-card_num').html('* 微信账号:');
- $('#c-card_bank').val('');
- }else if(sval==4){ //支付宝
- $('.c-card_bank').hide();
- $('.c-card_holder').html('* 姓名:');
- $('.c-card_num').html('* 支付宝账号:');
- $('#c-card_bank').val('');
- }
- });
-
- //book_but
- $(document).on('click','.book_but',function () {
- Fast.api.open($(this).attr('href'), '代理商数据', {});
- return false;
- });
- $(document).on('click','.btn-re',function () {
- var uid = $(this).data('uid');
- layer.confirm("请确认你要进行重置服务号,重置后将会导致、数据清空、老用户无法访问、等等一系列你无法想象的超级严重的问题", { title: "重置服务号确认" }, function (index) {
- layer.close(index);
- $.post('/admin/auth/agent/re?admin_id='+uid,{},function(data){
- console.log(data);
- if(data.code != 0){
- Toastr.success(data.msg);
- setTimeout(function() {
- window.location.reload();
- },2000);
- }else{
- Toastr.error(data.msg);
- }
- })
- });
- });
- $(document).on('click','.btn-sync',function () {
- var uid = $(this).data('uid');
- layer.confirm("请确认你要进行微信用户同步确认", { title: "微信用户同步确认" }, function (index) {
- layer.close(index);
- $.post('/admin/auth/agent/sync?admin_id='+uid,{},function(data){
- if(data.code != 0){
- Toastr.success(data.msg);
- setTimeout(function() {
- window.location.reload();
- },2000);
- }else{
- Toastr.error(data.msg);
- }
- })
- });
- });
- //推送开关全选 add by liues@dianzhong.com at 2018-09-05 11:01:18
- Form.events.selecttips = function (form) {
- var all_tip = $("#c-all_tip", form);
- var other_tips = $(":checkbox[id$='_tip']:not('#c-all_tip')", form);
- var all_tip_checked = function () {
- var checked = (other_tips.length == other_tips.filter(":checked").length);
- all_tip.prop("checked", checked);
- };
- var other_tips_checked = function () {
- var checked = all_tip.prop("checked");
- other_tips.prop("checked", checked);
- };
- all_tip.change(other_tips_checked);
- other_tips.change(all_tip_checked);
- all_tip_checked();
- }
- if(Config.ids>0){
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'auth/agent/index?ids='+Config.ids,
- add_url: '',
- edit_url: '',
- del_url: '',
- multi_url: '',
- },
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- searchFormVisible:true,
- columns: [
- [
- {field: 'id', title: 'ID', operate: false},
- {field: 'username', title: __('账号'), operate: false},
- {field: 'nickname', title: __('昵称'), operate: false},
- {field: 'admin_extend.benefit', title: __('佣金比例'), operate: false},
- {field: 'admin_extend.benefit_app', title: __('APP佣金比例'), operate: false},
- {field: 'admin_extend.create_by', title: __('开户人ID'), operate: 'LIKE %...%',formatter:function(value, row, index){
- return row.create_id;
- }},
- {field: 'a2.username', title: __('开户人账户'), operate: 'LIKE %...%',formatter:function(value, row, index){
- return row.create_username;
- }},
- {field: 'a2.nickname', title: __('开户人昵称'), operate: 'LIKE %...%',formatter:function(value, row, index){
- return row.create_nickname;
- }},
- {field: 'today_recharge_money', title: __('今日充值'), operate: false},
- {field: 'yesterday_recharge_money', title: __('昨日充值'), operate: false},
- {field: 'recharge_money', title: __('总充值金额(不含当日)'), operate: false},
- {field: 'benefit_money', title: __('结算单总额(包含当日)'), operate: false},
- {field: 'no_cash_money', title: __('未提现总额(包含当日)'), operate: false},
- {
- field: 'admin_extend.createtime',
- title: __('注册时间'),
- formatter: Table.api.formatter.datetime,
- operate: false
- },
- {field: 'admin_extend.distribute', title: __('配号状态'),formatter:function(value, row, index){
- if(value==0){
- return '<span style="color:red">关闭</span>';
- }else{
- return '<span style="color:green">已开启</span>';
- }
- }, operate: false},
- {
- field: 'tongji', visible:([2, 3, 9].indexOf(Config.group) > -1), title: __("统计"), operate: false, formatter: function (value, row, index) {
- return '<a style="float:left;margin-left: 10%" href="/admin/collect/index?channel_id=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">数据统计</a>'+
- '<a style="float:left;margin-left: 10%" href="/admin/orders/index?channel_id=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">订单明细</a>';
- }
- },
- {field: 'status', title: __("Status"), formatter: Table.api.formatter.status,searchList: {'normal': __('Normal'), 'hidden': __('Hidden')}, style: 'min-width:100px;'},
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- Form.api.bindevent($("form[role=form]"));
- },
- edit: function () {
- Form.api.bindevent($("form[role=form]"));
- Form.events.selecttips("form[role=form]");
- },
- select: function() {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'auth/agent/select',
- },
- showColumns:false,
- showToggle:false,
- showExport:false,
- searchFormVisible: true,
- search:false,
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: '代理ID', visible:false,operate:false},
- {field: 'nickname', title: '代理名称',operate: 'LIKE %...%'},
- {field: 'operate', title: __('Operate'), events: {
- 'click .btn-chooseone': function (e, value, row, index) {
- Fast.api.close([row]);
- },
- }, formatter: function () {
- return '<a href="javascript:;" class="btn btn-danger btn-chooseone btn-xs"><i class="fa fa-check"></i> ' + __('Choose') + '</a>';
- }}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- //获取选中数据
- $(document).on('click', "#btn-chooseone", function () {
- Fast.api.close(table.bootstrapTable('getSelections'));
- });
- }
- };
- }else{
- if ([3, 4, 5, 6, 7, 8, 9].indexOf(Config.group) > -1) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'auth/agent/index',
- add_url: 'auth/agent/add',
- edit_url: 'auth/agent/edit',
- del_url: 'auth/agent/del',
- multi_url: 'auth/agent/multi',
- },
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- search: false,
- searchFormVisible:true,
- columns: [
- [
- {field: 'admin.id', title: 'ID', operate:'=',visible:false},
- {field: 'id', title: 'ID', operate:false},
- {field: 'username', title: '账号', operate: 'LIKE %...%'},
- {field: 'nickname', title: '昵称', operate: 'LIKE %...%'},
- {field: 'admin_extend.benefit', title: __('佣金比例'), operate: false},
- {field: 'admin_extend.benefit_app', title: __('APP佣金比例'), operate: false},
- {field: 'admin_extend.create_by', title: __('开户人ID'), operate: 'LIKE %...%',formatter:function(value, row, index){
- return row.create_id;
- }},
- {field: 'a2.username', title: __('开户人账户'), operate: 'LIKE %...%',formatter:function(value, row, index){
- return row.create_username;
- }},
- {field: 'a2.nickname', title: __('开户人昵称'), operate: 'LIKE %...%',formatter:function(value, row, index){
- return row.create_nickname;
- }},
- {field: 'today_recharge_money', title: __('今日充值'), operate: false},
- {field: 'yesterday_recharge_money', title: __('昨日充值'), operate: false},
- {field: 'recharge_money', title: __('总充值金额(不含当日)'), operate: false},
- {field: 'benefit_money', title: __('结算单总额(包含当日)'), operate: false},
- {field: 'no_cash_money', title: __('未提现总额(包含当日)'), operate: false},
- {field: 'admin_extend.distribute', title: __('配号状态'),formatter:function(value, row, index){
- if(value==0){
- return '<span style="color:red">关闭</span>';
- }else{
- return '<span style="color:green">已开启</span>';
- }
- }, operate: false},
- {
- field: 'tongji',visible:([2, 3, 9].indexOf(Config.group) > -1), title: __("统计"), operate: false, formatter: function (value, row, index) {
- return '<a style="float:left;margin-left: 10%" href="/admin/collect/index?channel_id=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">数据统计</a>'+
- '<a style="float:left;margin-left: 10%" href="/admin/orders/index?channel_id=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">订单明细</a>';
- }
- },
- {field: 'operate', title: __('Operate'), table: table, buttons: [], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
- //{field: 'id', title: __('统计'), table: table, buttons: [
- // {name: 'collect', text: '数据统计', title: '数据统计', icon: 'fa fa-list', classname: 'btn btn-xs btn-primary btn-dialog', url: '/admin/auth/agent/collect', callback:function(data){}},
- // {name: 'more', text: '更多', title: '更多', icon: 'fa fa-flash', classname: 'btn btn-xs btn-primary btn-dialog', url: '/admin/auth/agent/more'}
- //], operate:false, formatter: Table.api.formatter.buttons},
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- Form.api.bindevent($("form[role=form]"));
- },
- edit: function () {
- Form.api.bindevent($("form[role=form]"));
- Form.events.selecttips("form[role=form]");
- $('.checkbox_plat input').change(function () {
- var platform_id = $(this).attr('value');
- if($(this).is(":checked")){
- if(Controller.api.checkedPlatformAuth(platform_id,Config.admin_id)){
- Controller.api.addOphostList(platform_id);
- }
- }else{
- Controller.api.delPlatformList(platform_id);
- }
- });
- },
- select: function() {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'auth/agent/select',
- },
- showColumns:false,
- showToggle:false,
- showExport:false,
- searchFormVisible: true,
- search:false,
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: '代理ID', visible:false,operate:false},
- {field: 'nickname', title: '代理名称',operate: 'LIKE %...%'},
- {field: 'operate', title: __('Operate'), events: {
- 'click .btn-chooseone': function (e, value, row, index) {
- Fast.api.close([row]);
- },
- }, formatter: function () {
- return '<a href="javascript:;" class="btn btn-danger btn-chooseone btn-xs"><i class="fa fa-check"></i> ' + __('Choose') + '</a>';
- }}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- //获取选中数据
- $(document).on('click', "#btn-chooseone", function () {
- Fast.api.close(table.bootstrapTable('getSelections'));
- });
- },
- api:{
- //检查平台,检查用户是否已授权过,检查平台是否已授权过
- checkedPlatformAuth:function(platform_id,channel_id){
- let is_auth = false;
- if(Config.channel_is_auth){
- $.ajaxSettings.async = false;
- $.get("auth/channel/checkplatformauth?platform_id=" + platform_id +'&channel_id='+channel_id,function(data){
- if(data.code){
- is_auth = true;
- }else{
- is_auth = false;
- }
- });
- $.ajaxSettings.async = true;
- }else{
- is_auth = true;
- }
- return is_auth;
- },
- //添加业务域名列表
- addOphostList:function(platform_id){
- $.get("auth/channel/ajaxgetophostlistbyplatformid?platform_id=" + platform_id, function (data) {
- if (data.code) {
- var ophost_list = data.data;
- for (var key in ophost_list) {
- $("#c-ophost_id").append("<option data-platform_id='"+ platform_id +"' value='" + ophost_list[key]['id'] + "' >" + ophost_list[key]['text']+ "</option><br>");
- $("#c-menuophost_id").append("<option data-platform_id='"+ platform_id +"' value='" + ophost_list[key]['id'] + "' >" + ophost_list[key]['text'] + "</option><br>");
- }
- }else{
- Toastr.error(data.msg);
- }
- });
- },
- //添加支付域名列表
- addOphostPayList:function(platform_id,ophost_id,wxpayName){
- $.get("auth/channel/ajaxgetwxpaylistbyplatformid?platform_id=" + platform_id+'&ophost_id='+ophost_id, function (data) {
- if (data.code) {
- Controller.api.delWxpayList(wxpayName);
- var pay_list = data.data;
- for (var key in pay_list) {
- $('#'+wxpayName).append("<option value='" + pay_list[key]['id'] + "' >" + pay_list[key]['text'] + "</option><br>");
- }
- }else{
- Toastr.error(data.msg);
- }
- });
- },
- //删除平台列表
- delPlatformList:function(platform_id){
- $("#c-ophost_id option[data-platform_id='"+platform_id+"']").remove();
- $("#c-menuophost_id option[data-platform_id='"+platform_id+"']").remove();
- },
- delWxpayList:function(wxpayName){
- $("#"+wxpayName+" option").remove();
- $("#"+wxpayName).append("<option value='' selected>请选择</option><br>");
- },
- }
- };
- }else{
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'auth/agent/index',
- add_url: 'auth/agent/add',
- edit_url: 'auth/agent/edit',
- del_url: 'auth/agent/del',
- multi_url: 'auth/agent/multi',
- },
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- search: false,
- searchFormVisible:true,
- columns: [
- [
- {field: 'admin.id', title: 'ID', operate:'=',visible:false},
- {field: 'id', title: 'ID', operate:false},
- {field: 'username', title: '账号', operate: 'LIKE %...%'},
- {field: 'nickname', title: '昵称', operate: 'LIKE %...%'},
- {field: 'ac.appid', title: __('Appid'),visible:false,operate: 'LIKE %...%'},
- {field: 'appid', title: __('Appid'),operate:false},
- {field: 'admin_extend.benefit', title: __('佣金比例'), operate: false},
- {field: 'admin_extend.benefit_app', title: __('APP佣金比例'), operate: false},
- {field: 'admin_extend.create_by', title: __('开户人ID'), operate: 'LIKE %...%',formatter:function(value, row, index){
- return row.create_id;
- }},
- {field: 'a2.username', title: __('开户人账户'), operate: 'LIKE %...%',formatter:function(value, row, index){
- return row.create_username;
- }},
- {field: 'a2.nickname', title: __('开户人昵称'), operate: 'LIKE %...%',formatter:function(value, row, index){
- return row.create_nickname;
- }},
- {field: 'status', title: __("Status"), formatter: Table.api.formatter.status,searchList: {'normal': '正常', 'hidden':'隐藏'}},
- {field: 'today_recharge_money', title: __('今日充值'), operate: false},
- {field: 'yesterday_recharge_money', title: __('昨日充值'), operate: false},
- {field: 'recharge_money', title: __('总充值金额(不含当日)'), operate: false},
- {field: 'benefit_money', title: __('结算单总额(包含当日)'), operate: false},
- {field: 'no_cash_money', title: __('未提现总额(包含当日)'), operate: false},
- {field: 'is_fouce', title: __("是否强制授权"), operate: false,formatter: function(value,row,index){return value==1?"强制":"不强制";}},
- {field: 'ac.platform_id', title: __("默认平台"), visible:false, searchList:function(){
- var list = {};
- for(var val in Config.platforms){
- list[Config.platforms[val].id] = Config.platforms[val].name;
- }
- return list;
- }()},
- {field: 'platforms', title: __("域名系统"), operate: false,formatter: function(value,row,index){return $('<div/>').html(value).text();}},
- {field: 'ophost', title: __("业务域名(主)"), operate: '=', searchList: Controller.api.formatter.ophosts()},
- {field: 'wxpay', title: __("支付服务号(主)"), operate: '=', searchList: Controller.api.formatter.wxpays()},
- {field: 'menuophost', title: __("业务域名(菜单)"), operate: '=', searchList: Controller.api.formatter.ophosts()},
- {field: 'menuwxpay_host', title: __("支付服务号(菜单)"), operate: '=', searchList: Controller.api.formatter.wxpays()},
- {field: 'admin_extend.distribute', title: __('配号状态'),formatter:function(value, row, index){
- if(value==0){
- return '<span style="color:red">关闭</span>';
- }else{
- return '<span style="color:green">已开启</span>';
- }
- }, searchList: {'0': '关闭', '1':'开启'}},
- {field: 'admin_extend.reward_state', title: __('赏金开关'),formatter:function(value,row,index){return value==1?"已开启":"未开启";}, searchList: {'0': '未开启', '1':'已开启'}},
- {field: 'guide_domain', title: __('导粉短链开关'), searchList: {'0': '已关闭', '1':'已开启'},formatter:function(value,row,index){return value==1?"<span style='color: green;'>已开启</span>":"<span style='color: red;'>已关闭</span>";}},
- {field: 'short_relation_count', title: __('短链域名数'),operate:false},
- {field: 'guide_relation_count', title: __('导粉域名数'),operate:false},
- // {
- // field: 'tongji',visible:([2, 3, 9].indexOf(Config.group) > -1), title: __("统计"), operate: false, formatter: function (value, row, index) {
- // return '<a style="float:left;margin-left: 10%" href="/admin/collect/index?channel_id=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">数据统计</a>'+
- // '<a style="float:left;margin-left: 10%" href="/admin/orders/index?channel_id=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">订单明细</a>';
- // }
- // },
- {
- field: 'tongji', visible:([2, 3, 9].indexOf(Config.group) > -1), title: __("统计"), operate: false, formatter: function (value, row, index) {
- return '<a style="display:inline-block; margin:4px 5px;vertical-align: middle;" href="/admin/collect/index?channel_id=' + row.id + '" class="book_but"><button type="button" class="btn dropdown-toggle" style="background-color:#ddd;">订单统计</button></a>' +
- '<div class="dropdown" style="display:inline-block; margin:4px 5px;vertical-align: middle;"> <button type="button" style="background-color:#ddd;" class="btn dropdown-toggle" id="dropdownMenu1"data-toggle="dropdown">更多' +
- '<span class="caret"></span>' +
- '</button>' +
- '<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1" style="min-width: 5px;">' +
- '<li role="presentation">' +
- '<a role="menuitem" tabindex="-1" href="/admin/user/collect/index?ids=' + row.id + '" class="book_but">用户统计</a>' +
- '</li>' +
- '<li role="presentation">' +
- '<a role="menuitem" tabindex="-1" href="/admin/orders/index?channel_id=' + row.id + '" class="book_but">订单明细</a>' +
- '</li>' +
- '<li role="presentation">' +
- '<a role="menuitem" tabindex="-1" href="/admin/referral/referral/index?ids=' + row.id + '" class="book_but">推广链接</a>' +
- '</li>' +
- '</ul>' +
- '</div>';
- }
- },
- {field: 'operate', title: __('Operate'), table: table, buttons: [], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
- //{field: 'id', title: __('统计'), table: table, buttons: [
- // {name: 'collect', text: '数据统计', title: '数据统计', icon: 'fa fa-list', classname: 'btn btn-xs btn-primary btn-dialog', url: '/admin/auth/agent/collect', callback:function(data){}},
- // {name: 'more', text: '更多', title: '更多', icon: 'fa fa-flash', classname: 'btn btn-xs btn-primary btn-dialog', url: '/admin/auth/agent/more'}
- //], operate:false, formatter: Table.api.formatter.buttons},
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- Form.api.bindevent($("form[role=form]"));
- },
- edit: function () {
- Form.api.bindevent($("form[role=form]"));
- Form.events.selecttips("form[role=form]");
- $('.checkbox_plat input').change(function () {
- var platform_id = $(this).attr('value');
- if($(this).is(":checked")){
- if(Controller.api.checkedPlatformAuth(platform_id,Config.admin_id)){
- Controller.api.addOphostList(platform_id);
- }
- }else{
- Controller.api.delPlatformList(platform_id);
- }
- });
- },
- select: function() {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'auth/agent/select',
- },
- showColumns:false,
- showToggle:false,
- showExport:false,
- searchFormVisible: true,
- search:false,
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: '代理ID', visible:false,operate:false},
- {field: 'nickname', title: '代理名称',operate: 'LIKE %...%'},
- {field: 'operate', title: __('Operate'), events: {
- 'click .btn-chooseone': function (e, value, row, index) {
- Fast.api.close([row]);
- },
- }, formatter: function () {
- return '<a href="javascript:;" class="btn btn-danger btn-chooseone btn-xs"><i class="fa fa-check"></i> ' + __('Choose') + '</a>';
- }}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- //获取选中数据
- $(document).on('click', "#btn-chooseone", function () {
- Fast.api.close(table.bootstrapTable('getSelections'));
- });
- },
- api:{
- //检查平台,检查用户是否已授权过,检查平台是否已授权过
- checkedPlatformAuth:function(platform_id,channel_id){
- let is_auth = false;
- if(Config.channel_is_auth){
- $.ajaxSettings.async = false;
- $.get("auth/channel/checkplatformauth?platform_id=" + platform_id +'&channel_id='+channel_id,function(data){
- if(data.code){
- is_auth = true;
- }else{
- is_auth = false;
- }
- });
- $.ajaxSettings.async = true;
- }else{
- is_auth = true;
- }
- return is_auth;
- },
- //添加业务域名列表
- addOphostList:function(platform_id){
- $.get("auth/channel/ajaxgetophostlistbyplatformid?platform_id=" + platform_id, function (data) {
- if (data.code) {
- var ophost_list = data.data;
- for (var key in ophost_list) {
- $("#c-ophost_id").append("<option data-platform_id='"+ platform_id +"' value='" + ophost_list[key]['id'] + "' >" + ophost_list[key]['text']+ "</option><br>");
- $("#c-menuophost_id").append("<option data-platform_id='"+ platform_id +"' value='" + ophost_list[key]['id'] + "' >" + ophost_list[key]['text'] + "</option><br>");
- }
- }else{
- Toastr.error(data.msg);
- }
- });
- },
- //添加支付域名列表
- addOphostPayList:function(platform_id,ophost_id,wxpayName){
- $.get("auth/channel/ajaxgetwxpaylistbyplatformid?platform_id=" + platform_id+'&ophost_id='+ophost_id, function (data) {
- if (data.code) {
- Controller.api.delWxpayList(wxpayName);
- var pay_list = data.data;
- for (var key in pay_list) {
- $('#'+wxpayName).append("<option data-platform_id='"+ platform_id +"' value='" + pay_list[key]['id'] + "' >" + pay_list[key]['text'] + "</option><br>");
- }
- }else{
- Toastr.error(data.msg);
- }
- });
- },
- //删除平台列表
- delPlatformList:function(platform_id){
- $("#c-ophost_id option[data-platform_id='"+platform_id+"']").remove();
- $("#c-menuophost_id option[data-platform_id='"+platform_id+"']").remove();
- },
- delWxpayList:function(wxpayName){
- $("#"+wxpayName+" option").remove();
- $("#"+wxpayName).append("<option value='' selected>请选择</option><br>");
- },
- formatter: {
- ophosts: function () {
- var list = {};
- for(var val in Config.ophosts){
- list[val] = Config.ophosts[val];
- }
- return list;
- },
- wxpays: function () {
- var list = {};
- for(var val in Config.wxpays){
- list[val] = Config.wxpays[val];
- }
- return list;
- }
- },
- }
- };
- }
- }
- return Controller;
- });
|