1
0

brand.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. {extend name="public/layout" /} {block name="title"}文章添加{/block}
  2. {block name="head"}
  3. {include file="public/head"}
  4. <style>
  5. html {
  6. height: 91%;
  7. }
  8. body {
  9. height: 100%;
  10. }
  11. .layui-fluid {
  12. display: block;
  13. box-shadow: 0 0 4px 0 #b6cade;
  14. border-radius: 5px;
  15. margin: 15px;
  16. background-color: #ffffff;
  17. height: 100%;
  18. }
  19. </style>
  20. {/block}
  21. {block name="body"}
  22. <body>
  23. <div class="layui-fluid">
  24. <div class="layui-inline tables">
  25. <button class="layui-btn op-btn" data-type="add"><i class="layui-icon layui-icon-edit"></i>新建品牌</button>
  26. </div>
  27. <table lay-filter="brand">
  28. <thead>
  29. <tr>
  30. <th lay-data="{field:'brand_name', align:'center'}">品牌名称</th>
  31. <th lay-data="{field:'logo', align:'center'}">品牌logo</th>
  32. <th lay-data="{field:'shop_num', align:'center'}">公司/店面数量</th>
  33. <th lay-data="{field:'employes_num', align:'center'}">销售人数</th>
  34. <th lay-data="{field:'id', align:'center'}">操作</th>
  35. </tr>
  36. </thead>
  37. <tbody>
  38. {volist name="brands" id="brand"}
  39. <tr>
  40. <td>{$brand.brand_name}</td>
  41. <td><img src="{$brand.logo}" alt="{$brand.brand_name}" style="width: 30px;"></td>
  42. <td>{$brand.shop_count}</td>
  43. <td>{$brand.employee_count}</td>
  44. <td>
  45. <a class="layui-btn layui-btn-normal layui-btn-xs" data-event="edit" data-id="{$brand.id}">编辑</a>
  46. <a class="layui-btn layui-btn-normal layui-btn-xs" data-event="brand" data-id="{$brand.id}">添加公司/店面</a>
  47. <a class="layui-btn layui-btn-normal layui-btn-xs" data-event="shop" data-id="{$brand.id}">店面管理</a>
  48. </td>
  49. </tr>
  50. {/volist}
  51. </tbody>
  52. </table>
  53. </div>
  54. </body>
  55. {/block}
  56. {block name="js"}
  57. <script src="__STATIC__/layui/layui/layui.js"></script>
  58. <script>
  59. layui.config({
  60. base: '__LAYUI__/',
  61. urlbase: '/sys'
  62. }).extend({
  63. index: 'lib/index' //主入口模块
  64. }).use(['form', 'table'], function () {
  65. var table = layui.table,
  66. form = layui.from,
  67. $ = layui.jquery;
  68. table.init('brand');
  69. // 添加编辑操作
  70. active = {
  71. shop(id){
  72. location.href = '{:url("company/shop")}?id='+id;
  73. },
  74. brand(id){
  75. layer.open({
  76. type: 2,
  77. title: '新建店面',
  78. content: '{:url("company/addshop")}?id=' + id,
  79. area: ['30%', '60%'],
  80. })
  81. },
  82. add() {
  83. layer.open({
  84. type: 2,
  85. title: '新建品牌',
  86. content: '{:url("company/addbrand")}',
  87. area: ['45%', '40%'],
  88. })
  89. },
  90. edit(id) {
  91. layer.open({
  92. type: 2,
  93. title: '编辑品牌',
  94. content: '{:url("company/editbrand")}?id='+ id,
  95. area: ['45%', '40%'],
  96. })
  97. }
  98. };
  99. $('table a').click(function(){
  100. let id = $(this).data('id'),
  101. type = $(this).data('event');
  102. active[type] ? active[type](id) : '';
  103. });
  104. $('.tables .layui-btn').on('click', function () {
  105. var type = $(this).data('type');
  106. active[type] ? active[type].call(this) : '';
  107. });
  108. });
  109. </script>
  110. {/block}