Home  >  Article  >  Backend Development  >  How to implement thinkPHP order digital reminder function

How to implement thinkPHP order digital reminder function

不言
不言Original
2018-06-14 15:55:592041browse

This article mainly introduces the implementation method of thinkPHP order digital reminder function, involving the implementation skills of thinkPHP database query, traversal and front-end display related functions. Friends in need can refer to the following

The example of this article tells the thinkPHP order Implementation method of digital reminder function. Share it with everyone for your reference, the details are as follows:

The operation rendering is as follows:

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(&#39;member_id&#39; => $this->member_id);
$allorder = $this->orderModel->where($whereall)->select();
$num = array(&#39;all&#39;=>0,&#39;unpaid&#39;=>0,&#39;unsent&#39;=>0,&#39;unresevied&#39;=>0,&#39;resevied&#39;=>0);
foreach ($allorder as $k => $order) {
  if ( $order[&#39;paytime&#39;] == 0 ) {
    $num[&#39;unpaid&#39;]++ ;
  }
  if ($order[&#39;paytime&#39;] != 0 && $order[&#39;sendtime&#39;] == 0) {
    $num[&#39;unsent&#39;] ++ ;
  }
  if ($order[&#39;paytime&#39;] != 0 && $order[&#39;sendtime&#39;] != 0 && $order[&#39;receivetime&#39;] == 0) {
    $num[&#39;unresevied&#39;] ++ ;
  }
  if ($order[&#39;paytime&#39;] != 0 && $order[&#39;sendtime&#39;] != 0 && $order[&#39;receivetime&#39;] != 0) {
    $num[&#39;resevied&#39;] ++ ;
  }
  $num[&#39;all&#39;] ++ ;
}
$this->assign(&#39;num&#39;,$num);

This time, the value is passed in the form of an array, which is consistent.

Add a fixed layout effect

css:

<style type="text/css">
  .badge {
    background-color:#FFC245;
    position: absolute;
    top:-5px;
    right:-20px;
  }
  .condition{
    position: relative;
  }
</style>

The above is the entire content of this article. I hope it will be helpful to everyone's learning. For more related content, please pay attention to PHP Chinese website!

Related recommendations:

About the code for adding js event paging class to the thinkPHP framework

How to implement a shopping cart based on the CodeIgniter framework Function

The above is the detailed content of How to implement thinkPHP order digital reminder function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn