本篇文章为大家展示了使用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>
上述内容就是使用thinkPHP怎么实现一个订单数字提醒功能,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注亿速云行业资讯频道。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。