截流自动化的商城平台
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

lists.html 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. {layout name="layout1" /}
  2. <style>
  3. .layui-border-box {
  4. margin-left: 40px;
  5. margin-right: 40px;
  6. }
  7. .record {
  8. display: none;
  9. margin-top: 20px;
  10. }
  11. </style>
  12. <div class="wrapper">
  13. <div class="layui-form">
  14. <div class="layui-card">
  15. <div class="layui-card-body">
  16. <div class="layui-collapse like-layui-collapse" lay-accordion="" style="border:1px dashed #c4c4c4">
  17. <div class="layui-colla-item">
  18. <h2 class="layui-colla-title like-layui-colla-title" style="background-color: #fff">操作提示</h2>
  19. <div class="layui-colla-content layui-show">
  20. <p>*用户每天签到一次可获得每天签到奖励,包括积分和成长值。</p>
  21. <p>*点击新增连续签到奖励可以设置满足连续签到天数时的额外奖励,连续天数规则不能重复。</p>
  22. <p>*用户签到中断会重新计算连续天数;超过设置的最大连续签到奖励天数后,也会重新计算连续天数,循环发放连续奖励。</p>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="layui-tab layui-tab-card" lay-filter="tab-all">
  28. <ul class="layui-tab-title">
  29. <li data-type=1 class="layui-this">签到设置</li>
  30. <li data-type=2>签到记录</li>
  31. </ul>
  32. <div class="layui-card-header"></div>
  33. <div class="layui-form-item record">
  34. <div class="layui-inline">
  35. <label class="layui-form-label">会员信息:</label>
  36. <div class="layui-input-inline">
  37. <select name="type" id="type">
  38. <option value=""></option>
  39. <option value="sn">会员编号</option>
  40. <option value="nickname">会员昵称</option>
  41. <option value="mobile">手机号码</option>
  42. </select>
  43. </div>
  44. <div class="layui-input-inline">
  45. <input type="text" name="keyword" id="keyword" placeholder="请输入关键词" autocomplete="off"
  46. class="layui-input">
  47. </div>
  48. <div class="layui-inline">
  49. <button class="layui-btn layui-btn-sm {$view_theme_color}"lay-submit lay-filter="record-search">查询</button>
  50. <button class="layui-btn layui-btn-sm layui-btn-primary " lay-submit lay-filter="record-clear-search">清空查询</button>
  51. </div>
  52. </div>
  53. </div>
  54. <!--每天签到奖励-->
  55. <div class="layui-form-item sigh">
  56. <label class="layui-form-label " style="margin-left: 20px;width: 100px">每天签到奖励:</label>
  57. <div class="layui-input-inline " style="margin-right: 0px;width: 110px">
  58. <input type="checkbox" name="integral_status" title="赠送积分" min="0" lay-skin="primary" {if
  59. condition="$config['dailySign']['integral_status'] eq 1" }checked{/if}>
  60. </div>
  61. <div class="layui-input-inline">
  62. <input type="number" name="integral" value="{$config.dailySign.integral}" lay-verType="tips" placeholder="请输入积分" autocomplete="off" class="layui-input">
  63. </div>
  64. <div class="layui-input-inline">
  65. <label class="layui-form-mid">积分</label>
  66. </div>
  67. </div>
  68. <div class="layui-form-item sigh">
  69. <label class="layui-form-label" style="margin-left: 20px;width: 100px"></label>
  70. <div class="layui-input-inline" style="margin-right: 0px;width: 110px">
  71. <input type="checkbox" name="growth_status" title="赠送成长值" min="0" lay-skin="primary"
  72. {if condition="$config['dailySign']['growth_status'] eq 1" }checked{/if}>
  73. </div>
  74. <div class="layui-input-inline">
  75. <input type="number" name="growth" value="{$config.dailySign.growth}" lay-vertype="tips" placeholder="请输入成长值" autocomplete="off" class="layui-input">
  76. </div>
  77. <div class="layui-input-inline">
  78. <label class="layui-form-mid">成长值</label>
  79. </div>
  80. </div>
  81. <div class="layui-form-item sigh">
  82. <div class="layui-inline">
  83. <label class="layui-form-label" style="margin-left: 20px;width: 100px">连续签到奖励:</label>
  84. <div class=" layui-form-mid layui-word-aux">连续签到奖励断签后会重新计算连续签到天数,达到连续天数后即可获得连续奖励</div>
  85. </div>
  86. </div>
  87. <!--新增连续签到奖励-->
  88. <div class="layui-form-item sigh">
  89. <div class="layui-inline " style="margin-left: 15px;width: 100px">
  90. <button class="layui-btn layui-btn-sm layEvent {$view_theme_color}" lay-event="add">新增连续签到奖励</button>
  91. </div>
  92. </div>
  93. <div class="layui-card-body" style="margin-top: -20px">
  94. <div class="layui-card">
  95. <table id="like-table-lists" class="layui-border-box" lay-filter="like-table-lists"></table>
  96. <script type="text/html" id="status">
  97. <input type="checkbox" lay-filter="switch-status" data-id={{d.id}} data-field='is_recommend'
  98. lay-skin="switch"
  99. lay-text="是|否" {{# if(d.is_recommend){ }} checked {{# } }}/>
  100. </script>
  101. <!--连续天数-->
  102. <script type="text/html" id="daysTpl">
  103. {{# if( d.days == null || d.days == 0 || d.days == ''){ }}
  104. ----
  105. {{# } else { }}
  106. {{d.days}}天
  107. {{# } }}
  108. </script>
  109. <script type="text/html" id="table-operation">
  110. <a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="edit">编辑</a>
  111. <a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="del">删除</a>
  112. </script>
  113. <!--会员信息-->
  114. <script type="text/html" id="user">
  115. <img src="{{d.avatar}}" style="height:80px;width: 80px" class="image-show">
  116. <div class="layui-input-inline" style="text-align: left">
  117. <p>会员编号:{{d.sn}}</p>
  118. <p>昵称:{{d.nickname}}</p>
  119. <p>手机号:{{d.mobile}}</p>
  120. <p>性别:{{d.sex}}</p>
  121. <p>注册时间:{{d.create_time}}</p>
  122. </div>
  123. </script>
  124. <!--签到奖励-->
  125. <script type="text/html" id="integral">
  126. 赠送{{d.integral}}积分;赠送{{d.growth}}成长值
  127. </script>
  128. <!--连续奖励-->
  129. <script type="text/html" id="continuous_integral">
  130. 赠送{{d.continuous_integral}}积分;赠送{{d.continuous_growth}}成长值
  131. </script>
  132. </div>
  133. </div>
  134. <!--签到规则说明-->
  135. <div class="layui-form-item sigh">
  136. <div class="layui-card">
  137. <label class="layui-form-label" style="margin-left: 20px;width: 100px">签到规则说明:</label>
  138. <div class="layui-input-inline" style="width: 500px">
  139. <textarea name="instructions" id="instructions" placeholder="请输入签到规则说明"
  140. class="layui-textarea" style="width: 500px;height: 200px">{$config.instructions| default=''}</textarea>
  141. </div>
  142. <div class="layui-input-inline">
  143. <button class="layui-btn layui-btn-primary " id="default">使用默认说明
  144. </button>
  145. </div>
  146. </div>
  147. </div>
  148. <div class="layui-form-item sigh">
  149. <label class="layui-form-label" style="width: 100px"></label>
  150. <div class="layui-input-block" style="text-align: center; width: 950px;height: 60px">
  151. <button class="layui-btn layui-btn-sm {$view_theme_color}" lay-submit lay-filter="formSign">
  152. 确认保存
  153. </button>
  154. </div>
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. </div>
  160. <script>
  161. layui.use(['table'], function () {
  162. var $ = layui.$
  163. , form = layui.form
  164. , table = layui.table
  165. , element = layui.element;
  166. //监听搜索
  167. form.on('submit(record-search)', function (data) {
  168. var field = data.field;
  169. //执行重载
  170. table.reload('like-table-lists', {
  171. where: field,
  172. page: {curr: 1}
  173. });
  174. });
  175. //清空记录查询
  176. form.on('submit(record-clear-search)', function () {
  177. $('#keyword').val('');
  178. $('#type').val('');
  179. form.render('select');
  180. table.reload('like-table-lists', {
  181. where: [],
  182. page: {curr: 1}
  183. });
  184. });
  185. //图片放大
  186. $(document).on('click', '.image-show', function () {
  187. var src = $(this).attr('src');
  188. like.showImg(src, 600);
  189. });
  190. getList(1);
  191. //切换列表
  192. element.on('tab(tab-all)', function (data) {
  193. var type = $(this).attr('data-type');
  194. if (type == 1) {
  195. $('.sigh').show();
  196. $('.record').hide();
  197. }
  198. if (type == 2) {
  199. $('.sigh').hide();
  200. $('.record').show();
  201. }
  202. getList(type);
  203. });
  204. //签到规则默认说明
  205. $('#default').click(function () {
  206. $('#instructions').val('1.每天签到可以获得每天签到奖励;\n' +
  207. '2.每日最多可签到1次,断签则会重新计算连签天数,达到连续天数后即可获得连续奖励;\n' +
  208. '3.活动以及奖励最终解释权归商家所有。')
  209. })
  210. //确定保存按钮
  211. form.on('submit(formSign)', function (data) {
  212. set(data, "{:url('sign_daily.SignDaily/signRule')}");
  213. });
  214. function set(data, url) {
  215. like.ajax({
  216. url: url
  217. , data: data.field
  218. , type: "post",
  219. success: function (res) {
  220. if (res.code == 1) {
  221. layui.layer.msg(res.msg, {
  222. offset: '15px'
  223. , icon: 1
  224. , time: 1000
  225. }, function () {
  226. location.href = location.href;
  227. });
  228. }
  229. }
  230. });
  231. }
  232. function getList(type) {
  233. var tablecols = [
  234. {field: 'days', title: '连续天数', templet: '#daysTpl',width:300}
  235. , {field: 'award_tips', title: '连续奖励',width:400}
  236. , {title: '操作', align: 'center', fixed: 'right', toolbar: '#table-operation',width:350}
  237. ];
  238. var page = false;
  239. var url = '{:url("sign_daily.SignDaily/lists")}';
  240. if (type == 2) {
  241. tablecols = [
  242. {type:'numbers',title:'序号'}
  243. , {field: 'user', title: '会员信息', align: 'center',templet:'#user',width:400}
  244. , {field: 'days', title: '连续天数',width:100}
  245. , {field: 'reward_tips', title: '签到奖励',templet:'#integral',width:250}
  246. , {field: 'continuous_reward', title: '连续奖励',templet:'#continuous_integral',width:250}
  247. , {fixed: 'right', field:'sign_time',title:'签到时间',width:250}
  248. ];
  249. page = true;
  250. url = '{:url("sign_daily.SignDaily/record")}';
  251. }
  252. like.tableLists("#like-table-lists", url, tablecols, {}, page);
  253. }
  254. //事件
  255. var active = {
  256. add: function () {
  257. layer.open({
  258. type: 2
  259. , title: '新增连续签到奖励'
  260. , content: '{:url("sign_daily.SignDaily/add",["type"=>2])}'
  261. , area: ['60%', '60%']
  262. , btn: ['确定', '取消']
  263. , yes: function (index, layero) {
  264. var iframeWindow = window['layui-layer-iframe' + index]
  265. , submitID = 'addSubmit'
  266. , submit = layero.find('iframe').contents().find('#' + submitID);
  267. //监听提交
  268. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  269. var field = data.field;
  270. like.ajax({
  271. url: '{:url("sign_daily.SignDaily/add")}',
  272. data: field,
  273. type: "post",
  274. success: function (res) {
  275. if (res.code == 1) {
  276. layui.layer.msg(res.msg, {
  277. offset: '15px'
  278. , icon: 1
  279. , time: 1000
  280. });
  281. layer.close(index);
  282. table.reload('like-table-lists');
  283. }
  284. }
  285. });
  286. });
  287. submit.trigger('click');
  288. }
  289. });
  290. },
  291. edit: function (obj) {
  292. var id = obj.data.id;
  293. layer.open({
  294. type: 2
  295. , title: '编辑连续签到奖励'
  296. , content: '{:url("sign_daily.SignDaily/edit")}?id=' + id
  297. , area: ['60%', '60%']
  298. , btn: ['确定', '取消']
  299. , yes: function (index, layero) {
  300. var iframeWindow = window['layui-layer-iframe' + index]
  301. , submitID = 'edit-sign_daily-submit'
  302. , submit = layero.find('iframe').contents().find('#' + submitID);
  303. //监听提交
  304. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  305. var field = data.field;
  306. like.ajax({
  307. url: '{:url("sign_daily.SignDaily/edit")}',
  308. data: field,
  309. type: "post",
  310. success: function (res) {
  311. if (res.code == 1) {
  312. layui.layer.msg(res.msg, {
  313. offset: '15px'
  314. , icon: 1
  315. , time: 1000
  316. });
  317. layer.close(index);
  318. table.reload('like-table-lists');
  319. }
  320. }
  321. });
  322. });
  323. submit.trigger('click');
  324. }
  325. })
  326. },
  327. del: function (obj) {
  328. var id = obj.data.id;
  329. var day = obj.data.days;
  330. layer.confirm('确定移除连续签到奖励:' + '<span style="color: red">' + day + '天</span>', function (index) {
  331. like.ajax({
  332. url: '{:url("sign_daily.SignDaily/del")}',
  333. data: {'id': id},
  334. type: "post",
  335. success: function (res) {
  336. if (res.code == 1) {
  337. obj.del();
  338. layui.layer.msg(res.msg, {
  339. offset: '15px'
  340. , icon: 1
  341. , time: 1000
  342. });
  343. layer.close(index);
  344. }
  345. },
  346. });
  347. });
  348. }
  349. }
  350. like.eventClick(active);
  351. });
  352. </script>