123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'qrcode'], function ($, undefined, Backend, Table, Form) {
- $(document).on("click", '.qrcode', function () {
- var qrUrl = $(this).data("qrcode");
- $('#tong').html("");
- $('#tong').qrcode(qrUrl);
- layer.open({
- type: 1,
- title: false,
- area: '258px',
- skin: 'layui-layer-nobg', //没有背景色
- shadeClose: true,
- content: $('#tong')
- });
- });
- $(document).on('click', '.short_link_but', function () {
- var $this = $(this);
- $this.hide().siblings('.short_link').show();
- });
- $(document).on('click', '.book_but', function () {
- Fast.api.open($(this).attr('href'), '订单详情', {});
- return false;
- });
- var Controller = {
- index: function () {
- Table.api.init({
- extend: {
- index_url: 'referral/vipchannelreferral/index',
- export_url: '/admin/referral/vipchannelreferral/export',
- table: 'vip_admin_bind',
- },
- searchFormVisible: true,
- showExport: false,
- search: false,
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {field: 'referral.admin_id', title: '渠道商ID', visible: false},
- {field: 'admin_id', title: '渠道商ID', operate: false},
- {field: 'username', title: '渠道商账号'},
- {field: 'nickname', title: '渠道商昵称', operate: 'LIKE %...%'},
- {field: 'wx_nickname', title: '公众号', operate: false},
- {field: 'id', title: '推广ID', operate: false},
- {field: 'source_url', title: '推广链接', formatter: Controller.api.source_url, operate: false},
- {field: 'entry_page', title: '入口页面', formatter: Controller.api.entry_page, operate: false},
- {field: 'referral.name', title: '派单渠道', visible: false,operate: 'LIKE %...%'},
- {field: 'name', title: '派单渠道',operate: false },
- {field: 'book.name', title: '书籍名称', visible: false, operate: 'LIKE %...%'},
- {
- field: 'uv',
- title: '累计阅读人数(今日阅读人数)',
- operate: false,
- formatter: function (value, row, index) {
- return value + "(" + row.dayuv + ")";
- }
- },
- {
- field: 'follow',
- title: '累计关注人数(今日关注人数)',
- operate: false,
- formatter: function (value, row, index) {
- var percent = daypercent= '0.0%';
- if (row.uv > 0) {
- percent = (value/row.uv) * 100;
- percent = percent.toFixed(1)+'%';
- }
- if (row.dayuv > 0) {
- daypercent = (row.dayut/row.dayuv) * 100;
- daypercent = daypercent.toFixed(1)+'%';
- }
- if (percent == '0.0%') {
- return value + "(" + row.dayut + ")";
- }
- return str = value + "(" + row.dayut + ")" + "<br> 关注率 "+percent+"("+daypercent+")";
- }
- },
- {
- field: 'net_follow_num',
- title: '累计净关注人数(今日净关注人数)',
- operate: false,
- formatter: function (value, row, index) {
- return value + "(" + row.dayjt + ")";
- }
- },
- {
- field: 'money',
- title: '总充值金额(今日)',
- operate: false,
- formatter: function (value, row, index) {
- return value + "(" + row.daymt + ")";
- }
- },
- {
- field: 'order_nums',
- title: '充值笔数/充值比例(今日)',
- operate: false,
- formatter: function (value, row, index) {
- var percent = daypercent= '0.0%';
- if (row.follow > 0) {
- percent = (value/row.follow) * 100;
- percent = percent.toFixed(1)+'%';
- }
- if (row.dayut > 0) {
- daypercent = (row.day_order_nums/row.dayut) * 100;
- daypercent = daypercent.toFixed(1)+'%';
- }
- return ''+ value + ' 笔/'+ percent +' <br>('+ row.day_order_nums+ ' 笔/'+daypercent+')';
- }
- },
- {field: 'cost', title: '推广成本', operate: false},
- {
- field: 'money',
- title: '利润',
- operate: false,
- formatter: function (value, row, index) {
- if (row.cost >0) {
- var lirun = value-row.cost;
- var percent = '0.00%';
- if (value > 0) {
- var percent = (value/row.cost) * 100;
- percent = percent.toFixed(2)+'%';
- }
- return lirun.toFixed(2) + "<br>回本率 " + percent;
- }
- return '-';
- }
- },
- {
- field: 'createtime',
- title: '创建时间',
- operate: false,
- addclass: 'datetimerange',
- formatter: Table.api.formatter.datetime
- },
- {
- field: 'tongji',
- title: __("操作"),
- operate: false,
- formatter: function (value, row, index) {
- return '<a style="float:left;margin-left: 10%" href="/admin/viporders/index?ids=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">订单详情</a>';
- }
- },
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- },
- source_url: function (value, row, index) {
- var html = [];
- html.push((row.wx_type == 1 ? '<b>认证公众号</b>' : '<b>未认证公众号</b>'));
- if (row.short_id > 0) {
- value = row.short_url;
- } else {
- if (Config.url_referral) {
- value = Config.url_referral + '/t/' + row.id;
- } else {
- value = row.url_referral;
- }
- }
- if (row.limited == 1) {
- html.push('<div class="link_txt">公众号阅读原文必选</div><div class="url_text">' + value);
- html.push('<div class="link_txt" style="padding:0 10px;background-color:red;color:#fff;font-weight:normal;display:inline-block;height:auto;">该链接对新用户已失效,无法进行推广</div></div>');
- } else {
- if (row.state == "1") {
- html.push('<div class="link_txt">公众号阅读原文必选</div><div class="url_text">' + value + ' <i class="fa fa-copy copy" data-clipboard-text="' + value + '"></i> <i class="fa fa-qrcode qrcode" data-qrcode="' + value + '"></i>');
- html.push('<a href="javascript:;" class="short_link_but">点击显示短链</a><div class="short_link"><strong>腾讯短链:</strong> ' + row.short_url_qq + ' <i class="fa fa-copy copy" data-clipboard-text="' + row.short_url_qq + '"></i> <i class="fa fa-qrcode qrcode" data-qrcode="' + row.short_url_qq + '"></i>');
- html.push('<strong>微博短链:</strong> ' + row.short_url_weibo + ' <i class="fa fa-copy copy" data-clipboard-text="' + row.short_url_weibo + '"></i> <i class="fa fa-qrcode qrcode" data-qrcode="' + row.short_url_weibo + '"></i></div></div>');
- } else {
- html.push('<div class="link_txt">当前链接已失效,请禁止使用</div><div class="url_text">' + value + '</div>');
- }
- }
- return html.join('<br>');
- },
- entry_page: function (value, row, index) {
- var html = [];
- if (row.type == 1) {
- html.push('<span>' + row.book_name + '</span>');
- html.push(row.chapter_name);
- if (row.guide_chapter_idx) {
- html.push('关注章节:' + row.guide_chapter_idx);
- } else {
- html.push('关注章节:默认');
- }
- } else if (row.type == 3) {
- html.push('落地页推广');
- html.push('<span>' + row.book_name + '</span>');
- html.push(row.chapter_name);
- if (row.guide_chapter_idx) {
- html.push('关注章节:' + row.guide_chapter_idx);
- } else {
- html.push('关注章节:默认');
- }
- } else {
- html.push('书城首页推广');
- }
- return html.join('<br>');
- }
- }
- };
- return Controller;
- });
|