wupengfei 2 years ago
parent
commit
bd58e83078
37 changed files with 3388 additions and 0 deletions
  1. 145 0
      application/nutrition/controller/Channel.php
  2. 154 0
      application/nutrition/controller/InformationGoods.php
  3. 163 0
      application/nutrition/controller/NewsCate.php
  4. 184 0
      application/nutrition/controller/NewsManage.php
  5. 145 0
      application/nutrition/controller/NewsMaterial.php
  6. 145 0
      application/nutrition/controller/SubHealth.php
  7. 144 0
      application/nutrition/controller/VideoCate.php
  8. 155 0
      application/nutrition/controller/VideoGoods.php
  9. 166 0
      application/nutrition/controller/VideoManage.php
  10. 37 0
      application/nutrition/view/channel/form.html
  11. 65 0
      application/nutrition/view/channel/index.html
  12. 147 0
      application/nutrition/view/information_goods/form.html
  13. 98 0
      application/nutrition/view/information_goods/goods_list.html
  14. 78 0
      application/nutrition/view/information_goods/index.html
  15. 17 0
      application/nutrition/view/information_goods/index_search.html
  16. 77 0
      application/nutrition/view/information_goods/relate_goods.html
  17. 53 0
      application/nutrition/view/news_cate/form.html
  18. 91 0
      application/nutrition/view/news_cate/index.html
  19. 16 0
      application/nutrition/view/news_cate/index_search.html
  20. 203 0
      application/nutrition/view/news_manage/form.html
  21. 91 0
      application/nutrition/view/news_manage/index.html
  22. 33 0
      application/nutrition/view/news_manage/index_search.html
  23. 49 0
      application/nutrition/view/news_material/form.html
  24. 67 0
      application/nutrition/view/news_material/index.html
  25. 50 0
      application/nutrition/view/sub_health/form.html
  26. 65 0
      application/nutrition/view/sub_health/index.html
  27. 36 0
      application/nutrition/view/video_cate/form.html
  28. 66 0
      application/nutrition/view/video_cate/index.html
  29. 16 0
      application/nutrition/view/video_cate/index_search.html
  30. 147 0
      application/nutrition/view/video_goods/form.html
  31. 98 0
      application/nutrition/view/video_goods/goods_list.html
  32. 78 0
      application/nutrition/view/video_goods/index.html
  33. 17 0
      application/nutrition/view/video_goods/index_search.html
  34. 77 0
      application/nutrition/view/video_goods/relate_goods.html
  35. 109 0
      application/nutrition/view/video_manage/form.html
  36. 89 0
      application/nutrition/view/video_manage/index.html
  37. 17 0
      application/nutrition/view/video_manage/index_search.html

+ 145 - 0
application/nutrition/controller/Channel.php

@@ -0,0 +1,145 @@
+<?php
+namespace app\nutrition\controller;
+use library\Controller;
+use think\Db;
+
+/**
+ * 资讯栏目
+ * Class Channel
+ * @package app\mall\controller
+ */
+class Channel extends Controller
+{
+
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'NewsChannel';
+
+    /**
+     * 资讯栏目
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '资讯栏目';
+        $query = $this->_query($this->table)->where('is_deleted',0);
+        $query->like('title');
+        $query->order(' sort desc , id desc')->page();
+    }
+
+    /**
+     * 数据列表处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _index_page_filter(&$data)
+    {
+
+    }
+
+
+
+
+
+
+
+    /**
+     * 添加
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function add()
+    {
+        $this->title = '添加';
+        $this->_form($this->table, 'form');
+    }
+
+
+    /**
+     * 编辑
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function edit()
+    {
+        $this->title = '编辑';
+        $this->_form($this->table, 'form');
+    }
+
+
+
+    /**
+     * 启用
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function enable()
+    {
+        $this->_save($this->table, ['status' => 1]);
+    }
+
+
+    /**
+     * 禁用
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function forbidden()
+    {
+        $this->_save($this->table, ['status' => '0']);
+    }
+
+    /**
+     * 删除
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function del()
+    {
+        $this->_save($this->table, ['is_deleted' => 1]);
+    }
+
+
+    /**
+     * 表单数据处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     */
+    protected function _form_filter(&$data)
+    {
+        $data['create_at'] = date('Y-m-d H:i:s');
+    }
+
+}

+ 154 - 0
application/nutrition/controller/InformationGoods.php

@@ -0,0 +1,154 @@
+<?php
+namespace app\Nutrition\controller;
+use library\Controller;
+use think\Db;
+/**
+ * 资讯商品
+ * Class InformationGoods
+ * @package app\Nutrition\controller
+ */
+class InformationGoods extends Controller
+{
+
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'InformationGoods';
+
+    /**
+     * 列表
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $lid = input('id');
+        $search_name = input('search_name','');
+        $information_info = Db::name('information_article')->find($lid);
+        $this->title = $information_info['title'];
+        $this->lid = $lid;
+        $where = [];
+        $where[]= ['v.news_id','=',$lid];
+        if($search_name) $where[] = ['g.name','like',"%".$search_name."%"];
+        $list = $this->_query($this->table)->alias('v')
+            ->field('v.create_at,v.sort,v.id,v.goods_id,g.name as goods_name,g.cover,g.name,g.low_price,g.status,g.is_deleted')
+            ->where($where)
+            ->join('StoreGoods g','v.goods_id = g.id','LEFT')
+            ->order('v.sort desc ,v.id desc')
+            ->page();
+    }
+
+
+    /**
+     * 数据列表处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _index_page_filter(&$data)
+    {
+        foreach ($data as &$v){
+            $v['goods_num'] = Db::name('InformationGoods')->where('news_id',$v['id'])->count();
+        }
+
+    }
+
+
+
+    /**
+     * 可添加商品列表
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function goods_list()
+    {
+        $lid = input('id');
+        $live_info = Db::name('InformationArticle')->find($lid);
+        $this->title = $live_info['title'];
+        $this->lid = $lid;
+        $name = input('name');
+        $sel_ids = Db::name('InformationGoods')->where(['news_id'=>$lid])->column('goods_id');
+        $where = [];
+        $where[]= ['is_deleted','=',0];
+        $where[]= ['status','=',1];
+        if(!empty($sel_ids)) $where[] = ['id','not in',$sel_ids];
+        if($name) $where[] = ['name','like','%'.$name.'%'];
+        $list = $this->_query('StoreGoods')
+            ->field('id,name,cover,low_price')
+            ->where($where)
+            ->order('sort desc ,id desc')->page();
+        return $this->fetch('goods_list');
+    }
+
+
+    /**
+     * ajax添加商品
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+
+    public function ajax_add()
+    {
+        $sel_goods = input('post.ids');
+        $news_id = input('post.news_id');
+        foreach ($sel_goods as $goods_id){
+            $int_data[]=[
+                'news_id' => $news_id,
+                'goods_id' => $goods_id,
+                'sort' => 0,
+                'create_at' => date("Y-m-d H:i:s")
+            ];
+        }
+        Db::name('InformationGoods')->insertAll($int_data);
+        return json_encode(['code'=>200]);
+    }
+
+
+    /**
+     * 删除关联商品
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function del_goods()
+    {
+        $this->_delete($this->table);
+    }
+
+
+    /**
+     * 表单数据处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     */
+    protected function _form_filter(&$data)
+    {
+
+    }
+    protected function  _form_result($result){
+
+    }
+
+}

+ 163 - 0
application/nutrition/controller/NewsCate.php

@@ -0,0 +1,163 @@
+<?php
+namespace app\Nutrition\controller;
+use library\Controller;
+use think\Db;
+use app\common\model\NewsCate as NTC;
+/**
+ * 营养百科分类
+ * Class NewsCate
+ * @package app\Nutrition\controller
+ */
+class NewsCate extends Controller
+{
+
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'NewsCate';
+
+    /**
+     * 分类列表
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '分类列表';
+        $sel_where = [];
+        $sel_where[] = ['is_deleted','=',0];
+        $sel_where[] = ['pid','=',0];
+        if($title = $this->request->get('title')) $sel_where[] = ['title','like','%'.$title.'%'];
+        $query = $this->_query($this->table)->where($sel_where);
+        $query->dateBetween('create_at')->order('status desc ,sort desc , id desc')->page();
+
+    }
+
+    /**
+     * 数据列表处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _index_page_filter(&$data)
+    {
+        foreach ($data as $k=>&$v){
+            $v['children'] = NTC::where(['pid'=>$v['id'],'is_deleted'=>0])
+                ->order('status desc ,sort desc , id desc')
+                ->select();
+        }
+
+    }
+
+
+
+    /**
+     * 添加分类
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function add()
+    {
+        $this->title = '添加分类';
+        $this->all_cate = NTC::field('id,title')->where('is_deleted',0)->select();
+        $this->_form($this->table, 'form');
+    }
+
+
+    /**
+     * 编辑分类
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function edit()
+    {
+        $this->title = '编辑分类';
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 禁用分类
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function forbidden()
+    {
+        $this->_save($this->table, ['status' => '0']);
+    }
+
+    /**
+     * 启用分类
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function enable()
+    {
+        $this->_save($this->table, ['status' => 1]);
+    }
+
+    /**
+     * 删除分类
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function del()
+    {
+        $this->_save($this->table, ['is_deleted' => 1]);
+    }
+
+
+    /**
+     * 表单数据处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     */
+    protected function _form_filter(&$data)
+    {
+        if($this->request->get()){
+            $this->pid = input('pid',0);
+            $this->pname = NTC::where(['id'=>$this->pid])->value('title');
+            $this->is_desc = 1;
+            if($this->request->action() == 'add'){
+                $this->is_desc =  $this->pid ?1:0;
+            }else{
+                $this->is_desc =  $data['pid'] > 0 ? 1:0;
+            }
+        }
+    }
+
+}

+ 184 - 0
application/nutrition/controller/NewsManage.php

