作者 anyv
1 个管道 的构建 通过 耗费 1 秒

bug修改

... ... @@ -27,7 +27,8 @@ class GoodsdetailsController extends WeChatBaseController{
$data['price1'] = $price[1];
$data['pricing0'] = $pricing[0];
$data['pricing1'] = $pricing[1];
$data['det_img'] = explode(',',$data['det_img']);
$data['det_img'] = json_decode($data['det_img'],true);
/* $data['det_img'] = explode(',',$data['det_img']);*/
$this -> assign('det_img',$data['det_img']);
$this -> assign('data',$data);
$data_label = Db::name('label') -> alias('a') -> field("a.*,b.goods_id,b.label_id") -> join('goods_label b','a.id=b.label_id','LEFT') -> where("b.goods_id = ".$goods_id['goods_id']) -> select();
... ... @@ -48,6 +49,15 @@ class GoodsdetailsController extends WeChatBaseController{
$browsing_history['goods_id'] = $goods_id['goods_id'];
Db::name('browsing_history') -> insert($browsing_history);
}
//判断订单收藏
$collect = Db::name('collect') -> where('goods_id',$goods_id['goods_id']) -> find();
if($collect){
//存在显示2
$this -> assign('is_collect',2);
}else{
//不存在显示1
$this -> assign('is_collect',1);
}
return $this -> fetch();
}
... ... @@ -61,12 +71,17 @@ class GoodsdetailsController extends WeChatBaseController{
$uid = cmf_get_current_user_id();
$arr['goods_id'] = $goods_id;
$arr['uid'] = $uid;
$collect = Db::name('collect') -> where('goods_id',$arr['goods_id']) -> find();
if($collect){
return 3;
}else{
$data = Db::name('collect') -> insert($arr);
if($data){
return true;
}else{
return false;
}
}
}
... ...
... ... @@ -204,7 +204,8 @@ class PersonalcenterController extends WeChatBaseController{
*/
public function shop_address(){
$data = Db::name('address') -> where("delete_time = 0") -> select() -> toArray();
$uid = cmf_get_current_user_id();
$data = Db::name('address') -> where("delete_time = 0 and uid =".$uid) -> select() -> toArray();
if(!empty($data)){
foreach($data as $key => $val){
$detailed = explode(',',$val['detailed']);
... ...
... ... @@ -115,7 +115,11 @@ class SalesmangoodsController extends WeChatBaseController{
$data['press_time'] = $_POST['press_time'];
$data['suit'] = $_POST['suit'];
$data['grade'] = $_POST['grade'];
$data['det_img'] = $_POST['img0'].','.$_POST['img1'].','.$_POST['img2'];
$det_img[0] = $_POST['img0'];
$det_img[1] = $_POST['img1'];
$det_img[2] = $_POST['img2'];
/* $data['det_img'] = $_POST['img0'].','.$_POST['img1'].','.$_POST['img2'];*/
$data['det_img'] = json_encode($det_img);
$data['create_time'] = time();
$data['type'] = 2;
$data['uid'] = cmf_get_current_user_id();
... ...
... ... @@ -59,7 +59,7 @@
<img src="{:cmf_get_image_url($vo.show_img)}" alt="">
</div>
<div class="in_hotText">
<div class="in_hotName txt-cut"><span>{$vo.name}</span>{$vo.book_name}</div>
<div class="in_hotName txt-cut"><span>{$vo.grade}</span>{$vo.book_name}</div>
<div class="in_cam_shopPrice">
<div class="in_hotPrice1"><span>{$vo.price0}</span>.{$vo.price01}</div>
</div>
... ... @@ -116,7 +116,7 @@
for(var i=0;i<data_arr.length;i++){
show_img = data_arr[i].show_img;
url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].name+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div></div></div></a></div>");
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].grade+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div></div></div></a></div>");
}
});
}
... ... @@ -132,7 +132,7 @@
for(var i=0;i<data_arr.length;i++){
show_img = data_arr[i].show_img;
url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].name+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div></div></div></a></div>");
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].grade+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div></div></div></a></div>");
}
});
}
... ... @@ -149,7 +149,7 @@
for(var i=0;i<data_arr.length;i++){
show_img = data_arr[i].show_img;
url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].name+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div></div></div></a></div>");
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].grade+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div></div></div></a></div>");
}
});
}
... ... @@ -166,7 +166,7 @@
for(var i=0;i<data_arr.length;i++){
show_img = data_arr[i].show_img;
url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].name+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div></div></div></a></div>");
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].grade+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div></div></div></a></div>");
}
});
}
... ... @@ -184,7 +184,7 @@
for(var i=0;i<data_arr.length;i++){
show_img = data_arr[i].show_img;
url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].name+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div></div></div></a></div>");
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].grade+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div></div></div></a></div>");
}
});
}else{
... ... @@ -194,7 +194,7 @@
for(var i=0;i<data_arr.length;i++){
show_img = data_arr[i].show_img;
url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].name+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div></div></div></a></div>");
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].grade+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div></div></div></a></div>");
}
});
}
... ...
... ... @@ -119,12 +119,31 @@
<!-- 底部 -->
<div class="de_footer">
<if condition="$is_collect eq 1">
<div class="de_footerLeft" onclick="goods_collection({$data.id})">
<div class="de_footerLeftLi" style="margin-top: 0.1rem">
<div class="de_footerLeftImg">
<img src="__TMPL__/public/assets/images/26.png" alt="" id="imgsss">
</div>
<p id="shoucang">收藏</p>
</div>
</div>
<else/>
<div class="de_footerLeft">
<div class="de_footerLeftLi">
<div class="de_footerLeftImg">
<img src="__TMPL__/public/assets/images/26.png" alt="">
<img src="__TMPL__/public/assets/images/xin (1).png" alt="">
</div>
<p>已收藏</p>
</div>
</div>
</if>
<div class="de_footerLeft">
<div class="de_footerLeftLi" onclick="go_to_car()">
<div class="de_footerLeftImg" style="width: 0.45rem;height: 0.45rem;">
<img src="__TMPL__/public/assets/images/17.png" alt="">
</div>
<p>收藏</p>
<p>购物车</p>
</div>
</div>
<div class="de_footerRight">
... ... @@ -137,6 +156,13 @@
<script src="__TMPL__/public/assets/js/jquery.js"></script>
<script>
/**
* 点击跳转购物车页面
*/
function go_to_car(){
window.location.href = "{:url('Shopcart/shop_cart')}";
}
/**
* 点击立即购买
*/
function buy_now(id){
... ... @@ -160,11 +186,18 @@
*/
function goods_collection(id){
$.post("{:url('Goodsdetails/goods_collection')}",{goods_id:id},function(data){
if(data == 3){
alert('已收藏');
}else{
if(data){
$("#imgsss").attr("src","__TMPL__/public/assets/images/xin (1).png");
$('#shoucang').text('已收藏');
alert('收藏成功');
}else{
alert('收藏失败');
}
}
});
}
... ...
... ... @@ -126,11 +126,11 @@
phone = $('#phone').text();
detailed = $('#detailed').text();
if(name == ''){
alert('姓名不能为空');
alert('收货地址不能为空');
}else if(phone == ''){
alert('手机号不能为空');
alert('收货地址不能为空');
}else if(detailed == ''){
alert('地址不能为空');
alert('收货地址不能为空');
}else{
id = {$indent_id};
liuyan = $('#liuyan').val();
... ...
... ... @@ -143,11 +143,11 @@
phone = $('#phone').text();
detailed = $('#detailed').text();
if(name == ''){
alert('姓名不能为空');
alert('收货地址不能为空');
}else if(phone == ''){
alert('手机号不能为空');
alert('收货地址不能为空');
}else if(detailed == ''){
alert('地址不能为空');
alert('收货地址不能为空');
}else{
liuyan = $('#liuyan').val();
indet_id = {$indet_id};
... ...
... ... @@ -68,7 +68,7 @@
alert('姓名不能为空');
}else if($('#phone').val() == ''){
alert('手机号不能为空');
}else if($('#city_text').text() == ''){
}else if($('#city_text').text() == '选择省市区'){
alert('地区不能为空');
}else if($('#address_content').val() == ''){
alert('详细地址不能为空');
... ...
... ... @@ -248,12 +248,10 @@
<p>购物车</p>
</li>
</a>
<a href="log_one.html">
<li>
<img src="__TMPL__/public/assets/images/19.png" alt="" />
<p style="color:#FF7700;">我的</p>
</li>
</a>
</ul>
</div>
<script src="__TMPL__/public/assets/js/jquery.js"></script>
... ...
... ... @@ -137,6 +137,7 @@
for(i=0;i<ids.length;i++){
goods_id[i] = ids[i].dataset.id;
}
console.log(goods_id);
if(goods_id.length == 0){
alert('不能为空');
}else{
... ... @@ -257,10 +258,13 @@
if ($(this).attr("src") == "__TMPL__/public/assets/images/39_0.png") {
$(this).attr("src", "__TMPL__/public/assets/images/39.png");
calcTotal();
$(this).parents('.sh_cartround').addClass('add');
} else {
$(this).attr("src", "__TMPL__/public/assets/images/39_0.png");
$(".shop_carts1 img").attr('src', "__TMPL__/public/assets/images/39_1.png");
calcTotal();
$(this).parents('.sh_cartround').removeClass('add');
}
});
});
... ...