referral.js 103 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'qrcode'], function ($, undefined, Backend, Table, Form, Qrcode) {
  2. // 更换图文
  3. $(document).delegate('.changeTeleTxt', 'click', function () {
  4. $.post({
  5. url: "referral/referral/edit?ids="+$(this).data('id'),
  6. success:function (data) {
  7. $('fieldset .row .btn-success').trigger('click');
  8. }
  9. });
  10. });
  11. // 分享图片
  12. var shareImgBig11 = '';
  13. $(document).delegate('.sharepic', 'click', function(){
  14. $.post({
  15. url: "/admin/referral.referral/merge_image?id="+$(this).data('id'),
  16. success:function (data) {
  17. if (data.code) {
  18. $("#t_pic").attr('src', data.data.path);
  19. shareImgBig11 = data.data.path;
  20. $(".copy_dialog").show();
  21. } else {
  22. alert('没有可用的底图,' + data.msg);
  23. }
  24. }
  25. });
  26. });
  27. function touchstart(e){
  28. window.parent.document.getElementById('bigImg111').src=shareImgBig11;
  29. window.parent.document.getElementById('showImg').click();
  30. }
  31. function touchend(e){
  32. // 关闭图片
  33. window.parent.document.getElementById('hidImg').click();
  34. }
  35. function touchcancel(e){
  36. // 关闭图片
  37. window.parent.document.getElementById('hidImg').click();
  38. }
  39. // 按下事件
  40. $('#t_pic').on('touchstart', touchstart);
  41. // 抬起事件
  42. $('#t_pic').on('touchend', touchend);
  43. $('#t_pic').on('touchcancel', touchend);
  44. function isAndroid() {
  45. var u = navigator.userAgent;
  46. return (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1);
  47. }
  48. if(isAndroid()){
  49. var text = "长按图片 ==> 查看图片 ==> 分享图片";
  50. $('.copy_dialog .top_p1').html(text);
  51. }else{
  52. var text = "长按图片 ==> 分享图片";
  53. $('.copy_dialog .top_p1').html(text);
  54. }
  55. $(document).on('click','.copy_dialog_close',function(){
  56. $('.copy_dialog').hide();
  57. });
  58. $(document).on('click','.btn-collect',function(){
  59. var rid = $(this).attr('rid');
  60. $.get('referral/referral/collection/ids/'+rid,function(result){
  61. if(result.code == 1){
  62. var table = $("#table");
  63. Toastr.success(result.msg);
  64. table.bootstrapTable('refresh');
  65. }else{
  66. Toastr.error(result.msg);
  67. }
  68. });
  69. });
  70. // 分享给好友 || 分享到朋友圈
  71. $(document).on('click', '.sharebtn', function () {
  72. var id = $(this).data('id');
  73. var share_type = $(this).data('type');
  74. $.post({
  75. url: "/admin/referral.referral/ajaxgetshare?id=" + id + "&type=" + share_type,
  76. success:function (data) {
  77. var ah = {
  78. url: data.shareLink,
  79. title: data.shareTitle,
  80. description: data.shareDesc,
  81. img_url: data.shareIcon,
  82. img_title: data.shareTitle,
  83. to_app: data.shareType,
  84. cus_txt: data.shareDesc
  85. };
  86. try {
  87. top.browser.app.share(ah);
  88. if (typeof(top.browser) != "undefined") {
  89. if (typeof(top.browser.app) != "undefined") {
  90. top.browser.app.share(ah)
  91. }
  92. }else if (typeof(top.window) != "undefined") {
  93. if (typeof(top.window.qb) != "undefined") {
  94. top.window.qb.share(ah)
  95. }
  96. }else{
  97. alert('请在手机端使用QQ浏览器');
  98. }
  99. }catch (e) {
  100. //alert(e.message);
  101. alert('请在手机端使用QQ浏览器');
  102. }
  103. }
  104. });
  105. });
  106. $(document).on("click", '.qrcode', function () {
  107. var qrUrl = $(this).data("qrcode");
  108. // $('#tong').html("");
  109. // $('#tong').qrcode(qrUrl);
  110. // layer.open({
  111. // type: 1,
  112. // title: false,
  113. // area: '258px',
  114. // skin: 'layui-layer-nobg', //没有背景色
  115. // shadeClose: true,
  116. // content: $('#tong')
  117. // });
  118. Fast.api.open('referral/referral/show_tpl?url='+qrUrl, '图片二维码', {});
  119. });
  120. //book_but
  121. $(document).on('click', '.book_but', function () {
  122. Fast.api.open($(this).attr('href'), '订单详情', {});
  123. return false;
  124. });
  125. $(document).on('click', '.book_history', function () {
  126. Fast.api.open($(this).attr('href'), '历史数据', {});
  127. return false;
  128. });
  129. $(document).on('click', '.btn-look', function () {
  130. layer.open({
  131. type: 2,
  132. title: '查看代理商推广链接',
  133. maxmin: true,
  134. area: ['90%', '90%'],
  135. shadeClose: true, //点击遮罩关闭层
  136. content: $('.btn-look').data('action')
  137. });
  138. });
  139. $(document).on('click', '.short_link_but', function () {
  140. var $this = $(this);
  141. $this.hide().siblings('.short_link').show();
  142. });
  143. $(document).on('click','.short_link_butt',function(){
  144. var $this = $(this);
  145. var urlqq = $this.data('url-qq');
  146. var urlweibo = $this.data('url-weibo');
  147. layer.open({
  148. type: 1,
  149. title: '推广短链',
  150. toFixed: false, //不固定
  151. maxmin: true,
  152. area: ['auto', 'auto'],
  153. content: '<div class="short_chain_box">\
  154. <div class="short_input_box">\
  155. <strong>腾讯短链</strong>\
  156. <div class="short_input"><input type="text" value="' + urlqq + '" /></div>\
  157. <a href="javascript:;" class="copy" data-clipboard-text="' + urlqq + '">复制腾讯短链</a>\
  158. </div>\
  159. <div class="short_input_box">\
  160. <strong>腾讯短链</strong>\
  161. <div class="short_input"><input type="text" value="' + urlweibo + '" /></div>\
  162. <a href="javascript:;" class="copy" data-clipboard-text="' + urlweibo + '">复制新浪短链</a>\
  163. </div>\
  164. </div>'
  165. });
  166. });
  167. function UnixToDate(unixTime, isFull, timeZone) {
  168. if (typeof (timeZone) == 'number')
  169. {
  170. unixTime = parseInt(unixTime) + parseInt(timeZone) * 60 * 60;
  171. }
  172. var time = new Date(unixTime * 1000);
  173. var ymdhis = "";
  174. ymdhis += time.getUTCFullYear() + "-";
  175. ymdhis += ((time.getUTCMonth()+1) < 10 ? '0' + (time.getUTCMonth()+1) : (time.getUTCMonth()+1) )+ "-";
  176. ymdhis += (time.getUTCDate() < 10 ? '0' + time.getUTCDate() : time.getUTCDate());
  177. if (isFull === true)
  178. {
  179. ymdhis += "&nbsp" + (time.getUTCHours()<10 ? '0' + time.getUTCHours() : time.getUTCHours()) + ":";
  180. ymdhis += (time.getUTCMinutes()<10 ? '0' + time.getUTCMinutes() : time.getUTCMinutes()) + ":";
  181. ymdhis += (time.getUTCSeconds()<10 ? '0' + time.getUTCSeconds() : time.getUTCSeconds()) ;
  182. }
  183. return ymdhis;
  184. }
  185. if (Config.rtype == 1) {
  186. var Controller = {
  187. index: function () {
  188. // 初始化表格参数配置
  189. Table.api.init({
  190. extend: {
  191. index_url: Config.referralUrl,
  192. add_url: 'referral/referral/add?type=2&push='+Config.push,
  193. export_url: 'referral/export?push='+Config.push,
  194. edit_url: 'referral/referral/edit?push='+Config.push,
  195. del_url: 'referral/referral/del',
  196. multi_url: 'referral/referral/multi',
  197. table: 'referral',
  198. },
  199. pageSize: 10,
  200. pageList: [10],
  201. showToggle: false,
  202. showColumns: false,
  203. visible: false,
  204. commonSearch: true,
  205. showExport: true,
  206. searchFormVisible: true,
  207. search: false
  208. });
  209. var table = $("#table");
  210. // 初始化表格
  211. table.bootstrapTable({
  212. url: $.fn.bootstrapTable.defaults.extend.index_url,
  213. pk: 'id',
  214. sortName: 'id',
  215. columns: [
  216. [
  217. //{field: 'id', title: 'ID'},
  218. {field: 'source_url', title: '推广链接', formatter: Controller.api.source_url, operate: false},
  219. {field: 'entry_page', title: '入口页面', formatter: Controller.api.entry_page, operate: false},
  220. {field: 'book_id', title: '书籍ID', visible: false},
  221. {field: 'book.name', title: '书籍名称', visible: false, operate: 'LIKE %...%'},
  222. {field: 'chapter_idx', title: '章节序号', visible: false, operate: false},
  223. {field: 'admin_id', title: __('Admin_id'), visible: false, operate: false},
  224. {field: 'name', title: __('Name'), operate: 'LIKE %...%'},
  225. {
  226. field: 'wx_type',
  227. title: __('Wx_type'),
  228. visible: false,
  229. searchList: {"wx_type 1": __('Wx_type 1'), "wx_type 2": __('Wx_type 2')},
  230. operate: false
  231. },
  232. {field: 'wx_type_text', title: __('Wx_type'), visible: false, operate: false},
  233. {
  234. field: 'type',
  235. title: __('Type'),
  236. visible: false,
  237. searchList: {"type 1": '阅读页推广', "type 2": '首页推广', 'type 3': '落地页推广'},
  238. operate: false
  239. },
  240. {field: 'type_text', title: __('Type'), visible: false, operate: false},
  241. {
  242. field: 'uv',
  243. title: '总阅读人数(今日)',
  244. operate: false,
  245. formatter: function (value, row, index) {
  246. return value + "(" + row.dayuv + ")";
  247. }
  248. },
  249. {
  250. field: 'follow',
  251. title: '总关注人数(今日)',
  252. operate: false,
  253. formatter: function (value, row, index) {
  254. var percent = daypercent= '0.0%';
  255. if (row.uv > 0) {
  256. percent = (value/row.uv) * 100;
  257. percent = percent.toFixed(1)+'%';
  258. }
  259. if (row.dayuv > 0) {
  260. daypercent = (row.dayut/row.dayuv) * 100;
  261. daypercent = daypercent.toFixed(1)+'%';
  262. }
  263. if (percent == '0.0%') {
  264. return value + "(" + row.dayut + ")";
  265. }
  266. return str = value + "(" + row.dayut + ")" + "<br> 关注率 "+percent+"("+daypercent+")";
  267. }
  268. },
  269. {
  270. field: 'net_follow_num',
  271. title: '总净关注人数(今日净关注人数)',
  272. operate: false,
  273. formatter: function (value, row, index) {
  274. return value + "(" + row.dayjt + ")";
  275. }
  276. },
  277. // {
  278. // field: 'guide_follow_num',
  279. // title: '承接功能关注人数(今日)',
  280. // operate: false,
  281. // formatter: function (value, row, index) {
  282. // return value + "(" + row.daydt + ")";
  283. // }
  284. // },
  285. {
  286. field: 'money',
  287. title: '总充值金额(今日)',
  288. operate: false,
  289. formatter: function (value, row, index) {
  290. return value + "(" + row.daymt + ")";
  291. }
  292. },
  293. {
  294. field: 'order_nums',
  295. title: '充值笔数/充值比例(今日)',
  296. operate: false,
  297. formatter: function (value, row, index) {
  298. var percent = daypercent= '0.0%';
  299. if (row.follow > 0) {
  300. percent = (value/row.follow) * 100;
  301. percent = percent.toFixed(1)+'%';
  302. }
  303. if (row.dayut > 0) {
  304. daypercent = (row.day_order_nums/row.dayut) * 100;
  305. daypercent = daypercent.toFixed(1)+'%';
  306. }
  307. return ''+ value + ' 笔/'+ percent +' <br>('+ row.day_order_nums+ ' 笔/'+daypercent+')';
  308. }
  309. },
  310. {field: 'cost', title: '推广成本', operate: false},
  311. {
  312. field: 'money',
  313. title: '利润',
  314. operate: false,
  315. formatter: function (value, row, index) {
  316. if (row.cost >0) {
  317. var lirun = value-row.cost;
  318. var percent = '0.00%';
  319. if (value > 0) {
  320. var percent = (value/row.cost) * 100;
  321. percent = percent.toFixed(2)+'%';
  322. }
  323. return lirun.toFixed(2) + "<br>回本率 " + percent;
  324. }
  325. return '-';
  326. }
  327. },
  328. {
  329. field: 'createtime',
  330. title: '创建时间',
  331. operate: 'RANGE',
  332. addclass: 'datetimerange',
  333. formatter: Table.api.formatter.datetime
  334. },
  335. {
  336. field: 'updatetime',
  337. title: '更新时间',
  338. visible: false,
  339. operate: false,
  340. addclass: 'datetimerange',
  341. formatter: Table.api.formatter.datetime
  342. },
  343. {
  344. field: 'tongji',
  345. title: __("统计"),
  346. operate: false,
  347. formatter: function (value, row, index) {
  348. return '<a style="float:left;margin-left: 10%" href="/admin/orders/index?ids=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">订单详情</a>';
  349. }
  350. },
  351. ]
  352. ],
  353. exportOptions: {
  354. type: 'excel',
  355. fileName: '推广链接',
  356. ignoreColumn: [8, 9],
  357. onMsoNumberFormat: function (cell, row, col) {
  358. return (row > 0 && col == 1) ? '\\@' : '';
  359. }
  360. }
  361. });
  362. // 为表格绑定事件
  363. Table.api.bindevent(table);
  364. },
  365. lookagentreferral: function () {
  366. // 初始化表格参数配置
  367. Table.api.init({
  368. extend: {
  369. look_url: "referral/referral/lookAgentReferral",
  370. table: 'referral',
  371. },
  372. pageSize: 10,
  373. pageList: [10],
  374. showColumns: false,
  375. showToggle: false,
  376. searchFormVisible: true,
  377. search: false,
  378. });
  379. var table = $("#table");
  380. // 初始化表格
  381. table.bootstrapTable({
  382. url: $.fn.bootstrapTable.defaults.extend.look_url,
  383. pk: 'id',
  384. sortName: 'id',
  385. columns: [
  386. [
  387. //{checkbox: true},
  388. //{field: 'id', title: 'ID'},
  389. {field: 'source_url', title: '推广链接', formatter: Controller.api.source_url, operate: false},
  390. {field: 'entry_page', title: '入口页面', formatter: Controller.api.entry_page, operate: false},
  391. {field: 'book_id', title: '书籍ID', visible: false},
  392. {field: 'book.name', title: '书籍名称', visible: false, operate: 'LIKE %...%'},
  393. {field: 'chapter_idx', title: '章节序号', visible: false, operate: false},
  394. {
  395. field: 'admin_id',
  396. title: '代理商',
  397. formatter: Controller.api.formatter.agent_text,
  398. searchList: Controller.api.formatter.agent_select()
  399. },
  400. {
  401. field: 'wx_type',
  402. title: __('Wx_type'),
  403. visible: false,
  404. searchList: {"wx_type 1": __('Wx_type 1'), "wx_type 2": __('Wx_type 2')},
  405. operate: false
  406. },
  407. {field: 'wx_type_text', title: __('Wx_type'), visible: false, operate: false},
  408. {
  409. field: 'type',
  410. title: __('Type'),
  411. visible: false,
  412. searchList: {"type 1": '阅读页推广', "type 2": '首页推广', 'type 3': '落地页推广'},
  413. operate: false
  414. },
  415. {field: 'type_text', title: __('Type'), visible: false, operate: false},
  416. {
  417. field: 'uv',
  418. title: '总阅读人数(今日)',
  419. operate: false,
  420. formatter: function (value, row, index) {
  421. return value + "(" + row.dayuv + ")";
  422. }
  423. },
  424. {
  425. field: 'follow',
  426. title: '总关注人数(今日)',
  427. operate: false,
  428. formatter: function (value, row, index) {
  429. var percent = daypercent= '0.0%';
  430. if (row.uv > 0) {
  431. percent = (value/row.uv) * 100;
  432. percent = percent.toFixed(1)+'%';
  433. }
  434. if (row.dayuv > 0) {
  435. daypercent = (row.dayut/row.dayuv) * 100;
  436. daypercent = daypercent.toFixed(1)+'%';
  437. }
  438. if (percent == '0.0%') {
  439. return value + "(" + row.dayut + ")";
  440. }
  441. return str = value + "(" + row.dayut + ")" + "<br> 关注率 "+percent+"("+daypercent+")";
  442. }
  443. },
  444. {
  445. field: 'net_follow_num',
  446. title: '总净关注人数(今日)',
  447. operate: false,
  448. formatter: function (value, row, index) {
  449. return value + "(" + row.dayjt + ")";
  450. }
  451. },
  452. // {
  453. // field: 'guide_follow_num',
  454. // title: '承接功能关注人数(今日)',
  455. // operate: false,
  456. // formatter: function (value, row, index) {
  457. // return value + "(" + row.daydt + ")";
  458. // }
  459. // },
  460. {
  461. field: 'money',
  462. title: '总充值金额(今日)',
  463. operate: false,
  464. formatter: function (value, row, index) {
  465. return value + "(" + row.daymt + ")";
  466. }
  467. },
  468. {
  469. field: 'order_nums',
  470. title: '充值笔数/充值比例(今日)',
  471. operate: false,
  472. formatter: function (value, row, index) {
  473. var percent = daypercent= '0.0%';
  474. if (row.follow > 0) {
  475. percent = (value/row.follow) * 100;
  476. percent = percent.toFixed(1)+'%';
  477. }
  478. if (row.dayut > 0) {
  479. daypercent = (row.day_order_nums/row.dayut) * 100;
  480. daypercent = daypercent.toFixed(1)+'%';
  481. }
  482. return ''+ value + ' 笔/'+ percent +' <br>('+ row.day_order_nums+ ' 笔/'+daypercent+')';
  483. }
  484. },
  485. {field: 'cost', title: '推广成本', operate: false},
  486. {
  487. field: 'money',
  488. title: '利润',
  489. operate: false,
  490. formatter: function (value, row, index) {
  491. if (row.cost >0) {
  492. var lirun = value-row.cost;
  493. var percent = '0.00%';
  494. if (value > 0) {
  495. var percent = (value/row.cost) * 100;
  496. percent = percent.toFixed(2)+'%';
  497. }
  498. return lirun.toFixed(2) + "<br>回本率 " + percent;
  499. }
  500. return '-';
  501. }
  502. },
  503. {
  504. field: 'createtime',
  505. title: '创建时间',
  506. operate: 'RANGE',
  507. addclass: 'datetimerange',
  508. formatter: Table.api.formatter.datetime
  509. },
  510. {
  511. field: 'updatetime',
  512. title: '更新时间',
  513. visible: false,
  514. operate: false,
  515. addclass: 'datetimerange',
  516. formatter: Table.api.formatter.datetime
  517. },
  518. {
  519. field: 'operate',
  520. title: '操作',
  521. table: table,
  522. events: Table.api.events.operate,
  523. formatter: Table.api.formatter.operate
  524. },
  525. {
  526. field: 'tongji',
  527. title: __("统计"),
  528. operate: false,
  529. formatter: function (value, row, index) {
  530. return '<a style="float:left;margin-left: 10%" href="/admin/orders/index?ids=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">订单详情</a>';
  531. }
  532. },
  533. ]
  534. ],
  535. });
  536. // 为表格绑定事件
  537. Table.api.bindevent(table);
  538. },
  539. add: function () {
  540. Form.api.bindevent($("form[role=form]"), function (data) {
  541. Toastr.success('添加成功');
  542. $('.url_txt').eq(0).text(data.jmp_url);
  543. $('.url_txt').eq(1).text(data.short_url_weibo);
  544. $('.url_txt').eq(2).text(data.short_url_qq);
  545. $('.copy').eq(0).attr('data-clipboard-text', data.jmp_url);
  546. $('.copy').eq(1).attr('data-clipboard-text', data.short_url_weibo);
  547. $('.copy').eq(2).attr('data-clipboard-text', data.short_url_qq);
  548. $('#erweima').html("");
  549. $('#erweima').qrcode(data.jmp_url);
  550. $('#erweima').html('<img style="display: block;margin: 0;padding: 0;border: 0;height: 160px;width: 160px;" src="' + $('#erweima canvas')[0].toDataURL("image/png") + '" />');
  551. $('#add-form').hide();
  552. $('#add-dialog').show();
  553. return false;
  554. });
  555. $(document).on('click', '.btn-close', function () {
  556. Fast.api.close();
  557. })
  558. },
  559. edit: function () {
  560. Controller.api.bindevent();
  561. },
  562. select: function () {
  563. // 初始化表格参数配置
  564. Table.api.init({
  565. extend: {
  566. index_url: 'referral/referral/select',
  567. },
  568. pageSize: 10,
  569. pageList: [10],
  570. showColumns: false,
  571. showToggle: false,
  572. showExport: false,
  573. searchFormVisible: false,
  574. search: false,
  575. });
  576. var table = $("#table");
  577. // 初始化表格
  578. table.bootstrapTable({
  579. url: $.fn.bootstrapTable.defaults.extend.index_url,
  580. pk: 'id',
  581. sortName: 'state desc,id desc',
  582. sortOrder: '',
  583. columns: [
  584. [
  585. {checkbox: true},
  586. //{field: 'id', title: __('Id')},
  587. {field: 'source_url', title: '推广链接', formatter: Controller.api.source_url, operate: false},
  588. {field: 'entry_page', title: '入口页面', formatter: Controller.api.entry_page, operate: false},
  589. {field: 'push', title: '内推外派', formatter:function(val,row){if(parseInt(val) == 0){return "外派";}else{return "内推";}},searchList: {"0":"外派", "1": "内推"} },
  590. {field: 'book_id', title: __('Book_id'), visible: false},
  591. {field: 'book.name', title: '书籍名称', visible: false, operate: 'LIKE %...%'},
  592. {field: 'chapter_idx', title: __('Chapter_idx'), visible: false, operate: false},
  593. {field: 'admin_id', title: __('Admin_id'), visible: false, operate: false},
  594. {field: 'name', title: __('Name'), visible: false, operate: 'LIKE %...%'},
  595. {
  596. field: 'wx_type',
  597. title: __('Wx_type'),
  598. visible: false,
  599. searchList: {"wx_type 1": __('Wx_type 1'), "wx_type 2": __('Wx_type 2')},
  600. operate: false
  601. },
  602. {field: 'wx_type_text', title: __('Wx_type'), visible: false, operate: false},
  603. {
  604. field: 'type',
  605. title: __('Type'),
  606. visible: false,
  607. searchList: {"type 1": '阅读页推广', "type 2": '首页推广', 'type 3': '落地页推广'}
  608. },
  609. {field: 'type_text', title: __('Type'), visible: false, operate: false},
  610. {
  611. field: 'createtime',
  612. title: __('Createtime'),
  613. operate: 'RANGE',
  614. addclass: 'datetimerange',
  615. formatter: Table.api.formatter.datetime
  616. },
  617. {
  618. field: 'updatetime',
  619. title: __('Updatetime'),
  620. visible: false,
  621. operate: false,
  622. addclass: 'datetimerange',
  623. formatter: Table.api.formatter.datetime
  624. },
  625. {
  626. field: 'operate', title: __('Operate'), events: {
  627. 'click .btn-chooseone': function (e, value, row, index) {
  628. Fast.api.close([row]);
  629. },
  630. }, formatter: function () {
  631. return '<a href="javascript:;" class="btn btn-danger btn-chooseone btn-xs"><i class="fa fa-check"></i> ' + __('Choose') + '</a>';
  632. }
  633. }
  634. ]
  635. ]
  636. });
  637. // 为表格绑定事件
  638. Table.api.bindevent(table);
  639. //获取选中数据
  640. $(document).on('click', "#btn-chooseone", function () {
  641. Fast.api.close(table.bootstrapTable('getSelections'));
  642. });
  643. },
  644. api: {
  645. formatter: {
  646. agent_text: function (value, row, index) {
  647. var name = '';
  648. $.each(Config.adminExtend, function (key, val) {
  649. if (row.admin_id == val.admin_id) {
  650. name = val.card_holder;
  651. return;
  652. }
  653. });
  654. return name;
  655. },
  656. agent_select: function () {
  657. var data = {};
  658. $.each(Config.adminExtend, function (key, val) {
  659. data[val.admin_id] = val.card_holder;
  660. });
  661. return data;
  662. },
  663. },
  664. bindevent: function () {
  665. Form.api.bindevent($("form[role=form]"));
  666. },
  667. source_url: function (value, row, index) {
  668. var html = [];
  669. html.push((row.wx_type == 1 ? '<b>认证公众号</b>' : '<b>未认证公众号</b>'));
  670. if (row.short_id > 0) {
  671. value = row.short_url;
  672. } else {
  673. if (Config.url_referral) {
  674. value = Config.url_referral + '/t/' + row.id;
  675. } else {
  676. value = row.url_referral;
  677. }
  678. }
  679. if (row.limited == 1) {
  680. html.push('<div class="link_txt">公众号阅读原文必选</div><div class="url_text">' + value);
  681. 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>');
  682. } else {
  683. if (row.state == "1") {
  684. html.push('<div class="link_txt">公众号阅读原文必选</div><div class="url_text">' + value + '&nbsp;<i class="fa fa-copy copy" data-clipboard-text="' + value + '"></i>&nbsp;&nbsp;<i class="fa fa-qrcode qrcode" data-qrcode="' + value + '"></i>');
  685. html.push('<a href="javascript:;" class="short_link_but">点击显示短链</a><div class="short_link"><strong>腾讯短链:</strong>&nbsp;' + row.short_url_qq + '&nbsp;<i class="fa fa-copy copy" data-clipboard-text="' + row.short_url_qq + '"></i>&nbsp;&nbsp;<i class="fa fa-qrcode qrcode" data-qrcode="' + row.short_url_qq + '"></i>');
  686. html.push('<strong>微博短链:</strong>&nbsp;' + row.short_url_weibo + '&nbsp;<i class="fa fa-copy copy" data-clipboard-text="' + row.short_url_weibo + '"></i>&nbsp;&nbsp;<i class="fa fa-qrcode qrcode" data-qrcode="' + row.short_url_weibo + '"></i></div></div>');
  687. } else {
  688. html.push('<div class="link_txt">当前链接已失效,请禁止使用</div><div class="url_text">' + value + '</div>');
  689. }
  690. }
  691. return html.join('<br>');
  692. },
  693. entry_page: function (value, row, index) {
  694. var html = [];
  695. if (row.type == 1) {
  696. html.push('<a href="/admin/referral/book/info?id=' + row.book_id + '">' + row.book.name + '</a>');
  697. html.push(row.chapter_name);
  698. if (row.guide_chapter_idx) {
  699. html.push('关注章节:' + row.guide_chapter_idx);
  700. } else {
  701. html.push('关注章节:默认');
  702. }
  703. } else if (row.type == 3) {
  704. html.push('落地页推广');
  705. html.push('<a href="/admin/referral/book/info?id=' + row.book_id + '">' + row.book.name + '</a>');
  706. html.push(row.chapter_name);
  707. if (row.guide_chapter_idx) {
  708. html.push('关注章节:' + row.guide_chapter_idx);
  709. } else {
  710. html.push('关注章节:默认');
  711. }
  712. } else {
  713. html.push('书城首页推广');
  714. }
  715. return html.join('<br>');
  716. }
  717. }
  718. };
  719. } else {
  720. var Controller = {
  721. index: function () {
  722. // 初始化表格参数配置
  723. Table.api.init({
  724. extend: {
  725. index_url: Config.referralUrl,
  726. add_url: 'referral/referral/add?type=2&push='+Config.push,
  727. export_url: 'referral/export?push='+Config.push,
  728. edit_url: 'referral/referral/edit?push='+Config.push,
  729. del_url: 'referral/referral/del',
  730. multi_url: 'referral/referral/multi',
  731. disable_url: 'referral/referral/disable',
  732. collection_url: 'referral/referral/collection',
  733. table: 'referral',
  734. },
  735. pageSize: 10,
  736. pageList: [10],
  737. showColumns: false,
  738. showToggle: false,
  739. searchFormVisible: true,
  740. search: false,
  741. });
  742. var table = $("#table");
  743. if(Config.authGroupId == 4 && Config.authDistribute == '0' && Config.open_wechat_share == 1){
  744. //只有代理商才有权限看
  745. table.bootstrapTable({
  746. url: $.fn.bootstrapTable.defaults.extend.index_url,
  747. pk: 'id',
  748. sortName: 'id',
  749. columns: [
  750. [
  751. //{checkbox: true},
  752. //{field: 'id', title: 'ID'},
  753. {field: 'id', title: '推广ID'},
  754. {field: 'source_url', title: '推广链接',formatter:Controller.api.source_url2, operate:false},
  755. {field: 'entry_page', title: '入口页面',formatter:Controller.api.entry_page, operate:false},
  756. {field: 'book_id', title: '书籍ID', visible:false},
  757. {field: 'book.name', title: '书籍名称', visible:false,operate: 'LIKE %...%'},
  758. {field: 'chapter_idx', title: '章节序号', visible:false, operate:false},
  759. {field: 'admin_id', title: __('Admin_id'), visible:false, operate:false},
  760. {field: 'name', title: __('Name'),operate: 'LIKE %...%'},
  761. {field: 'wx_type', title: __('Wx_type'), visible:false, searchList: {"wx_type 1":__('Wx_type 1'),"wx_type 2":__('Wx_type 2')}, operate:false},
  762. {field: 'wx_type_text', title: __('Wx_type'), visible:false, operate:false},
  763. {field: 'type', title: __('Type'), visible:false, searchList: {"type 1":'阅读页推广',"type 2":'首页推广'}, operate:false},
  764. {field: 'type_text', title: __('Type'), visible:false, operate:false},
  765. {field: 'uv', title: '总阅读人数(今日)', operate:false,formatter:function(value,row,index){
  766. return '<span style="font-size:18px;color:#f33;white-space: nowrap;">' + value+' <span style="font-size:18px;color:#00f;">('+row.dayuv+')</span></span>';
  767. }},
  768. {field: 'follow', title: '总关注人数(今日)', operate:false,formatter:function(value,row,index){
  769. var percent = daypercent= '0.0%';
  770. if (row.uv > 0) {
  771. percent = (value/row.uv) * 100;
  772. percent = percent.toFixed(1)+'%';
  773. }
  774. if (row.dayuv > 0) {
  775. daypercent = (row.dayut/row.dayuv) * 100;
  776. daypercent = daypercent.toFixed(1)+'%';
  777. }
  778. if (percent == '0.0%') {
  779. return value + "(" + row.dayut + ")";
  780. }
  781. return str = value + "(" + row.dayut + ")" + "<br> 关注率 "+percent+"("+daypercent+")";
  782. /*return '<span style="font-size:18px;color:#f33;white-space: nowrap;">' + value+' <span style="font-size:18px;color:#00f;">('+row.dayut+')</span></span><br><span style="font-size:18px;color:#f33;white-space: nowrap;">'+percent+'% <span style="font-size:18px;color:#00f;">('+daypercent+'%)</span></span>';*/
  783. }},
  784. {
  785. field: 'net_follow_num',
  786. title: '总净关注人数(今日)',
  787. operate: false,
  788. formatter: function (value, row, index) {
  789. return '<span style="font-size:18px;color:#f33;white-space: nowrap;">' + value+' <span style="font-size:18px;color:#00f;">('+row.dayjt+')</span></span>';
  790. //return value + "(" + row.dayjt + ")";
  791. }
  792. },
  793. // {
  794. // field: 'guide_follow_num',
  795. // title: '承接功能关注人数(今日)',
  796. // operate: false,
  797. // formatter: function (value, row, index) {
  798. // return '<span style="font-size:18px;color:#f33;white-space: nowrap;">' + value+' <span style="font-size:18px;color:#00f;">('+row.daydt+')</span></span>';
  799. // //return value + "(" + row.daydt + ")";
  800. // }
  801. // },
  802. {field: 'money', title: '总充值金额(今日)', operate:false,formatter:function(value,row,index){
  803. return '<span style="font-size:18px;color:#f33;white-space: nowrap;">' + value+' <span style="font-size:18px;color:#00f;">('+row.daymt+')</span></span>';
  804. }},
  805. {
  806. field: 'order_nums',
  807. title: '充值笔数/充值比例(今日)',
  808. operate: false,
  809. formatter: function (value, row, index) {
  810. var percent = daypercent= '0.0%';
  811. if (row.follow > 0) {
  812. percent = (value/row.follow) * 100;
  813. percent = percent.toFixed(1)+'%';
  814. }
  815. if (row.dayut > 0) {
  816. daypercent = (row.day_order_nums/row.dayut) * 100;
  817. daypercent = daypercent.toFixed(1)+'%';
  818. }
  819. return ''+ value + ' 笔/'+ percent +' <br>('+ row.day_order_nums+ ' 笔/'+daypercent+')';
  820. }
  821. },
  822. {field: 'cost', title: '推广成本', operate: false},
  823. {
  824. field: 'money',
  825. title: '利润',
  826. operate: false,
  827. formatter: function (value, row, index) {
  828. if (row.cost >0) {
  829. var lirun = value-row.cost;
  830. var percent = '0.00%';
  831. if (value > 0) {
  832. var percent = (value/row.cost) * 100;
  833. percent = percent.toFixed(2)+'%';
  834. }
  835. return lirun.toFixed(2) + "<br>回本率 " + percent;
  836. }
  837. return '-';
  838. }
  839. },
  840. {
  841. field: 'createtime',
  842. title: '创建时间',
  843. operate: 'RANGE',
  844. addclass: 'datetimerange',
  845. formatter: Table.api.formatter.datetime
  846. },
  847. {
  848. field: 'updatetime',
  849. title: '更新时间',
  850. visible: false,
  851. operate: false,
  852. addclass: 'datetimerange',
  853. formatter: Table.api.formatter.datetime
  854. },
  855. {
  856. field: 'state',
  857. title: '状态',
  858. searchList: {'0': '禁用', '1': '正常'},
  859. formatter: function (value, row, index) {
  860. return value == 1 ? "<span style='color: green;'>正常</span>" : "<span style='color: red;'>禁用</span>";
  861. }
  862. },
  863. {field: 'share_title',title:'分享标题', operate:false},
  864. {field: 'share_image', title: '分享图片', operate: false,
  865. formatter: function (value, row, index) {
  866. if(value){
  867. return '<img style="width:80px; height:auto" src=' + value + '>';
  868. }else{
  869. return '-';
  870. }
  871. }
  872. },
  873. {field: 'createtime', title: '分享操作', operate: false,
  874. formatter: function (value, row, index) {
  875. if(row.share_title){
  876. var share_title = row.share_title + "\n";
  877. }else{
  878. var share_title = "她是怎么想的,有人能告诉我吗\n";
  879. }
  880. if(row.short_url_qq){
  881. share_title += row.short_url_qq;
  882. }else{
  883. share_title += row.source_url;
  884. }
  885. var html = '';
  886. html += '<div class="opshare copy" data-clipboard-text="' + share_title + '"><div>';
  887. html += '<img style="width: 32px;height: auto; margin: 0 auto; display: block" src="../../assets/img/s_link.png"></div>';
  888. html += '<div style="text-align: center">复制链接</div></div>';
  889. html += '<div class="opshare sharebtn" data-id="'+row.id+'" data-type="s_chat">';
  890. html += '<div><img style="width: 32px;height: auto; margin: 0 auto; display: block" src="../../assets/img/s_chat.png"></div>';
  891. html += '<div style="text-align: center">分享群聊</div></div>';
  892. html += '<div class="opshare sharebtn" data-id="'+row.id+'" data-type="s_friends">';
  893. html += '<div><img style="width: 32px;height: auto; margin: 0 auto; display: block" src="../../assets/img/s_friends.png"></div>';
  894. html += '<div style="text-align: center">朋友圈</div></div>';
  895. html += '<div class="opshare sharepic" data-id="' + row.id + '">';
  896. html += '<div><img style="width: 32px;height: auto; margin: 0 auto; display: block" src="../../assets/img/s_pic.png"></div>';
  897. html += '<div style="text-align: center">分享图片</div></div>';
  898. html += '<div class="opshare changeTeleTxt" data-id="'+row.id+'"><div>';
  899. html += '<img style="width: 32px;height: auto; margin: 0 auto; display: block" src="../../assets/img/s_change.png"></div>';
  900. html += '<div style="text-align: center">更换图文</div></div>';
  901. return html;
  902. }
  903. },
  904. /*{
  905. field: 'operate',
  906. title: '操作',
  907. table: table,
  908. events: Table.api.events.operate,
  909. buttons:[
  910. {
  911. name: 'detail',
  912. text: '订单详情',
  913. title: '订单详情',
  914. classname: 'btn btn-xs btn-success btn-dialog btn_kuai',
  915. url: '/admin/orders/index?a=n'
  916. }
  917. ],
  918. formatter: Table.api.formatter.operate
  919. },*/
  920. {
  921. field: 'operate',
  922. title: '操作',
  923. table: table,
  924. events: Table.api.events.operate,
  925. buttons: [
  926. {
  927. name: 'disable',
  928. text: '',
  929. title: '禁用',
  930. icon: 'fa fa-ban',
  931. classname: 'btn btn-xs btn-danger btn-ajax btn-disable',
  932. confirm: "一旦禁用,用户将无法访问链接,确定禁用?",
  933. url: $.fn.bootstrapTable.defaults.extend.disable_url,
  934. success: function (data) {
  935. table.bootstrapTable('refresh');
  936. }
  937. }
  938. ],
  939. formatter: Table.api.formatter.operate
  940. },
  941. {
  942. field: 'tongji',
  943. title: __("统计"),
  944. operate: false,
  945. formatter: function (value, row, index) {
  946. return '<a style="float:left;margin-left: 10%" href="/admin/orders/index?ids=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">订单详情</a>';
  947. }
  948. }
  949. ]
  950. ],
  951. });
  952. }else{
  953. // 初始化表格
  954. table.bootstrapTable({
  955. url: $.fn.bootstrapTable.defaults.extend.index_url,
  956. pk: 'id',
  957. sortName: 'state desc,id desc',
  958. sortOrder: '',
  959. columns: [
  960. [
  961. //{checkbox: true},
  962. //{field: 'id', title: 'ID'},
  963. {field: 'id', title: '推广ID'},
  964. {field: 'source_url', title: '推广链接', formatter: Controller.api.source_url, operate: false},
  965. {field: 'entry_page', title: '入口页面', formatter: Controller.api.entry_page, operate: false},
  966. {
  967. field: 'book_id', title: '书籍', visible: false,
  968. addclass: 'selectpage',
  969. data: 'data-source="/admin/book/book/index" data-field="name"',
  970. formatter: Table.api.formatter.search
  971. },
  972. {field: 'chapter_idx', title: '章节序号', visible: false, operate: false},
  973. {field: 'admin_id', title: __('Admin_id'), visible: false, operate: false},
  974. {field: 'name', title: __('Name'), operate: 'LIKE %...%'},
  975. {
  976. field: 'wx_type',
  977. title: __('Wx_type'),
  978. visible: false,
  979. searchList: {"wx_type 1": __('Wx_type 1'), "wx_type 2": __('Wx_type 2')},
  980. operate: false
  981. },
  982. {field: 'wx_type_text', title: __('Wx_type'), visible: false, operate: false},
  983. {
  984. field: 'type',
  985. title: __('Type'),
  986. visible: false,
  987. searchList: {"1": '阅读页推广', "type 2": '首页推广', 'type 3': '落地页推广'},
  988. operate: false
  989. },
  990. {field: 'type_text', title: __('Type'), visible: false, operate: false},
  991. {
  992. field: 'uv',
  993. title: '总阅读人数(今日)',
  994. operate: false,
  995. formatter: function (value, row, index) {
  996. return value + "(" + row.dayuv + ")";
  997. }
  998. },
  999. {
  1000. field: 'follow',
  1001. title: '总关注人数(今日)',
  1002. operate: false,
  1003. formatter: function (value, row, index) {
  1004. var percent = daypercent= '0.0%';
  1005. if (row.uv > 0) {
  1006. percent = (value/row.uv) * 100;
  1007. percent = percent.toFixed(1)+'%';
  1008. }
  1009. if (row.dayuv > 0) {
  1010. daypercent = (row.dayut/row.dayuv) * 100;
  1011. daypercent = daypercent.toFixed(1)+'%';
  1012. }
  1013. if (percent == '0.0%') {
  1014. return value + "(" + row.dayut + ")";
  1015. }
  1016. return str = value + "(" + row.dayut + ")" + "<br> 关注率 "+percent+"("+daypercent+")";
  1017. }
  1018. },
  1019. {
  1020. field: 'net_follow_num',
  1021. title: '总净关注人数(今日)',
  1022. operate: false,
  1023. formatter: function (value, row, index) {
  1024. return value + "(" + row.dayjt + ")";
  1025. }
  1026. },
  1027. // {
  1028. // field: 'guide_follow_num',
  1029. // title: '承接功能关注人数(今日)',
  1030. // operate: false,
  1031. // formatter: function (value, row, index) {
  1032. // return value + "(" + row.daydt + ")";
  1033. // }
  1034. // },
  1035. {
  1036. field: 'money',
  1037. title: '总充值金额(今日)',
  1038. operate: false,
  1039. formatter: function (value, row, index) {
  1040. return value + "(" + row.daymt + ")";
  1041. }
  1042. },
  1043. {
  1044. field: 'order_nums',
  1045. title: '充值笔数/充值比例(今日)',
  1046. operate: false,
  1047. formatter: function (value, row, index) {
  1048. var percent = daypercent= '0.0%';
  1049. if (row.follow > 0) {
  1050. percent = (value/row.follow) * 100;
  1051. percent = percent.toFixed(1)+'%';
  1052. }
  1053. if (row.dayut > 0) {
  1054. daypercent = (row.day_order_nums/row.dayut) * 100;
  1055. daypercent = daypercent.toFixed(1)+'%';
  1056. }
  1057. return ''+ value + ' 笔/'+ percent +' <br>('+ row.day_order_nums+ ' 笔/'+daypercent+')';
  1058. }
  1059. },
  1060. {field: 'cost', title: '推广成本', operate: false},
  1061. {
  1062. field: 'money',
  1063. title: '利润',
  1064. operate: false,
  1065. formatter: function (value, row, index) {
  1066. if (row.cost >0) {
  1067. var lirun = value-row.cost;
  1068. var percent = '0.00%';
  1069. if (value > 0) {
  1070. var percent = (value/row.cost) * 100;
  1071. percent = percent.toFixed(2)+'%';
  1072. }
  1073. return lirun.toFixed(2) + "<br>回本率 " + percent;
  1074. }
  1075. return '-';
  1076. }
  1077. },
  1078. {
  1079. field: 'createtime',
  1080. title: '创建时间',
  1081. operate: 'RANGE',
  1082. addclass: 'datetimerange',
  1083. formatter: Table.api.formatter.datetime
  1084. },
  1085. {
  1086. field: 'updatetime',
  1087. title: '更新时间',
  1088. visible: false,
  1089. operate: false,
  1090. addclass: 'datetimerange',
  1091. formatter: Table.api.formatter.datetime
  1092. },
  1093. {
  1094. field: 'state',
  1095. title: '状态',
  1096. searchList: {'0': '禁用', '1': '正常'},
  1097. formatter: function (value, row, index) {
  1098. return value == 1 ? "<span style='color: green;'>正常</span>" : "<span style='color: red;'>禁用</span>";
  1099. }
  1100. },
  1101. {
  1102. field: 'operate',
  1103. title: '操作',
  1104. table: table,
  1105. events: Table.api.events.operate,
  1106. buttons: [
  1107. {
  1108. name: 'disable',
  1109. text: '',
  1110. title: '禁用',
  1111. icon: 'fa fa-ban',
  1112. classname: 'btn btn-xs btn-danger btn-ajax btn-disable',
  1113. confirm: "一旦禁用,用户将无法访问链接,确定禁用?",
  1114. url: $.fn.bootstrapTable.defaults.extend.disable_url,
  1115. success: function (data) {
  1116. table.bootstrapTable('refresh');
  1117. }
  1118. },
  1119. {
  1120. name: 'disable',
  1121. text: '',
  1122. title: '解禁',
  1123. icon: 'fa fa-share',
  1124. classname: 'btn btn-xs btn-success btn-ajax btn-goable',
  1125. confirm: "一旦解除禁用,用户将正常访问链接,确定恢复?",
  1126. url: $.fn.bootstrapTable.defaults.extend.disable_url,
  1127. success: function (data) {
  1128. table.bootstrapTable('refresh');
  1129. }
  1130. },
  1131. ],
  1132. formatter: Table.api.formatter.operate
  1133. },
  1134. {
  1135. field: 'tongji',
  1136. title: __("统计"),
  1137. operate: false,
  1138. formatter: function (value, row, index) {
  1139. var btn = '<a style="float:left;margin-left: 10%" href="/admin/orders/index?ids=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">订单详情</a>&nbsp;';
  1140. btn += '<a style="float:left;margin-left: 10%" href="/admin/referral/referral/daydata?ids=' + row.id + '" class="btn btn-xs btn-success btn-editone book_history">历史数据</a>';
  1141. return btn;
  1142. }
  1143. },
  1144. ]
  1145. ],
  1146. onPostBody: function () {
  1147. //隐藏禁用操作按钮
  1148. $.each(table.bootstrapTable("getData"), function (index, row) {
  1149. if (row.state == "0") {
  1150. //隐藏禁用按钮 显示解禁按钮
  1151. $("a.btn-disable").eq(index).hide();
  1152. } else {
  1153. //隐藏解禁按钮 显示禁用按钮
  1154. $("a.btn-goable").eq(index).hide();
  1155. }
  1156. });
  1157. }
  1158. });
  1159. }
  1160. // 为表格绑定事件
  1161. Table.api.bindevent(table);
  1162. },
  1163. admin_index: function () {
  1164. // 初始化表格参数配置
  1165. Table.api.init({
  1166. extend: {
  1167. admin_index: 'referral/referral/admin_index?push='+Config.push,
  1168. table: 'referral',
  1169. },
  1170. pageSize: 10,
  1171. pageList: [10],
  1172. showColumns: false,
  1173. showToggle: false,
  1174. searchFormVisible: true,
  1175. search: false,
  1176. });
  1177. var table = $("#table");
  1178. // 初始化表格
  1179. table.bootstrapTable({
  1180. url: $.fn.bootstrapTable.defaults.extend.admin_index,
  1181. pk: 'id',
  1182. sortName: 'referral.money',
  1183. sortOrder: 'desc',
  1184. columns: [
  1185. [
  1186. //{checkbox: true},
  1187. //{field: 'id', title: 'ID'},
  1188. {field: 'id', title: '推广ID'},
  1189. {field: 'source_url', title: '推广链接', formatter: Controller.api.source_admin_url, operate: false},
  1190. {field: 'entry_page', title: '入口页面', formatter: Controller.api.entry_page, operate: false},
  1191. {field: 'book_id', title: '书籍ID', visible: false},
  1192. {field: 'book.name', title: '书籍名称', visible: false, operate: 'LIKE %...%'},
  1193. {field: 'chapter_idx', title: '章节序号', visible: false, operate: false},
  1194. {field: 'admin_id', title: __('Admin_id'), visible: false, operate: false},
  1195. {field: 'name', title: __('Name'), operate: 'LIKE %...%'},
  1196. {
  1197. field: 'wx_type',
  1198. title: __('Wx_type'),
  1199. visible: false,
  1200. searchList: {"wx_type 1": __('Wx_type 1'), "wx_type 2": __('Wx_type 2')},
  1201. operate: false
  1202. },
  1203. {field: 'wx_type_text', title: __('Wx_type'), visible: false, operate: false},
  1204. {
  1205. field: 'type',
  1206. title: __('Type'),
  1207. visible: false,
  1208. searchList: {"1": '阅读页推广', "type 2": '首页推广', 'type 3': '落地页推广'},
  1209. operate: false
  1210. },
  1211. {field: 'type_text', title: __('Type'), visible: false, operate: false},
  1212. {
  1213. field: 'uv',
  1214. title: '总阅读人数(今日)',
  1215. operate: false,
  1216. formatter: function (value, row, index) {
  1217. return value + "(" + row.dayuv + ")";
  1218. }
  1219. },
  1220. {
  1221. field: 'follow',
  1222. title: '总关注人数(今日)',
  1223. operate: false,
  1224. formatter: function (value, row, index) {
  1225. var percent = daypercent= '0.0%';
  1226. if (row.uv > 0) {
  1227. percent = (value/row.uv) * 100;
  1228. percent = percent.toFixed(1)+'%';
  1229. }
  1230. if (row.dayuv > 0) {
  1231. daypercent = (row.dayut/row.dayuv) * 100;
  1232. daypercent = daypercent.toFixed(1)+'%';
  1233. }
  1234. if (percent == '0.0%') {
  1235. return value + "(" + row.dayut + ")";
  1236. }
  1237. return str = value + "(" + row.dayut + ")" + "<br> 关注率 "+percent+"("+daypercent+")";
  1238. }
  1239. },
  1240. {
  1241. field: 'net_follow_num',
  1242. title: '总净关注人数(今日)',
  1243. operate: false,
  1244. formatter: function (value, row, index) {
  1245. return value + "(" + row.dayjt + ")";
  1246. }
  1247. },
  1248. {
  1249. field: 'money',
  1250. title: '总充值金额(今日)',
  1251. operate: false,
  1252. formatter: function (value, row, index) {
  1253. return value + "(" + row.daymt + ")";
  1254. }
  1255. },
  1256. {
  1257. field: 'order_nums',
  1258. title: '充值笔数/充值比例(今日)',
  1259. operate: false,
  1260. formatter: function (value, row, index) {
  1261. var percent = daypercent= '0.0%';
  1262. if (row.follow > 0) {
  1263. percent = (value/row.follow) * 100;
  1264. percent = percent.toFixed(1)+'%';
  1265. }
  1266. if (row.dayut > 0) {
  1267. daypercent = (row.day_order_nums/row.dayut) * 100;
  1268. daypercent = daypercent.toFixed(1)+'%';
  1269. }
  1270. return ''+ value + ' 笔/'+ percent +' <br>('+ row.day_order_nums+ ' 笔/'+daypercent+')';
  1271. }
  1272. },
  1273. {field: 'cost', title: '推广成本', operate: false},
  1274. {
  1275. field: 'money',
  1276. title: '利润',
  1277. operate: false,
  1278. formatter: function (value, row, index) {
  1279. if (row.cost >0) {
  1280. var lirun = value-row.cost;
  1281. var percent = '0.00%';
  1282. if (value > 0) {
  1283. var percent = (value/row.cost) * 100;
  1284. percent = percent.toFixed(2)+'%';
  1285. }
  1286. return lirun.toFixed(2) + "<br>回本率 " + percent;
  1287. }
  1288. return '-';
  1289. }
  1290. },
  1291. {
  1292. field: 'createtime',
  1293. title: '创建时间',
  1294. operate: 'RANGE',
  1295. addclass: 'datetimerange',
  1296. formatter: Table.api.formatter.datetime
  1297. },
  1298. {
  1299. field: 'updatetime',
  1300. title: '更新时间',
  1301. visible: false,
  1302. operate: false,
  1303. addclass: 'datetimerange',
  1304. formatter: Table.api.formatter.datetime
  1305. },
  1306. {
  1307. field: 'state',
  1308. title: '状态',
  1309. searchList: {'0': '禁用', '1': '正常'},
  1310. formatter: function (value, row, index) {
  1311. return value == 1 ? "<span style='color: green;'>正常</span>" : "<span style='color: red;'>禁用</span>";
  1312. }
  1313. },
  1314. {
  1315. field: 'tongji',
  1316. title: __("统计"),
  1317. operate: false,
  1318. formatter: function (value, row, index) {
  1319. var btn = '&nbsp;<a href="/admin/orders/index?ids=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">订单详情</a>';
  1320. btn +='&nbsp;<a href="/admin/referral/referral/daydata?ids=' + row.id + '" class="btn btn-xs btn-success btn-editone book_history">历史数据</a>';
  1321. return btn;
  1322. }
  1323. },
  1324. ]
  1325. ]
  1326. });
  1327. // 为表格绑定事件
  1328. Table.api.bindevent(table);
  1329. },
  1330. lookagentreferral: function () {
  1331. // 初始化表格参数配置
  1332. Table.api.init({
  1333. extend: {
  1334. look_url: Config.look_url,
  1335. table: 'referral',
  1336. },
  1337. pageSize: 10,
  1338. pageList: [10],
  1339. showColumns: false,
  1340. showToggle: false,
  1341. searchFormVisible: true,
  1342. search: false,
  1343. });
  1344. var table = $("#table");
  1345. // 初始化表格
  1346. table.bootstrapTable({
  1347. url: $.fn.bootstrapTable.defaults.extend.look_url,
  1348. pk: 'id',
  1349. sortName: 'id',
  1350. columns: [
  1351. [
  1352. //{checkbox: true},
  1353. //{field: 'id', title: 'ID'},
  1354. {field: 'source_url', title: '推广链接', formatter: Controller.api.source_url, operate: false},
  1355. {field: 'entry_page', title: '入口页面', formatter: Controller.api.entry_page, operate: false},
  1356. {field: 'book_id', title: '书籍ID', visible: false},
  1357. {field: 'book.name', title: '书籍名称', visible: false, operate: 'LIKE %...%'},
  1358. {field: 'chapter_idx', title: '章节序号', visible: false, operate: false},
  1359. {
  1360. field: 'admin_id',
  1361. title: '代理商',
  1362. formatter: Controller.api.formatter.agent_text,
  1363. searchList: Controller.api.formatter.agent_select()
  1364. },
  1365. {
  1366. field: 'wx_type',
  1367. title: __('Wx_type'),
  1368. visible: false,
  1369. searchList: {"wx_type 1": __('Wx_type 1'), "wx_type 2": __('Wx_type 2')},
  1370. operate: false
  1371. },
  1372. {field: 'wx_type_text', title: __('Wx_type'), visible: false, operate: false},
  1373. {
  1374. field: 'type',
  1375. title: __('Type'),
  1376. visible: false,
  1377. searchList: {"type 1": '阅读页推广', "type 2": '首页推广', 'type 3': '落地页推广'},
  1378. operate: false
  1379. },
  1380. {field: 'type_text', title: __('Type'), visible: false, operate: false},
  1381. {
  1382. field: 'uv',
  1383. title: '总阅读人数(今日)',
  1384. operate: false,
  1385. formatter: function (value, row, index) {
  1386. return value + "(" + row.dayuv + ")";
  1387. }
  1388. },
  1389. {
  1390. field: 'follow',
  1391. title: '总关注人数(今日)',
  1392. operate: false,
  1393. formatter: function (value, row, index) {
  1394. var percent = daypercent= '0.0%';
  1395. if (row.uv > 0) {
  1396. percent = (value/row.uv) * 100;
  1397. percent = percent.toFixed(1)+'%';
  1398. }
  1399. if (row.dayuv > 0) {
  1400. daypercent = (row.dayut/row.dayuv) * 100;
  1401. daypercent = daypercent.toFixed(1)+'%';
  1402. }
  1403. if (percent == '0.0%') {
  1404. return value + "(" + row.dayut + ")";
  1405. }
  1406. return str = value + "(" + row.dayut + ")" + "<br> 关注率 "+percent+"("+daypercent+")";
  1407. }
  1408. },
  1409. {
  1410. field: 'net_follow_num',
  1411. title: '总净关注人数(今日)',
  1412. operate: false,
  1413. formatter: function (value, row, index) {
  1414. return value + "(" + row.dayjt + ")";
  1415. }
  1416. },
  1417. // {
  1418. // field: 'guide_follow_num',
  1419. // title: '承接功能关注人数(今日)',
  1420. // operate: false,
  1421. // formatter: function (value, row, index) {
  1422. // return value + "(" + row.daydt + ")";
  1423. // }
  1424. // },
  1425. {
  1426. field: 'money',
  1427. title: '总充值金额(今日)',
  1428. operate: false,
  1429. formatter: function (value, row, index) {
  1430. return value + "(" + row.daymt + ")";
  1431. }
  1432. },
  1433. {
  1434. field: 'order_nums',
  1435. title: '充值笔数/充值比例(今日)',
  1436. operate: false,
  1437. formatter: function (value, row, index) {
  1438. var percent = daypercent= '0.0%';
  1439. if (row.follow > 0) {
  1440. percent = (value/row.follow) * 100;
  1441. percent = percent.toFixed(1)+'%';
  1442. }
  1443. if (row.dayut > 0) {
  1444. daypercent = (row.day_order_nums/row.dayut) * 100;
  1445. daypercent = daypercent.toFixed(1)+'%';
  1446. }
  1447. return ''+ value + ' 笔/'+ percent +' <br>('+ row.day_order_nums+ ' 笔/'+daypercent+')';
  1448. }
  1449. },
  1450. {field: 'cost', title: '推广成本', operate: false},
  1451. {
  1452. field: 'money',
  1453. title: '利润',
  1454. operate: false,
  1455. formatter: function (value, row, index) {
  1456. if (row.cost >0) {
  1457. var lirun = value-row.cost;
  1458. var percent = '0.00%';
  1459. if (value > 0) {
  1460. var percent = (value/row.cost) * 100;
  1461. percent = percent.toFixed(2)+'%';
  1462. }
  1463. return lirun.toFixed(2) + "<br>回本率 " + percent;
  1464. }
  1465. return '-';
  1466. }
  1467. },
  1468. {
  1469. field: 'createtime',
  1470. title: '创建时间',
  1471. operate: 'RANGE',
  1472. addclass: 'datetimerange',
  1473. formatter: Table.api.formatter.datetime
  1474. },
  1475. {
  1476. field: 'updatetime',
  1477. title: '更新时间',
  1478. visible: false,
  1479. operate: false,
  1480. addclass: 'datetimerange',
  1481. formatter: Table.api.formatter.datetime
  1482. },
  1483. {
  1484. field: 'operate',
  1485. title: '操作',
  1486. table: table,
  1487. events: Table.api.events.operate,
  1488. formatter: Table.api.formatter.operate
  1489. },
  1490. {
  1491. field: 'tongji',
  1492. title: __("统计"),
  1493. operate: false,
  1494. formatter: function (value, row, index) {
  1495. var btn = '<a style="float:left;margin-left: 10%" href="/admin/orders/index?ids=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">订单详情</a>&nbsp;';
  1496. btn += '<a style="float:left;margin-left: 10%" href="/admin/referral/referral/daydata?ids=' + row.id + '" class="btn btn-xs btn-success btn-editone book_history">查看历史</a>';
  1497. return btn;
  1498. }
  1499. },
  1500. ]
  1501. ],
  1502. });
  1503. // 为表格绑定事件
  1504. Table.api.bindevent(table);
  1505. },
  1506. daydata: function () {
  1507. // 初始化表格参数配置
  1508. Table.api.init({
  1509. extend: {
  1510. index_url: "referral/referral/daydata?ids="+Config.referral_id,
  1511. table: 'referral_day_collect',
  1512. },
  1513. pageSize: 10,
  1514. pageList: [10],
  1515. showColumns: false,
  1516. showToggle: false,
  1517. searchFormVisible: false,
  1518. search: false,
  1519. commonSearch: false,
  1520. pageSize: 100,
  1521. pageList: [100, 200, 'All']
  1522. });
  1523. var table = $("#table");
  1524. // 初始化表格
  1525. table.bootstrapTable({
  1526. url: $.fn.bootstrapTable.defaults.extend.index_url,
  1527. pk: 'id',
  1528. sortName: 'id',
  1529. columns: [
  1530. [
  1531. //{checkbox: true},
  1532. //{field: 'id', title: 'ID'},
  1533. {field: 'referral_id', title: '推广链接ID'},
  1534. {field: 'createdate', title: '日期'},
  1535. {field: 'uv', title: '阅读人数'},
  1536. {field: 'follow', title: '关注人数'},
  1537. {field: 'recharge_money', title: '充值金额'},
  1538. {field: 'orders_num', title: '充值笔数'},
  1539. {
  1540. field: 'all_recharge_money',
  1541. title: '回本率',
  1542. operate: false,
  1543. formatter: function (value, row, index) {
  1544. if (row.cost > 0) {
  1545. var percent = (value/row.cost) * 100;
  1546. percent = percent.toFixed(2)+'%';
  1547. return percent;
  1548. }
  1549. return '-';
  1550. }
  1551. }
  1552. ]
  1553. ],
  1554. });
  1555. // 为表格绑定事件
  1556. Table.api.bindevent(table);
  1557. },
  1558. add: function () {
  1559. Form.api.bindevent($("form[role=form]"), function (data) {
  1560. Toastr.success('添加成功');
  1561. if (data.closeTip == 1) {
  1562. //延时关闭
  1563. setTimeout(function () {
  1564. Fast.api.close();
  1565. }, 2000);
  1566. return false;
  1567. }
  1568. $('.url_txt').eq(0).text(data.jmp_url);
  1569. $('.url_txt').eq(1).text(data.short_url_weibo);
  1570. $('.url_txt').eq(2).text(data.short_url_qq);
  1571. $('.copy').eq(0).attr('data-clipboard-text', data.jmp_url);
  1572. $('.copy').eq(1).attr('data-clipboard-text', data.short_url_weibo);
  1573. $('.copy').eq(2).attr('data-clipboard-text', data.short_url_qq);
  1574. $('#erweima').html("");
  1575. $('#erweima').qrcode(data.jmp_url);
  1576. $('#erweima').html('<img style="display: block;margin: 0;padding: 0;border: 0;height: 160px;width: 160px;" src="' + $('#erweima canvas')[0].toDataURL("image/png") + '" />');
  1577. $('#add-form').hide();
  1578. $('#add-dialog').show();
  1579. return false;
  1580. });
  1581. $(document).on('click', '.btn-close', function () {
  1582. Fast.api.close();
  1583. });
  1584. $(document).on("click", '#fachoose-guide_title', function () {
  1585. Fast.api.open("/admin/manage/title/select", "落地页标题", {
  1586. callback: function (data) {
  1587. console.info(data);
  1588. if (data.sex == "1" || data.sex == "2") {
  1589. $("#c-guide_title").val(data.title);
  1590. } else {
  1591. Toastr.error("请选择男频或女频标题");
  1592. }
  1593. }
  1594. });
  1595. return false;
  1596. });
  1597. },
  1598. edit: function () {
  1599. Controller.api.bindevent();
  1600. },
  1601. select: function () {
  1602. // 初始化表格参数配置
  1603. Table.api.init({
  1604. extend: {
  1605. index_url: 'referral/referral/select',
  1606. },
  1607. pageSize: 10,
  1608. pageList: [10],
  1609. showColumns: false,
  1610. showToggle: false,
  1611. showExport: false,
  1612. searchFormVisible: false,
  1613. search: false,
  1614. });
  1615. var table = $("#table");
  1616. // 初始化表格
  1617. table.bootstrapTable({
  1618. url: $.fn.bootstrapTable.defaults.extend.index_url,
  1619. pk: 'id',
  1620. sortName: 'state desc,id desc',
  1621. sortOrder: '',
  1622. columns: [
  1623. [
  1624. {checkbox: true},
  1625. // {field: 'id', title: __('Id')},
  1626. {field: 'source_url', title: '推广链接', formatter: Controller.api.source_url, operate: false},
  1627. {field: 'entry_page', title: '入口页面', formatter: Controller.api.entry_page, operate: false},
  1628. {field: 'push', title: '内推外派', formatter:function(val,row){if(parseInt(val) == 0){return "外派";}else{return "内推";}},searchList: {"0":"外派", "1": "内推"} },
  1629. {field: 'book_id', title: __('Book_id'), visible: false},
  1630. {field: 'book.name', title: '书籍名称', visible: false, operate: 'LIKE %...%'},
  1631. {field: 'chapter_idx', title: __('Chapter_idx'), visible: false, operate: false},
  1632. {field: 'admin_id', title: __('Admin_id'), visible: false, operate: false},
  1633. {field: 'name', title: __('Name'), operate: 'LIKE %...%'},
  1634. {
  1635. field: 'wx_type',
  1636. title: __('Wx_type'),
  1637. visible: false,
  1638. searchList: {"wx_type 1": __('Wx_type 1'), "wx_type 2": __('Wx_type 2')},
  1639. operate: false
  1640. },
  1641. {field: 'wx_type_text', title: __('Wx_type'), visible: false, operate: false},
  1642. {
  1643. field: 'type',
  1644. title: __('Type'),
  1645. visible: false,
  1646. searchList: {"type 1": '阅读页推广', "type 2": '首页推广', 'type 3': '落地页推广'},
  1647. operate: false
  1648. },
  1649. {field: 'type_text', title: __('Type'), visible: false, operate: false},
  1650. {
  1651. field: 'createtime',
  1652. title: __('Createtime'),
  1653. operate: 'RANGE',
  1654. addclass: 'datetimerange',
  1655. formatter: Table.api.formatter.datetime
  1656. },
  1657. {
  1658. field: 'updatetime',
  1659. title: __('Updatetime'),
  1660. visible: false,
  1661. operate: false,
  1662. addclass: 'datetimerange',
  1663. formatter: Table.api.formatter.datetime
  1664. },
  1665. {
  1666. field: 'operate', title: __('Operate'), events: {
  1667. 'click .btn-chooseone': function (e, value, row, index) {
  1668. Fast.api.close([row]);
  1669. },
  1670. }, formatter: function () {
  1671. return '<a href="javascript:;" class="btn btn-danger btn-chooseone btn-xs"><i class="fa fa-check"></i> ' + __('Choose') + '</a>';
  1672. }
  1673. }
  1674. ]
  1675. ]
  1676. });
  1677. // 为表格绑定事件
  1678. Table.api.bindevent(table);
  1679. //获取选中数据
  1680. $(document).on('click', "#btn-chooseone", function () {
  1681. Fast.api.close(table.bootstrapTable('getSelections'));
  1682. });
  1683. },
  1684. api: {
  1685. formatter: {
  1686. agent_text: function (value, row, index) {
  1687. var name = '';
  1688. $.each(Config.adminExtend, function (key, val) {
  1689. if (row.admin_id == val.admin_id) {
  1690. name = val.nickname;
  1691. return;
  1692. }
  1693. });
  1694. return name;
  1695. },
  1696. agent_select: function () {
  1697. var data = {};
  1698. $.each(Config.adminExtend, function (key, val) {
  1699. data[val.admin_id] = val.nickname;
  1700. });
  1701. return data;
  1702. },
  1703. },
  1704. bindevent: function () {
  1705. Form.api.bindevent($("form[role=form]"));
  1706. },
  1707. source_url2: function (value, row, index) {
  1708. var format_time = function(ns){
  1709. return new Date(parseInt(ns) * 1000).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ");
  1710. };
  1711. var html = [];
  1712. if(Config.open_wechat_share == 1){
  1713. value = row.skin_url;
  1714. } else{
  1715. if(Config.url_referral){
  1716. value = Config.url_referral + '/t/' + row.id;
  1717. }else{
  1718. value = row.url_referral;
  1719. }
  1720. }
  1721. var push_name = row.push == 1 ? '内推' : '外派';
  1722. html.push('<div style="margin-top:10px;font-size:18px;color:#000;text-align: left;">'+row.name+'('+push_name+')</div>');
  1723. html.push('<div class="url_text">' + value + '&nbsp;<br/><a href="javascript:;" style="margin:5px 0;background-color:#169bd5;" class="btn btn-success btn-xs copy" data-clipboard-text="'+value+'">复制链接</a>&nbsp;&nbsp;<a href="javascript:;" style="margin:5px 0;background-color:#169bd5;" class="btn btn-success btn-xs qrcode" data-qrcode="'+value+'">获取二维码</a><a href="javascript:;" style="margin:5px;background-color:#169bd5;" data-url-weibo="' + row.short_url_weibo + '" data-url-qq="' + row.short_url_qq +'" class="btn btn-success btn-xs short_link_butt">获取短链</a>');
  1724. html.push('<div style="margin-bottom:10px;text-align: left;">创建时间:'+UnixToDate(row.createtime,true,8) + '</div>');
  1725. html.push('</div>');
  1726. return html.join('<br>');
  1727. },
  1728. source_admin_url: function (value, row, index) {
  1729. var html = [];
  1730. if(parseInt(row.is_collect) == 0){
  1731. html.push((row.wx_type == 1 ? '<b>认证公众号</b></i>' : '<b>未认证公众号</b></i>'));
  1732. }else{
  1733. html.push((row.wx_type == 1 ? '<b>认证公众号</b><i class="btn-collect fa fa-star" rid="'+row.id+'" style="cursor:pointer;float:right;font-size:20px;color:gold;"></i>' : '<b>未认证公众号</b><i class="btn-collect fa fa-star" rid="'+row.id+'" style="cursor:pointer;float:right;font-size:20px;color:gold;"></i>'));
  1734. }
  1735. if (row.short_id > 0) {
  1736. value = row.short_url;
  1737. } else {
  1738. if (Config.url_referral) {
  1739. value = Config.url_referral + '/t/' + row.id;
  1740. } else {
  1741. value = row.url_referral;
  1742. }
  1743. }
  1744. if (row.limited == 1) {
  1745. html.push('<div class="link_txt">公众号阅读原文必选</div><div class="url_text">' + value);
  1746. 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>');
  1747. } else {
  1748. if (row.state == "1") {
  1749. html.push('<div class="link_txt">公众号阅读原文必选</div><div class="url_text">' + value + '&nbsp;<i class="fa fa-copy copy" data-clipboard-text="' + value + '"></i>&nbsp;&nbsp;<i class="fa fa-qrcode qrcode" data-qrcode="' + value + '"></i>');
  1750. html.push('<a href="javascript:;" class="short_link_but">点击显示短链</a><div class="short_link"><strong>腾讯短链:</strong>&nbsp;' + row.short_url_qq + '&nbsp;<i class="fa fa-copy copy" data-clipboard-text="' + row.short_url_qq + '"></i>&nbsp;&nbsp;<i class="fa fa-qrcode qrcode" data-qrcode="' + row.short_url_qq + '"></i>');
  1751. html.push('<strong>微博短链:</strong>&nbsp;' + row.short_url_weibo + '&nbsp;<i class="fa fa-copy copy" data-clipboard-text="' + row.short_url_weibo + '"></i>&nbsp;&nbsp;<i class="fa fa-qrcode qrcode" data-qrcode="' + row.short_url_weibo + '"></i></div></div>');
  1752. } else {
  1753. html.push('<div class="link_txt">当前链接已失效,请禁止使用</div><div class="url_text">' + value + '</div>');
  1754. }
  1755. }
  1756. return html.join('<br>');
  1757. },
  1758. source_url: function (value, row, index) {
  1759. var html = [];
  1760. if(parseInt(row.is_collect) == 0){
  1761. html.push((row.wx_type == 1 ? '<b>认证公众号</b><i class="btn-collect fa fa-star-o" rid="'+row.id+'" style="cursor:pointer;float:right;font-size:20px;color:gold;"></i>' : '<b>未认证公众号</b><i class="btn-collect fa fa-star-o" rid="'+row.id+'" style="cursor:pointer;float:right;font-size:20px;color:gold;"></i>'));
  1762. }else{
  1763. html.push((row.wx_type == 1 ? '<b>认证公众号</b><i class="btn-collect fa fa-star" rid="'+row.id+'" style="cursor:pointer;float:right;font-size:20px;color:gold;"></i>' : '<b>未认证公众号</b><i class="btn-collect fa fa-star" rid="'+row.id+'" style="cursor:pointer;float:right;font-size:20px;color:gold;"></i>'));
  1764. }
  1765. if (row.short_id > 0) {
  1766. value = row.short_url;
  1767. } else {
  1768. if (Config.url_referral) {
  1769. value = Config.url_referral + '/t/' + row.id;
  1770. } else {
  1771. value = row.url_referral;
  1772. }
  1773. }
  1774. if (row.limited == 1) {
  1775. html.push('<div class="link_txt">公众号阅读原文必选</div><div class="url_text">' + value);
  1776. 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>');
  1777. } else {
  1778. if (row.state == "1") {
  1779. html.push('<div class="link_txt">公众号阅读原文必选</div><div class="url_text">' + value + '&nbsp;<i class="fa fa-copy copy" data-clipboard-text="' + value + '"></i>&nbsp;&nbsp;<i class="fa fa-qrcode qrcode" data-qrcode="' + value + '"></i>');
  1780. html.push('<a href="javascript:;" class="short_link_but">点击显示短链</a><div class="short_link"><strong>腾讯短链:</strong>&nbsp;' + row.short_url_qq + '&nbsp;<i class="fa fa-copy copy" data-clipboard-text="' + row.short_url_qq + '"></i>&nbsp;&nbsp;<i class="fa fa-qrcode qrcode" data-qrcode="' + row.short_url_qq + '"></i>');
  1781. html.push('<strong>微博短链:</strong>&nbsp;' + row.short_url_weibo + '&nbsp;<i class="fa fa-copy copy" data-clipboard-text="' + row.short_url_weibo + '"></i>&nbsp;&nbsp;<i class="fa fa-qrcode qrcode" data-qrcode="' + row.short_url_weibo + '"></i></div></div>');
  1782. } else {
  1783. html.push('<div class="link_txt">当前链接已失效,请禁止使用</div><div class="url_text">' + value + '</div>');
  1784. }
  1785. }
  1786. return html.join('<br>');
  1787. },
  1788. entry_page: function (value, row, index) {
  1789. var html = [];
  1790. if (row.type == 1) {
  1791. if (row.book.id == undefined) {
  1792. html.push(row.book.name);
  1793. }else{
  1794. html.push('<a href="/admin/referral/book/info?id=' + row.book_id + '">' + row.book.name + '</a>');
  1795. }
  1796. html.push(row.chapter_name);
  1797. if (row.guide_chapter_idx) {
  1798. html.push('关注章节:' + row.guide_chapter_idx);
  1799. } else {
  1800. html.push('关注章节:默认');
  1801. }
  1802. } else if (row.type == 3) {
  1803. html.push('落地页推广');
  1804. if (row.book.id == undefined) {
  1805. html.push(row.book.name);
  1806. }else{
  1807. html.push('<a href="/admin/referral/book/info?id=' + row.book_id + '">' + row.book.name + '</a>');
  1808. }
  1809. html.push(row.chapter_name);
  1810. if (row.guide_chapter_idx) {
  1811. html.push('关注章节:' + row.guide_chapter_idx);
  1812. } else {
  1813. html.push('关注章节:默认');
  1814. }
  1815. } else {
  1816. html.push('书城首页推广');
  1817. }
  1818. return html.join('<br>');
  1819. }
  1820. }
  1821. };
  1822. }
  1823. return Controller;
  1824. });