@@ -0,0 +1,184 @@
+<?php
+namespace app\Nutrition\controller;
+use app\common\model\NewsChannel;
+use app\common\model\NutritionCase;
+use library\Controller;
+use think\Db;
+use app\common\model\NewsCate as NTC;
+/**
+ * 资讯管理
+ * Class NewsManage
+ * @package app\Nutrition\controller
+ */
+class NewsManage extends Controller
+{
+
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'InformationArticle';
+
+    /**
+     * 列表
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '资讯列表';
+        $sel_where = [];
+        $sel_where[] = ['is_deleted','=',0];
+        if($title = $this->request->get('title')) $sel_where[] = ['title','like','%'.$title.'%'];
+        if($type = $this->request->get('type')) $sel_where[] = ['type','=',$type];
+        $query = $this->_query($this->table);
+        $query->where($sel_where)->order('status desc ,is_top desc ,sort desc,id desc')->page();
+    }
+
+    /**
+     * 数据列表处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _index_page_filter(&$data)
+    {
+
+
+    }
+
+
+
+    /**
+     * 添加
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function add()
+    {
+        $this->title = '添加资讯';
+        $this->all_cate = NTC::field('id,title')->where('is_deleted',0)->select();
+        $this->_form($this->table, 'form');
+    }
+
+
+    /**
+     * 编辑
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function edit()
+    {
+        $this->title = '编辑资讯';
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 禁用
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function forbidden()
+    {
+        $this->_save($this->table, ['status' => '0']);
+    }
+
+    /**
+     * 启用
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function enable()
+    {
+        $this->_save($this->table, ['status' => 1]);
+    }
+
+    /**
+     * 删除
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function del()
+    {
+        $this->_save($this->table, ['is_deleted' => 1]);
+    }
+
+
+    /**
+     * 表单数据处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     */
+    protected function _form_filter(&$data)
+    {
+
+        if($this->request->isGet()){
+            $all_cate  = NTC::where(['is_deleted'=>0])->order('sort desc ,id desc')->select();
+            $this->cate_tree = make_tree($all_cate);
+            //选中的标签
+            $this->label_arr = isset($data['label']) ? explode('|',trim($data['label'],'|')) : [];
+            $this->case = NutritionCase::column('title','id');
+            $this->news_channel = NewsChannel::where(['is_deleted'=>0,'status'=>1])->order('sort desc ,id desc')->column('title','id');
+        }
+
+
+        if($this->request->isPost())
+        {
+            if($data['type'] == 1 && !$data['cover']){
+                $this->error('请上传封面');
+                $data['video_url'] = '';
+            }
+            if($data['type'] == 2 && !$data['video_url']){
+                $this->error('请上传视频');
+                $data['detail'] = '';
+            }
+            // 服务标签
+            $label_sever = [];
+            if(isset($data['label']) && !empty($data['label'])){
+                foreach ($data['label'] as $key=>$value){
+                    if($value) $label_sever[] = $key;
+                }
+            }
+            $data['label'] = '|'.implode('|',$label_sever).'|';
+        }
+    }
+
+    protected function  _form_result($result){
+        $this->success('商品编辑成功!', 'javascript:history.back()');
+    }
+
+}

+ 145 - 0
application/nutrition/controller/NewsMaterial.php

@@ -0,0 +1,145 @@
+<?php
+namespace app\nutrition\controller;
+use library\Controller;
+use think\Db;
+
+/**
+ * 资讯素材
+ * Class NewsMaterial
+ * @package app\mall\controller
+ */
+class NewsMaterial extends Controller
+{
+
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'NewsMaterial';
+
+    /**
+     * 资讯素材
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '资讯';
+        $query = $this->_query($this->table)->where('is_deleted',0);
+        $query->like('title');
+        $query->order(' sort desc , id desc')->page();
+    }
+
+    /**
+     * 数据列表处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _index_page_filter(&$data)
+    {
+
+    }
+
+
+
+
+
+
+
+    /**
+     * 添加
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function add()
+    {
+        $this->title = '添加';
+        $this->_form($this->table, 'form');
+    }
+
+
+    /**
+     * 编辑
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function edit()
+    {
+        $this->title = '编辑';
+        $this->_form($this->table, 'form');
+    }
+
+
+
+    /**
+     * 启用
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function enable()
+    {
+        $this->_save($this->table, ['status' => 1]);
+    }
+
+
+    /**
+     * 禁用
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function forbidden()
+    {
+        $this->_save($this->table, ['status' => '0']);
+    }
+
+    /**
+     * 删除
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function del()
+    {
+        $this->_save($this->table, ['is_deleted' => 1]);
+    }
+
+
+    /**
+     * 表单数据处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     */
+    protected function _form_filter(&$data)
+    {
+        $data['create_at'] = date('Y-m-d H:i:s');
+    }
+
+}

+ 145 - 0
application/nutrition/controller/SubHealth.php

@@ -0,0 +1,145 @@
+<?php
+namespace app\nutrition\controller;
+use library\Controller;
+use think\Db;
+
+/**
+ * 资讯标签(资讯)
+ * Class SubHealth
+ * @package app\mall\controller
+ */
+class SubHealth extends Controller
+{
+
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'NutritionCase';
+
+    /**
+     * 资讯标签
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '资讯标签';
+        $query = $this->_query($this->table)->where('is_deleted',0);
+        $query->like('title');
+        $query->order(' sort desc , id desc')->page();
+    }
+
+    /**
+     * 数据列表处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _index_page_filter(&$data)
+    {
+
+    }
+
+
+
+
+
+
+
+    /**
+     * 添加
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function add()
+    {
+        $this->title = '添加专题';
+        $this->_form($this->table, 'form');
+    }
+
+
+    /**
+     * 编辑
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function edit()
+    {
+        $this->title = '编辑';
+        $this->_form($this->table, 'form');
+    }
+
+
+
+    /**
+     * 启用
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function enable()
+    {
+        $this->_save($this->table, ['status' => 1]);
+    }
+
+
+    /**
+     * 禁用
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function forbidden()
+    {
+        $this->_save($this->table, ['status' => '0']);
+    }
+
+    /**
+     * 删除
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function del()
+    {
+        $this->_save($this->table, ['is_deleted' => 1]);
+    }
+
+
+    /**
+     * 表单数据处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     */
+    protected function _form_filter(&$data)
+    {
+        $data['create_at'] = date('Y-m-d H:i:s');
+    }
+
+}

+ 144 - 0
application/nutrition/controller/VideoCate.php

@@ -0,0 +1,144 @@
+<?php
+namespace app\Nutrition\controller;
+use library\Controller;
+use think\Db;
+use app\common\model\VideoCate as VCM;
+/**
+ * 视频分类
+ * Class VideoCate
+ * @package app\Nutrition\controller
+ */
+class VideoCate extends Controller
+{
+
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'VideoCate';
+
+    /**
+     * 分类列表
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '分类管理';
+        $query = $this->_query($this->table)->where('is_deleted',0)->like('title');
+        $query->dateBetween('create_at')->order('status desc ,sort desc , id desc')->page();
+
+    }
+
+    /**
+     * 数据列表处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _index_page_filter(&$data)
+    {
+
+    }
+
+
+
+    /**
+     * 添加分类
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function add()
+    {
+        $this->title = '添加分类';
+        $this->_form($this->table, 'form');
+    }
+
+
+    /**
+     * 编辑分类
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function edit()
+    {
+        $this->title = '编辑分类';
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 禁用
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function forbidden()
+    {
+        $this->_save($this->table, ['status' => '0']);
+    }
+
+    /**
+     * 启用分类
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function enable()
+    {
+        $this->_save($this->table, ['status' => 1]);
+    }
+
+    /**
+     * 删除分类
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function del()
+    {
+        $this->_save($this->table, ['is_deleted' => 1]);
+    }
+
+
+    /**
+     * 表单数据处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     */
+    protected function _form_filter(&$data)
+    {
+
+    }
+
+}

+ 155 - 0
application/nutrition/controller/VideoGoods.php

@@ -0,0 +1,155 @@
+<?php
+namespace app\Nutrition\controller;
+use library\Controller;
+use think\Db;
+use app\common\model\VideoCate as VCM;
+/**
+ * 视频商品
+ * Class VideoGoods
+ * @package app\Nutrition\controller
+ */
+class VideoGoods extends Controller
+{
+
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'VideoGoods';
+
+    /**
+     * 列表
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $lid = input('id');
+        $search_name = input('search_name','');
+        $video_info = Db::name('video_intro')->find($lid);
+        $this->title = $video_info['title'];
+        $this->lid = $lid;
+        $where = [];
+        $where[]= ['v.video_id','=',$lid];
+        if($search_name) $where[] = ['g.name','like',"%".$search_name."%"];
+        $list = $this->_query($this->table)->alias('v')
+            ->field('v.create_at,v.sort,v.id,v.goods_id,g.name as goods_name,g.cover,g.name,g.low_price,g.status,g.is_deleted')
+            ->where($where)
+            ->join('StoreGoods g','v.goods_id = g.id','LEFT')
+            ->order('v.sort desc ,v.id desc')
+            ->page();
+    }
+
+
+    /**
+     * 数据列表处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _index_page_filter(&$data)
+    {
+        foreach ($data as &$v){
+            $v['goods_num'] = Db::name('VideoGoods')->where('video_id',$v['id'])->count();
+        }
+
+    }
+
+
+
+    /**
+     * 可添加商品列表
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function goods_list()
+    {
+        $lid = input('id');
+        $live_info = Db::name('VideoIntro')->find($lid);
+        $this->title = $live_info['title'];
+        $this->lid = $lid;
+        $name = input('name');
+        $sel_ids = Db::name('VideoGoods')->where(['video_id'=>$lid])->column('goods_id');
+        $where = [];
+        $where[]= ['is_deleted','=',0];
+        $where[]= ['status','=',1];
+        if(!empty($sel_ids)) $where[] = ['id','not in',$sel_ids];
+        if($name) $where[] = ['name','like','%'.$name.'%'];
+        $list = $this->_query('StoreGoods')
+            ->field('id,name,cover,low_price')
+            ->where($where)
+            ->order('sort desc ,id desc')->page();
+        return $this->fetch('goods_list');
+    }
+
+
+    /**
+     * ajax添加商品
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+
+    public function ajax_add()
+    {
+        $sel_goods = input('post.ids');
+        $video_id = input('post.video_id');
+        foreach ($sel_goods as $goods_id){
+            $int_data[]=[
+                'video_id' => $video_id,
+                'goods_id' => $goods_id,
+                'sort' => 0,
+                'create_at' => date("Y-m-d H:i:s")
+            ];
+        }
+        Db::name('VideoGoods')->insertAll($int_data);
+        return json_encode(['code'=>200]);
+    }
+
+
+    /**
+     * 删除关联商品
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function del_goods()
+    {
+        $this->_delete($this->table);
+    }
+
+
+    /**
+     * 表单数据处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     */
+    protected function _form_filter(&$data)
+    {
+
+    }
+    protected function  _form_result($result){
+
+    }
+
+}

+ 166 - 0
application/nutrition/controller/VideoManage.php

