這篇文章主要介紹了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>
以上就是本文的全部內容,希望對大家的學習有所幫助,更多相關內容請關注PHP中文網!
相關推薦:
#
以上是如何實現thinkPHP訂單數位提醒功能的詳細內容。更多資訊請關注PHP中文網其他相關文章!