addcube.html 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <?php $shoname_name = D('Home/Front')->get_config_by_name('shoname'); ?>
  6. <title><?php echo $shoname; ?></title>
  7. <link rel="shortcut icon" href="" />
  8. <meta name="renderer" content="webkit">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  11. <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
  12. <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
  13. <!--[if lt IE 9]>
  14. <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  15. <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  16. <![endif]-->
  17. <link href="./resource/css/bootstrap.min.css?v=201903260001" rel="stylesheet">
  18. <link href="./resource/css/common.css?v=201903260001" rel="stylesheet">
  19. <script type="text/javascript">
  20. window.sysinfo = {
  21. <?php if (!empty($_W['uniacid']) ){ ?>'uniacid': '{$_W['uniacid']}',<?php } ?>
  22. <?php if( !empty($_W['acid']) ){ ?>'acid': '{$_W['acid']}',<?php } ?>
  23. <?php if (!empty($_W['openid']) ) { ?>'openid': '{$_W['openid']}',<?php } ?>
  24. <?php if( !empty($_W['uid']) ) { ?>'uid': '{$_W['uid']}',<?php } ?>
  25. 'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php }else{ ?>0<?php } ?>,
  26. 'siteroot': '{$_W['siteroot']}',
  27. 'siteurl': '{$_W['siteurl']}',
  28. 'attachurl': '{$_W['attachurl']}',
  29. 'attachurl_local': '{$_W['attachurl_local']}',
  30. 'attachurl_remote': '{$_W['attachurl_remote']}',
  31. 'module' : {'url' : '<?php if( defined('MODULE_URL') ) { ?>{MODULE_URL}<?php } ?>', 'name' : '<?php if (defined('IN_MODULE') ) { ?>{IN_MODULE}<?php } ?>'},
  32. 'cookie' : {'pre': ''},
  33. 'account' : {:json_encode($_W['account'])},
  34. };
  35. </script>
  36. <script type="text/javascript" src="./resource/js/lib/jquery-1.11.1.min.js"></script>
  37. <script type="text/javascript" src="./resource/js/lib/bootstrap.min.js"></script>
  38. <script type="text/javascript" src="./resource/js/app/util.js?v=201903260001"></script>
  39. <script type="text/javascript" src="./resource/js/app/common.min.js?v=201903260001"></script>
  40. <script type="text/javascript" src="./resource/js/require.js?v=201903260001"></script>
  41. <script type="text/javascript" src="./resource/js/lib/jquery.nice-select.js?v=201903260001"></script>
  42. <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  43. <link href="/static/css/snailfish.css" rel="stylesheet">
  44. <style type="text/css">
  45. .block-box {
  46. color: #ffffff;
  47. cursor: pointer;
  48. display: inline-block;
  49. margin-right: 25px;
  50. height: 280px;
  51. width: 300px;
  52. border: 1px solid #D4D4D4;
  53. border-top-left-radius: 20px;
  54. border-top-right-radius: 20px;
  55. position: relative;
  56. }
  57. .opacity {
  58. position: absolute;
  59. height: 250px;
  60. width: 280px;
  61. bottom: 0;
  62. left: 10px;
  63. z-index: 5;
  64. background-color: rgba(0, 0, 0, .3);
  65. display: none;
  66. }
  67. .block-img {
  68. width: 280px;
  69. height: 250px;
  70. position: absolute;
  71. bottom: 0px;
  72. left: 10px;
  73. }
  74. .select {
  75. display: none;
  76. }
  77. .block-box.active {
  78. border: 2px solid #409EFF;
  79. }
  80. .active .select {
  81. display: block;
  82. position: absolute;
  83. top: 0;
  84. left: 0;
  85. height: 80px;
  86. width: 80px;
  87. z-index: 10;
  88. }
  89. .choose-button {
  90. border: 0;
  91. position: absolute;
  92. height: 30px;
  93. width: 80px;
  94. padding: 0;
  95. text-align: center;
  96. background-color: #409EFF;
  97. top: 50%;
  98. left: 0;
  99. right: 0;
  100. margin: -15px auto 0;
  101. z-index: 10;
  102. display: none;
  103. font-size: 12px;
  104. border-radius: 3px;
  105. }
  106. .block-box:hover .choose-button,
  107. .block-box:hover .opacity {
  108. display: block;
  109. }
  110. .active.block-box:hover .choose-button,
  111. .active.block-box:hover .opacity {
  112. display: none;
  113. }
  114. .cctip {
  115. position: absolute;
  116. bottom: 5px;
  117. left: 10px;
  118. right: 10px;
  119. font-size: 14px;
  120. color: #333;
  121. }
  122. .w100 {
  123. width: 100px!important;
  124. }
  125. .ml100 {
  126. margin-left: 100px!important;
  127. }
  128. .multi-audio-details .multi-audio-item {
  129. width: 155px;
  130. height: 40px;
  131. position: relative;
  132. float: left;
  133. margin-right: 5px;
  134. }
  135. </style>
  136. </head>
  137. <body layadmin-themealias="default">
  138. <div class="layui-fluid">
  139. <div class="layui-card">
  140. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">
  141. <?php if( !empty($item['id']) ){ ?>编辑<?php }else{ ?>添加<?php } ?>魔方图片<?php if( !empty($item['id']) ){ ?>({$item['name']})<?php } ?>
  142. </span>
  143. </div>
  144. <div class="layui-card-body" style="padding:15px;">
  145. <form action="" method="post" class="layui-form" enctype="multipart/form-data">
  146. <input type="hidden" name="data[id]" value="{$item['id']}" />
  147. <div class="layui-form-item">
  148. <label class="layui-form-label">名称</label>
  149. <div class="layui-input-block ">
  150. <input type="text" id='advname' lay-verify="required" name="data[name]" class="form-control" value="{$item['name']}" />
  151. </div>
  152. </div>
  153. <div class="layui-form-item">
  154. <label class="layui-form-label">排序</label>
  155. <div class="layui-input-block">
  156. <input type="text" name="data[displayorder]" class="form-control"
  157. value="{$item['displayorder']}" />
  158. <span class='help-block'>数字越大,排名越靠前</span>
  159. </div>
  160. </div>
  161. <div class="layui-form-item">
  162. <label class="layui-form-label">状态</label>
  163. <div class="layui-input-block">
  164. <label class='radio-inline'>
  165. <input type='radio' name='data[enabled]' title="显示" value=1 <?php if( $item['enabled']==1 || empty($item) ){ ?>checked<?php } ?> />
  166. </label>
  167. <label class='radio-inline'>
  168. <input type='radio' name='data[enabled]' title="隐藏" value=0 <?php if( $item['enabled']==0 && !empty($item) ){ ?>checked<?php } ?> />
  169. </label>
  170. </div>
  171. </div>
  172. <div class="layui-form-item">
  173. <label class="layui-form-label">样式选择</label>
  174. <div class="layui-input-block" id="selectBox">
  175. <div class="block-box <?php if( empty($item['type']) || $item['type']==1 ){ ?>active<?php } ?>" data-type="1" data-num="1">
  176. <img src="/static/images/select.png" class="select">
  177. <div class="opacity"></div>
  178. <button type="button" class="choose-button">
  179. <span>启用该样式</span>
  180. </button>
  181. <img src="/static/images/1-1.png" class="block-img">
  182. <div class="cctip">
  183. 建议尺寸: 宽度710,高度无限制
  184. </div>
  185. </div>
  186. <div class="block-box" <?php if($item['type']==2){ ?>active<?php } ?>" data-type="2" data-num="2">
  187. <img src="/static/images/select.png" class="select">
  188. <div class="opacity"></div>
  189. <button type="button" class="choose-button">
  190. <span>启用该样式</span>
  191. </button>
  192. <img src="/static/images/1-2.png" class="block-img">
  193. <div class="cctip">
  194. 建议尺寸: 1,275*365;<br/>2,430*365(或同等比例)
  195. </div>
  196. </div>
  197. <div class="block-box" <?php if($item['type']==3){ ?>active<?php } ?>" data-type="3" data-num="3">
  198. <img src="/static/images/select.png" class="select">
  199. <div class="opacity"></div>
  200. <button type="button" class="choose-button">
  201. <span>启用该样式</span>
  202. </button>
  203. <img src="/static/images/1-3.png" class="block-img">
  204. <div class="cctip">
  205. 建议尺寸: 1,275*365;<br/>2、3、430*180(或同等比例)
  206. </div>
  207. </div>
  208. <div class="block-box" <?php if($item['type']==4){ ?>active<?php } ?>" data-type="4" data-num="4">
  209. <img src="/static/images/select.png" class="select">
  210. <div class="opacity"></div>
  211. <button type="button" class="choose-button">
  212. <span>启用该样式</span>
  213. </button>
  214. <img src="/static/images/1-4.png" class="block-img">
  215. <div class="cctip">
  216. 建议尺寸: 1,275*365;<br/>2、430*180;3、4、212.5*180(或同等比例)
  217. </div>
  218. </div>
  219. <div class="block-box" <?php if($item['type']==5){ ?>active<?php } ?>" data-type="5" data-num="2">
  220. <img src="/static/images/select.png" class="select">
  221. <div class="opacity"></div>
  222. <button type="button" class="choose-button">
  223. <span>启用该样式</span>
  224. </button>
  225. <img src="/static/images/1-7.png" class="block-img">
  226. <div class="cctip">
  227. 建议尺寸: 所有图片等尺寸或等比例
  228. </div>
  229. </div>
  230. <div class="block-box" <?php if($item['type']==6){ ?>active<?php } ?>" data-type="6" data-num="3">
  231. <img src="/static/images/select.png" class="select">
  232. <div class="opacity"></div>
  233. <button type="button" class="choose-button">
  234. <span>启用该样式</span>
  235. </button>
  236. <img src="/static/images/1-8.png" class="block-img">
  237. <div class="cctip">
  238. 建议尺寸: 所有图片等尺寸或等比例
  239. </div>
  240. </div>
  241. <div class="block-box" <?php if($item['type']==7){ ?>active<?php } ?>" data-type="7" data-num="4">
  242. <img src="/static/images/select.png" class="select">
  243. <div class="opacity"></div>
  244. <button type="button" class="choose-button">
  245. <span>启用该样式</span>
  246. </button>
  247. <img src="/static/images/1-5.png" class="block-img">
  248. <div class="cctip">
  249. 建议尺寸: 所有图片等尺寸或等比例
  250. </div>
  251. </div>
  252. <div class="block-box" <?php if($item['type']==8){ ?>active<?php } ?>" data-type="8" data-num="4">
  253. <img src="/static/images/select.png" class="select">
  254. <div class="opacity"></div>
  255. <button type="button" class="choose-button">
  256. <span>启用该样式</span>
  257. </button>
  258. <img src="/static/images/1-6.png" class="block-img">
  259. <div class="cctip">
  260. 建议尺寸: 所有图片等尺寸或等比例
  261. </div>
  262. </div>
  263. </div>
  264. </div>
  265. <div class="layui-form-item">
  266. <label class="layui-form-label">板块设置</label>
  267. <div class="layui-input-block" id="bkbox">
  268. <div class="row" style="margin-bottom: 20px;">
  269. <div class="layui-form-item">
  270. <label class="layui-form-label text-left w100">链接类型</label>
  271. <div class="layui-input-block ml100">
  272. <label class='radio-inline'>
  273. <input type='radio' name='data[linktype_0]' title="本小程序链接" value="1" lay-filter="linktype"
  274. <?php if( $item['thumb']['linktype'][0]==1 || !isset($item['thumb']['linktype'][0]) ){ ?>checked<?php } ?> data-idx="0" />
  275. </label>
  276. <label class='radio-inline'>
  277. <input type='radio' name='data[linktype_0]' title="webview外链" lay-filter="linktype"
  278. value="0" <?php if( $item['thumb']['linktype'][0]==0 && isset($item['thumb']['linktype'][0]) ){ ?>checked<?php } ?> data-idx="0" />
  279. </label>
  280. <label class='radio-inline'>
  281. <input type='radio' name='data[linktype_0]' title="首页分类" lay-filter="linktype"
  282. value="3" <?php if( $item['thumb']['linktype'][0]==3 && isset($item['thumb']['linktype'][0]) ){ ?>checked<?php } ?> data-idx="0" />
  283. </label>
  284. <label class='radio-inline'>
  285. <input type='radio' name='data[linktype_0]' title="独立分类页" lay-filter="linktype"
  286. value="4" <?php if( $item['thumb']['linktype'][0]==4 && isset($item['thumb']['linktype'][0]) ){ ?>checked<?php } ?> data-idx="0" />
  287. </label>
  288. <label class='radio-inline'>
  289. <input type='radio' name='data[linktype_0]' title="外部小程序链接" lay-filter="linktype"
  290. value="5" <?php if( $item['thumb']['linktype'][0]==5 && isset($item['thumb']['linktype'][0]) ){ ?>checked<?php } ?> data-idx="0" />
  291. </label>
  292. <label class='radio-inline'>
  293. <input type='radio' name='data[linktype_0]' title="优惠券" lay-filter="linktype"
  294. value="6" <?php if( $item['thumb']['linktype'][0]==6 && isset($item['thumb']['linktype'][0]) ){ ?>checked<?php } ?> data-idx="0" />
  295. </label>
  296. <label class='radio-inline'>
  297. <input type='radio' name='data[linktype_0]' title="客服" lay-filter="linktype"
  298. value="7" <?php if( $item['thumb']['linktype'][0]==7 && isset($item['thumb']['linktype'][0]) ){ ?>checked<?php } ?> data-idx="0" />
  299. </label>
  300. </div>
  301. </div>
  302. <div class="col-md-12" style="margin-bottom: 20px;">
  303. <div class="input-group url-group" style="display:<?php if( $item['thumb']['linktype'][0]==1 || !isset($item['thumb']['linktype'][0]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link0-1">
  304. <input type="text" class="form-control valid" name="data[link_0]" value="{$item['thumb']['link'][0]}" placeholder="请选择链接" id="advlink1">
  305. <span class="input-group-btn">
  306. <span data-input="#advlink1" class="btn btn-default chose_link">选择链接</span>
  307. </span>
  308. </div>
  309. <!-- webview -->
  310. <div class="url-group layui-input-block " style="margin-left:0;display:<?php if( $item['thumb']['linktype'][0]==0 && isset($item['thumb']['linktype'][0]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link0-0">
  311. <input type="text" class="form-control" name="data[webview_0]" value="{$item['thumb']['webview'][0]}" placeholder="请输入webview链接" value="{$item['thumb']['webview'][0]}">
  312. </div>
  313. <!-- 分类 -->
  314. <div class="url-group layui-input-block " style="margin-left:0;display:<?php if( $item['thumb']['linktype'][0]==3&&isset($item['thumb']['linktype'][0]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link0-3">
  315. <select name='data[cateid_0]' class="form-control select2">
  316. <?php foreach($category as $c){ ?>
  317. <option value="{$c['id']}" <?php if($c['id']==$item['thumb']['cateid'][0]){ ?>selected<?php } ?> >{$c['name']}</option>
  318. <?php } ?>
  319. </select>
  320. </div>
  321. <div class="url-group layui-input-block " style="margin-left:0;display:<?php if( $item['thumb']['linktype'][0]==4&&isset($item['thumb']['linktype'][0]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link0-4">
  322. <select name='data[cateid_0]' class="form-control select2">
  323. <?php foreach($category as $c){ ?>
  324. <option value="{$c['id']}" <?php if($c['id']==$item['thumb']['cateid'][0]){ ?>selected<?php } ?> >{$c['name']}</option>
  325. <?php } ?>
  326. </select>
  327. </div>
  328. <div class="url-group layui-input-block " style="margin-left:0;display:<?php if( $item['thumb']['linktype'][0]==5&&isset($item['thumb']['linktype'][0]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link0-5">
  329. <input type="text" id='appid_0' name="data[appid_0]" class="form-control" placeholder="请输入外链小程序appid" value="{$item['thumb']['appid'][0]}" maxlength="32"/><br />
  330. <input type="text" class="form-control valid" name="data[outlink_0]" value="{$item['thumb']['outlink'][0]}" placeholder="请输入外链小程序链接" id="advlink1_1">
  331. <!--
  332. <span class="input-group-btn">
  333. <span data-input="#advlink1_1" class="btn btn-default chose_link">选择链接</span>
  334. </span>-->
  335. </div>
  336. <!-- 优惠券 -->
  337. <div class="layui-form-item url-group" id="tabs-link0-6" style="display: <?php if( $item['thumb']['linktype'][0]==6&&isset($item['thumb']['linktype'][0]) ){ ?>block<?php }else{ ?>none<?php } ?>;">
  338. <label class="layui-form-label must" style="width: auto;padding: 9px 0;">优惠券</label>
  339. <div class="layui-input-block" style="margin-left: 70px;">
  340. <div class="input-group " style="margin: 0;">
  341. <input type="text" disabled value="" class="form-control valid" placeholder="">
  342. <span class="input-group-btn">
  343. <span data-input="#coupon_id_box_0" data-name="coupon_id_0" class="btn btn-default chose_coupon_id">选择优惠券</span>
  344. </span>
  345. </div>
  346. <div class="multi-audio-details container" id="coupon_id_box_0" style="width:auto;">
  347. <?php if( !empty($couponinfo[0]) ){ ?>
  348. <?php foreach($couponinfo[0] as $c){ ?>
  349. <div class="multi-audio-item " data-id="{$c['id']}">
  350. <div class="input-group">
  351. <input type="text" class="form-control img-textname" readonly="" value="{$c['voucher_title']}">
  352. <input type="hidden" value="{$c['id']}" name="coupon_id_0[]">
  353. <div class="input-group-btn">
  354. <button class="btn btn-default" data-id="{$c['id']}" onclick="cancle_coupon(this, {$c['id']})" type="button"><i class="fa fa-remove"></i></button>
  355. </div>
  356. </div>
  357. </div>
  358. <?php } ?>
  359. <?php } ?>
  360. </div>
  361. </div>
  362. </div>
  363. <div class="layui-form-item url-group" id="tabs-link0-7"></div>
  364. </div>
  365. <div class="col-md-12" style="margin-bottom: 20px;">
  366. {:tpl_form_field_image2('data[thumb_0]', $item['thumb']['cover'][0], '', array('extras'=>array('text'=>'placeholder="必选"')))}
  367. </div>
  368. <hr>
  369. </div>
  370. <div class="row" style="margin-bottom: 20px;<?php if($item['num']<2){ ?>display: none;<?php } ?>">
  371. <div class="layui-form-item">
  372. <label class="layui-form-label text-left w100">链接类型</label>
  373. <div class="layui-input-block ml100">
  374. <label class='radio-inline'>
  375. <input type='radio' name='data[linktype_1]' title="本小程序链接" value="1" lay-filter="linktype"
  376. <?php if( $item['thumb']['linktype'][1]==1 || !isset($item['thumb']['linktype'][1]) ){ ?>checked<?php } ?> data-idx="1" />
  377. </label>
  378. <label class='radio-inline'>
  379. <input type='radio' name='data[linktype_1]' title="webview外链" lay-filter="linktype"
  380. value="0" <?php if( $item['thumb']['linktype'][1]==0 && isset($item['thumb']['linktype'][1]) ){ ?>checked<?php } ?> data-idx="1" />
  381. </label>
  382. <label class='radio-inline'>
  383. <input type='radio' name='data[linktype_1]' title="首页分类" lay-filter="linktype"
  384. value="3" <?php if( $item['thumb']['linktype'][1]==3 && isset($item['thumb']['linktype'][1]) ){ ?>checked<?php } ?> data-idx="1" />
  385. </label>
  386. <label class='radio-inline'>
  387. <input type='radio' name='data[linktype_1]' title="独立分类页" lay-filter="linktype"
  388. value="4" <?php if( $item['thumb']['linktype'][1]==4 && isset($item['thumb']['linktype'][1]) ){ ?>checked<?php } ?> data-idx="1" />
  389. </label>
  390. <label class='radio-inline'>
  391. <input type='radio' name='data[linktype_1]' title="外部小程序链接" lay-filter="linktype"
  392. value="5" <?php if( $item['thumb']['linktype'][1]==5 && isset($item['thumb']['linktype'][1]) ){ ?>checked<?php } ?> data-idx="1" />
  393. </label>
  394. <label class='radio-inline'>
  395. <input type='radio' name='data[linktype_1]' title="优惠券" lay-filter="linktype"
  396. value="6" <?php if( $item['thumb']['linktype'][1]==6 && isset($item['thumb']['linktype'][1]) ){ ?>checked<?php } ?> data-idx="1" />
  397. </label>
  398. <label class='radio-inline'>
  399. <input type='radio' name='data[linktype_1]' title="客服" lay-filter="linktype"
  400. value="7" <?php if( $item['thumb']['linktype'][1]==7 && isset($item['thumb']['linktype'][1]) ){ ?>checked<?php } ?> data-idx="1" />
  401. </label>
  402. </div>
  403. </div>
  404. <div class="col-md-12" style="margin-bottom: 20px;">
  405. <div class="input-group url-group" style="display:<?php if( $item['thumb']['linktype'][1]==1 || !isset($item['thumb']['linktype'][1]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link1-1">
  406. <input type="text" class="form-control valid" name="data[link_1]" value="{$item['thumb']['link'][1]}" placeholder="请选择链接" id="advlink2">
  407. <span class="input-group-btn">
  408. <span data-input="#advlink2" class="btn btn-default chose_link">选择链接</span>
  409. </span>
  410. </div>
  411. <!-- webview -->
  412. <div class="url-group layui-input-block " style="margin-left:0;display:<?php if( $item['thumb']['linktype'][1]==0 && isset($item['thumb']['linktype'][1]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link1-0">
  413. <input type="text" class="form-control" name="data[webview_1]" value="{$item['thumb']['webview'][1]}" placeholder="请输入webview链接" value="{$item['thumb']['webview'][1]}">
  414. </div>
  415. <!-- 分类 -->
  416. <div class="url-group layui-input-block " style="margin-left:0;display:<?php if( $item['thumb']['linktype'][1]==3&&isset($item['thumb']['linktype'][1]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link1-3">
  417. <select name='data[cateid_1]' class="form-control select2">
  418. <?php foreach($category as $c){ ?>
  419. <option value="{$c['id']}" <?php if($c['id']==$item['thumb']['cateid'][1]){ ?>selected<?php } ?> >{$c['name']}</option>
  420. <?php } ?>
  421. </select>
  422. </div>
  423. <div class="url-group layui-input-block " style="margin-left:0;display:<?php if( $item['thumb']['linktype'][1]==4&&isset($item['thumb']['linktype'][1]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link1-4">
  424. <select name='data[cateid_1]' class="form-control select2">
  425. <?php foreach($category as $c){ ?>
  426. <option value="{$c['id']}" <?php if($c['id']==$item['thumb']['cateid'][1]){ ?>selected<?php } ?> >{$c['name']}</option>
  427. <?php } ?>
  428. </select>
  429. </div>
  430. <div class="url-group layui-input-block " style="margin-left:0;display:<?php if( $item['thumb']['linktype'][1]==5&&isset($item['thumb']['linktype'][1]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link1-5">
  431. <input type="text" id='appid_1' name="data[appid_1]" class="form-control" placeholder="请输入外链小程序appid" value="{$item['thumb']['appid'][1]}" maxlength="32"/><br />
  432. <input type="text" class="form-control valid" name="data[outlink_1]" value="{$item['thumb']['outlink'][1]}" placeholder="请输入外链小程序链接" id="advlink2_1">
  433. <!--
  434. <span class="input-group-btn">
  435. <span data-input="#advlink1_1" class="btn btn-default chose_link">选择链接</span>
  436. </span>-->
  437. </div>
  438. <!-- 优惠券 -->
  439. <div class="layui-form-item url-group" id="tabs-link1-6" style="display: <?php if( $item['thumb']['linktype'][1]==6&&isset($item['thumb']['linktype'][1]) ){ ?>block<?php }else{ ?>none<?php } ?>;">
  440. <label class="layui-form-label must" style="width: auto;padding: 9px 0;">优惠券</label>
  441. <div class="layui-input-block" style="margin-left: 70px;">
  442. <div class="input-group " style="margin: 0;">
  443. <input type="text" disabled value="" class="form-control valid" placeholder="">
  444. <span class="input-group-btn">
  445. <span data-input="#coupon_id_box_1" data-name="coupon_id_1" class="btn btn-default chose_coupon_id">选择优惠券</span>
  446. </span>
  447. </div>
  448. <div class="multi-audio-details container" id="coupon_id_box_1" style="width:auto;">
  449. <?php if( !empty($couponinfo[1]) ){ ?>
  450. <?php foreach($couponinfo[1] as $c){ ?>
  451. <div class="multi-audio-item " data-id="{$c['id']}">
  452. <div class="input-group">
  453. <input type="text" class="form-control img-textname" readonly="" value="{$c['voucher_title']}">
  454. <input type="hidden" value="{$c['id']}" name="coupon_id_1[]">
  455. <div class="input-group-btn">
  456. <button class="btn btn-default" data-id="{$c['id']}" onclick="cancle_coupon(this, {$c['id']})" type="button"><i class="fa fa-remove"></i></button>
  457. </div>
  458. </div>
  459. </div>
  460. <?php } ?>
  461. <?php } ?>
  462. </div>
  463. </div>
  464. </div>
  465. <div class="layui-form-item url-group" id="tabs-link1-7"></div>
  466. </div>
  467. <div class="col-md-12" style="margin-bottom: 20px;">
  468. {:tpl_form_field_image2('data[thumb_1]', $item['thumb']['cover'][1], '')}
  469. </div>
  470. <hr>
  471. </div>
  472. <div class="row" style="margin-bottom: 20px;<?php if( $item['num']<3 ){ ?>display: none;<?php } ?>">
  473. <div class="layui-form-item">
  474. <label class="layui-form-label text-left w100">链接类型</label>
  475. <div class="layui-input-block ml100 radioBox">
  476. <label class='radio-inline'>
  477. <input type='radio' name='data[linktype_2]' title="本小程序链接" value="1" lay-filter="linktype"
  478. <?php if( $item['thumb']['linktype'][2]==1 || !isset($item['thumb']['linktype'][2]) ){ ?>checked<?php } ?> data-idx="2" />
  479. </label>
  480. <label class='radio-inline'>
  481. <input type='radio' name='data[linktype_2]' title="webview外链" lay-filter="linktype"
  482. value="0" <?php if( $item['thumb']['linktype'][2]==0 && isset($item['thumb']['linktype'][2]) ){ ?>checked<?php } ?> data-idx="2" />
  483. </label>
  484. <label class='radio-inline'>
  485. <input type='radio' name='data[linktype_2]' title="首页分类" lay-filter="linktype"
  486. value="3" <?php if( $item['thumb']['linktype'][2]==3 && isset($item['thumb']['linktype'][2]) ){ ?>checked<?php } ?> data-idx="2" />
  487. </label>
  488. <label class='radio-inline'>
  489. <input type='radio' name='data[linktype_2]' title="独立分类页" lay-filter="linktype"
  490. value="4" <?php if( $item['thumb']['linktype'][2]==4 && isset($item['thumb']['linktype'][2]) ){ ?>checked<?php } ?> data-idx="2" />
  491. </label>
  492. <label class='radio-inline'>
  493. <input type='radio' name='data[linktype_2]' title="外部小程序链接" lay-filter="linktype"
  494. value="5" <?php if( $item['thumb']['linktype'][2]==5 && isset($item['thumb']['linktype'][2]) ){ ?>checked<?php } ?> data-idx="2" />
  495. </label>
  496. <label class='radio-inline'>
  497. <input type='radio' name='data[linktype_2]' title="优惠券" lay-filter="linktype"
  498. value="6" <?php if( $item['thumb']['linktype'][2]==6 && isset($item['thumb']['linktype'][2]) ){ ?>checked<?php } ?> data-idx="2" />
  499. </label>
  500. <label class='radio-inline'>
  501. <input type='radio' name='data[linktype_2]' title="客服" lay-filter="linktype"
  502. value="7" <?php if( $item['thumb']['linktype'][2]==7 && isset($item['thumb']['linktype'][2]) ){ ?>checked<?php } ?> data-idx="2" />
  503. </label>
  504. </div>
  505. </div>
  506. <div class="col-md-12" style="margin-bottom: 20px;">
  507. <div class="input-group url-group" style="display:<?php if( $item['thumb']['linktype'][2]==1 || !isset($item['thumb']['linktype'][2]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link2-1">
  508. <input type="text" class="form-control valid" name="data[link_2]" value="{$item['thumb']['link'][2]}" placeholder="请选择链接" id="advlink3">
  509. <span class="input-group-btn">
  510. <span data-input="#advlink3" class="btn btn-default chose_link">选择链接</span>
  511. </span>
  512. </div>
  513. <!-- webview -->
  514. <div class="url-group layui-input-block " style="margin-left:0;display:<?php if( $item['thumb']['linktype'][2]==0 && isset($item['thumb']['linktype'][2]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link2-0">
  515. <input type="text" class="form-control" name="data[webview_2]" value="{$item['thumb']['webview'][2]}" placeholder="请输入webview链接" value="{$item['thumb']['webview'][2]}">
  516. </div>
  517. <!-- 分类 -->
  518. <div class="url-group layui-input-block " style="margin-left:0;display:<?php if( $item['thumb']['linktype'][2]==3&&isset($item['thumb']['linktype'][2]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link2-3">
  519. <select name='data[cateid_2]' class="form-control select2">
  520. <?php foreach($category as $c){ ?>
  521. <option value="{$c['id']}" <?php if($c['id']==$item['thumb']['cateid'][2]){ ?>selected<?php } ?> >{$c['name']}</option>
  522. <?php } ?>
  523. </select>
  524. </div>
  525. <div class="url-group layui-input-block " style="margin-left:0;display:<?php if( $item['thumb']['linktype'][2]==4&&isset($item['thumb']['linktype'][2]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link2-4">
  526. <select name='data[cateid_2]' class="form-control select2">
  527. <?php foreach($category as $c){ ?>
  528. <option value="{$c['id']}" <?php if($c['id']==$item['thumb']['cateid'][2]){ ?>selected<?php } ?> >{$c['name']}</option>
  529. <?php } ?>
  530. </select>
  531. </div>
  532. <div class="url-group layui-input-block " style="margin-left:0;display:<?php if( $item['thumb']['linktype'][2]==5&&isset($item['thumb']['linktype'][2]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link2-5">
  533. <input type="text" id='appid_2' name="data[appid_2]" class="form-control" placeholder="请输入外链小程序appid" value="{$item['thumb']['appid'][2]}" maxlength="32"/><br />
  534. <input type="text" class="form-control valid" name="data[outlink_2]" value="{$item['thumb']['outlink'][2]}" placeholder="请输入外链小程序链接" id="advlink3_1">
  535. <!--
  536. <span class="input-group-btn">
  537. <span data-input="#advlink1_1" class="btn btn-default chose_link">选择链接</span>
  538. </span>-->
  539. </div>
  540. <!-- 优惠券 -->
  541. <div class="layui-form-item url-group" id="tabs-link2-6" style="display: <?php if( $item['thumb']['linktype'][2]==6&&isset($item['thumb']['linktype'][2]) ){ ?>block<?php }else{ ?>none<?php } ?>;">
  542. <label class="layui-form-label must" style="width: auto;padding: 9px 0;">优惠券</label>
  543. <div class="layui-input-block" style="margin-left: 70px;">
  544. <div class="input-group " style="margin: 0;">
  545. <input type="text" disabled value="" class="form-control valid" placeholder="">
  546. <span class="input-group-btn">
  547. <span data-input="#coupon_id_box_2" data-name="coupon_id_2" class="btn btn-default chose_coupon_id">选择优惠券</span>
  548. </span>
  549. </div>
  550. <div class="multi-audio-details container" id="coupon_id_box_2" style="width:auto;">
  551. <?php if( !empty($couponinfo[2]) ){ ?>
  552. <?php foreach($couponinfo[2] as $c){ ?>
  553. <div class="multi-audio-item " data-id="{$c['id']}">
  554. <div class="input-group">
  555. <input type="text" class="form-control img-textname" readonly="" value="{$c['voucher_title']}">
  556. <input type="hidden" value="{$c['id']}" name="coupon_id_2[]">
  557. <div class="input-group-btn">
  558. <button class="btn btn-default" data-id="{$c['id']}" onclick="cancle_coupon(this, {$c['id']})" type="button"><i class="fa fa-remove"></i></button>
  559. </div>
  560. </div>
  561. </div>
  562. <?php } ?>
  563. <?php } ?>
  564. </div>
  565. </div>
  566. </div>
  567. <div class="layui-form-item url-group" id="tabs-link2-7"></div>
  568. </div>
  569. <div class="col-md-12" style="margin-bottom: 20px;">
  570. {:tpl_form_field_image2('data[thumb_2]', $item['thumb']['cover'][2], '', array('extras'=>array('text'=>'placeholder="必选"')))}
  571. </div>
  572. <hr>
  573. </div>
  574. <div class="row" style="margin-bottom: 20px;<?php if( $item['num']<4 ){ ?>display: none;<?php } ?>">
  575. <div class="layui-form-item">
  576. <label class="layui-form-label text-left w100">链接类型</label>
  577. <div class="layui-input-block ml100">
  578. <label class='radio-inline'>
  579. <input type='radio' name='data[linktype_3]' title="本小程序链接" value="1" lay-filter="linktype"
  580. <?php if( $item['thumb']['linktype'][3]==1 || !isset($item['thumb']['linktype'][3]) ){ ?>checked<?php } ?> data-idx="3" />
  581. </label>
  582. <label class='radio-inline'>
  583. <input type='radio' name='data[linktype_3]' title="webview外链" lay-filter="linktype"
  584. value="0" <?php if( $item['thumb']['linktype'][3]==0 && isset($item['thumb']['linktype'][3]) ){ ?>checked<?php } ?> data-idx="3" />
  585. </label>
  586. <label class='radio-inline'>
  587. <input type='radio' name='data[linktype_3]' title="首页分类" lay-filter="linktype"
  588. value="3" <?php if( $item['thumb']['linktype'][3]==3 && isset($item['thumb']['linktype'][3]) ){ ?>checked<?php } ?> data-idx="3" />
  589. </label>
  590. <label class='radio-inline'>
  591. <input type='radio' name='data[linktype_3]' title="独立分类页" lay-filter="linktype"
  592. value="4" <?php if( $item['thumb']['linktype'][3]==4 && isset($item['thumb']['linktype'][3]) ){ ?>checked<?php } ?> data-idx="3" />
  593. </label>
  594. <label class='radio-inline'>
  595. <input type='radio' name='data[linktype_3]' title="外部小程序链接" lay-filter="linktype"
  596. value="5" <?php if( $item['thumb']['linktype'][3]==5 && isset($item['thumb']['linktype'][3]) ){ ?>checked<?php } ?> data-idx="3" />
  597. </label>
  598. <label class='radio-inline'>
  599. <input type='radio' name='data[linktype_3]' title="优惠券" lay-filter="linktype"
  600. value="6" <?php if( $item['thumb']['linktype'][3]==6 && isset($item['thumb']['linktype'][3]) ){ ?>checked<?php } ?> data-idx="3" />
  601. </label>
  602. <label class='radio-inline'>
  603. <input type='radio' name='data[linktype_3]' title="客服" lay-filter="linktype"
  604. value="7" <?php if( $item['thumb']['linktype'][3]==7 && isset($item['thumb']['linktype'][3]) ){ ?>checked<?php } ?> data-idx="3" />
  605. </label>
  606. </div>
  607. </div>
  608. <div class="col-md-12" style="margin-bottom: 20px;">
  609. <div class="input-group url-group" style="display:<?php if( $item['thumb']['linktype'][3]==1 || !isset($item['thumb']['linktype'][3]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link3-1">
  610. <input type="text" class="form-control valid" name="data[link_3]" value="{$item['thumb']['link'][3]}" placeholder="请选择链接" id="advlink4">
  611. <span class="input-group-btn">
  612. <span data-input="#advlink4" class="btn btn-default chose_link">选择链接</span>
  613. </span>
  614. </div>
  615. <!-- webview -->
  616. <div class="url-group layui-input-block" style="margin-left:0;display:<?php if( $item['thumb']['linktype'][3]==0 && isset($item['thumb']['linktype'][3]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link3-0">
  617. <input type="text" class="form-control" name="data[webview_3]" value="{$item['thumb']['webview'][3]}" placeholder="请输入webview链接" value="{$item['thumb']['webview'][3]}">
  618. </div>
  619. <!-- 分类 -->
  620. <div class="url-group layui-input-block " style="margin-left:0;display:<?php if( $item['thumb']['linktype'][3]==3&&isset($item['thumb']['linktype'][3]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link3-3">
  621. <select name='data[cateid_3]' class="form-control select2">
  622. <?php foreach($category as $c){ ?>
  623. <option value="{$c['id']}" <?php if($c['id']==$item['thumb']['cateid'][3]){ ?>selected<?php } ?> >{$c['name']}</option>
  624. <?php } ?>
  625. </select>
  626. </div>
  627. <div class="url-group layui-input-block " style="margin-left:0;display:<?php if( $item['thumb']['linktype'][3]==4&&isset($item['thumb']['linktype'][3]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link3-4">
  628. <select name='data[cateid_3]' class="form-control select2">
  629. <?php foreach($category as $c){ ?>
  630. <option value="{$c['id']}" <?php if($c['id']==$item['thumb']['cateid'][3]){ ?>selected<?php } ?> >{$c['name']}</option>
  631. <?php } ?>
  632. </select>
  633. </div>
  634. <div class="url-group layui-input-block " style="margin-left:0;display:<?php if( $item['thumb']['linktype'][3]==5&&isset($item['thumb']['linktype'][3]) ){ ?>block<?php }else{ ?>none<?php } ?>;" id="tabs-link3-5">
  635. <input type="text" id='appid_3' name="data[appid_3]" class="form-control" placeholder="请输入外链小程序appid" value="{$item['thumb']['appid'][3]}" maxlength="32"/><br />
  636. <input type="text" class="form-control valid" name="data[outlink_3]" value="{$item['thumb']['outlink'][3]}" placeholder="请输入外链小程序链接" id="advlink4_1">
  637. <!--
  638. <span class="input-group-btn">
  639. <span data-input="#advlink1_1" class="btn btn-default chose_link">选择链接</span>
  640. </span>-->
  641. </div>
  642. <!-- 优惠券 -->
  643. <div class="layui-form-item url-group" id="tabs-link3-6" style="display: <?php if( $item['thumb']['linktype'][3]==6&&isset($item['thumb']['linktype'][3]) ){ ?>block<?php }else{ ?>none<?php } ?>;">
  644. <label class="layui-form-label must" style="width: auto;padding: 9px 0;">优惠券</label>
  645. <div class="layui-input-block" style="margin-left: 70px;">
  646. <div class="input-group " style="margin: 0;">
  647. <input type="text" disabled value="" class="form-control valid" placeholder="">
  648. <span class="input-group-btn">
  649. <span data-input="#coupon_id_box_3" data-name="coupon_id_3" class="btn btn-default chose_coupon_id">选择优惠券</span>
  650. </span>
  651. </div>
  652. <div class="multi-audio-details container" id="coupon_id_box_3" style="width:auto;">
  653. <?php if( !empty($couponinfo[3]) ){ ?>
  654. <?php foreach($couponinfo[3] as $c){ ?>
  655. <div class="multi-audio-item " data-id="{$c['id']}">
  656. <div class="input-group">
  657. <input type="text" class="form-control img-textname" readonly="" value="{$c['voucher_title']}">
  658. <input type="hidden" value="{$c['id']}" name="coupon_id_3[]">
  659. <div class="input-group-btn">
  660. <button class="btn btn-default" data-id="{$c['id']}" onclick="cancle_coupon(this, {$c['id']})" type="button"><i class="fa fa-remove"></i></button>
  661. </div>
  662. </div>
  663. </div>
  664. <?php } ?>
  665. <?php } ?>
  666. </div>
  667. </div>
  668. </div>
  669. <div class="layui-form-item url-group" id="tabs-link3-7"></div>
  670. </div>
  671. <div class="col-md-12">
  672. {:tpl_form_field_image2('data[thumb_3]', $item['thumb']['cover'][3], '', array('extras'=>array('text'=>'placeholder="必选"')))}
  673. </div>
  674. </div>
  675. </div>
  676. </div>
  677. <div class="layui-form-item">
  678. <label class="layui-form-label"> </label>
  679. <div class="layui-input-block">
  680. <input type="hidden" name="data[type]" value="<?php if($item['type']){ ?>{$item['type']}<?php }else{ ?>1<?php } ?>" id="cubeType">
  681. <input type="hidden" name="data[num]" value="<?php if($item['num']){ ?>{$item['num']}<?php }else{ ?>1<?php } ?>" id="cubeNum">
  682. <input type="submit" value="提交" lay-submit lay-filter="formDemo" class="btn btn-primary" id="submitBtn"/>
  683. </div>
  684. </div>
  685. </form>
  686. </div>
  687. </div>
  688. </div>
  689. <script src="/layuiadmin/layui/layui.js"></script>
  690. <script>
  691. layui.config({
  692. base: '/layuiadmin/' //静态资源所在路径
  693. }).extend({
  694. index: 'lib/index' //主入口模块
  695. }).use('index');
  696. $('#selectBox').on('click', '.block-box', function(){
  697. $(this).addClass('active').siblings().removeClass('active');
  698. var type = $(this).data('type');
  699. var num = $(this).data('num');
  700. $('#cubeType').val(type);
  701. $('#cubeNum').val(num);
  702. $('#bkbox').find('.row').filter(":lt(" + num +")").show();
  703. $('#bkbox').find('.row').filter(":gt(" + (num-1) +")").hide();
  704. })
  705. </script>
  706. <script>
  707. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  708. var layer = layui.layer;
  709. var $;
  710. var cur_open_div;
  711. var iptname;
  712. layui.use(['jquery', 'layer', 'form'], function () {
  713. $ = layui.$;
  714. var form = layui.form;
  715. form.on('radio(linktype)', function (data) {
  716. var idx = $(data.elem).data('idx');
  717. var val = data.value;
  718. $('#tabs-link'+ idx + '-' + val).show().siblings('.url-group').hide();
  719. });
  720. $('.chose_link').click(function () {
  721. cur_open_div = $(this).attr('data-input');
  722. $.post("{:U('util/selecturl', array('ok' => 1))}", {}, function (shtml) {
  723. layer.open({
  724. type: 1,
  725. area: '930px',
  726. content: shtml //注意,如果str是object,那么需要字符拼接。
  727. });
  728. });
  729. })
  730. $('.deldom').click(function () {
  731. var s_url = $(this).attr('data-href');
  732. layer.confirm($(this).attr('data-confirm'), function (index) {
  733. $.ajax({
  734. url: s_url,
  735. type: 'post',
  736. dataType: 'json',
  737. success: function (info) {
  738. if (info.status == 0) {
  739. layer.msg(info.result.message, {
  740. icon: 1,
  741. time: 2000
  742. });
  743. } else if (info.status == 1) {
  744. var go_url = location.href;
  745. if (info.result.hasOwnProperty("url")) {
  746. go_url = info.result.url;
  747. }
  748. layer.msg('操作成功', {
  749. time: 1000,
  750. end: function () {
  751. location.href = info.result.url;
  752. }
  753. });
  754. }
  755. }
  756. })
  757. });
  758. })
  759. $('.btn-operation').click(function () {
  760. var ids_arr = [];
  761. var obj = $(this);
  762. var s_toggle = $(this).attr('data-toggle');
  763. var s_url = $(this).attr('data-href');
  764. $("input[name=item_checkbox]").each(function () {
  765. if ($(this).prop('checked')) {
  766. ids_arr.push($(this).val());
  767. }
  768. })
  769. if (ids_arr.length < 1) {
  770. layer.msg('请选择要操作的内容');
  771. } else {
  772. var can_sub = true;
  773. if (s_toggle == 'batch-remove') {
  774. can_sub = false;
  775. layer.confirm($(obj).attr('data-confirm'), function (index) {
  776. $.ajax({
  777. url: s_url,
  778. type: 'post',
  779. dataType: 'json',
  780. data: {
  781. ids: ids_arr
  782. },
  783. success: function (info) {
  784. if (info.status == 0) {
  785. layer.msg(info.result.message, {
  786. icon: 1,
  787. time: 2000
  788. });
  789. } else if (info.status == 1) {
  790. var go_url = location.href;
  791. if (info.result.hasOwnProperty("url")) {
  792. go_url = info.result.url;
  793. }
  794. layer.msg('操作成功', {
  795. time: 1000,
  796. end: function () {
  797. location.href = info.result
  798. .url;
  799. }
  800. });
  801. }
  802. }
  803. })
  804. });
  805. } else {
  806. $.ajax({
  807. url: s_url,
  808. type: 'post',
  809. dataType: 'json',
  810. data: {
  811. ids: ids_arr
  812. },
  813. success: function (info) {
  814. if (info.status == 0) {
  815. layer.msg(info.result.message, {
  816. icon: 1,
  817. time: 2000
  818. });
  819. } else if (info.status == 1) {
  820. var go_url = location.href;
  821. if (info.result.hasOwnProperty("url")) {
  822. go_url = info.result.url;
  823. }
  824. layer.msg('操作成功', {
  825. time: 1000,
  826. end: function () {
  827. location.href = info.result.url;
  828. }
  829. });
  830. }
  831. }
  832. })
  833. }
  834. }
  835. })
  836. form.on('switch(statewsitch)', function (data) {
  837. var s_url = $(this).attr('data-href')
  838. var s_value = 1;
  839. if (data.elem.checked) {
  840. s_value = 1;
  841. } else {
  842. s_value = 0;
  843. }
  844. $.ajax({
  845. url: s_url,
  846. type: 'post',
  847. dataType: 'json',
  848. data: {
  849. value: s_value
  850. },
  851. success: function (info) {
  852. if (info.status == 0) {
  853. layer.msg(info.result.message, {
  854. icon: 1,
  855. time: 2000
  856. });
  857. } else if (info.status == 1) {
  858. var go_url = location.href;
  859. if (info.result.hasOwnProperty("url")) {
  860. go_url = info.result.url;
  861. }
  862. layer.msg('操作成功', {
  863. time: 1000,
  864. end: function () {
  865. location.href = info.result.url;
  866. }
  867. });
  868. }
  869. }
  870. })
  871. });
  872. form.on('checkbox(checkboxall)', function (data) {
  873. if (data.elem.checked) {
  874. $("input[name=item_checkbox]").each(function () {
  875. $(this).prop("checked", true);
  876. });
  877. $("input[name=checkall]").each(function () {
  878. $(this).prop("checked", true);
  879. });
  880. } else {
  881. $("input[name=item_checkbox]").each(function () {
  882. $(this).prop("checked", false);
  883. });
  884. $("input[name=checkall]").each(function () {
  885. $(this).prop("checked", false);
  886. });
  887. }
  888. form.render('checkbox');
  889. });
  890. $('.chose_coupon_id').click(function(){
  891. cur_open_div = $(this).attr('data-input');
  892. iptname = $(this).data('name');
  893. var coupon_ids = [];
  894. var item = $(cur_open_div).find('.multi-audio-item');
  895. item.each(function(){
  896. coupon_ids.push( $(this).attr("data-id") );
  897. })
  898. $.post("{:U('Marketing/couponquery', array('ok' => 1))}", {coupon_ids:coupon_ids}, function(shtml){
  899. layer.open({
  900. type: 1,
  901. area: '930px',
  902. content: shtml //注意,如果str是object,那么需要字符拼接。
  903. });
  904. })
  905. })
  906. var lock = false;
  907. //监听提交
  908. form.on('submit(formDemo)', function (data) {
  909. var cubeNum = $('#cubeNum').val() ? $('#cubeNum').val() : 1;
  910. var thumb_0 = $("input[name='data[thumb_0]']").val();
  911. var thumb_1 = $("input[name='data[thumb_1]']").val();
  912. var thumb_2 = $("input[name='data[thumb_2]']").val();
  913. var thumb_3 = $("input[name='data[thumb_3]']").val();
  914. if(cubeNum==1) {
  915. if(thumb_0=='') {
  916. layer.msg('图片必须上传', {icon: 5});
  917. return false;
  918. }
  919. } else if(cubeNum==2) {
  920. if(thumb_0=='' || thumb_1=='') {
  921. layer.msg('图片必须上传', {icon: 5});
  922. return false;
  923. }
  924. } else if(cubeNum==3) {
  925. if(thumb_0=='' || thumb_1=='' || thumb_2=='') {
  926. layer.msg('图片必须上传', {icon: 5});
  927. return false;
  928. }
  929. } else if(cubeNum==4) {
  930. if(thumb_0=='' || thumb_1=='' || thumb_2=='' || thumb_3=='') {
  931. layer.msg('图片必须上传', {icon: 5});
  932. return false;
  933. }
  934. }
  935. $('#submitBtn').attr('disabled', true);
  936. $.ajax({
  937. url: data.form.action,
  938. type: data.form.method,
  939. data: data.field,
  940. dataType: 'json',
  941. success: function (info) {
  942. if (info.status == 0) {
  943. layer.msg(info.result.message, {
  944. icon: 1,
  945. time: 2000
  946. });
  947. } else if (info.status == 1) {
  948. var go_url = location.href;
  949. if (info.result.hasOwnProperty("url")) {
  950. go_url = info.result.url;
  951. }
  952. console.log(info.result.url+777);
  953. layer.msg('操作成功', {
  954. time: 1000,
  955. end: function () {
  956. location.href = info.result.url;
  957. }
  958. });
  959. }
  960. $('#submitBtn').attr('disabled', "none");
  961. }
  962. });
  963. return false;
  964. });
  965. })
  966. function cancle_coupon(obj,sdiv)
  967. {
  968. $(obj).parents('.multi-audio-item').remove();
  969. }
  970. </script>
  971. </body>