@@ -0,0 +1,166 @@
+<?php
+namespace app\Nutrition\controller;
+use app\common\model\NutritionCase;
+use library\Controller;
+use library\tools\Data;
+use think\Db;
+use app\common\model\VideoCate as VCM;
+/**
+ * 视频管理
+ * Class VideoManage
+ * @package app\Nutrition\controller
+ */
+class VideoManage extends Controller
+{
+
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'VideoIntro';
+
+    /**
+     * 列表
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '视频列表';
+        $video_cate = VCM::field('id,title')->select()->toArray();
+        $this->video_cate = array_column($video_cate,null,'id');
+        $sel_where = [];
+        $sel_where[] = ['is_deleted','=',0];
+        if($title = $this->request->get('title')) $sel_where[] = ['title','like','%'.$title.'%'];
+        $query = $this->_query($this->table);
+        $query->where($sel_where)->order('status desc ,is_top desc ,sort desc,id desc')->page();
+    }
+
+    /**
+     * 数据列表处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _index_page_filter(&$data)
+    {
+
+
+    }
+
+
+
+    /**
+     * 添加
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function add()
+    {
+        $this->title = '添加视频';
+        $this->_form($this->table, 'form');
+    }
+
+
+    /**
+     * 编辑
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function edit()
+    {
+        $this->title = '编辑视频';
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 禁用
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function forbidden()
+    {
+        $this->_save($this->table, ['status' => '0']);
+    }
+
+    /**
+     * 启用
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function enable()
+    {
+        $this->_save($this->table, ['status' => 1]);
+    }
+
+
+
+
+    /**
+     * 删除视频
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function del()
+    {
+        $this->_save($this->table, ['is_deleted' => 1]);
+    }
+
+
+    /**
+     * 表单数据处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     */
+    protected function _form_filter(&$data)
+    {
+        if($this->request->isGet()){
+            $this->cate_tree  = VCM::where(['is_deleted'=>0])->order('sort desc ,id desc')->select();
+        }
+
+        if($this->request->isPost()) {
+            if( !$data['video_url']) $this->error('请上传视频');
+        }
+    }
+    protected function  _form_result($result){
+        if($this->request->isPost()){
+            Data::save('PlatformMessage',['type'=>1,'create_at'=>date('Y-m-d H:i:s'),'content'=>input('post.title'),'relation_id'=>$result],'type',['type'=>1,'relation_id'=>$result]);
+        }
+
+    }
+
+}

+ 37 - 0
application/nutrition/view/channel/form.html

@@ -0,0 +1,37 @@
+<style>
+
+</style>
+<div class="think-box-shadow">
+    <form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
+        <div class="layui-card-body">
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">标题</label>
+                <div class="layui-input-block">
+                    <input name="title" maxlength="20"  value='{$vo.title|default=""}' placeholder="请输入名称" class="layui-input">
+                </div>
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">描述</label>
+                <div class="layui-input-block">
+                    <input name="desc" maxlength="20"  value='{$vo.desc|default=""}' placeholder="请输入描述" class="layui-input">
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">排序</label>
+                <div class="layui-input-block">
+                    <input type="number" name="sort"  value='{$vo.sort|default=""}' placeholder="请输入排序号" class="layui-input">
+                </div>
+            </div>
+            {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+            <div class="layui-form-item text-center">
+                <button class="layui-btn" type='submit'>保 存</button>
+                <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定取消编辑吗?" data-close>取消编辑</button>
+            </div>
+        </div>
+    </form>
+    <script>
+        window.form.render();
+    </script>
+</div>

+ 65 - 0
application/nutrition/view/channel/index.html

@@ -0,0 +1,65 @@
+{extend name='admin@main'}
+
+{block name="button"}
+<button data-modal='{:url("add")}' data-title="添加" class='layui-btn layui-btn-sm layui-btn-primary'>添加</button>
+{/block}
+
+{block name="content"}
+<div class="think-box-shadow">
+    <table class="layui-table margin-top-20" lay-skin="line">
+        <thead>
+        <tr>
+            <th class='text-left nowrap' style="width: 30%">标题</th>
+            <th class='text-left nowrap'>描述</th>
+            <th class='text-left nowrap'>状态</th>
+            <th class="text-left nowrap" >操作</th>
+        </tr>
+        </thead>
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='text-left nowrap'>{$vo.title|default=''}</td>
+            <td class='text-left nowrap'>{$vo.desc|default=''}</td>
+            <td class='text-left nowrap'>{$vo.status == 1 ?'已启用' :'已禁用'}</td>
+            <td class='text-left nowrap' >
+                <a data-title="编辑" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                {if $vo.status == 1}
+                <span class="layui-btn layui-btn-sm layui-btn-warm"  onclick="btn_confirm('禁用','forbidden','{$vo.id}');" >禁 用</span>
+                {else}
+                <span class="layui-btn layui-btn-sm layui-btn-sm"  onclick="btn_confirm('启用','enable','{$vo.id}');">启 用</span>
+                {/if}
+                <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','del','{$vo.id}');">删 除</span>
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    function btn_confirm(msg,fun,id) {
+        layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
+            var url = "/nutrition/channel/"+fun;
+            layer.closeAll();
+            $.ajax({
+                type: "post",
+                url: url,
+                data: {id:id},
+                dataType: "json",
+                async: false,
+                success: function (data) {
+                    layer.msg(data.info);
+                    setTimeout(function () {
+                        window.location.reload();
+                    },1000)
+                }
+            });
+        });
+    }
+
+</script>
+{/block}
+
+
+

+ 147 - 0
application/nutrition/view/information_goods/form.html

@@ -0,0 +1,147 @@
+
+<div class="think-box-shadow">
+    <form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
+        <div class="layui-card-body">
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">标题</label>
+                <div class="layui-input-block">
+                    <input name="title" maxlength="20"  value='{$vo.title|default=""}' placeholder="请输入标题" class="layui-input">
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">分类</label>
+                <div class="layui-input-inline">
+                    <select name="first_classify" lay-filter ="first_classify">
+                        <option value="0">请选择</option>
+                        {if !empty($cate_tree)}
+                        {foreach $cate_tree as $ck=>$cv}
+                        {if  isset($vo.first_classify) && $vo.first_classify == $cv['id'] }
+                        <option selected data-cl_key="{$ck}" value="{$cv['id']}">{$cv['title']}</option>
+                        {else}
+                        <option data-cl_key="{$ck}" value="{$cv['id']}">{$cv['title']}</option>
+                        {/if}
+                        {/foreach}
+                        {/if}
+                    </select>
+                </div>
+                <div class="layui-input-inline">
+                    <select name="second_classify" lay-filter ="second_classify">
+                        <option value="0">请选择</option>
+                        {if !empty($cate_tree)}
+                        {foreach $cate_tree as $ck=>$cv}
+                        {if isset($vo.first_classify) && $vo.first_classify == $cv['id'] }
+                        {if isset($cv['children'])}
+                        {foreach $cv['children'] as $cln}
+                        {if isset($vo.second_classify) && $vo.second_classify == $cln['id'] }
+                        <option selected  value="{$cln['id']}">{$cln['title']}</option>
+                        {else}
+                        <option  value="{$cln['id']}">{$cln['title']}</option>
+                        {/if}
+                        {/foreach}
+                        {/if}
+                        {/if}
+                        {/foreach}
+                        {/if}
+                    </select>
+                </div>
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">封面</label>
+                <div class="layui-input-block">
+                    <input name="cover" type="hidden" value="{$vo.cover|default=''}">
+                </div>
+            </div>
+
+
+            <div class="layui-form-item video">
+                <label class="layui-form-label label-required">视频</label>
+                <div class="layui-input-block">
+                    <input name="video_url" type="hidden" value="{$vo.video_url|default=''}">
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">是否置顶</label>
+                <div class="layui-input-inline">
+                    <select name="is_top" lay-filter ="is_top">
+                        {foreach ['不置顶','置顶'] as $ck=>$cv}
+                        {if !empty($vo.is_top) &&  $vo.is_top == $ck }
+                        <option selected data-cl_key="{$ck}" value="{$ck}">{$cv}</option>
+                        {else}
+                        <option data-cl_key="{$ck}" value="{$ck}">{$cv}</option>
+                        {/if}
+                        {/foreach}
+                    </select>
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">排序</label>
+                <div class="layui-input-block">
+                    <input type="number" name="sort"  value='{$vo.sort|default=""}' placeholder="请输入排序号" class="layui-input">
+                </div>
+            </div>
+
+
+
+            {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+            <div class="layui-form-item text-center">
+                <button class="layui-btn" type='submit'>保 存</button>
+                <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定取消编辑吗?" data-close>取消编辑</button>
+            </div>
+        </div>
+    </form>
+    <script>
+        window.form.render();
+        require(['ckeditor', 'angular'], function () {
+            window.createEditor('[name="detail"]', {height: 500,width:1000});
+        })
+
+        $('[name="cover"]').uploadOneImage();
+        $('[name="video_url"]').uploadOneVideo()
+        // 类型选择监听
+        form.on('select(type)', function(data){
+            if(data.value == 1) {
+                $(".video").hide();
+                $(".detail").show();
+            }else{
+                $(".video").show();
+                $(".detail").hide();
+            }
+            window.form.render();
+        })
+        function check_type() {
+            console.log($("select[name='type']").val());
+            if(  $("select[name='type']").val() == 1) {
+                $(".video").hide();
+                $(".detail").show();
+            }else{
+                $(".video").show();
+                $(".detail").hide();
+            }
+            window.form.render();
+        }
+        check_type()
+
+
+        // 分类选择监听
+        form.on('select(first_classify)', function(data){
+            var cl_html = '<option value="0">请选择</option>';
+            if(data.value == 0) {
+                $("select[name='second_classify']").html(cl_html);
+            }else{
+                var cl_key =  data.elem[data.elem.selectedIndex].dataset.cl_key;
+                var goods_spec = {:json_encode($cate_tree)};
+                $.each(goods_spec[cl_key]['children'],function (ck,cv) {
+                    cl_html +='<option value="'+cv.id+'">'+cv.title+'</option>';
+                })
+                $("select[name='second_classify']").html(cl_html);
+            }
+            window.form.render();
+        })
+
+
+    </script>
+</div>

+ 98 - 0
application/nutrition/view/information_goods/goods_list.html

@@ -0,0 +1,98 @@
+{extend name='admin@main'}
+{block name="button"}
+<a href="javascript:history.go(-1);"  data-title="返 回" class='layui-btn layui-btn-sm layui-btn-primary'>返 回</a>
+{/block}
+{block name="content"}
+<div class="think-box-shadow">
+    <fieldset>
+        <legend>条件搜索</legend>
+        <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+            <input type="hidden" name="id" value="{$lid|default=0}" />
+            <div class="layui-form-item layui-inline">
+                <label class="layui-form-label">商品名称</label>
+                <div class="layui-input-inline">
+                    <input name="name" value="{$Think.get.name|default=''}" placeholder="商品名称" class="layui-input">
+                </div>
+            </div>
+
+            <div class="layui-form-item layui-inline">
+                <button class="layui-btn"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+                <span class="layui-btn" id="add_goods">添 加</span>
+            </div>
+        </form>
+    </fieldset>
+
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='list-table-check-td think-checkbox'><input id="sel_box" data-auto-none data-check-target='.list-check-box' type='checkbox'></th>
+            <th class='text-left nowrap'>商品ID</th>
+            <th class='text-left nowrap'>商品名称</th>
+            <th class='text-left nowrap'>商品图片</th>
+            <th class='text-left nowrap'>最低价</th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
+            <td class='text-left nowrap'>{$vo.id|default=''}</td>
+            <td class='text-left nowrap'>{$vo.name|default=''}</td>
+            <td class='text-left nowrap'><img data-tips-image="{$vo.cover|default=''}"  src="{$vo.cover|default=''}" width="50px"></td>
+            <th class='text-left nowrap'>{$vo.low_price|default=''}</th>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有可添加商品</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    form.render();
+    function btn_confirm(msg,fun,id) {
+        layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
+            var url = "/nutrition/information_goods/"+fun;
+            layer.closeAll();
+            $.ajax({
+                type: "post",
+                url: url,
+                data: {id:id},
+                dataType: "json",
+                async: false,
+                success: function (data) {
+                    layer.msg(data.info);
+                    setTimeout(function () {
+                        window.location.reload();
+                    },1500)
+                }
+            });
+        });
+    }
+
+
+    $("#add_goods").click(function () {
+        var sel_goods = new Array();
+        $.each($(".list-check-box"),function (k,v) {
+            if($(".list-check-box").eq(k).is(":checked")) {
+                sel_goods.push($(".list-check-box").eq(k).val());
+            }
+        })
+        if(sel_goods.length == 0){
+            layer.msg('请选择商品');
+            return false;
+        }
+        var news_id = $("input[name='id']").val();
+        $.post('/nutrition/information_goods/ajax_add',{ids:sel_goods,news_id:news_id},function (res) {
+            layer.msg('添加成功');
+            setTimeout(function () {
+                history.go(-1);
+            },1500)
+        })
+    })
+
+</script>
+{/block}
+
+
+

