截流自动化的商城平台
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. {layout name="layout1" /}
  2. <div class="wrapper">
  3. <div class="layui-card">
  4. <!-- 搜索区域 -->
  5. <div class="layui-card-body layui-form">
  6. <div class="layui-form-item">
  7. <div class="layui-inline">
  8. <label for="name" class="layui-form-label">商品名称:</label>
  9. <div class="layui-inline" style="margin-right:0;">
  10. <div class="layui-input-inline" >
  11. <input type="text" id="name" name="name" autocomplete="off" class="layui-input">
  12. </div>
  13. </div>
  14. </div>
  15. <div class="layui-inline">
  16. <a class="layui-btn layui-btn-sm layui-btn-normal" lay-submit lay-filter="search">搜索</a>
  17. <a class="layui-btn layui-btn-sm layui-btn-primary" lay-submit lay-filter="clear-search">重置</a>
  18. </div>
  19. </div>
  20. </div>
  21. <!-- 主体区域 -->
  22. <div class="layui-card-body">
  23. <table id="like-table-lists" lay-filter="like-table-lists"></table>
  24. <script type="text/html" id="table-activity">
  25. {{# if(d.is_activity=="正常"){ }}正常 {{# } }}
  26. {{# if(d.is_activity!="正常"){ }}<span style="color:red;">{{d.is_activity}}</span> {{# } }}
  27. </script>
  28. </div>
  29. </div>
  30. </div>
  31. <script>
  32. layui.use(["table", "form"], function(){
  33. var table = layui.table;
  34. var form = layui.form;
  35. like.tableLists("#like-table-lists", "{:url()}", [
  36. {type:"radio"}
  37. ,{field:"name", title:"商品名称", templet:"#table-goods"}
  38. ,{field:"market_price", width:100, align:"center",title:"最高价"}
  39. ,{field:"min_price", width:100, align:"center",title:"最低价"}
  40. ,{field:"market_price", width:100, align:"center",title:"市场价"}
  41. ,{field:"stock", width:150, align:"center", title:"库存"}
  42. ,{field:"activity", width:150, align:"center", title:"活动", templet:"#table-activity"}
  43. ]);
  44. form.on("submit(search)", function(data){
  45. table.reload("like-table-lists", {
  46. where: data.field,
  47. page: {
  48. curr: 1
  49. }
  50. });
  51. });
  52. form.on("submit(clear-search)", function(){
  53. $("#name").val("");
  54. $("#cid").val("");
  55. table.reload("like-table-lists", {
  56. where: {},
  57. page: {
  58. curr: 1
  59. }
  60. });
  61. });
  62. });
  63. /**
  64. * 获取选择数据
  65. * @returns {*}
  66. */
  67. var callbackData = function () {
  68. var data = layui.table.checkStatus('like-table-lists').data;
  69. if (data[0]['is_activity'] !== '正常') {
  70. layer.msg("此商品正在参与其他活动,换一个吧", {time:1000});
  71. return [];
  72. }
  73. var index = parent.layer.getFrameIndex(window.name);
  74. parent.layer.close(index);
  75. return data;
  76. }
  77. </script>