123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- {extend name="public/layout" /} {block name="title"}文章添加{/block}
- {block name="head"}
- {include file="public/head"}
- <style>
- html {
- height: 91%;
- }
- body {
- height: 100%;
- }
- .layui-fluid {
- display: block;
- box-shadow: 0 0 4px 0 #b6cade;
- border-radius: 5px;
- margin: 15px;
- background-color: #ffffff;
- height: 100%;
- }
- </style>
- {/block}
- {block name="body"}
- <body>
- <div class="layui-fluid">
- <div class="layui-inline tables">
- <button class="layui-btn op-btn" data-type="add"><i class="layui-icon layui-icon-edit"></i>新建品牌</button>
- </div>
- <table lay-filter="brand">
- <thead>
- <tr>
- <th lay-data="{field:'brand_name', align:'center'}">品牌名称</th>
- <th lay-data="{field:'logo', align:'center'}">品牌logo</th>
- <th lay-data="{field:'shop_num', align:'center'}">公司/店面数量</th>
- <th lay-data="{field:'employes_num', align:'center'}">销售人数</th>
- <th lay-data="{field:'id', align:'center'}">操作</th>
- </tr>
- </thead>
- <tbody>
- {volist name="brands" id="brand"}
- <tr>
- <td>{$brand.brand_name}</td>
- <td><img src="{$brand.logo}" alt="{$brand.brand_name}" style="width: 30px;"></td>
- <td>{$brand.shop_count}</td>
- <td>{$brand.employee_count}</td>
- <td>
- <a class="layui-btn layui-btn-normal layui-btn-xs" data-event="edit" data-id="{$brand.id}">编辑</a>
- <a class="layui-btn layui-btn-normal layui-btn-xs" data-event="brand" data-id="{$brand.id}">添加公司/店面</a>
- <a class="layui-btn layui-btn-normal layui-btn-xs" data-event="shop" data-id="{$brand.id}">店面管理</a>
- </td>
- </tr>
- {/volist}
- </tbody>
- </table>
- </div>
- </body>
- {/block}
- {block name="js"}
- <script src="__STATIC__/layui/layui/layui.js"></script>
- <script>
- layui.config({
- base: '__LAYUI__/',
- urlbase: '/sys'
- }).extend({
- index: 'lib/index' //主入口模块
- }).use(['form', 'table'], function () {
- var table = layui.table,
- form = layui.from,
- $ = layui.jquery;
- table.init('brand');
- // 添加编辑操作
- active = {
- shop(id){
- location.href = '{:url("company/shop")}?id='+id;
- },
- brand(id){
- layer.open({
- type: 2,
- title: '新建店面',
- content: '{:url("company/addshop")}?id=' + id,
- area: ['30%', '60%'],
- })
- },
- add() {
- layer.open({
- type: 2,
- title: '新建品牌',
- content: '{:url("company/addbrand")}',
- area: ['45%', '40%'],
- })
- },
- edit(id) {
- layer.open({
- type: 2,
- title: '编辑品牌',
- content: '{:url("company/editbrand")}?id='+ id,
- area: ['45%', '40%'],
- })
- }
- };
- $('table a').click(function(){
- let id = $(this).data('id'),
- type = $(this).data('event');
- active[type] ? active[type](id) : '';
- });
- $('.tables .layui-btn').on('click', function () {
- var type = $(this).data('type');
- active[type] ? active[type].call(this) : '';
- });
- });
- </script>
- {/block}
|