+ 78 - 0
application/nutrition/view/information_goods/index.html

@@ -0,0 +1,78 @@
+{extend name='admin@main'}
+{block name="button"}
+<a data-open='{:url("goods_list")}?id={$lid}'   data-title="添加商品" class='layui-btn layui-btn-sm layui-btn-primary'>添加商品</a>
+{/block}
+{block name="content"}
+<div class="think-box-shadow">
+    <fieldset>
+        <legend>条件搜索</legend>
+        <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+            <div class="layui-form-item layui-inline">
+                <label class="layui-form-label">商品名称</label>
+                <div class="layui-input-inline">
+                    <input name="search_name" value="{$Think.get.search_name|default=''}" placeholder="" class="layui-input">
+                </div>
+            </div>
+            <div class="layui-form-item layui-inline">
+                <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+            </div>
+        </form>
+    </fieldset>
+
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='list-table-check-td think-checkbox'><input data-auto-none data-check-target='.list-check-box' type='checkbox'></th>
+            <th class='list-table-sort-td'><button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button></th>
+            <th class='text-left nowrap'>商品名称</th>
+            <th class='text-left nowrap'>商品图片</th>
+            <th class='text-left nowrap'>最低价</th>
+            <th class="text-left nowrap">操作</th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
+            <td class='list-table-sort-td'><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></td>
+            <td class='text-left nowrap'>{$vo.goods_name|default=''}</td>
+            <td class='text-left nowrap'><img data-tips-image="{$vo.cover|default=''}"  src="{$vo.cover|default=''}" width="50px"></td>
+            <th class='text-left nowrap'>{$vo.low_price|default=''}</th>
+            <td class='text-left nowrap'>
+                <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','del_goods','{$vo.id}');">删 除</span>
+                <span class="layui-btn layui-btn-sm" data-open='{:url("/mall/store_goods/edit")}?id={$vo.goods_id}' >商品详情</span>
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    form.render();
+    function btn_confirm(msg,fun,id) {
+        layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
+            var url = "/nutrition/information_goods/"+fun;
+            layer.closeAll();
+            $.ajax({
+                type: "post",
+                url: url,
+                data: {id:id},
+                dataType: "json",
+                async: false,
+                success: function (data) {
+                    layer.msg('删除成功');
+                    setTimeout(function () {
+                        window.location.reload();
+                    },1000)
+                }
+            });
+        });
+    }
+</script>
+{/block}
+
+
+

+ 17 - 0
application/nutrition/view/information_goods/index_search.html

@@ -0,0 +1,17 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">标题</label>
+            <div class="layui-input-inline">
+                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入标题" class="layui-input">
+            </div>
+        </div>
+
+
+        <div class="layui-form-item layui-inline">
+            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+        </div>
+    </form>
+    <script>form.render()</script>
+</fieldset>

+ 77 - 0
application/nutrition/view/information_goods/relate_goods.html

@@ -0,0 +1,77 @@
+{extend name='admin@main'}
+{block name="button"}
+<a data-open='{:url("add_goods")}?id={$lid}'   data-title="添加商品" class='layui-btn layui-btn-sm layui-btn-primary'>添加商品</a>
+{/block}
+{block name="content"}
+<div class="think-box-shadow">
+    <fieldset>
+        <legend>条件搜索</legend>
+        <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+            <div class="layui-form-item layui-inline">
+                <label class="layui-form-label">商品名称</label>
+                <div class="layui-input-inline">
+                    <input name="search_name" value="{$Think.get.search_name|default=''}" placeholder="" class="layui-input">
+                </div>
+            </div>
+            <div class="layui-form-item layui-inline">
+                <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+            </div>
+        </form>
+    </fieldset>
+
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='list-table-check-td think-checkbox'><input data-auto-none data-check-target='.list-check-box' type='checkbox'></th>
+            <th class='list-table-sort-td'><button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button></th>
+            <th class='text-left nowrap'>商品名称</th>
+            <th class='text-left nowrap'>商品图片</th>
+            <th class='text-left nowrap'>最低价</th>
+            <th class="text-left nowrap">操作</th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
+            <td class='list-table-sort-td'><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></td>
+            <td class='text-left nowrap'>{$vo.goods_name|default=''}</td>
+            <td class='text-left nowrap'><img data-tips-image="{$vo.cover|default=''}"  src="{$vo.cover|default=''}" width="50px"></td>
+            <th class='text-left nowrap'>{$vo.low_price|default=''}</th>
+            <td class='text-left nowrap'>
+                <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','del_goods','{$vo.id}');">删 除</span>
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    form.render();
+    function btn_confirm(msg,fun,id) {
+        layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
+            var url = "/mall/video_manage/"+fun;
+            layer.closeAll();
+            $.ajax({
+                type: "post",
+                url: url,
+                data: {id:id},
+                dataType: "json",
+                async: false,
+                success: function (data) {
+                    layer.msg('删除成功');
+                    setTimeout(function () {
+                        window.location.reload();
+                    },1000)
+                }
+            });
+        });
+    }
+</script>
+{/block}
+
+
+

+ 53 - 0
application/nutrition/view/news_cate/form.html

@@ -0,0 +1,53 @@
+<div class="think-box-shadow">
+    <form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
+        <div class="layui-card-body">
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">上级分类</label>
+                <div class="layui-input-block">
+                    <input name="pid" type="hidden" maxlength="20"  value='{$Think.get.pid|default="0"}'>
+                    <input  maxlength="20" style="background-color: #e6e6e6" readonly  value='{$pname|default="顶级分类"}' placeholder="" class="layui-input">
+                </div>
+            </div>
+
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">分类名称</label>
+                <div class="layui-input-block">
+                    <input name="title" maxlength="20"  value='{$vo.title|default=""}' placeholder="请输入分类名称" class="layui-input">
+                </div>
+            </div>
+
+            <div class="layui-form-item" {if !$is_desc}style="display:none"{/if} >
+                <label class="layui-form-label label-required" >分类描述</label>
+                <div class="layui-input-block">
+                    <input name="desc" maxlength="20"  value='{$vo.desc|default=""}' placeholder="请输入分类描述内容" class="layui-input">
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">LOGO</label>
+                <div class="layui-input-block">
+                    <input name="logo" type="hidden" value="{$vo.logo|default=''}">
+                </div>
+            </div>
+
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">排序</label>
+                <div class="layui-input-block">
+                    <input type="number" name="sort"  value='{$vo.sort|default=""}' placeholder="请输入排序号" class="layui-input">
+                </div>
+            </div>
+            {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+            <div class="layui-form-item text-center">
+                <button class="layui-btn" type='submit'>保 存</button>
+                <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定取消编辑吗?" data-close>取消编辑</button>
+            </div>
+        </div>
+    </form>
+    <script>
+        window.form.render();
+        $('[name="logo"]').uploadOneImage();
+    </script>
+</div>

+ 91 - 0
application/nutrition/view/news_cate/index.html

@@ -0,0 +1,91 @@
+{extend name='admin@main'}
+
+{block name="button"}
+<button data-modal='{:url("add")}' data-title="添加分类" class='layui-btn layui-btn-sm layui-btn-primary'>添加分类</button>
+{/block}
+
+{block name="content"}
+<div class="think-box-shadow">
+    {include file='news_cate/index_search'}
+    <table class="layui-table margin-top-20" lay-skin="line">
+        <thead>
+        <tr>
+            <th class='list-table-check-td think-checkbox'><input data-auto-none data-check-target='.list-check-box' type='checkbox'></th>
+            <th class='list-table-sort-td'><button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button></th>
+            <th class='text-left nowrap' style="width: 40%">分类名称</th>
+            <th class='text-left nowrap'>LOGO</th>
+            <th class="text-left" style="width: 20%">操作</th>
+        </tr>
+        </thead>
+    </table>
+
+    {foreach $list as $key=>$vo}
+    <table class="layui-table margin-top-10" lay-skin="line">
+        <thead>
+        <tr>
+            <th class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></th>
+            <th class='list-table-sort-td'><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></th>
+            <th class='text-left nowrap' style="width: 40%">{$vo.title|default=''}</th>
+            <th class='text-left nowrap' ><img data-tips-image="{$vo.logo|default=''}"  src="{$vo.logo|default=''}" width="35px"/></th>
+            <th class='text-left' style="width: 20%">
+                <a data-title="编辑分类" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                {if $vo.status == 1}
+                <span class="layui-btn layui-btn-sm layui-btn-warm"  onclick="btn_confirm('禁用','forbidden','{$vo.id}');" >禁 用</span>
+                {else}
+                <span class="layui-btn layui-btn-sm layui-btn-sm"  onclick="btn_confirm('启用','enable','{$vo.id}');">启 用</span>
+                {/if}
+                <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','del','{$vo.id}');">删 除</span>
+                <a data-title="添加" class="layui-btn layui-btn-sm"  data-modal='{:url("add")}?pid={$vo.id}'>添加</a>
+            </th>
+        </tr>
+        </thead>
+        {foreach $vo['children'] as $ck=>$cv}
+        <tbody>
+        <tr>
+            <td class='list-table-check-td think-checkbox'></td>
+            <td class='list-table-sort-td'><input data-action-blur="{:request()->url()}" data-value="id#{$cv.id};action#sort;sort#{value}" data-loading="false" value="{$cv.sort}" class="list-sort-input"></td>
+            <td class='text-left nowrap' style="width: 40%">|-- {$cv.title|default=''}</td>
+            <td class='text-left nowrap' ><img data-tips-image="{$cv.logo|default=''}"  src="{$cv.logo|default=''}" width="35px"/></td>
+            <td class='text-left nowrap'>
+                <a data-title="编辑分类" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$cv.id}&pid={$cv.pid}'>编 辑</a>
+                {if $cv.status == 1}
+                <span class="layui-btn layui-btn-sm layui-btn-warm"  onclick="btn_confirm('禁用','forbidden','{$cv.id}');" >禁 用</span>
+                {else}
+                <span class="layui-btn layui-btn-sm layui-btn-sm"  onclick="btn_confirm('启用','enable','{$cv.id}');">启 用</span>
+                {/if}
+                <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','del','{$cv.id}');">删 除</span>
+            </td>
+        </tr>
+        </tbody>
+        {/foreach}
+    </table>
+    {/foreach}
+
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    function btn_confirm(msg,fun,id) {
+        layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
+            var url = "/mall/nutrition_cate/"+fun;
+            layer.closeAll();
+            $.ajax({
+                type: "post",
+                url: url,
+                data: {id:id},
+                dataType: "json",
+                async: false,
+                success: function (data) {
+                    layer.msg(data.info);
+                    setTimeout(function () {
+                        window.location.reload();
+                    },1000)
+                }
+            });
+        });
+    }
+
+</script>
+{/block}
+
+
+

