list.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. {extend name="public/layout" /} {block name="title"}活动管理{/block} {block name="body"}
  2. <link rel="stylesheet" href="__LAYUI__/common.css" media="all">
  3. <style type="text/css">
  4. html,
  5. body {
  6. display: block;
  7. min-width: 1100px;
  8. font-family: inherit;
  9. }
  10. .layui-table thead tr,
  11. .layui-table-header {
  12. background-color: #D8E6F1 !important;
  13. }
  14. .layui-fluid {
  15. display: block;
  16. box-shadow: 0 0 4px 0 #B6CADE;
  17. border-radius: 5px;
  18. margin: 15px;
  19. background-color: #ffffff;
  20. }
  21. .layui-form-label {
  22. width: auto;
  23. }
  24. .layui-laydate-range {
  25. width: 581px;
  26. }
  27. .layui-table-page>div {
  28. display: flex;
  29. justify-content: flex-start;
  30. }
  31. .layui-btn-primary,
  32. .layui-btn-primary:hover {
  33. border: 1px solid #249EFB;
  34. background-color: #fff;
  35. color: #249EFB;
  36. }
  37. .layui-form-item .layui-inline {
  38. margin-right: 0px;
  39. }
  40. .layui-btn-normal,
  41. .layui-btn-normal:hover {
  42. border: 1px solid #249EFB;
  43. background-color: #fff;
  44. color: #249EFB;
  45. }
  46. .layui-btn-danger,
  47. .layui-btn-danger:hover {
  48. color: #FF5722;
  49. border: 1px solid #FF5722;
  50. background-color: #fff;
  51. }
  52. .layui-form-select dl {
  53. z-index: 999999999;
  54. }
  55. .ahref {
  56. font-style: normal;
  57. color: #249EFB !important;
  58. }
  59. </style>
  60. <body>
  61. <div class="layui-fluid">
  62. <div class="layui-card">
  63. <div class="layui-form layui-card-header layuiadmin-card-header-auto">
  64. <div class="layui-form-item">
  65. <div class="layui-inline" style="float: left;">
  66. <button class="layui-btn layui-btn-primary layuiadmin-btn-course" data-type="add">添加活动</button>
  67. </div>
  68. <div style="float:right;">
  69. <div class="layui-inline">
  70. <label class="layui-form-label">活动名称</label>
  71. <div class="layui-input-inline">
  72. <input type="text" name="keyword" placeholder="请输入活动名称" autocomplete="off"
  73. class="layui-input">
  74. </div>
  75. </div>
  76. <!-- <div class="layui-inline">
  77. <label class="layui-form-label">分类</label>
  78. <div class="layui-input-inline">
  79. <select name="type" lay-filter="type" id="type">
  80. <option value="">请选择分类</option>
  81. </select>
  82. </div>
  83. </div> -->
  84. <div class="layui-inline">
  85. <label class="layui-form-label">活动时间</label>
  86. <div class="layui-input-inline select-date">
  87. <input type="text" name="date" id="select_date" placeholder="活动时间" autocomplete="off"
  88. class="layui-input">
  89. </div>
  90. </div>
  91. <!-- <div class="layui-inline">
  92. <label class="layui-form-label">标签</label>
  93. <div class="layui-input-inline">
  94. <select name="label" id="label">
  95. <option value="">请选择标签</option>
  96. </select>
  97. </div>
  98. </div> -->
  99. <div class="layui-inline" style="margin-right: 0px;">
  100. <label class="layui-form-label">上传人</label>
  101. <div class="layui-input-inline">
  102. <select name="employee_id" id="employee">
  103. <option value="">请选择人员</option>
  104. {volist name="employee" id="e"}
  105. <option value="{$e.id}">{$e.name}</option>
  106. {/volist}
  107. </select>
  108. </div>
  109. </div>
  110. <div class="layui-inline">
  111. <button class="layui-btn layuiadmin-btn-course searchBtn" lay-submit
  112. lay-filter="LAY-user-front-search">
  113. <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
  114. </button>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. <div class="layui-card-body" style="text-align: center;">
  120. <table id="company-activity" lay-filter="company-activity"></table>
  121. <script type="text/html" id="cover">
  122. {{# if(d.cover){ }}
  123. <img style="display: inline-block; width: 25%; height: 100%;" src="{{d.cover}}?x-oss-process=image/resize,w_50">
  124. {{# }else{ }}
  125. <span style="color: #cccccc;">无</span>
  126. {{# } }}
  127. </script>
  128. <script type="text/html" id="numbertpl">
  129. {{# if(d.number){ }}
  130. <span>{{d.number}}</span>
  131. {{# }else{ }}
  132. <span style="color: #cccccc;">无</span>
  133. {{# } }}
  134. </script>
  135. <script type="text/html" id="type">
  136. {{# if(d.type == 1){ }}
  137. 获客
  138. {{# }else{ }}
  139. 定金
  140. {{# } }}
  141. </script>
  142. <script type="text/html" id="titletpl">
  143. {{# if(d.title){ }}
  144. <span>{{d.title}}</span>
  145. {{# }else{ }}
  146. <span style="color: #cccccc;">无</span>
  147. {{# } }}
  148. </script>
  149. <script type="text/html" id="start_datetpl">
  150. {{# if(d.start_date){ }}
  151. <span>{{d.start_date}}-{{d.end_date}}</span>
  152. {{# }else{ }}
  153. <span style="color: #cccccc;">无</span>
  154. {{# } }}
  155. </script>
  156. <script type="text/html" id="end_datetpl">
  157. {{# if(d.end_date){ }}
  158. <span>{{d.end_date}}</span>
  159. {{# }else{ }}
  160. <span style="color: #cccccc;">无</span>
  161. {{# } }}
  162. </script>
  163. <script type="text/html" id="activitype">
  164. {{# if(d.cate){ }}
  165. <span>外场</span>
  166. {{# }else{ }}
  167. <span>内场</span>
  168. {{# } }}
  169. </script>
  170. <script type="text/html" id="timestate">
  171. {{# if(d.timestate == 0){ }}
  172. <span>预热中</span>
  173. {{# }else if(d.timestate == 1){ }}
  174. <span>进行中</span>
  175. {{# }else{ }}
  176. <span>已结束</span>
  177. {{# } }}
  178. </script>
  179. <script type="text/html" id="show">
  180. <input type="checkbox" name="show" value="{{d.id}}" lay-skin="switch" lay-text="上架|下架" lay-filter="show" {{ d.show == 1 ? 'checked' : '' }} id="clickshow">
  181. </script>
  182. <script type="text/html" id="table-user-bind">
  183. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">
  184. 编辑
  185. </a>
  186. <a class="layui-btn layui-btn-normal layui-btn-xs ahref" href="{:url('activity/source_material')}?id={{d.id}}">
  187. 活动素材
  188. </a>
  189. <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">
  190. <i class="layui-icon layui-icon-delete"></i>
  191. 删除
  192. </a>
  193. </script>
  194. <script type="text/html" id="employee_name">
  195. {{# if(d.opt_name){ }}
  196. <span>{{d.opt_name}}</span>
  197. {{# }else{ }}
  198. <span style="color: #cccccc;">无</span>
  199. {{# } }}
  200. </script>
  201. <script type="text/html" id="qrcode_name">
  202. {{# if(d.qrcode_name){ }}
  203. <span>{{d.qrcode_name}}</span>
  204. {{# }else{ }}
  205. <span style="color: #cccccc;">无</span>
  206. {{# } }}
  207. </script>
  208. </div>
  209. </div>
  210. </div>
  211. </body>
  212. {/block} {block name="js"}
  213. <script>
  214. layui.config({
  215. base: '__LAYUI__/',
  216. urlbase: '/sys'
  217. }).extend({
  218. index: 'lib/index' //主入口模块
  219. }).use(['index', 'form', 'table', 'laydate'], function () {
  220. var $ = layui.$,
  221. form = layui.form,
  222. laydate = layui.laydate,
  223. table = layui.table;
  224. //日期范围
  225. laydate.render({
  226. elem: '#select_date',
  227. range: true
  228. });
  229. //监听搜索
  230. form.on('submit(LAY-user-front-search)', function (data) {
  231. var field = data.field;
  232. //执行重载
  233. table.reload('company-activity', {
  234. where: field
  235. });
  236. });
  237. //事件
  238. var active = {
  239. add: function () {
  240. layer.open({
  241. type: 2,
  242. title: ['活动添加', 'color:#333333;background-color:#D8E6F1;'],
  243. content: '{:url("activity/add")}',
  244. resize: false,
  245. area: ['80%', '80%'],
  246. // btn: ['确定', '取消'],
  247. yes: function (index, layero) {
  248. //点击确认触发 iframe 内容中的按钮提交
  249. // var submit = layero.find('iframe').contents().find("#activity-submit");
  250. // submit.click();
  251. }
  252. });
  253. }
  254. };
  255. //活动列表
  256. table.render({
  257. elem: '#company-activity',
  258. // autoSort: false,
  259. // url: layui.setter.urlbase + '/Activity/list.html',
  260. url: "{:url('activity/list')}",
  261. height: 'full-160',
  262. cols: [
  263. [
  264. // {align:'center',field: 'number',title: '活动编号',width: '7%',templet:'#numbertpl'},
  265. { align: 'center', field: 'title', title: '活动名称', width: '15%', templet: '#titletpl' },
  266. { align: 'center', title: '活动时间', minWidth: 300, templet: '#start_datetpl' },
  267. { align: 'center', field: 'address', title: '活动地点',minWidth: 300 },
  268. { align: 'center', field: 'collect_count', title: '收藏人数',minWidth: 100 },
  269. { align: 'center', field: 'activity_sign_count', title: '报名数量',minWidth: 100 },
  270. { align: 'center', field: 'material_count', title: '素材数量',minWidth: 100 },
  271. { align: 'center', title: '操作', width: '20%', align: 'center', toolbar: '#table-user-bind', fixed: 'right' }
  272. ]
  273. ],
  274. page: true,
  275. // limit: 30,
  276. // height: 'full-220',
  277. text: '对不起,加载出现异常!'
  278. });
  279. //监听审核
  280. table.on('tool(company-activity)', function (obj) {
  281. var data = obj.data;
  282. if (obj.event === 'customer') {
  283. layer.open({
  284. type: 2,
  285. title: ['客户详情', 'color:#333333;background-color:#D8E6F1;'],
  286. content: "{:url('activity/customer')}?id=" + data.id + "&cate=" + data.cate,
  287. // content: layui.setter.urlbase + "/activity/edit/id/" + data.id,
  288. resize: false,
  289. area: ['80%', '80%'],
  290. // btn: ['确定', '取消'],
  291. yes: function (index, layero) {
  292. //点击确认触发 iframe 内容中的按钮提交
  293. // var submit = layero.find('iframe').contents().find("#activity-submit");
  294. // submit.click();
  295. }
  296. });
  297. } else if (obj.event === 'source_material') {
  298. //活动素材
  299. } else if (obj.event === 'edit') {
  300. layer.open({
  301. type: 2,
  302. title: ['活动修改', 'color:#333333;background-color:#D8E6F1;'],
  303. content: "{:url('activity/edit')}?id=" + data.id,
  304. // content: layui.setter.urlbase + "/activity/edit/id/" + data.id,
  305. resize: false,
  306. area: ['80%', '80%'],
  307. // btn: ['确定', '取消'],
  308. yes: function (index, layero) {
  309. //点击确认触发 iframe 内容中的按钮提交
  310. // var submit = layero.find('iframe').contents().find("#activity-submit");
  311. // submit.click();
  312. }
  313. });
  314. } else if (obj.event === 'del') {
  315. layer.confirm('确定删除此活动?', { title: ['信息', 'color:#333333;background-color:#D8E6F1;'], }, function (index) {
  316. $.ajax({
  317. type: 'post',
  318. // url: layui.setter.urlbase + "/activity/del",
  319. url: "{:url('activity/del')}",
  320. data: {
  321. id: data.id
  322. },
  323. success: function (res) {
  324. if (res.code == 0) {
  325. layer.msg(res.msg, {
  326. anim: 0
  327. }, function () {
  328. //执行重载
  329. table.reload('company-activity');
  330. // obj.del();
  331. layer.close(index);
  332. });
  333. } else {
  334. layer.msg(res.msg, {
  335. anim: 6
  336. });
  337. }
  338. }
  339. });
  340. });
  341. } else if (obj.event === 'end') {
  342. layer.confirm('确定结束此活动?', { title: ['信息', 'color:#333333;background-color:#D8E6F1;'], }, function (index) {
  343. $.ajax({
  344. type: 'post',
  345. // url: layui.setter.urlbase + "/activity/del",
  346. url: "{:url('activity/end')}",
  347. data: {
  348. id: data.id
  349. },
  350. success: function (res) {
  351. if (res.code == 0) {
  352. layer.msg(res.msg, {
  353. anim: 0
  354. }, function () {
  355. //执行重载
  356. table.reload('company-activity');
  357. // obj.del();
  358. layer.close(index);
  359. });
  360. } else {
  361. layer.msg(res.msg, {
  362. anim: 6
  363. });
  364. }
  365. }
  366. });
  367. });
  368. } else if (obj.event === 'assign'){
  369. layer.open({
  370. type: 2,
  371. title: ['指派', 'color:#333333;background-color:#D8E6F1;'],
  372. content: '{:url("activity/activity_assign")}?id=' + data.id,
  373. area: ['80%', '80%'],
  374. btn: ['确定', '取消'],
  375. yes: function (index, layero) {
  376. layer.close(index);
  377. //点击确认触发 iframe 内容中的按钮提交
  378. },
  379. end: function () {
  380. }
  381. });
  382. }
  383. });
  384. form.on('switch(show)', function (obj) {
  385. var id = obj.value;
  386. $.ajax({
  387. type: "post",
  388. url: '{:url("activity/show")}',
  389. data: {
  390. id: id
  391. },
  392. success: function (res) {
  393. layer.msg(res.msg);
  394. }
  395. });
  396. });
  397. $('.layui-btn.layuiadmin-btn-course').on('click', function () {
  398. var type = $(this).data('type');
  399. active[type] ? active[type].call(this) : '';
  400. });
  401. //发布
  402. form.on('switch(show)', function (obj) {
  403. // console.log(obj)
  404. // return false;
  405. var id = obj.value;
  406. $.ajax({
  407. type: "post",
  408. url: '{:url("activity/show")}',
  409. data: {
  410. id: id,
  411. cate: 'case'
  412. },
  413. success: function (res) {
  414. layer.msg(res.msg, { time: 2000 });
  415. }
  416. });
  417. });
  418. });
  419. </script>
  420. {/block}