Member Price Completion
Member price list
Controller
<?php namespace Admin\Controller; class MemberlevelController extends CommonController { public function index(){ $memberlevel = M('member_level'); $count = $memberlevel->count(); $Page = new \Think\Page($count,25); $show = $Page->show(); $list = $memberlevel->order('id')->limit($Page->firstRow.','.$Page->listRows)->select(); $this->assign('list',$list); $this->assign('page',$show); $this->display(); } public function add(){ $memberlevel=D('member_level'); if(IS_POST){ if($memberlevel->create()){ if($memberlevel->add()){ $this->success('添加会员价格成功!',U('index')); }else{ $this->error('添加会员价格失败!'); } }else{ $this->error($memberlevel->getError()); } return; } $this->display(); } public function edit(){ $memberlevel=D('member_level'); if(IS_POST){ if($memberlevel->create()){ if($memberlevel->save()!==false){ $this->success('修改会员价格成功!',U('index')); }else{ $this->error('修改会员价格失败!'); } }else{ $this->error($memberlevel->getError()); } return; } $memberLevels=$memberlevel->find(I('id')); $this->assign('memberLevels',$memberLevels); $this->display(); } public function del(){ if(D('member_level')->delete(I('id'))){ $this->success('删除会员价格成功!',U('index')); }else{ $this->error('删除会员价格失败!'); } } }
List page
<!DOCTYPE html> <html><head> <meta charset="utf-8"> <title>PHP中文网</title> <meta name="description" content="Dashboard"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!--Basic Styles--> <link href="/Public/style/bootstrap.css" rel="stylesheet"> <link href="/Public/style/font-awesome.css" rel="stylesheet"> <link href="/Public/style/weather-icons.css" rel="stylesheet"> <!--Beyond styles--> <link id="beyond-link" href="/Public/style/beyond.css" rel="stylesheet" type="text/css"> <link href="/Public/style/demo.css" rel="stylesheet"> <link href="/Public/style/typicons.css" rel="stylesheet"> <link href="/Public/style/animate.css" rel="stylesheet"> </head> <body> <!-- 头部 --> <include file="Common/header" /> <!-- /头部 --> <div class="main-container container-fluid"> <div class="page-container"> <!-- Page Sidebar --> <include file="Common/left" /> <!-- /Page Sidebar --> <!-- Page Content --> <div class="page-content"> <!-- Page Breadcrumb --> <div class="page-breadcrumbs"> <ul class="breadcrumb"> <li> <a href="__MODULE__/Index/index">系统</a> </li> <li class="active">品牌管理</li> </ul> </div> <!-- /Page Breadcrumb --> <!-- Page Body --> <div class="page-body"> <button type="button" tooltip="添加用户" class="btn btn-sm btn-azure btn-addon" onClick="javascript:window.location.href = '__CONTROLLER__/add'"> <i class="fa fa-plus"></i> Add </button> <div class="row"> <div class="col-lg-12 col-sm-12 col-xs-12"> <div class="widget"> <div class="widget-body"> <div class="flip-scroll"> <table class="table table-bordered table-hover"> <thead class=""> <tr> <th class="text-center" width="10%">ID</th> <th align="left">等级名称</th> <th align="left">积分下限</th> <th align="left">积分上限</th> <th align="left">折扣率</th> <th class="text-center" width="10%">操作</th> </tr> </thead> <tbody> <volist name="list" id="vo"> <tr> <td align="center">{$vo.id}</td> <td align="left">{$vo.level_name}</td> <td align="left">{$vo.points_min}</td> <td align="left">{$vo.points_max}</td> <td align="left">{$vo.rate}</td> <td align="center"> <a href="__CONTROLLER__/edit/id/{$vo.id}" class="btn btn-primary btn-sm shiny"> <i class="fa fa-edit"></i> 编辑 </a> <a href="#" onClick="warning('确实要删除吗', '__CONTROLLER__/del/id/{$vo.id}')" class="btn btn-danger btn-sm shiny"> <i class="fa fa-trash-o"></i> 删除 </a> </td> </tr> </volist> </tbody> </table> <div style="height:40px;"> <ul class="pagination" style="float:right; margin:10px 0 0 0; "> {$page} </ul> </div> </div> <div> </div> </div> </div> </div> </div> </div> <!-- /Page Body --> </div> <!-- /Page Content --> </div> </div> <!--Basic Scripts--> <script src="/Public/style/jquery_002.js"></script> <script src="/Public/style/bootstrap.js"></script> <script src="/Public/style/jquery.js"></script> <!--Beyond Scripts--> <script src="/Public/style/beyond.js"></script> </body> </html>
Modify page
<!DOCTYPE html> <html><head> <meta charset="utf-8"> <title>PHP中文网</title> <meta name="description" content="Dashboard"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!--Basic Styles--> <link href="/Public/style/bootstrap.css" rel="stylesheet"> <link href="/Public/style/font-awesome.css" rel="stylesheet"> <link href="/Public/style/weather-icons.css" rel="stylesheet"> <!--Beyond styles--> <link id="beyond-link" href="/Public/style/beyond.css" rel="stylesheet" type="text/css"> <link href="/Public/style/demo.css" rel="stylesheet"> <link href="_ _PUBLIC__/style/typicons.css" rel="stylesheet"> <link href="/Public/style/animate.css" rel="stylesheet"> </head> <body> <!-- 头部 --> <include file="Common/header" /> <!-- /头部 --> <div class="main-container container-fluid"> <div class="page-container"> <!-- Page Sidebar --> <include file="Common/left" /> <!-- /Page Sidebar --> <!-- Page Content --> <div class="page-content"> <!-- Page Breadcrumb --> <div class="page-breadcrumbs"> <ul class="breadcrumb"> <li> <a href="__MODULE__/Index/index">系统</a> </li> <li> <a href="__CONTROLLER__/inde">会员价格列表</a> </li> <li class="active">修改会员价格</li> </ul> </div> <!-- /Page Breadcrumb --> <!-- Page Body --> <div class="page-body"> <div class="row"> <div class="col-lg-12 col-sm-12 col-xs-12"> <div class="widget"> <div class="widget-header bordered-bottom bordered-blue"> <span class="widget-caption">修改等级</span> </div> <div class="widget-body"> <div id="horizontal-form"> <form class="form-horizontal" role="form" action="" method="post" enctype="multipart/form-data" > <input type="hidden" name="id" value="{$memberLevels.id}" /> <div class="form-group"> <label for="username" class="col-sm-2 control-label no-padding-right">等级名称</label> <div class="col-sm-6"> <input class="form-control" placeholder="" name="level_name" required="" value="{$memberLevels.level_name}" type="text"> </div> <p class="help-block col-sm-4 red">* 必填</p> </div> <div class="form-group"> <label for="username" class="col-sm-2 control-label no-padding-right">积分下限</label> <div class="col-sm-6"> <input class="form-control" placeholder="" name="points_min" value="{$memberLevels.points_min}" required="" type="text"> </div> <p class="help-block col-sm-4 red">* 必填</p> </div> <div class="form-group"> <label for="username" class="col-sm-2 control-label no-padding-right">积分上限</label> <div class="col-sm-6"> <input class="form-control" placeholder="" name="points_max" value="{$memberLevels.points_max}" required="" type="text"> </div> <p class="help-block col-sm-4 red">* 必填</p> </div> <div class="form-group"> <label for="username" class="col-sm-2 control-label no-padding-right">折扣率</label> <div class="col-sm-6"> <input class="form-control" placeholder="" name="rate" value="{$memberLevels.rate}" required="" type="text"> </div> <p class="help-block col-sm-4 red">* 必填</p> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-default">保存信息</button> </div> </div> </form> </div> </div> </div> </div> </div> </div> <!-- /Page Body --> </div> <!-- /Page Content --> </div> </div> <!--Basic Scripts--> <script src="/Public/style/jquery_002.js"></script> <script src="/Public/style/bootstrap.js"></script> <script src="/Public/style/jquery.js"></script> <!--Beyond Scripts--> <script src="/Public/style/beyond.js"></script> </body> </html>