+ 16 - 0
application/nutrition/view/news_cate/index_search.html

@@ -0,0 +1,16 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">分类名称</label>
+            <div class="layui-input-inline">
+                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入分类名称" class="layui-input">
+            </div>
+        </div>
+
+        <div class="layui-form-item layui-inline">
+            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+        </div>
+    </form>
+    <script>form.render()</script>
+</fieldset>

+ 203 - 0
application/nutrition/view/news_manage/form.html

@@ -0,0 +1,203 @@
+{extend name='admin@main'}
+{block name="content"}
+<div class="think-box-shadow">
+    <form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
+        <div class="layui-card-body">
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">标题</label>
+                <div class="layui-input-block">
+                    <input name="title" maxlength="20"  value='{$vo.title|default=""}' placeholder="请输入标题" class="layui-input">
+                </div>
+            </div>
+
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">资讯栏目</label>
+                <div class="layui-input-inline">
+                    <select name="channel_id" lay-filter ="channel_id">
+                        <option value="0">请选择</option>
+                        {foreach $news_channel as $nk=>$nv}
+                            {if  isset($vo.channel_id) && $vo.channel_id == $nk }
+                                <option selected value="{$nk}">{$nv}</option>
+                            {else}
+                                <option value="{$nk}">{$nv}</option>
+                            {/if}
+                        {/foreach}
+                    </select>
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">分类</label>
+                <div class="layui-input-inline">
+                    <select name="first_classify" lay-filter ="first_classify">
+                        <option value="0">请选择</option>
+                        {if !empty($cate_tree)}
+                        {foreach $cate_tree as $ck=>$cv}
+                        {if  isset($vo.first_classify) && $vo.first_classify == $cv['id'] }
+                        <option selected data-cl_key="{$ck}" value="{$cv['id']}">{$cv['title']}</option>
+                        {else}
+                        <option data-cl_key="{$ck}" value="{$cv['id']}">{$cv['title']}</option>
+                        {/if}
+                        {/foreach}
+                        {/if}
+                    </select>
+                </div>
+
+
+                <div class="layui-input-inline">
+                    <select name="second_classify" lay-filter ="second_classify">
+                        <option value="0">请选择</option>
+                        {if !empty($cate_tree)}
+                        {foreach $cate_tree as $ck=>$cv}
+                        {if isset($vo.first_classify) && $vo.first_classify == $cv['id'] }
+                        {if isset($cv['children'])}
+                        {foreach $cv['children'] as $cln}
+                        {if isset($vo.second_classify) && $vo.second_classify == $cln['id'] }
+                        <option selected  value="{$cln['id']}">{$cln['title']}</option>
+                        {else}
+                        <option  value="{$cln['id']}">{$cln['title']}</option>
+                        {/if}
+                        {/foreach}
+                        {/if}
+                        {/if}
+                        {/foreach}
+                        {/if}
+                    </select>
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label ">资讯标签</label>
+                <div class="layui-input-block">
+                    <div style="display: none;"><input type="checkbox" name="" ></div>
+                    {foreach $case as $key=>$value}
+                    <input type="checkbox" name="label[{$key}]" title="{$value}" {if isset($label_arr) && in_array($key,$label_arr)} checked = "checked" {/if}>
+                    {/foreach}
+                </div>
+            </div>
+
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">类型</label>
+                <div class="layui-input-inline">
+                    <select name="type" lay-filter ="type">
+                        {foreach ['1'=>'文章','2'=>'视频'] as $ck=>$cv}
+                            {if !empty($vo.type) &&  $vo.type == $ck }
+                                <option selected data-cl_key="{$ck}" value="{$ck}">{$cv}</option>
+                            {else}
+                                <option data-cl_key="{$ck}" value="{$ck}">{$cv}</option>
+                            {/if}
+                        {/foreach}
+                    </select>
+                </div>
+            </div>
+
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">是否置顶</label>
+                <div class="layui-input-inline">
+                    <select name="is_top" lay-filter ="is_top">
+                        {foreach ['不置顶','置顶'] as $ck=>$cv}
+                        {if !empty($vo.is_top) &&  $vo.is_top == $ck }
+                        <option selected data-cl_key="{$ck}" value="{$ck}">{$cv}</option>
+                        {else}
+                        <option data-cl_key="{$ck}" value="{$ck}">{$cv}</option>
+                        {/if}
+                        {/foreach}
+                    </select>
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">封面</label>
+                <div class="layui-input-block">
+                    <input name="cover" type="hidden" value="{$vo.cover|default=''}">
+                </div>
+            </div>
+
+            <div class="layui-form-item video" style="display: none">
+                <label class="layui-form-label label-required">视频</label>
+                <div class="layui-input-block">
+                    <input name="video_url" type="hidden" value="{$vo.video_url|default=''}">
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label ">排序</label>
+                <div class="layui-input-block">
+                    <input type="number" name="sort"  value='{$vo.sort|default=""}' placeholder="请输入排序号" class="layui-input">
+                </div>
+            </div>
+
+
+
+            <div class="layui-form-item detail" >
+                <label class="layui-form-label">资讯内容</label>
+                <div class="layui-input-block">
+                    <textarea name="detail">{$vo.detail|default=""}</textarea>
+                </div>
+            </div>
+
+            {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+            <div class="layui-form-item text-center">
+                <button class="layui-btn" type='submit'>保 存</button>
+                <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定取消编辑吗?" data-close>取消编辑</button>
+            </div>
+        </div>
+    </form>
+    <script>
+        window.form.render();
+        require(['ckeditor', 'angular'], function () {
+            window.createEditor('[name="detail"]', {height: 500,width:1000});
+        })
+
+        $('[name="cover"]').uploadOneImage();
+        $('[name="video_url"]').uploadOneVideo()
+        // 分类选择监听
+        form.on('select(type)', function(data){
+            if(data.value == 1) {
+                $(".video").hide();
+                $(".detail").show();
+            }else{
+                $(".video").show();
+                $(".detail").hide();
+            }
+            window.form.render();
+        })
+
+
+        function check_type() {
+            console.log($("select[name='type']").val());
+            if(  $("select[name='type']").val() == 1) {
+                $(".video").hide();
+                $(".detail").show();
+            }else{
+                $(".video").show();
+                $(".detail").hide();
+            }
+            window.form.render();
+        }
+        check_type()
+
+
+        // 分类选择监听
+        form.on('select(first_classify)', function(data){
+            var cl_html = '<option value="0">请选择</option>';
+            if(data.value == 0) {
+                $("select[name='second_classify']").html(cl_html);
+            }else{
+                var cl_key =  data.elem[data.elem.selectedIndex].dataset.cl_key;
+                var goods_spec = {:json_encode($cate_tree)};
+                $.each(goods_spec[cl_key]['children'],function (ck,cv) {
+                    cl_html +='<option value="'+cv.id+'">'+cv.title+'</option>';
+                })
+                $("select[name='second_classify']").html(cl_html);
+            }
+            window.form.render();
+        })
+
+    </script>
+</div>
+{/block}

+ 91 - 0
application/nutrition/view/news_manage/index.html

@@ -0,0 +1,91 @@
+{extend name='admin@main'}
+
+{block name="button"}
+<button data-open='{:url("add")}' data-title="添加" class='layui-btn layui-btn-sm layui-btn-primary'>添加</button>
+{/block}
+
+{block name="content"}
+<div class="think-box-shadow">
+    {include file='news_manage/index_search'}
+    <table class="layui-table margin-top-20" lay-skin="line">
+        <thead>
+        <tr>
+            <th class='text-left nowrap' >标题</th>
+            <th class='text-left nowrap' >封面/视频</th>
+            <th class='text-left nowrap'>类型</th>
+            <th class='text-left nowrap'>状态</th>
+            <th class='text-left nowrap'>置顶</th>
+            <th class="text-left nowrap">操作</th>
+        </tr>
+        </thead>
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='text-left nowrap'>{$vo.title|default=''}</td>
+            <td class='text-left nowrap'>
+                {if $vo.type == 1}
+                    <img data-tips-image="{$vo.cover|default=''}"  src="{$vo.cover|default=''}" width="50px"/>
+                {else}
+                    <img  class="video_player"  alert="点击播放"   src="{$vo.cover|default=''}" data-src="{$vo.video_url|default=''}" style="height: 50px;width: 75px" />
+                {/if}
+            </td>
+            <td class='text-left nowrap'>{$vo.type == 1 ?'文章' :'视频'}</td>
+            <td class='text-left nowrap'>{$vo.status == 1 ?'已启用' :'已禁用'}</td>
+            <td class='text-left nowrap'>{$vo.is_top == 1 ?'是' :'否'}</td>
+            <td class='text-left nowrap' >
+                <a data-title="编辑" class="layui-btn layui-btn-sm" data-open='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                <a data-title="商品管理" class="layui-btn layui-btn-sm layui-btn-normal" data-open='{:url("/nutrition/information_goods/index")}?id={$vo.id}'>商品管理</a>
+                {if $vo.status == 1}
+                <span class="layui-btn layui-btn-sm layui-btn-warm"  onclick="btn_confirm('禁用','forbidden','{$vo.id}');" >禁 用</span>
+                {else}
+                <span class="layui-btn layui-btn-sm layui-btn-sm"  onclick="btn_confirm('启用','enable','{$vo.id}');">启 用</span>
+                {/if}
+                <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','del','{$vo.id}');">删 除</span>
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    function btn_confirm(msg,fun,id) {
+        layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
+            var url = "/nutrition/news_manage/"+fun;
+            layer.closeAll();
+            $.ajax({
+                type: "post",
+                url: url,
+                data: {id:id},
+                dataType: "json",
+                async: false,
+                success: function (data) {
+                    layer.msg(data.info);
+                    setTimeout(function () {
+                        window.location.reload();
+                    },1000)
+                }
+            });
+        });
+    }
+
+    $('.video_player').click(function () {
+        vUrl = $(this).data('src');  //获取到播放的url
+        var loadstr = '<video width="100%" height="100%"  controls="controls" autobuffer="autobuffer"  autoplay="autoplay" loop="loop">' +
+            '<source src='+vUrl+' type="video/mp4"></source></video>';
+        layer.open({
+            type: 1,
+            title: false,
+            area: ['730px', '500px'],
+            shade: [0.8, 'rgb(14, 16, 22)'],
+            skin: 'demo-class',
+            content: loadstr
+        });
+    });
+
+</script>
+{/block}
+
+
+

