作者 李涵

合并分支 'xv' 到 'master'

首页、商品列表页,细节优化,商品列表页上拉加载未测试



查看合并请求 !12
... ... @@ -88,6 +88,14 @@ class ZjGoodsController extends AdminBaseController
public function state(){
if ($this->request->isAjax()){
$param=input('param.');
if (empty($param['is_shove'])){
if ($param['is_shove']==2){
$num=Db::name('zj_goods')->where(['delete_time'=>0,'is_shove'=>2])->count();
if ($num>=6){
$this->error('推荐商品最多为6个');
}
}
}
$edit=Db::name('zj_goods')->update($param);
if (empty($edit)){
$this->error('商品状态修改失败');
... ...
... ... @@ -39,8 +39,8 @@ class ZjNewsController extends AdminBaseController
$arr['create_time']=time();
if($arr['is_sta']==1){
$num=Db::name('zj_news')->where(['is_sta'=>1,'delete_time'=>0])->count();
if ($num>=3){
$this->error('最多同时发布三条系统消息');
if ($num>=1){
$this->error('最多同时发布一条系统消息');
}
}
$add=Db::name('zj_news')->insert($arr);
... ... @@ -71,8 +71,8 @@ class ZjNewsController extends AdminBaseController
$arr=input('param.');
if($arr['is_sta']==1){
$num=Db::name('zj_news')->where(['is_sta'=>1,'delete_time'=>0])->count();
if ($num>=3){
$this->error('最多同时发布三条系统消息');
if ($num>=1){
$this->error('最多同时发布一条系统消息');
}
}
$edit=Db::name('zj_news')->update($arr);
... ... @@ -92,8 +92,8 @@ class ZjNewsController extends AdminBaseController
$arr=input('param.');
if($arr['is_sta']==1){
$num=Db::name('zj_news')->where(['is_sta'=>1,'delete_time'=>0])->count();
if ($num>=3){
$this->error('最多同时发布三条系统消息');
if ($num>=1){
$this->error('最多同时发布一条系统消息');
}
}
$edit=Db::name('zj_news')->update($arr);
... ...
... ... @@ -22,6 +22,11 @@ class GoodsController extends HomeBaseController
$html = '';
if (!empty($goodsList)) {
foreach ($goodsList as $item) {
if ($item['caid']==1){
$integral='购买可获得'.$item['price']*2 .'积分';
}else{
$integral='该商品无积分奖励';
}
$html .= '
<a href="' . url('goods/Goods/detail', ['id' => $item['id']]) . '">
<div class="container_list">
... ... @@ -37,7 +42,7 @@ class GoodsController extends HomeBaseController
</p>
<div class="people">
<p class="people_weight">
购买可获得40积分
'. $integral .'
</p>
<p class="people_money">¥<span class="money">' . $item['price'] . '</span></p>
</div>
... ...
... ... @@ -8,16 +8,16 @@ class GoodsModel extends Model
public function getGoods($is_shove = null, $cid = null)
{
$map['is_sta'] = ['eq', 1];
$map['delete_time'] = ['eq', 0];
$map['g.is_sta'] = ['eq', 1];
$map['g.delete_time'] = ['eq', 0];
if ($cid != null) {
$map['cid'] = ['eq', $cid];
$map['g.cid'] = ['eq', $cid];
}
if($is_shove != null) {
$map['is_shove'] = ['eq', $is_shove];
$map['g.is_shove'] = ['eq', $is_shove];
}
$res = Db::name('zj_goods')->field('id,name,intro,price,thumb')
->where($map)
$res = Db::name('zj_goods')->alias('g')->join('zj_category c','g.cid=c.id')
->field('g.id,g.name,g.intro,g.price,g.thumb,c.cid as caid')->where($map)
->select()->toArray();
foreach ($res as $k => $v) {
$res[$k]['thumb'] = cmf_get_image_url($v['thumb']);
... ...
... ... @@ -17,7 +17,27 @@ class IndexController extends HomeBaseController
{
$goods = new GoodsModel;
$goodsList = $goods->getGoods(2);
$id=[];
foreach ($goodsList as $k=>$v){
$id[$k]=$v['id'];
}
$num=Db::name('zj_evaluate')->where(['delete_time'=>'0','is_sta'=>'2','gid'=>['in',$id]])->group('gid')
->field("count('gid') as num,gid")->select();
foreach ($goodsList as $k=>$v){
foreach ($num as $val){
if ($v['id']==$val['gid']){
$goodsList[$k]['eva']=$val['num'];
break;
}else{
$goodsList[$k]['eva']=0;
}
}
}
$notice=Db::name('zj_news')->where(['delete_time'=>0,'is_sta'=>1])->find();
$return = [
'notice' => $notice,
'banner' => getBanner(),
'goodsList' => $goodsList
];
... ...
... ... @@ -72,7 +72,8 @@ body,html{
padding:0.23rem 0;
}
.text_img img{
width:100%;
width:1.2rem;
height:1.2rem;
border-radius: 0.1rem;
}
.container_info{
... ...
... ... @@ -113,7 +113,8 @@ body,html{
height:3.71rem;
}
.good_img img{
width:100%;
width: 3.71rem;
height: 3.71rem;
}
.good_name{
width:3rem;
... ...
... ... @@ -91,6 +91,8 @@
</p>
<if condition="$vo.caid eq 1">
<p class="inter">购买可获得{$vo.price*2}积分</p>
<else>
<p class="inter">该商品无积分奖励</p>
</if>
<div class="addcart">
<p class="price">
... ... @@ -288,7 +290,7 @@
window.location.href="{:url('index/index/index')}"
})
$(".membercenter").click(function(){
window.location.href="{:url('index/index/index')}"
window.location.href="{:url('user/Center/index')}"
})
</script>
</html>
... ...
... ... @@ -41,7 +41,7 @@
</p>
<div class="people">
<p class="people_weight">
购买可获得40积分
<if condition="$vo.caid eq 1">购买可获得{$vo.price*2}积分<else>该商品无积分奖励</if>
</p>
<p class="people_money"><span class="money">{$vo.price}</span></p>
</div>
... ...
... ... @@ -9,6 +9,25 @@
<link rel="stylesheet" href="__INDEX__/css/swiper.min.css">
<script type="text/javascript" src="__INDEX__/js/base.js"></script>
<title>天生红积分商城</title>
<style>
.notice_text{
width:6rem;
height:18px;
overflow: hidden;
margin-top: 0.15rem;
position:relative;
}
.companynotice{
height:max-content;
font-size: 0.26rem;
color:#1A1A1A;
margin-left: 0.17rem;
position:absolute;
left:0;
top:0
}
</style>
</head>
<body>
<!--绑定手机号-->
... ... @@ -31,7 +50,7 @@
<div class="swiper-wrapper">
<volist name="data.banner" id="vo">
<div class="swiper-slide">
<a href="{$vo.url}"><img src="{$vo.image}" alt="" ></a>
<a href="{$vo.url}"><img src="{$vo.image}"></a>
</div>
</volist>
</div>
... ... @@ -40,17 +59,19 @@
</div>
<div class="notice">
<p class="iconfont icon-laba"></p>
<p class="companynotice">公司公告</p>
<div class="notice_text">
<p class="companynotice">{$data.notice.title}:{$data.notice.content}</p>
</div>
</div>
<div class="special">
<p class="memberarea">
<a href="{:url('goods/Goods/goodsList',['cid'=>1])}"><img src="__INDEX__/img/aicon01@2x.png" alt=""></a>
<a href="{:url('goods/Goods/goodsList',['cid'=>1])}"><img src="__INDEX__/img/aicon01@2x.png"></a>
</p>
<p class="cashzone">
<a href="{:url('goods/Goods/goodsList',['cid'=>2])}"><img src="__INDEX__/img/aicon02@2x.png" alt=""></a>
<a href="{:url('goods/Goods/goodsList',['cid'=>2])}"><img src="__INDEX__/img/aicon02@2x.png"></a>
</p>
<p class="intergralarea">
<a href="{:url('goods/Goods/goodsList',['cid'=>3])}"><img src="__INDEX__/img/money.png" alt=""></a>
<a href="{:url('goods/Goods/goodsList',['cid'=>3])}"><img src="__INDEX__/img/money.png"></a>
</p>
</div>
<div class="specialword">
... ... @@ -78,11 +99,11 @@
{$vo.intro}
</p>
<p class="good_points">
购买可获得40积分
<if condition="$vo.caid eq 1">购买可获得{$vo.price*2}积分<else>该商品无积分奖励</if>
</p>
<div class="people">
<p class="people_price"><span class="money">{$vo.price}</span></p>
<p class="people_comment">40人好评</p>
<p class="people_comment">{$vo.eva}人好评</p>
</div>
</div>
</volist>
... ... @@ -139,11 +160,39 @@
})
$(".shopcart").click(function(){
window.location.href='shopcar/cart.html'
window.location.href="{:url('cart/zj_cart/cart')}"
})
$(".membercenter").click(function(){
window.location.href="{:url('user/Center/index')}";
})
//系统消息
var otoutiaoCt=document.querySelectorAll('.companynotice')[0];
var otoutiaoC=document.querySelectorAll('.notice_text')[0];
// console.log($('.companynotice').css('height'));
// console.log(otoutiaoCt.offsetHeight);
var timer0=null;
otoutiaoCt.style.top=otoutiaoC.offsetHeight+'px';
var tt=otoutiaoC.offsetHeight;
console.log(tt)
console.log(otoutiaoCt.offsetTop);
console.log(otoutiaoCt.offsetHeight);
console.log(otoutiaoCt.style.top);
// // console.log( otoutiaoCt.style.top)
// console.log(otoutiaoCt.offsetTop)
timer0=setInterval(function(){
if(otoutiaoCt.offsetTop<=-otoutiaoCt.offsetHeight-2){
tt=otoutiaoC.offsetHeight;
otoutiaoCt.style.top=tt +'px';
// console.log( otoutiaoCt.style.Top)
}else{
tt=tt-1;
otoutiaoCt.style.top=tt+'px';
// console.log(otoutiaoCt.offsetTop)
var ll=-otoutiaoCt.offsetHeight-2+"px";
}
},4000/60)
</script>
</body>
</html>
... ...
... ... @@ -137,7 +137,7 @@
window.location.href="{:url('index/Index/index')}";
})
$(".shopcart").click(function(){
window.location.href='__INDEX__/shopcar/cart.html'
window.location.href="{:url('cart/zj_cart/cart')}"
})
</script>
</html>
... ...