index.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. {extend name="public/container"}
  2. {block name="content"}
  3. <div class="layui-fluid">
  4. <div class="layui-card">
  5. <div class="layui-card-header">拼团专题</div>
  6. <div class="layui-card-body">
  7. <div class="layui-row layui-col-space15">
  8. <div class="layui-col-md12">
  9. <form class="layui-form layui-form-pane" action="">
  10. <div class="layui-form-item">
  11. <div class="layui-inline">
  12. <label class="layui-form-label">专题搜索</label>
  13. <div class="layui-input-inline">
  14. <input type="text" name="store_name" class="layui-input" placeholder="专栏名称、简介、编号">
  15. </div>
  16. </div>
  17. <div class="layui-inline">
  18. <label class="layui-form-label">专题分类</label>
  19. <div class="layui-input-inline">
  20. <select name="subject_id" lay-search="">
  21. <option value="0">全部</option>
  22. {volist name='subject_list' id='vc'}
  23. <option {if $vc.grade_id==0}disabled{/if} value="{$vc.id}">{$vc.html}{$vc.name}</option>
  24. {/volist}
  25. </select>
  26. </div>
  27. </div>
  28. <div class="layui-inline">
  29. <label class="layui-form-label">状态</label>
  30. <div class="layui-input-inline">
  31. <select name="is_show">
  32. <option value="">全部</option>
  33. <option value="1">上架</option>
  34. <option value="0">下架</option>
  35. </select>
  36. </div>
  37. </div>
  38. <div class="layui-inline">
  39. <label class="layui-form-label">时间范围</label>
  40. <div class="layui-input-inline" style="width: 260px;">
  41. <input type="text" name="datetime" class="layui-input" id="datetime" placeholder="时间范围">
  42. </div>
  43. </div>
  44. <div class="layui-inline">
  45. <div class="layui-input-inline">
  46. <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="search" lay-filter="search">
  47. <i class="layui-icon">&#xe615;</i>搜索
  48. </button>
  49. <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" data-type="refresh" onclick="window.location.reload()">
  50. <i class="layui-icon">&#xe669;</i>刷新
  51. </button>
  52. </div>
  53. </div>
  54. </div>
  55. </form>
  56. </div>
  57. <div class="layui-col-md12">
  58. <table class="layui-hide" id="List" lay-filter="List"></table>
  59. <script type="text/html" id="is_pink">
  60. {{# if(d.is_pink){ }}
  61. <span class="layui-badge layui-bg-blue">开启</span>
  62. {{# }else{ }}
  63. <span class="layui-badge">关闭</span>
  64. {{# } }}
  65. </script>
  66. <script type="text/html" id="is_live_goods">
  67. <input type='checkbox' name='is_live_goods' lay-skin='switch' value="{{d.id}}" lay-filter='is_live_goods' lay-text='是|否' {{ d.is_live_goods == 1 ? 'checked' : '' }}>
  68. </script>
  69. <script type="text/html" id="is_mer_visible">
  70. <input type='checkbox' name='id' lay-skin='switch' value="{{d.id}}" lay-filter='is_mer_visible' lay-text='是|否' {{ d.is_mer_visible == 1 ? 'checked' : '' }}>
  71. </script>
  72. <script type="text/html" id="is_show">
  73. <input type='checkbox' name='id' lay-skin='switch' value="{{d.id}}" lay-filter='is_show' lay-text='上架|下架' {{ d.is_show == 1 ? 'checked' : '' }}>
  74. </script>
  75. <script type="text/html" id="image">
  76. <img width="89" height="50" lay-event='open_image' src="{{d.image}}">
  77. </script>
  78. <script type="text/html" id="quantity">
  79. <p>{{d.quantity}}/{{d.sum}}</p>
  80. <a href="javascript:void(0)" class="layui-badge layui-bg-blue" onclick="$eb.createModalFrame('查看素材','{:Url('source_material')}?id='+{{d.id}}+'&special_type='+{{d.type}},{w:1200,h:800})">
  81. 查看素材
  82. </a>
  83. </script>
  84. <script type="text/html" id="act">
  85. <button type="button" class="layui-btn layui-btn-normal layui-btn-xs" onclick="dropdown(this)">
  86. <i class="layui-icon">&#xe625;</i>操作
  87. </button>
  88. <ul class="layui-nav-child layui-anim layui-anim-upbit">
  89. <li>
  90. <a href="{:Url('ump.store_combination/combina_list')}?cid={{d.id}}&special_type=0">
  91. <i class="fa fa-street-view"></i> 查看拼团
  92. </a>
  93. </li>
  94. <li>
  95. <a href="javascript:void(0)" onclick="$eb.createModalFrame('{{d.title}}-拼团管理','{:Url('pink')}?special_id={{d.id}}',{h:500})">
  96. <i class="fa fa-users"></i> 拼团设置
  97. </a>
  98. </li>
  99. </ul>
  100. </script>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  107. {/block}
  108. {block name="script"}
  109. <script>
  110. //实例化form
  111. layList.form.render();
  112. layList.date({
  113. elem: '#datetime',
  114. type: 'datetime',
  115. range: '~'
  116. });
  117. //加载列表
  118. layList.tableList({o:'List', done:function () {}},"{:Url('pink_list')}",function (){
  119. return [
  120. {field: 'id', title: '编号',width:'5%',align: 'center'},
  121. {field: 'title', title: '名称'},
  122. {field: 'subject_name', title: '分类',align: 'center'},
  123. {field: 'image', title: '封面',templet:'#image',align: 'center',minWidth:119},
  124. {field: 'money', title: '价格',align: 'center',width:'5%'},
  125. {field: 'member_money', title: '会员价',align: 'center',width:'5%'},
  126. {field: 'pink_money', title: '拼团价',align: 'center',width:'5%'},
  127. {field: 'quantity', title: '(已选/总数) 查看素材',align: 'center',width:'7%',templet:'#quantity'},
  128. {field: 'is_pink', title: '拼团状态',templet:'#is_pink',align: 'center',width:'6%'},
  129. {field: 'is_show', title: '状态',templet:'#is_show',align: 'center',minWidth:92},
  130. {field: 'right', title: '操作',align:'center',toolbar:'#act',minWidth:81},
  131. ];
  132. });
  133. //下拉框
  134. $(document).click(function (e) {
  135. $('.layui-nav-child').hide();
  136. });
  137. function dropdown(that){
  138. var oEvent = arguments.callee.caller.arguments[0] || event;
  139. oEvent.stopPropagation();
  140. var offset = $(that).offset();
  141. var top=offset.top-$(window).scrollTop();
  142. var index = $(that).parents('tr').data('index');
  143. $('.layui-nav-child').each(function (key) {
  144. if (key != index) {
  145. $(this).hide();
  146. }
  147. })
  148. if($(document).height() < top+$(that).next('ul').height()){
  149. $(that).next('ul').css({
  150. 'padding': 10,
  151. 'top': - ($(that).parent('td').height() / 2 + $(that).height() + $(that).next('ul').height()/2),
  152. 'min-width': 'inherit',
  153. 'position': 'absolute'
  154. }).toggle();
  155. }else{
  156. $(that).next('ul').css({
  157. 'padding': 10,
  158. 'top':$(that).parent('td').height() / 2 + $(that).height(),
  159. 'min-width': 'inherit',
  160. 'position': 'absolute'
  161. }).toggle();
  162. }
  163. }
  164. //自定义方法
  165. var action= {
  166. set_value: function (field, id, value, model_type) {
  167. layList.baseGet(layList.Url({
  168. a: 'set_value',
  169. q: {field: field, id: id, value: value, model_type:model_type}
  170. }), function (res) {
  171. layList.msg(res.msg);
  172. });
  173. },
  174. //打开新添加页面
  175. open_add: function (url,title) {
  176. layer.open({
  177. type: 2 //Page层类型
  178. ,area: ['100%', '100%']
  179. ,title: title
  180. ,shade: 0.6 //遮罩透明度
  181. ,maxmin: true //允许全屏最小化
  182. ,anim: 1 //0-6的动画形式,-1不开启
  183. ,content: url
  184. ,end:function() {
  185. location.reload();
  186. }
  187. });
  188. }
  189. };
  190. //查询
  191. layList.search('search',function(where){
  192. var arr_time = [];
  193. var start_time = '';
  194. var end_time = '';
  195. if (where.datetime) {
  196. arr_time = where.datetime.split('~');
  197. start_time = arr_time[0].trim();
  198. end_time = arr_time[1].trim();
  199. }
  200. layList.reload({
  201. subject_id: where.subject_id,
  202. is_show: where.is_show,
  203. start_time: start_time,
  204. end_time: end_time,
  205. store_name: where.store_name
  206. },true);
  207. });
  208. layList.switch('is_show',function (odj,value) {
  209. var is_show_value = 0
  210. if(odj.elem.checked==true){
  211. var is_show_value = 1
  212. }
  213. action.set_value('is_show',value,is_show_value,'special');
  214. });
  215. //快速编辑
  216. layList.edit(function (obj) {
  217. var id=obj.data.id,value=obj.value;
  218. switch (obj.field) {
  219. case 'title':
  220. action.set_value('title',id,value,'special');
  221. break;
  222. case 'sort':
  223. if (value.trim()) {
  224. if (isNaN(value.trim())) {
  225. layList.msg('请输入正确的数字');
  226. } else {
  227. if (value.trim() < 0) {
  228. layList.msg('排序不能小于0');
  229. } else if (value.trim() > 9999) {
  230. layList.msg('排序不能大于9999');
  231. } else if (parseInt(value.trim()) != value.trim()) {
  232. layList.msg('排序不能为小数');
  233. } else {
  234. action.set_value('sort', id, value.trim(), 'special');
  235. }
  236. }
  237. } else {
  238. layList.msg('排序不能为空');
  239. }
  240. break;
  241. case 'fake_sales':
  242. action.set_value('fake_sales',id,value,'special');
  243. break;
  244. }
  245. });
  246. //监听并执行排序
  247. layList.sort(['id','sort'],true);
  248. //点击事件绑定
  249. layList.tool(function (event,data,obj) {
  250. switch (event) {
  251. case 'delect':
  252. var url=layList.U({a:'delete',q:{id:data.id, model_type:'special'}});
  253. $eb.$swal('delete',function(){
  254. $eb.axios.get(url).then(function(res){
  255. if(res.status == 200 && res.data.code == 200) {
  256. $eb.$swal('success',res.data.msg);
  257. obj.del();
  258. }else
  259. return Promise.reject(res.data.msg || '删除失败')
  260. }).catch(function(err){
  261. $eb.$swal('error',err);
  262. });
  263. })
  264. break;
  265. case 'open_image':
  266. $eb.openImage(data.image);
  267. break;
  268. }
  269. })
  270. </script>
  271. {/block}