+ 33 - 0
application/nutrition/view/news_manage/index_search.html

@@ -0,0 +1,33 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">标题</label>
+            <div class="layui-input-inline">
+                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入标题" class="layui-input">
+            </div>
+        </div>
+
+
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">类型</label>
+            <div class="layui-input-inline">
+                <select class="layui-select" name="type">
+                    <option  value="-1">全部</option>
+                    {foreach ['全部','文章','视频'] as $k=>$v}
+                        {if $Think.get.order_status eq $k}
+                        <option selected value="{$k}">{$v}</option>
+                        {else}
+                        <option  value="{$k}">{$v}</option>
+                        {/if}
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+
+        <div class="layui-form-item layui-inline">
+            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+        </div>
+    </form>
+    <script>form.render()</script>
+</fieldset>

+ 49 - 0
application/nutrition/view/news_material/form.html

@@ -0,0 +1,49 @@
+<style>
+
+</style>
+<div class="think-box-shadow">
+    <form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
+        <div class="layui-card-body">
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">标题</label>
+                <div class="layui-input-block">
+                    <input name="title" maxlength="20"  value='{$vo.title|default=""}' placeholder="请输入名称" class="layui-input">
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">素材</label>
+                <div class="layui-input-block">
+                    <input name="cover" type="hidden" value="{$vo.cover|default=''}">
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">类型</label>
+                <div class="layui-input-block">
+                    <select name="type" class="layui-select">
+                        <option value="1" {if isset_full_check($vo,'type',1)}selected{/if}>线上</option>
+                        <option value="2" {if isset_full_check($vo,'type',2)}selected{/if}>线下</option>
+                    </select>
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">排序</label>
+                <div class="layui-input-block">
+                    <input type="number" name="sort"  value='{$vo.sort|default=""}' placeholder="请输入排序号" class="layui-input">
+                </div>
+            </div>
+            {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+            <div class="layui-form-item text-center">
+                <button class="layui-btn" type='submit'>保 存</button>
+                <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定取消编辑吗?" data-close>取消编辑</button>
+            </div>
+        </div>
+    </form>
+    <script>
+        window.form.render();
+        $('[name="cover"]').uploadOneImage();
+    </script>
+</div>

+ 67 - 0
application/nutrition/view/news_material/index.html

@@ -0,0 +1,67 @@
+{extend name='admin@main'}
+
+{block name="button"}
+<button data-modal='{:url("add")}' data-title="添加" class='layui-btn layui-btn-sm layui-btn-primary'>添加</button>
+{/block}
+
+{block name="content"}
+<div class="think-box-shadow">
+    <table class="layui-table margin-top-20" lay-skin="line">
+        <thead>
+        <tr>
+            <th class='text-left nowrap' style="width: 50%">标题</th>
+            <th class='text-left nowrap'>素材</th>
+            <th class='text-left nowrap'>状态</th>
+            <th class="text-left nowrap" >操作</th>
+        </tr>
+        </thead>
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='text-left nowrap'>{$vo.title|default=''}</td>
+            <td class='text-left nowrap'>
+                <img data-tips-image style="width:50px;height:50px" src="{$vo.cover|default=''}" class="margin-right-5 text-top">
+            </td>
+            <td class='text-left nowrap'>{$vo.status == 1 ?'已启用' :'已禁用'}</td>
+            <td class='text-left nowrap' >
+                <a data-title="编辑" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                {if $vo.status == 1}
+                <span class="layui-btn layui-btn-sm layui-btn-warm"  onclick="btn_confirm('禁用','forbidden','{$vo.id}');" >禁 用</span>
+                {else}
+                <span class="layui-btn layui-btn-sm layui-btn-sm"  onclick="btn_confirm('启用','enable','{$vo.id}');">启 用</span>
+                {/if}
+                <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','del','{$vo.id}');">删 除</span>
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    function btn_confirm(msg,fun,id) {
+        layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
+            var url = "/nutrition/news_material/"+fun;
+            layer.closeAll();
+            $.ajax({
+                type: "post",
+                url: url,
+                data: {id:id},
+                dataType: "json",
+                async: false,
+                success: function (data) {
+                    layer.msg(data.info);
+                    setTimeout(function () {
+                        window.location.reload();
+                    },1000)
+                }
+            });
+        });
+    }
+
+</script>
+{/block}
+
+
+

+ 50 - 0
application/nutrition/view/sub_health/form.html

@@ -0,0 +1,50 @@
+<style>
+
+</style>
+<div class="think-box-shadow">
+    <form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
+        <div class="layui-card-body">
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">标题</label>
+                <div class="layui-input-block">
+                    <input name="title" maxlength="20"  value='{$vo.title|default=""}' placeholder="请输入名称" class="layui-input">
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">封面</label>
+                <div class="layui-input-block">
+                    <input name="logo" type="hidden" value="{$vo.logo|default=''}">
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label ">介绍</label>
+                <div class="layui-input-block">
+                    <textarea name="intro">{$vo.intro|default=""}</textarea>
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">排序</label>
+                <div class="layui-input-block">
+                    <input type="number" name="sort"  value='{$vo.sort|default=""}' placeholder="请输入排序号" class="layui-input">
+                </div>
+            </div>
+            {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+            <div class="layui-form-item text-center">
+                <button class="layui-btn" type='submit'>保 存</button>
+                <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定取消编辑吗?" data-close>取消编辑</button>
+            </div>
+        </div>
+    </form>
+    <script>
+        window.form.render();
+        $('[name="logo"]').uploadOneImage();
+        require(['ckeditor', 'angular'], function () {
+            window.createEditor('[name="intro"]', {height: 200,width:610});
+        })
+
+    </script>
+</div>

+ 65 - 0
application/nutrition/view/sub_health/index.html

@@ -0,0 +1,65 @@
+{extend name='admin@main'}
+
+{block name="button"}
+<button data-modal='{:url("add")}' data-title="添加" class='layui-btn layui-btn-sm layui-btn-primary'>添加</button>
+{/block}
+
+{block name="content"}
+<div class="think-box-shadow">
+    <table class="layui-table margin-top-20" lay-skin="line">
+        <thead>
+        <tr>
+            <th class='text-left nowrap' style="width: 50%">标题</th>
+            <th class='text-left nowrap'>封面</th>
+            <th class='text-left nowrap'>状态</th>
+            <th class="text-left nowrap" >操作</th>
+        </tr>
+        </thead>
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='text-left nowrap'>{$vo.title|default=''}</td>
+            <td class='text-left nowrap'><img data-tips-image="{$vo.logo|default=''}"  src="{$vo.logo|default=''}" width="50px"></td>
+            <td class='text-left nowrap'>{$vo.status == 1 ?'已启用' :'已禁用'}</td>
+            <td class='text-left nowrap' >
+                <a data-title="编辑" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                {if $vo.status == 1}
+                <span class="layui-btn layui-btn-sm layui-btn-warm"  onclick="btn_confirm('禁用','forbidden','{$vo.id}');" >禁 用</span>
+                {else}
+                <span class="layui-btn layui-btn-sm layui-btn-sm"  onclick="btn_confirm('启用','enable','{$vo.id}');">启 用</span>
+                {/if}
+                <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','del','{$vo.id}');">删 除</span>
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    function btn_confirm(msg,fun,id) {
+        layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
+            var url = "/nutrition/bub_health/"+fun;
+            layer.closeAll();
+            $.ajax({
+                type: "post",
+                url: url,
+                data: {id:id},
+                dataType: "json",
+                async: false,
+                success: function (data) {
+                    layer.msg(data.info);
+                    setTimeout(function () {
+                        window.location.reload();
+                    },1000)
+                }
+            });
+        });
+    }
+
+</script>
+{/block}
+
+
+

+ 36 - 0
application/nutrition/view/video_cate/form.html

@@ -0,0 +1,36 @@
+<div class="think-box-shadow">
+    <form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
+        <div class="layui-card-body">
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">分类名称</label>
+                <div class="layui-input-block">
+                    <input name="title" maxlength="20"  value='{$vo.title|default=""}' placeholder="请输入分类名称" class="layui-input">
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">LOGO</label>
+                <div class="layui-input-block">
+                    <input name="logo" type="hidden" value="{$vo.logo|default=''}">
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">排序</label>
+                <div class="layui-input-block">
+                    <input type="number" name="sort"  value='{$vo.sort|default=""}' placeholder="请输入排序号" class="layui-input">
+                </div>
+            </div>
+            {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+            <div class="layui-form-item text-center">
+                <button class="layui-btn" type='submit'>保 存</button>
+                <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定取消编辑吗?" data-close>取消编辑</button>
+            </div>
+        </div>
+    </form>
+    <script>
+        window.form.render();
+        $('[name="logo"]').uploadOneImage();
+    </script>
+</div>

+ 66 - 0
application/nutrition/view/video_cate/index.html

@@ -0,0 +1,66 @@
+{extend name='admin@main'}
+
+{block name="button"}
+<button data-modal='{:url("add")}' data-title="添加分类" class='layui-btn layui-btn-sm layui-btn-primary'>添加分类</button>
+{/block}
+
+{block name="content"}
+<div class="think-box-shadow">
+    {include file='video_cate/index_search'}
+    <table class="layui-table margin-top-20" lay-skin="line">
+        <thead>
+        <tr>
+            <th class='list-table-sort-td'><button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button></th>
+            <th class='text-left nowrap'>分类名称</th>
+            <th class='text-left nowrap'>LOGO</th>
+            <th class="text-left" style="width: 30%">操作</th>
+        </tr>
+        </thead>
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+
+            <td class='list-table-sort-td'><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></td>
+            <td class='text-left nowrap'>{$vo.title|default=''}</td>
+            <td class='text-left nowrap'><img data-tips-image="{$vo.logo|default=''}"  src="{$vo.logo|default=''}" width="50px"></td>
+            <td class='text-left' style="width: 20%">
+                <a data-title="编辑分类" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                {if $vo.status == 1}
+                <span class="layui-btn layui-btn-sm layui-btn-warm"  onclick="btn_confirm('禁用','forbidden','{$vo.id}');" >禁 用</span>
+                {else}
+                <span class="layui-btn layui-btn-sm layui-btn-sm"  onclick="btn_confirm('启用','enable','{$vo.id}');">启 用</span>
+                {/if}
+                <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','del','{$vo.id}');">删 除</span>
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    function btn_confirm(msg,fun,id) {
+        layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
+            var url = "/nutrition/video_cate/"+fun;
+            layer.closeAll();
+            $.ajax({
+                type: "post",
+                url: url,
+                data: {id:id},
+                dataType: "json",
+                async: false,
+                success: function (data) {
+                    layer.msg(data.info);
+                    setTimeout(function () {
+                        window.location.reload();
+                    },1000)
+                }
+            });
+        });
+    }
+
+</script>
+{/block}
+
+
+

