link.html 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. <style>
  2. .link-box{font-size:12px}
  3. .link-box .link-center{display:flex;height:480px}
  4. .link-box .link-left{overflow-y:auto;width:138px;height:100%;border-right:1px solid #f2f2f2}
  5. .link-box .link-left dt{position:relative;padding-left:15px;height:32px;line-height:32px;color:#333;cursor:pointer;transition:all .3s}
  6. .link-box .link-left dt.triangle:after{content:'';position:absolute;left:0;top:51%;transform:translateY(-50%);border:4px solid transparent;border-right-color:#333;border-bottom-color:#333;cursor:pointer}
  7. .link-box .link-left dt.active:after{transform:translateY(-50%) rotate(-45deg)}
  8. .link-box .link-left dd{margin-right:25px;padding-left:25px;height:32px;line-height:32px;color:#666;cursor:pointer}
  9. .link-box .link-left dd:hover{background-color:#f2f2f2}
  10. .link-box .link-right{overflow-y:auto;height:100%;flex:1;padding-left:20px}
  11. .link-box .link-right dl{overflow:hidden}
  12. .link-box .link-right dt{height:40px;line-height:40px}
  13. .link-box .link-right dd{float:left;margin:5px 5px 5px 0;padding:0 16px;border:1px solid #ededed;border-radius:3px;line-height:30px;color:#666;cursor:pointer}
  14. .link-box .link-right .layui-table-body{height:350px}
  15. .link-btn{margin-top:20px;padding-right:10px;height:45px;line-height:45px;text-align:right;border-top:1px solid #f2f2f2}
  16. .link-box .custom-link{width:420px;margin:50px}
  17. .link-box .ns-word-aux{width:250px}
  18. .link-box .other-applet{width:450px;margin:50px}
  19. .link-box .layui-form-label{width: 150px;padding: 0 10px 0 0;line-height: 34px;height: 34px;}
  20. .link-box .layui-table td, .layui-table th {position: relative;}
  21. .ns-title-pic img {
  22. width: 50px;
  23. height: 50px;
  24. }
  25. .ns-table-title {
  26. display: flex;
  27. align-items: center;
  28. }
  29. .ns-table-title .ns-title-pic {
  30. flex-shrink: 0;
  31. display: inline-block;
  32. width: 50px;
  33. height: 50px;
  34. text-align: center;
  35. line-height: 50px;
  36. margin-left: 5px;
  37. }
  38. .ns-table-title .ns-title-content {
  39. overflow: hidden;
  40. margin-left: 10px;
  41. flex: 1;
  42. line-height: 1.8;
  43. }
  44. .ns-multi-line-hiding {
  45. overflow: hidden;
  46. text-overflow: ellipsis;
  47. display: -webkit-box;
  48. -webkit-line-clamp: 2;
  49. line-clamp: 2;
  50. -webkit-box-orient: vertical;
  51. white-space: normal;
  52. word-break: break-all;
  53. line-height: 22px !important;
  54. max-height: 42px !important;
  55. }
  56. .link-right .layui-table-view .layui-table[lay-size=lg] .layui-table-cell {
  57. height: 50px;
  58. line-height: 50px;
  59. }
  60. </style>
  61. <div class="link-box">
  62. <div class="link-center">
  63. <div class="link-left">
  64. <foreach name="list" item="item">
  65. <dl>
  66. <!-- style="<?php if($item['name']=='COMMODITY'){ echo 'display:none;'; } ?>" -->
  67. <dt data-ident="{$item.name}" <notempty name='item.child_list'>class="triangle"</notempty>>{$item.title}</dt>
  68. <foreach name="item.child_list" item="child_item" key="child_key">
  69. <dd data-ident="{$child_item.name}" class="<?php if(!empty($link)&&isset($link['parents'])&&$child_item.name==$link['parents']){ ?>ns-text-color<?php } ?>">{$child_item.title}</dd>
  70. </foreach>
  71. </dl>
  72. </foreach>
  73. </div>
  74. <div class="link-right"></div>
  75. </div>
  76. <div class="link-btn">
  77. <button class="layui-btn link-eliminate layui-btn-primary">清空</button>
  78. <button class="layui-btn link-save ns-bg-color">确定</button>
  79. </div>
  80. </div>
  81. <script>
  82. var promotion,wap_url,goodsIdent,
  83. initMeun = $(".link-box .link-left dd:eq(0)").attr("data-ident"),
  84. customIdent = false, //自定义链接
  85. appletIdent = false, //外部小程序链接
  86. webviewIdent = false, //外部链接
  87. getLineData = {
  88. link : '{:html_entity_decode($link)}',
  89. support_diy_view : '',
  90. };
  91. var preoldlink = JSON.parse(getLineData.link);
  92. if(!preoldlink.parents){
  93. preoldlink = {};
  94. preoldlink.parents = initMeun;
  95. }
  96. initRequest();
  97. function initRequest(){
  98. if(preoldlink.parents == 'CUSTOM_LINK'){
  99. $(".link-left dl").eq(2).find('dt').addClass("ns-text-color");
  100. customLinkHtml();
  101. $(".link-box input[name='title']").val(preoldlink.title);
  102. $(".link-box input[name='wap_url']").val(preoldlink.wap_url);
  103. customIdent = true;
  104. return;
  105. }
  106. if(preoldlink.parents == 'OTHER_APPLET'){
  107. $(".link-left dl").eq(3).find('dt').addClass("ns-text-color");
  108. otherAppletHtml();
  109. $(".link-box input[name='appid']").val(preoldlink.appid);
  110. $(".link-box input[name='page']").val(preoldlink.page);
  111. appletIdent = true;
  112. return;
  113. }
  114. if(preoldlink.parents == 'WEBVIEW'){
  115. $(".link-left dl").eq(4).find('dt').addClass("ns-text-color");
  116. webviewHtml();
  117. $(".link-box input[name='wapurl']").val(preoldlink.wap_url);
  118. webviewIdent = true;
  119. return;
  120. }
  121. $categoryList = eval(<?php echo json_encode($list); ?>);
  122. var categoryList=$categoryList;
  123. for(var i=0;i<categoryList.length;i++){
  124. var arr=categoryList[i].child_list;
  125. for(var j=0;j<arr.length;j++){
  126. if(arr[j].name == preoldlink.parents){
  127. let documentPage= $(".link-left dl dt");
  128. for(let z=0;z<documentPage.length;z++){
  129. documentPage.eq(z).addClass("active");
  130. $(documentPage.eq(z)).parent("dl").find("dd").addClass("layui-hide");
  131. }
  132. documentPage.eq(i).removeClass("active");
  133. $(documentPage.eq(i)).parent("dl").find("dd").removeClass("layui-hide");
  134. $(documentPage.eq(i)).parent("dl").find("dd").eq(j).addClass("ns-text-color");
  135. let title = $(documentPage.eq(i)).parent("dl").find("dd").eq(j).attr("data-ident");
  136. getLinkInfo(title);
  137. }
  138. }
  139. }
  140. }
  141. function getLinkInfo(name){
  142. getLineData.name = name;
  143. var lurl = "{:U('Shopdiy/childLink')}";
  144. if(name=='MALL_LINK') lurl = "{:U('Util/diygeturl')}";
  145. $.ajax({
  146. url : lurl,
  147. data: getLineData,
  148. dataType: 'json',
  149. type: 'post',
  150. success : function(data) {
  151. var list = data.list;
  152. var data_link = data.link;
  153. var html = '';
  154. if (list.length > 0){
  155. for (var i = 0; i < list.length; i++){
  156. html += `<dl>`;
  157. html += `<dt>${list[i].title}</dt>`;
  158. if (list[i].child_list != undefined) {
  159. for (var j = 0; j < list[i].child_list.length; j++){
  160. if (list[i].child_list[j].name == preoldlink.name || list[i].child_list[j].name == data_link.name)
  161. html += `<dd data-value='${JSON.stringify(list[i].child_list[j])}' class="ns-border-color" data-old-value='${JSON.stringify(data_link)}'>${list[i].child_list[j].title}</dd>`;
  162. else
  163. html += `<dd data-value='${JSON.stringify(list[i].child_list[j])}'>${list[i].child_list[j].title}</dd>`;
  164. }
  165. }
  166. html += `</dl>`
  167. }
  168. }else{
  169. if (name.indexOf('_GOODS') != -1) {
  170. html += `<table id="goods_list" lay-filter="goods_list"></table>`;
  171. } else if (name.indexOf('_GAME') != -1) {
  172. html += `<table id="game_list" lay-filter="game_list"></table>`;
  173. } else if(name.indexOf('_CATEGORY') != -1){
  174. html += `<div id="category_list" lay-filter="category_list"></div>`;
  175. }
  176. }
  177. $(".link-right").html(html);
  178. if (!list.length){
  179. if (name.indexOf('_GOODS') != -1) {
  180. getGoodsInfo(name);
  181. } else if(name.indexOf('_CATEGORY') != -1){
  182. getCategory(name);
  183. }
  184. }
  185. }
  186. });
  187. }
  188. function getGoodsInfo(name){
  189. var goodsCols,table;
  190. if (name == 'ALL_GOODS'){
  191. promotion = 'normal';
  192. wap_url = '/lionfish_comshop/pages/goods/goodsDetail?id=';
  193. goodsCols = [
  194. [
  195. {
  196. unresize: 'false',
  197. width: '8%',
  198. templet: '#checkbox'
  199. },
  200. {
  201. title: '商品',
  202. unresize: 'false',
  203. width: '62%',
  204. templet: '#goods_info'
  205. },
  206. {
  207. field: 'productprice',
  208. title: '价格',
  209. unresize: 'false',
  210. width: '15%'
  211. },
  212. {
  213. field: 'total',
  214. title: '库存',
  215. unresize: 'false',
  216. width: '15%'
  217. }
  218. ]
  219. ];
  220. }else if(name == "PINTUAN_GOODS"){
  221. promotion = 'pintuan';
  222. wap_url = '/lionfish_comshop/moduleA/pin/goodsDetail?id=';
  223. goodsCols = [
  224. [{
  225. unresize: 'false',
  226. width: '8%',
  227. templet: '#checkbox'
  228. },{
  229. title: '拼团商品',
  230. unresize: 'false',
  231. width: '62%',
  232. templet: function (data) {
  233. var html = '';
  234. html += `<div class="ns-table-title">`;
  235. html += `<div class="ns-title-pic" id="goods_img_{{data.id}}">`;
  236. html += `<img layer-src src="{{data.sku_image.split(',')[0]}}"/>`;
  237. html += `</div>`;
  238. html += `<div class="ns-title-content">`;
  239. html += `<a href="javascript:;" class="ns-multi-line-hiding ns-text-color" title="${data.sku_name}">${data.sku_name}</a>`;
  240. html += `</div>`;
  241. html += `</div>`;
  242. return html;
  243. }
  244. },{
  245. field: 'pintuan_price',
  246. title: '价格',
  247. unresize: 'false',
  248. width: '15%'
  249. },{
  250. field: 'goods_stock',
  251. title: '库存',
  252. unresize: 'false',
  253. width: '15%'
  254. }]
  255. ];
  256. }else if(name == "PRESALE_GOODS"){
  257. promotion = 'presale';
  258. wap_url = '/lionfish_comshop/pages/goods/goodsDetail?type=presale&id=';
  259. goodsCols = [
  260. [{
  261. unresize: 'false',
  262. width: '8%',
  263. templet: '#checkbox'
  264. },{
  265. title: '预售商品',
  266. unresize: 'false',
  267. width: '62%',
  268. templet: '#goods_info'
  269. },{
  270. field: 'price',
  271. title: '价格',
  272. unresize: 'false',
  273. width: '15%'
  274. },
  275. {
  276. field: 'goods_stock',
  277. title: '库存',
  278. unresize: 'false',
  279. width: '15%'
  280. }]
  281. ]
  282. }
  283. goodsIdent = name;
  284. initMeun = name;
  285. table = new Table({
  286. elem: '#goods_list',
  287. url: '{:U("Shopdiy/goodsselect")}',
  288. where: {promotion},
  289. cols: goodsCols
  290. });
  291. }
  292. function getCategory(name){
  293. var addon_url = '';
  294. wap_url = '/lionfish_comshop/pages/type/index?id=';
  295. initMeun = name;
  296. layui.use(['laytpl', 'form'], function(){
  297. var laytpl = layui.laytpl;
  298. var form = layui.form;
  299. laytpl($("#category_html").html()).render([], function(html) {
  300. $("#category_list").html(html);
  301. //展开收齐点击事件
  302. $(".js-switch").click(function () {
  303. var category_id = $(this).attr("data-category-id");
  304. console.log('category_id', category_id);
  305. var level = $(this).attr("data-level");
  306. var open = parseInt($(this).attr("data-open").toString());
  307. if(open){
  308. $(".goods-category-list .layui-table tr[data-category-id-"+ level+"='" + category_id + "']").hide();
  309. $(this).text("+");
  310. }else{
  311. $(".goods-category-list .layui-table tr[data-category-id-"+ level+"='" + category_id + "']").show();
  312. $(this).text("-");
  313. }
  314. $(this).attr("data-open", (open ? 0 : 1));
  315. });
  316. console.log($("input[name='category_select_id']:checked").length);
  317. if ($("input[name='category_select_id']:checked").length > 0){
  318. var category_id_1 = $("input[name='category_select_id']:checked").parents('.category-line').attr('data-category-id-1');
  319. var category_id_2 = $("input[name='category_select_id']:checked").parents('.category-line').attr('data-category-id-2');
  320. console.log(category_id_1,category_id_2);
  321. if(category_id_1 > 0){
  322. $('tr[data-category-id-1='+category_id_1+']').show();
  323. }
  324. if(category_id_2 > 0){
  325. $('tr[data-category-id-2='+category_id_2+']').show();
  326. }
  327. }
  328. // 勾选分类
  329. form.on('checkbox(category_select_id)', function(data) {
  330. if (data.elem.checked){
  331. $("input[name='category_select_id']:checked").prop("checked",false);
  332. $(data.elem).prop("checked",true);
  333. form.render();
  334. }
  335. });
  336. form.render();
  337. });
  338. });
  339. }
  340. //自定义链接
  341. $("dt[data-ident='CUSTOM_LINK']").click(function(){
  342. customLinkHtml();
  343. customIdent = true;
  344. appletIdent = false;
  345. webviewIdent = false;
  346. if (preoldlink.name == 'CUSTOM_LINK') {
  347. $(".link-box input[name='title']").val(preoldlink.title);
  348. $(".link-box input[name='wap_url']").val(preoldlink.wap_url);
  349. }
  350. });
  351. function customLinkHtml(){
  352. var html = '';
  353. html += '<div class="layui-form custom-link">';
  354. html += '<div class="layui-form-item">';
  355. html += '<label class="layui-form-label sm"><span class="required">*</span>链接名称</label>';
  356. html += '<div class="layui-input-inline">';
  357. html += '<input type="text" name="title" class="layui-input ns-len-mid" required>';
  358. html += '</div>';
  359. html += '</div>';
  360. html += '<div class="layui-form-item">';
  361. html += '<label class="layui-form-label sm"><span class="required">*</span>跳转路径</label>';
  362. html += '<div class="layui-input-block">';
  363. html += '<input type="text" name="wap_url" class="layui-input ns-len-mid">';
  364. html += '</div>';
  365. html += '<div class="ns-word-aux mid">路径必须以“/”开头,例:“/lionfish_comshop/pages/index/index”</div>';
  366. html += '</div>';
  367. html += '</div>';
  368. $(".link-right").html(html);
  369. }
  370. // 跳转小程序
  371. $("dt[data-ident='OTHER_APPLET']").click(function(){
  372. otherAppletHtml();
  373. customIdent = false;
  374. webviewIdent = false;
  375. appletIdent = true;
  376. if (preoldlink.name == 'OTHER_APPLET') {
  377. $(".link-box input[name='appid']").val(preoldlink.appid);
  378. $(".link-box input[name='page']").val(preoldlink.page);
  379. }
  380. });
  381. function otherAppletHtml(){
  382. var html = '';
  383. html += '<div class="layui-form other-applet">';
  384. html += '<div class="layui-form-item">';
  385. html += '<label class="layui-form-label mid"><span class="required">*</span>小程序AppID</label>';
  386. html += '<div class="layui-input-inline">';
  387. html += '<input type="text" name="appid" class="layui-input ns-len-mid" required placeholder="请输入要打开的小程序的appid">';
  388. html += '</div>';
  389. html += '</div>';
  390. html += '<div class="layui-form-item">';
  391. html += '<label class="layui-form-label mid">小程序路径</label>';
  392. html += '<div class="layui-input-block" style="margin-left: 150px;">';
  393. html += '<input type="text" name="page" class="layui-input ns-len-mid" placeholder="请输入要打开的小程序路径">';
  394. html += '</div>';
  395. html += '<div class="ns-word-aux mid" style="width: auto">仅支持小程序之间的跳转,不支持从其他渠道跳转小程序</div>';
  396. html += '<div class="ns-word-aux mid" style="width: auto">小程序路径如果为空则跳转到小程序首页</div>';
  397. html += '<div class="ns-word-aux mid" style="width: auto">小程序路径格式如:page/index/index/index</div>';
  398. html += '</div>';
  399. html += '</div>';
  400. $(".link-right").html(html);
  401. }
  402. // 跳转外部链接
  403. $("dt[data-ident='WEBVIEW']").click(function(){
  404. webviewHtml();
  405. customIdent = false;
  406. appletIdent = false;
  407. webviewIdent = true;
  408. if (preoldlink.name == 'WEBVIEW') {
  409. $(".link-box input[name='wapurl']").val(preoldlink.wapurl);
  410. }
  411. });
  412. function webviewHtml(){
  413. var html = '';
  414. html += '<div class="layui-form webview">';
  415. html += '<div class="layui-form-item">';
  416. html += '<label class="layui-form-label mid"><span class="required">*</span>外部链接</label>';
  417. html += '<div class="layui-input-block" style="margin-left: 150px;">';
  418. html += '<input type="text" name="wapurl" class="layui-input ns-len-mid" required placeholder="请输入要打开的外部链接">';
  419. html += '</div>';
  420. html += '<div class="ns-word-aux mid" style="width: auto">请使用http或https链接</div>';
  421. html += '<div class="ns-word-aux mid" style="width: auto">在<a href="https://mp.weixin.qq.com" class="ns-text-color" target="_blank">mp.weixin.qq.com</a>开发-开发设置-业务域名添加此域名</div>';
  422. html += '</div>';
  423. html += '</div>';
  424. $(".link-right").html(html);
  425. }
  426. $("body").off('click').on("click", ".link-box .link-left dd", function () {
  427. customIdent = false;
  428. appletIdent = false;
  429. webviewIdent = false;
  430. if (!$(this).hasClass("ns-text-color")){
  431. $(".link-box .link-left dd,.link-box .link-left dt").removeClass("ns-text-color");
  432. $(this).addClass("ns-text-color");
  433. }
  434. initMeun = $(this).attr("data-ident");
  435. getLinkInfo(initMeun);
  436. });
  437. $(".link-box .link-left dt").click(function () {
  438. if (!$(this).hasClass("active")){
  439. $(this).addClass("active");
  440. $(this).parent("dl").find("dd").addClass("layui-hide");
  441. }else{
  442. $(this).removeClass("active");
  443. $(this).parent("dl").find("dd").removeClass("layui-hide");
  444. }
  445. if ($(this).parent("dl").find("dd").length == 0) {
  446. $(".link-box .link-left dd,.link-box .link-left dt").removeClass("ns-text-color");
  447. $(this).addClass("ns-text-color");
  448. }
  449. });
  450. // 选择链接
  451. $("body").on("click", ".link-box .link-right dd", function () {
  452. $(".link-box .link-right dd").removeClass("ns-border-color");
  453. if (!$(this).hasClass("ns-border-color")) $(this).addClass("ns-border-color");
  454. });
  455. //清空
  456. $(".link-btn .link-eliminate").click(function () {
  457. $(".link-box input[name='title']").val('');
  458. $(".link-box input[name='wap_url']").val('');
  459. $(".link-box .link-right dd").removeClass("ns-border-color");
  460. $(".link-box input[type='checkbox']:checked").prop('checked',false);
  461. $(".link-box .layui-unselect.layui-form-checkbox").removeClass("layui-form-checked");
  462. var obj = {"title":"","wap_url":'',"name":''};
  463. window.linkData = obj;
  464. window.linkData.parents = '';
  465. layer.close(window.linkIndex);
  466. });
  467. // 保存
  468. $(".link-box .link-save").click(function(){
  469. var value,old_value;
  470. var dd = $(".link-box .link-right dd.ns-border-color").eq(0);
  471. /* 商城页面链接保存 */
  472. if(dd.length){
  473. value = dd.attr("data-value");
  474. old_value = dd.attr("data-old-value");
  475. if(old_value) value = old_value;
  476. initMeun = $(".link-box .link-left dd.ns-text-color").attr('data-ident');
  477. }
  478. /* 商品链接保存 */
  479. if ($("input[name='goods_checkbox']:checked").length){
  480. var goodsId = $("input[name='goods_checkbox']:checked").eq(0).attr("data-goods-id");
  481. value = $("input[name='goods_json'][data-goods-id = "+ goodsId +"]").val();
  482. old_value = $("input[name='old_goods_json'][data-goods-id = "+ goodsId +"]").val();
  483. console.log(value)
  484. if(old_value) value = old_value.toString();
  485. value = JSON.parse(value);
  486. if (!value.wap_url){
  487. var nn =value.id;
  488. value.wap_url = wap_url + value.id;
  489. value.title = value.title;
  490. value.name = "";
  491. }
  492. value = JSON.stringify(value);
  493. }
  494. // 商品分类
  495. if ($("input[name='category_select_id']:checked").length){
  496. var category_select_id = $("input[name='category_select_id']:checked").attr('data-category_select_id');
  497. value = $("input[name='category_select_id']:checked").val();
  498. value = JSON.parse(value);
  499. if (!value.wap_url){
  500. value.wap_url = wap_url+value.id;
  501. value.title = value.name;
  502. value.selected = true;
  503. value.name = "";
  504. }
  505. value = JSON.stringify(value);
  506. }
  507. //自定义链接
  508. if(customIdent){
  509. value = {};
  510. if (!$(".custom-link input[name='title']").val()){
  511. layer.msg("链接名称不能为空");
  512. return false;
  513. }
  514. if (!$(".custom-link input[name='wap_url']").val()){
  515. layer.msg("跳转路径不能为空");
  516. return false;
  517. }
  518. value.title = $(".custom-link input[name='title']").val();
  519. value.wap_url = $(".custom-link input[name='wap_url']").val();
  520. value.id = -999;
  521. value.addon_icon = "";
  522. value.addon_name = "CustomLink";
  523. value.addon_title = "自定义链接";
  524. value.icon = "";
  525. value.name = "CUSTOM_LINK";
  526. value.type = 0;
  527. window.linkData = value;
  528. window.linkData.parents = 'CUSTOM_LINK';
  529. }
  530. if(appletIdent){
  531. value = {};
  532. if (!$(".other-applet input[name='appid']").val()){
  533. layer.msg("跳转小程序appid不能为空");
  534. return false;
  535. }
  536. value.wap_url = '';
  537. value.appid = $(".other-applet input[name='appid']").val();
  538. value.page = $(".other-applet input[name='page']").val();
  539. value.title = '小程序-' + value.appid;
  540. value.id = -999;
  541. value.addon_icon = "";
  542. value.addon_name = "ToApplet";
  543. value.addon_title = "跳转小程序";
  544. value.icon = "";
  545. value.name = "OTHER_APPLET";
  546. value.type = 0;
  547. window.linkData = value;
  548. window.linkData.parents = 'OTHER_APPLET';
  549. }
  550. if(webviewIdent){
  551. value = {};
  552. if (!$(".webview input[name='wapurl']").val()){
  553. layer.msg("跳转链接不能为空");
  554. return false;
  555. }
  556. value.wap_url = $(".webview input[name='wapurl']").val();
  557. value.appid = '';
  558. value.page = '';
  559. value.title = '外链-' + value.wap_url;
  560. value.id = -999;
  561. value.addon_icon = "";
  562. value.addon_name = "Webview";
  563. value.addon_title = "webview跳转";
  564. value.icon = "";
  565. value.name = "WEBVIEW";
  566. value.type = 0;
  567. window.linkData = value;
  568. window.linkData.parents = 'WEBVIEW';
  569. }
  570. if(value && !customIdent && !appletIdent && !webviewIdent) {
  571. value = JSON.parse(value);
  572. window.linkData = value;
  573. window.linkData.parents = initMeun;
  574. }
  575. layer.close(window.linkIndex);
  576. });
  577. </script>
  578. <!-- 分类列表 -->
  579. <style>
  580. .goods-category-list .layui-table td {
  581. border-left: 0;
  582. border-right: 0;
  583. }
  584. .goods-category-list .layui-table .switchBtn {
  585. font-size: 16px;
  586. cursor: pointer;
  587. width: 12px;
  588. line-height: 1;
  589. display: inline-block;
  590. text-align: center;
  591. vertical-align: middle;
  592. }
  593. .goods-category-list .layui-table img {width: 40px;}
  594. </style>
  595. <script type="text/html" id="category_html">
  596. <div class="goods-category-list layui-form">
  597. <table class="layui-table ns-pithy-table">
  598. <colgroup>
  599. <col width="5%">
  600. <col width="6%">
  601. <col width="59%">
  602. <col width="30%">
  603. </colgroup>
  604. <thead>
  605. <tr>
  606. <th></th>
  607. <th></th>
  608. <th>分类名称</th>
  609. <th>图片</th>
  610. </tr>
  611. </thead>
  612. <tbody>
  613. <if condition="category_list">
  614. <foreach name="category_list" item="vo">
  615. <tr class='category-line'>
  616. <td>
  617. <input type="checkbox" name="category_select_id" data-category_select_id="{$vo['id']}" lay-skin="primary" value='{:json_encode($vo)}' lay-filter="category_select_id" <?php if(!empty($link_array['id']) && $link_array['id'] == $vo['id']){ ?>checked<?php } ?>>
  618. </td>
  619. <td>
  620. <notempty name="vo.child_list">
  621. <span class="switchBtn ns-text-color js-switch" data-category-id="{$vo['id']}" data-level="{$vo['level']}" data-open="0">+</span>
  622. </notempty>
  623. </td>
  624. <td>{$vo['name']}</td>
  625. <td>
  626. <notempty name="vo.logo">
  627. <div class="ns-img-box">
  628. <img layer-src src="{$vo['logo']}"/>
  629. </div>
  630. </notempty>
  631. </td>
  632. </tr>
  633. <notempty name="vo.child_list">
  634. <foreach name="vo.child_list" item="second">
  635. <tr class='category-line' data-category-id-1="{$second['category_id_1']}" style="display:none;">
  636. <td><input type="checkbox" name="category_select_id" lay-skin="primary"data-category_select_id="{$second['id']}" value='{:json_encode($second)}' lay-filter="category_select_id" <?php if(!empty($link_array['id'])&&$link_array['id']==$second['id']) { ?>checked<?php } ?>></td>
  637. <td></td>
  638. <td style="padding-left: 20px;">
  639. <span class="switchBtn ns-text-color js-switch" data-category-id="{$second['id']}" data-level="{$second['level']}" data-open="1" style="padding-right: 20px;">-</span>
  640. <span>{$second['name']}</span>
  641. </td>
  642. <td>
  643. <notempty name="second.logo">
  644. <img layer-src src="{$second.logo)}"/>
  645. </notempty>
  646. </td>
  647. </tr>
  648. <notempty name="second.child_list">
  649. <foreach name="second.child_list" item="third">
  650. <tr class='category-line'data-category-id-1="{$vo['category_id_1']}" data-category-id-2="{$third['category_id_2']}" style="display:none;">
  651. <td><input type="checkbox" name="category_select_id" lay-skin="primary" value='{:json_encode($third)}' data-category_select_id='{$third.id}' lay-filter="category_select_id" <?php if(!empty($link_array['id'])&&$link_array['id'] == $third['id']) { ?>checked<?php } ?>></td>
  652. <td></td>
  653. <td style="padding-left: 80px;">
  654. <span>{$third['name']}</span>
  655. </td>
  656. <td>
  657. <notempty name="third.logo">
  658. <img layer-src src="{$third['logo']}"/>
  659. </notempty>
  660. </td>
  661. </tr>
  662. </foreach>
  663. </notempty>
  664. </foreach>
  665. </notempty>
  666. </foreach>
  667. <else/>
  668. <tr>
  669. <td colspan="9" style="text-align: center">无数据</td>
  670. </tr>
  671. </if>
  672. </tbody>
  673. </table>
  674. </div>
  675. </script>
  676. <script type="text/html" id="checkbox">
  677. {{# if(d.selected){ }}
  678. <input type="checkbox" data-goods-id="{{d.id}}" name="goods_checkbox" lay-skin="primary" lay-filter="goods_checkbox" checked>
  679. <input type="hidden" data-goods-id="{{d.id}}" name="old_goods_json" value='{:html_entity_decode($link)}' />
  680. {{# }else{ }}
  681. <input type="checkbox" data-goods-id="{{d.id}}" name="goods_checkbox" lay-skin="primary" lay-filter="goods_checkbox">
  682. {{# } }}
  683. <input type="hidden" data-goods-id="{{d.id}}" name="goods_json" value='{{ JSON.stringify(d) }}' />
  684. </script>
  685. <!-- 商品信息 -->
  686. <script type="text/html" id="goods_info">
  687. <div class="ns-table-title">
  688. <div class="ns-title-pic" id="goods_img_{{d.id}}">
  689. <img layer-src src="{{d.image}}"/>
  690. </div>
  691. <div class="ns-title-content">
  692. <a href="javascript:;" class="ns-multi-line-hiding ns-text-color" title="{{d.title}}">{{d.title}}</a>
  693. </div>
  694. </div>
  695. </script>