乐码库:一个极速、放心、纯净的下载站! 更新: 资源发布
  • 您的位置:首页 > 技术文档 > PHP编程 > thinkPHP订单数字提醒功能的实现方法
  • 收藏本页
      thinkPHP订单数字提醒功能的实现方法
      发布时间:2016-12-21 08:09:20 关键词: thinkPHP,订单数字,提醒功能
      内容简介:这篇文章主要介绍了thinkPHP订单数字提醒功能的实现方法,涉及thinkPHP数据库查询、遍历及前台显示相关功能实现技巧,需要的朋友可以参考下

    本文实例讲述了thinkPHP订单数字提醒功能的实现方法。分享给大家供大家参考,具体如下:

    运行效果图如下:

    html:

    <ul class="am-avg-sm-5">
      <li class="condition-li" status="0">
        <span class="condition">全部<if condition="$num.all neq 0"><span class="badge">{sh:$num.all}</span></if></span>
      </li>
      <li class="condition-li" status="1">
        <span class="condition">待付款
        <if condition="$num.unpaid neq 0"><span class="badge">{sh:$num.unpaid}</span></if>
        </span>
      </li>
      <li class="condition-li" status="2">
        <span class="condition">待发货
        <if condition="$num.unsent neq 0"><span class="badge">{sh:$num.unsent}</span></if>
        </span>
      </li>
      <li class="condition-li" status="3">
        <span class="condition">待收货
        <if condition="$num.unresevied neq 0"><span class="badge">{sh:$num.unresevied}</span></if>
        </span>
      </li>
      <li class="condition-li" status="4">
        <span class="condition">已收货
        <if condition="$num.resevied neq 0"><span class="badge">{sh:$num.resevied}</span></if>
        </span>
      </li>
    </ul>
    
    

    php:

    // 各种状态的数字提醒
    $whereall = array('member_id' => $this->member_id);
    $allorder = $this->orderModel->where($whereall)->select();
    $num = array('all'=>0,'unpaid'=>0,'unsent'=>0,'unresevied'=>0,'resevied'=>0);
    foreach ($allorder as $k => $order) {
      if ( $order['paytime'] == 0 ) {
        $num['unpaid']++ ;
      }
      if ($order['paytime'] != 0 && $order['sendtime'] == 0) {
        $num['unsent'] ++ ;
      }
      if ($order['paytime'] != 0 && $order['sendtime'] != 0 && $order['receivetime'] == 0) {
        $num['unresevied'] ++ ;
      }
      if ($order['paytime'] != 0 && $order['sendtime'] != 0 && $order['receivetime'] != 0) {
        $num['resevied'] ++ ;
      }
      $num['all'] ++ ;
    }
    $this->assign('num',$num);
    
    

    本次采用数组的形式传值,具有统一性。

    再加一个固定布局效果

    css:

    <style type="text/css">
      .badge {
        background-color:#FFC245;
        position: absolute;
        top:-5px;
        right:-20px;
      }
      .condition{
        position: relative;
      }
    </style>
    
    
      最新更新
      热门排行榜