+ 16 - 0
application/nutrition/view/video_cate/index_search.html

@@ -0,0 +1,16 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">分类名称</label>
+            <div class="layui-input-inline">
+                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入分类名称" class="layui-input">
+            </div>
+        </div>
+
+        <div class="layui-form-item layui-inline">
+            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+        </div>
+    </form>
+    <script>form.render()</script>
+</fieldset>

+ 147 - 0
application/nutrition/view/video_goods/form.html

@@ -0,0 +1,147 @@
+
+<div class="think-box-shadow">
+    <form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
+        <div class="layui-card-body">
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">标题</label>
+                <div class="layui-input-block">
+                    <input name="title" maxlength="20"  value='{$vo.title|default=""}' placeholder="请输入标题" class="layui-input">
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">分类</label>
+                <div class="layui-input-inline">
+                    <select name="first_classify" lay-filter ="first_classify">
+                        <option value="0">请选择</option>
+                        {if !empty($cate_tree)}
+                        {foreach $cate_tree as $ck=>$cv}
+                        {if  isset($vo.first_classify) && $vo.first_classify == $cv['id'] }
+                        <option selected data-cl_key="{$ck}" value="{$cv['id']}">{$cv['title']}</option>
+                        {else}
+                        <option data-cl_key="{$ck}" value="{$cv['id']}">{$cv['title']}</option>
+                        {/if}
+                        {/foreach}
+                        {/if}
+                    </select>
+                </div>
+                <div class="layui-input-inline">
+                    <select name="second_classify" lay-filter ="second_classify">
+                        <option value="0">请选择</option>
+                        {if !empty($cate_tree)}
+                        {foreach $cate_tree as $ck=>$cv}
+                        {if isset($vo.first_classify) && $vo.first_classify == $cv['id'] }
+                        {if isset($cv['children'])}
+                        {foreach $cv['children'] as $cln}
+                        {if isset($vo.second_classify) && $vo.second_classify == $cln['id'] }
+                        <option selected  value="{$cln['id']}">{$cln['title']}</option>
+                        {else}
+                        <option  value="{$cln['id']}">{$cln['title']}</option>
+                        {/if}
+                        {/foreach}
+                        {/if}
+                        {/if}
+                        {/foreach}
+                        {/if}
+                    </select>
+                </div>
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">封面</label>
+                <div class="layui-input-block">
+                    <input name="cover" type="hidden" value="{$vo.cover|default=''}">
+                </div>
+            </div>
+
+
+            <div class="layui-form-item video">
+                <label class="layui-form-label label-required">视频</label>
+                <div class="layui-input-block">
+                    <input name="video_url" type="hidden" value="{$vo.video_url|default=''}">
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">是否置顶</label>
+                <div class="layui-input-inline">
+                    <select name="is_top" lay-filter ="is_top">
+                        {foreach ['不置顶','置顶'] as $ck=>$cv}
+                        {if !empty($vo.is_top) &&  $vo.is_top == $ck }
+                        <option selected data-cl_key="{$ck}" value="{$ck}">{$cv}</option>
+                        {else}
+                        <option data-cl_key="{$ck}" value="{$ck}">{$cv}</option>
+                        {/if}
+                        {/foreach}
+                    </select>
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">排序</label>
+                <div class="layui-input-block">
+                    <input type="number" name="sort"  value='{$vo.sort|default=""}' placeholder="请输入排序号" class="layui-input">
+                </div>
+            </div>
+
+
+
+            {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+            <div class="layui-form-item text-center">
+                <button class="layui-btn" type='submit'>保 存</button>
+                <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定取消编辑吗?" data-close>取消编辑</button>
+            </div>
+        </div>
+    </form>
+    <script>
+        window.form.render();
+        require(['ckeditor', 'angular'], function () {
+            window.createEditor('[name="detail"]', {height: 500,width:1000});
+        })
+
+        $('[name="cover"]').uploadOneImage();
+        $('[name="video_url"]').uploadOneVideo()
+        // 类型选择监听
+        form.on('select(type)', function(data){
+            if(data.value == 1) {
+                $(".video").hide();
+                $(".detail").show();
+            }else{
+                $(".video").show();
+                $(".detail").hide();
+            }
+            window.form.render();
+        })
+        function check_type() {
+            console.log($("select[name='type']").val());
+            if(  $("select[name='type']").val() == 1) {
+                $(".video").hide();
+                $(".detail").show();
+            }else{
+                $(".video").show();
+                $(".detail").hide();
+            }
+            window.form.render();
+        }
+        check_type()
+
+
+        // 分类选择监听
+        form.on('select(first_classify)', function(data){
+            var cl_html = '<option value="0">请选择</option>';
+            if(data.value == 0) {
+                $("select[name='second_classify']").html(cl_html);
+            }else{
+                var cl_key =  data.elem[data.elem.selectedIndex].dataset.cl_key;
+                var goods_spec = {:json_encode($cate_tree)};
+                $.each(goods_spec[cl_key]['children'],function (ck,cv) {
+                    cl_html +='<option value="'+cv.id+'">'+cv.title+'</option>';
+                })
+                $("select[name='second_classify']").html(cl_html);
+            }
+            window.form.render();
+        })
+
+
+    </script>
+</div>

+ 98 - 0
application/nutrition/view/video_goods/goods_list.html

@@ -0,0 +1,98 @@
+{extend name='admin@main'}
+{block name="button"}
+<a href="javascript:history.go(-1);"  data-title="返 回" class='layui-btn layui-btn-sm layui-btn-primary'>返 回</a>
+{/block}
+{block name="content"}
+<div class="think-box-shadow">
+    <fieldset>
+        <legend>条件搜索</legend>
+        <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+            <input type="hidden" name="id" value="{$lid|default=0}" />
+            <div class="layui-form-item layui-inline">
+                <label class="layui-form-label">商品名称</label>
+                <div class="layui-input-inline">
+                    <input name="name" value="{$Think.get.name|default=''}" placeholder="商品名称" class="layui-input">
+                </div>
+            </div>
+
+            <div class="layui-form-item layui-inline">
+                <button class="layui-btn"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+                <span class="layui-btn" id="add_goods">添 加</span>
+            </div>
+        </form>
+    </fieldset>
+
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='list-table-check-td think-checkbox'><input id="sel_box" data-auto-none data-check-target='.list-check-box' type='checkbox'></th>
+            <th class='text-left nowrap'>商品ID</th>
+            <th class='text-left nowrap'>商品名称</th>
+            <th class='text-left nowrap'>商品图片</th>
+            <th class='text-left nowrap'>最低价</th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
+            <td class='text-left nowrap'>{$vo.id|default=''}</td>
+            <td class='text-left nowrap'>{$vo.name|default=''}</td>
+            <td class='text-left nowrap'><img data-tips-image="{$vo.cover|default=''}"  src="{$vo.cover|default=''}" width="50px"></td>
+            <th class='text-left nowrap'>{$vo.low_price|default=''}</th>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有可添加商品</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    form.render();
+    function btn_confirm(msg,fun,id) {
+        layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
+            var url = "/nutrition/video_goods/"+fun;
+            layer.closeAll();
+            $.ajax({
+                type: "post",
+                url: url,
+                data: {id:id},
+                dataType: "json",
+                async: false,
+                success: function (data) {
+                    layer.msg(data.info);
+                    setTimeout(function () {
+                        window.location.reload();
+                    },1500)
+                }
+            });
+        });
+    }
+
+
+    $("#add_goods").click(function () {
+        var sel_goods = new Array();
+        $.each($(".list-check-box"),function (k,v) {
+            if($(".list-check-box").eq(k).is(":checked")) {
+                sel_goods.push($(".list-check-box").eq(k).val());
+            }
+        })
+        if(sel_goods.length == 0){
+            layer.msg('请选择商品');
+            return false;
+        }
+        var video_id = $("input[name='id']").val();
+        $.post('/nutrition/video_goods/ajax_add',{ids:sel_goods,video_id:video_id},function (res) {
+            layer.msg('添加成功');
+            setTimeout(function () {
+                history.go(-1);
+            },1500)
+        })
+    })
+
+</script>
+{/block}
+
+
+

+ 78 - 0
application/nutrition/view/video_goods/index.html

@@ -0,0 +1,78 @@
+{extend name='admin@main'}
+{block name="button"}
+<a data-open='{:url("goods_list")}?id={$lid}'   data-title="添加商品" class='layui-btn layui-btn-sm layui-btn-primary'>添加商品</a>
+{/block}
+{block name="content"}
+<div class="think-box-shadow">
+    <fieldset>
+        <legend>条件搜索</legend>
+        <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+            <div class="layui-form-item layui-inline">
+                <label class="layui-form-label">商品名称</label>
+                <div class="layui-input-inline">
+                    <input name="search_name" value="{$Think.get.search_name|default=''}" placeholder="" class="layui-input">
+                </div>
+            </div>
+            <div class="layui-form-item layui-inline">
+                <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+            </div>
+        </form>
+    </fieldset>
+
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='list-table-check-td think-checkbox'><input data-auto-none data-check-target='.list-check-box' type='checkbox'></th>
+            <th class='list-table-sort-td'><button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button></th>
+            <th class='text-left nowrap'>商品名称</th>
+            <th class='text-left nowrap'>商品图片</th>
+            <th class='text-left nowrap'>最低价</th>
+            <th class="text-left nowrap">操作</th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
+            <td class='list-table-sort-td'><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></td>
+            <td class='text-left nowrap'>{$vo.goods_name|default=''}</td>
+            <td class='text-left nowrap'><img data-tips-image="{$vo.cover|default=''}"  src="{$vo.cover|default=''}" width="50px"></td>
+            <th class='text-left nowrap'>{$vo.low_price|default=''}</th>
+            <td class='text-left nowrap'>
+                <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','del_goods','{$vo.id}');">删 除</span>
+                <span class="layui-btn layui-btn-sm" data-open='{:url("/mall/store_goods/edit")}?id={$vo.goods_id}' >商品详情</span>
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    form.render();
+    function btn_confirm(msg,fun,id) {
+        layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
+            var url = "/nutrition/video_goods/"+fun;
+            layer.closeAll();
+            $.ajax({
+                type: "post",
+                url: url,
+                data: {id:id},
+                dataType: "json",
+                async: false,
+                success: function (data) {
+                    layer.msg('删除成功');
+                    setTimeout(function () {
+                        window.location.reload();
+                    },1000)
+                }
+            });
+        });
+    }
+</script>
+{/block}
+
+
+

