Browse Source

商品详情-用户评论数

master
ZLW-PC\Administrator 7 years ago
parent
commit
39b704ddb3
  1. 3
      app/Http/Controllers/Weixin/GoodsController.php
  2. 5
      app/Http/Model/Comment.php
  3. 8
      app/Http/Model/Goods.php
  4. 13
      public/css/weixin/style.css
  5. 36
      resources/views/weixin/goods/goodsDetail.blade.php

3
app/Http/Controllers/Weixin/GoodsController.php

@ -3,6 +3,7 @@ namespace App\Http\Controllers\Weixin;
use App\Http\Controllers\Weixin\CommonController;
use Illuminate\Http\Request;
use App\Common\ReturnCode;
class GoodsController extends CommonController
{
@ -22,6 +23,8 @@ class GoodsController extends CommonController
$res = curl_request($url,$postdata,'GET');
$data['post'] = $res['data'];
if(!$data['post']){$this->error_jump(ReturnCode::NO_FOUND,route('weixin'),3);}
return view('weixin.goods.goodsDetail', $data);
}

5
app/Http/Model/Comment.php

@ -17,7 +17,10 @@ class Comment extends BaseModel
*/
protected $guarded = [];
const SHOW_COMMENT = 1; //评论已审核
const UNSHOW_COMMENT = 0; //评论未批准显示
const SHOW_COMMENT = 1; //评论批准显示
const GOODS_COMMENT_TYPE = 0; //商品评论
const ARTICLE_COMMENT_TYPE = 1; //文章评论
//获取列表
public static function getList(array $param)

8
app/Http/Model/Goods.php

@ -250,6 +250,14 @@ class Goods extends BaseModel
$res = $model->first();
if($res)
{
$where2['comment_type'] = Comment::GOODS_COMMENT_TYPE;
$where2['status'] = Comment::SHOW_COMMENT;
$where2['id_value'] = $id;
$res->goods_comments_num = Comment::where($where2)->count();
}
return $res;
}
}

13
public/css/weixin/style.css

@ -809,8 +809,6 @@ h1.arc_tit, h2.arc_tit{font-weight: normal;font-size: 1.4em;padding: 10px;}
}
.goods-header .wish-add {
position: relative;
height: 12px;
line-height: 12px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
@ -818,12 +816,11 @@ h1.arc_tit, h2.arc_tit{font-weight: normal;font-size: 1.4em;padding: 10px;}
color:#ea6f5a;
background-color: transparent;
border: 1px solid #ea6f5a;
border-radius: 3px;
font-size: 16px;
padding:4px 6px;
border-radius:2px;
font-size:14px;
padding:0 3px;
display: inline-block;
text-align: center;
margin:3px 10px 0 0;
margin-right:10px;
}
.goods-header .wish-add-activate{color:#fff;background-color:#ea6f5a;}
.goods-header .goods-price {
@ -915,7 +912,7 @@ display: block;
position: absolute;
top: 0;
}
.goods_info_pop{ background-color:#fff; display:block; position:fixed; z-index:100; bottom:0px; left:0; padding-bottom:20px; /*box-shadow:0 -2px 3px #a0a0a0;*/ border-top:2px solid #dcdcdc; width:100%;}
.goods_info_pop{background-color:#fff; display:block; position:fixed; z-index:100; bottom:0px; left:0; padding-bottom:20px; /*box-shadow:0 -2px 3px #a0a0a0;*/ border-top:1px solid #f1f1f1; width:100%;}
.goods_info_pop ul{ padding:0px 0 35px; display:inline-block;}

36
resources/views/weixin/goods/goodsDetail.blade.php

@ -83,7 +83,7 @@ var swiper = new Swiper('.swiper-container', {
</dl>
</div>
<div class="goods-comment">用户评价<span>0条评价 ></span></div>
<div class="goods-comment">用户评价<span><?php echo $post['goods_comments_num']; ?>条评价 ></span></div>
</div>
<div class="goods-content">
@ -99,14 +99,14 @@ var swiper = new Swiper('.swiper-container', {
<div class="cart_list" >
<div class="cart_list_info goods_list_item">
<div class="cart_list_img">
<img src="http://www.yst.com/yst/Public/kindeditor/attached/image/20160227/20160227031317_35279.png" style=" width:100%; height:100%;">
<img src="/uploads/2017/06/201706041951031181.jpg" style="width:100%; height:100%;">
</div>
<div class="cart_goods_info">
<div class="cart_list_name">
<div class="cart_detail_gray" style=""><span style="" class="cart_detail_gray_name">1232</span></div>
<div class="cart_detail_gray" style=""><span style="" class="cart_detail_gray_name"><?php echo $post['title']; ?></span></div>
<div class="cart_detail_gray" style="">
<p class="cart_sum" id="total_price1_296"><span class="attr_price">1.00</span></p>
<p class="goods_type">库存<span class="attr_storage">10</span></p>
<p class="cart_sum" id="total_price1_296"><span class="attr_price"><?php echo $post['price']; ?></span></p>
<p class="goods_type">库存<span class="attr_storage"><?php echo $post['goods_number']; ?></span>件</p>
</div>
</div>
</div> <!--cart_info-->
@ -123,8 +123,8 @@ var swiper = new Swiper('.swiper-container', {
</div>
</div>
</div>
<input type="hidden" id="resultid" value="">
<input type="hidden" id="storage" value="10">
<input type="hidden" id="id" value="<?php echo $post['id']; ?>">
<input type="hidden" id="goods_number" value="<?php echo $post['goods_number']; ?>">
<div class="registered_btn pop_btn confirmBtn" style="display:none;" onclick="dosubmit()">
<input type="hidden" name="cartType" id="cartType" value="">
<span>确定</span>
@ -155,21 +155,31 @@ function masterunshow()
function cart_num_sub()
{
var num = $('#num').val();
if(num>1){
if(num>1)
{
num = parseInt(num)-1;
$('#num').val(num);
}
}
function cart_num_add()
{
var storage = $('#storage').val();
var goods_number = $('#goods_number').val();
var num = $('#num').val();
num = parseInt(num)+1;
if(storage<num){
/* jAlert("库存量不足!", alert_title); */
messageNotice("库存量不足!");
if(goods_number<num)
{
//提示
layer.open({
content: '库存量不足!'
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
return false;
}
$('#num').val(num);
}
</script>
@ -179,7 +189,7 @@ function cart_num_add()
<div class="bottom_tool_black">
<div class="bottom_tool_white">
<ul>
<a href="http://wpa.qq.com/msgrd?v=3&amp;uin=386092124&amp;site=qq&amp;menu=yes"><li>
<a href="tel:12345678910"><li>
<img src="<?php echo env('APP_URL'); ?>/images/weixin/goods_ic_kefu.png">
<p>客服</p>
</li></a>

Loading…
Cancel
Save