+ 17 - 0
application/nutrition/view/video_goods/index_search.html

@@ -0,0 +1,17 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">标题</label>
+            <div class="layui-input-inline">
+                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入标题" class="layui-input">
+            </div>
+        </div>
+
+
+        <div class="layui-form-item layui-inline">
+            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+        </div>
+    </form>
+    <script>form.render()</script>
+</fieldset>

+ 77 - 0
application/nutrition/view/video_goods/relate_goods.html

@@ -0,0 +1,77 @@
+{extend name='admin@main'}
+{block name="button"}
+<a data-open='{:url("add_goods")}?id={$lid}'   data-title="添加商品" class='layui-btn layui-btn-sm layui-btn-primary'>添加商品</a>
+{/block}
+{block name="content"}
+<div class="think-box-shadow">
+    <fieldset>
+        <legend>条件搜索</legend>
+        <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+            <div class="layui-form-item layui-inline">
+                <label class="layui-form-label">商品名称</label>
+                <div class="layui-input-inline">
+                    <input name="search_name" value="{$Think.get.search_name|default=''}" placeholder="" class="layui-input">
+                </div>
+            </div>
+            <div class="layui-form-item layui-inline">
+                <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+            </div>
+        </form>
+    </fieldset>
+
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='list-table-check-td think-checkbox'><input data-auto-none data-check-target='.list-check-box' type='checkbox'></th>
+            <th class='list-table-sort-td'><button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button></th>
+            <th class='text-left nowrap'>商品名称</th>
+            <th class='text-left nowrap'>商品图片</th>
+            <th class='text-left nowrap'>最低价</th>
+            <th class="text-left nowrap">操作</th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
+            <td class='list-table-sort-td'><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></td>
+            <td class='text-left nowrap'>{$vo.goods_name|default=''}</td>
+            <td class='text-left nowrap'><img data-tips-image="{$vo.cover|default=''}"  src="{$vo.cover|default=''}" width="50px"></td>
+            <th class='text-left nowrap'>{$vo.low_price|default=''}</th>
+            <td class='text-left nowrap'>
+                <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','del_goods','{$vo.id}');">删 除</span>
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    form.render();
+    function btn_confirm(msg,fun,id) {
+        layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
+            var url = "/mall/video_manage/"+fun;
+            layer.closeAll();
+            $.ajax({
+                type: "post",
+                url: url,
+                data: {id:id},
+                dataType: "json",
+                async: false,
+                success: function (data) {
+                    layer.msg('删除成功');
+                    setTimeout(function () {
+                        window.location.reload();
+                    },1000)
+                }
+            });
+        });
+    }
+</script>
+{/block}
+
+
+

+ 109 - 0
application/nutrition/view/video_manage/form.html

@@ -0,0 +1,109 @@
+
+<div class="think-box-shadow">
+    <form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
+        <div class="layui-card-body">
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">标题</label>
+                <div class="layui-input-block">
+                    <input name="title" maxlength="20"  value='{$vo.title|default=""}' placeholder="请输入标题" class="layui-input">
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">分类</label>
+                <div class="layui-input-inline">
+                    <select name="first_classify" lay-filter ="first_classify">
+                        <option value="0">请选择</option>
+                        {if !empty($cate_tree)}
+                        {foreach $cate_tree as $ck=>$cv}
+                        {if  isset($vo.first_classify) && $vo.first_classify == $cv['id'] }
+                        <option selected data-cl_key="{$ck}" value="{$cv['id']}">{$cv['title']}</option>
+                        {else}
+                        <option data-cl_key="{$ck}" value="{$cv['id']}">{$cv['title']}</option>
+                        {/if}
+                        {/foreach}
+                        {/if}
+                    </select>
+                </div>
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">封面</label>
+                <div class="layui-input-block">
+                    <input name="cover" type="hidden" value="{$vo.cover|default=''}">
+                </div>
+            </div>
+
+
+            <div class="layui-form-item video">
+                <label class="layui-form-label label-required">视频</label>
+                <div class="layui-input-block">
+                    <input name="video_url" type="hidden" value="{$vo.video_url|default=''}">
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">是否置顶</label>
+                <div class="layui-input-inline">
+                    <select name="is_top" lay-filter ="is_top">
+                        {foreach ['不置顶','置顶'] as $ck=>$cv}
+                            {if !empty($vo.is_top) &&  $vo.is_top == $ck }
+                                <option selected data-cl_key="{$ck}" value="{$ck}">{$cv}</option>
+                            {else}
+                                <option data-cl_key="{$ck}" value="{$ck}">{$cv}</option>
+                            {/if}
+                        {/foreach}
+                    </select>
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">排序</label>
+                <div class="layui-input-block">
+                    <input type="number" name="sort"  value='{$vo.sort|default=""}' placeholder="请输入排序号" class="layui-input">
+                </div>
+            </div>
+
+
+
+            {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+            <div class="layui-form-item text-center">
+                <button class="layui-btn" type='submit'>保 存</button>
+                <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定取消编辑吗?" data-close>取消编辑</button>
+            </div>
+        </div>
+    </form>
+    <script>
+        window.form.render();
+        require(['ckeditor', 'angular'], function () {
+            window.createEditor('[name="detail"]', {height: 500,width:1000});
+        })
+
+        $('[name="cover"]').uploadOneImage();
+        $('[name="video_url"]').uploadOneVideo()
+        // 类型选择监听
+        form.on('select(type)', function(data){
+            if(data.value == 1) {
+                $(".video").hide();
+                $(".detail").show();
+            }else{
+                $(".video").show();
+                $(".detail").hide();
+            }
+            window.form.render();
+        })
+        function check_type() {
+            console.log($("select[name='type']").val());
+            if(  $("select[name='type']").val() == 1) {
+                $(".video").hide();
+                $(".detail").show();
+            }else{
+                $(".video").show();
+                $(".detail").hide();
+            }
+            window.form.render();
+        }
+        check_type()
+
+    </script>
+</div>

+ 89 - 0
application/nutrition/view/video_manage/index.html

@@ -0,0 +1,89 @@
+{extend name='admin@main'}
+
+{block name="button"}
+<button data-modal='{:url("add")}' data-title="添加" class='layui-btn layui-btn-sm layui-btn-primary'>添加</button>
+{/block}
+
+{block name="content"}
+<div class="think-box-shadow">
+    {include file='video_manage/index_search'}
+    <table class="layui-table margin-top-20" lay-skin="line">
+        <thead>
+        <tr>
+            <th class='text-left nowrap' >标题</th>
+            <th class='text-left nowrap' >视频</th>
+            <th class='text-left nowrap' >分类</th>
+            <th class='text-left nowrap' >商品数量</th>
+            <th class='text-left nowrap'>状态</th>
+            <th class='text-left nowrap'>置顶</th>
+            <th class="text-left nowrap">操作</th>
+        </tr>
+        </thead>
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='text-left nowrap'>{$vo.title|default=''}</td>
+            <td class='text-left nowrap'>
+                <img  class="video_player"  alert="点击播放"   src="{$vo.cover|default=''}" data-src="{$vo.video_url|default=''}" style="height: 50px;width: 75px" />
+            </td>
+            <td class='text-left nowrap'>{$video_cate[$vo.first_classify]['title']|default='--'}</td>
+            <td class='text-left nowrap'>{$vo.goods_num|default='0'}</td>
+            <td class='text-left nowrap'>{$vo.status == 1 ?'已启用' :'已禁用'}</td>
+            <td class='text-left nowrap'>{$vo.is_top == 1 ?'是' :'否'}</td>
+            <td class='text-left nowrap' >
+                <a data-title="编辑" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                <a data-title="商品管理" class="layui-btn layui-btn-sm layui-btn-normal" data-open='{:url("/nutrition/video_goods/index")}?id={$vo.id}'>商品管理</a>
+                {if $vo.status == 1}
+                <span class="layui-btn layui-btn-sm  layui-btn-warm"  onclick="btn_confirm('禁用','forbidden','{$vo.id}');" >禁 用</span>
+                {else}
+                <span class="layui-btn layui-btn-sm layui-btn-sm"  onclick="btn_confirm('启用','enable','{$vo.id}');">启 用</span>
+                {/if}
+                <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','del','{$vo.id}');">删 除</span>
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    function btn_confirm(msg,fun,id) {
+        layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
+            var url = "/nutrition/video_manage/"+fun;
+            layer.closeAll();
+            $.ajax({
+                type: "post",
+                url: url,
+                data: {id:id},
+                dataType: "json",
+                async: false,
+                success: function (data) {
+                    layer.msg(data.info);
+                    setTimeout(function () {
+                        window.location.reload();
+                    },1000)
+                }
+            });
+        });
+    }
+
+    $('.video_player').click(function () {
+        vUrl = $(this).data('src');  //获取到播放的url
+        var loadstr = '<video width="100%" height="100%"  controls="controls" autobuffer="autobuffer"  autoplay="autoplay" loop="loop">' +
+            '<source src='+vUrl+' type="video/mp4"></source></video>';
+        layer.open({
+            type: 1,
+            title: false,
+            area: ['730px', '500px'],
+            shade: [0.8, 'rgb(14, 16, 22)'],
+            skin: 'demo-class',
+            content: loadstr
+        });
+    });
+
+</script>
+{/block}
+
+
+

+ 17 - 0
application/nutrition/view/video_manage/index_search.html

@@ -0,0 +1,17 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">标题</label>
+            <div class="layui-input-inline">
+                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入标题" class="layui-input">
+            </div>
+        </div>
+
+
+        <div class="layui-form-item layui-inline">
+            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+        </div>
+    </form>
+    <script>form.render()</script>
+</fieldset>