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

bug修改

@@ -27,7 +27,8 @@ class GoodsdetailsController extends WeChatBaseController{ @@ -27,7 +27,8 @@ class GoodsdetailsController extends WeChatBaseController{
27 $data['price1'] = $price[1]; 27 $data['price1'] = $price[1];
28 $data['pricing0'] = $pricing[0]; 28 $data['pricing0'] = $pricing[0];
29 $data['pricing1'] = $pricing[1]; 29 $data['pricing1'] = $pricing[1];
30 - $data['det_img'] = explode(',',$data['det_img']); 30 + $data['det_img'] = json_decode($data['det_img'],true);
  31 + /* $data['det_img'] = explode(',',$data['det_img']);*/
31 $this -> assign('det_img',$data['det_img']); 32 $this -> assign('det_img',$data['det_img']);
32 $this -> assign('data',$data); 33 $this -> assign('data',$data);
33 $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(); 34 $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{ @@ -48,6 +49,15 @@ class GoodsdetailsController extends WeChatBaseController{
48 $browsing_history['goods_id'] = $goods_id['goods_id']; 49 $browsing_history['goods_id'] = $goods_id['goods_id'];
49 Db::name('browsing_history') -> insert($browsing_history); 50 Db::name('browsing_history') -> insert($browsing_history);
50 } 51 }
  52 + //判断订单收藏
  53 + $collect = Db::name('collect') -> where('goods_id',$goods_id['goods_id']) -> find();
  54 + if($collect){
  55 + //存在显示2
  56 + $this -> assign('is_collect',2);
  57 + }else{
  58 + //不存在显示1
  59 + $this -> assign('is_collect',1);
  60 + }
51 return $this -> fetch(); 61 return $this -> fetch();
52 62
53 } 63 }
@@ -61,12 +71,17 @@ class GoodsdetailsController extends WeChatBaseController{ @@ -61,12 +71,17 @@ class GoodsdetailsController extends WeChatBaseController{
61 $uid = cmf_get_current_user_id(); 71 $uid = cmf_get_current_user_id();
62 $arr['goods_id'] = $goods_id; 72 $arr['goods_id'] = $goods_id;
63 $arr['uid'] = $uid; 73 $arr['uid'] = $uid;
  74 + $collect = Db::name('collect') -> where('goods_id',$arr['goods_id']) -> find();
  75 + if($collect){
  76 + return 3;
  77 + }else{
64 $data = Db::name('collect') -> insert($arr); 78 $data = Db::name('collect') -> insert($arr);
65 if($data){ 79 if($data){
66 return true; 80 return true;
67 }else{ 81 }else{
68 return false; 82 return false;
69 } 83 }
  84 + }
70 85
71 } 86 }
72 87
@@ -204,7 +204,8 @@ class PersonalcenterController extends WeChatBaseController{ @@ -204,7 +204,8 @@ class PersonalcenterController extends WeChatBaseController{
204 */ 204 */
205 public function shop_address(){ 205 public function shop_address(){
206 206
207 - $data = Db::name('address') -> where("delete_time = 0") -> select() -> toArray(); 207 + $uid = cmf_get_current_user_id();
  208 + $data = Db::name('address') -> where("delete_time = 0 and uid =".$uid) -> select() -> toArray();
208 if(!empty($data)){ 209 if(!empty($data)){
209 foreach($data as $key => $val){ 210 foreach($data as $key => $val){
210 $detailed = explode(',',$val['detailed']); 211 $detailed = explode(',',$val['detailed']);
@@ -115,7 +115,11 @@ class SalesmangoodsController extends WeChatBaseController{ @@ -115,7 +115,11 @@ class SalesmangoodsController extends WeChatBaseController{
115 $data['press_time'] = $_POST['press_time']; 115 $data['press_time'] = $_POST['press_time'];
116 $data['suit'] = $_POST['suit']; 116 $data['suit'] = $_POST['suit'];
117 $data['grade'] = $_POST['grade']; 117 $data['grade'] = $_POST['grade'];
118 - $data['det_img'] = $_POST['img0'].','.$_POST['img1'].','.$_POST['img2']; 118 + $det_img[0] = $_POST['img0'];
  119 + $det_img[1] = $_POST['img1'];
  120 + $det_img[2] = $_POST['img2'];
  121 + /* $data['det_img'] = $_POST['img0'].','.$_POST['img1'].','.$_POST['img2'];*/
  122 + $data['det_img'] = json_encode($det_img);
119 $data['create_time'] = time(); 123 $data['create_time'] = time();
120 $data['type'] = 2; 124 $data['type'] = 2;
121 $data['uid'] = cmf_get_current_user_id(); 125 $data['uid'] = cmf_get_current_user_id();
@@ -59,7 +59,7 @@ @@ -59,7 +59,7 @@
59 <img src="{:cmf_get_image_url($vo.show_img)}" alt=""> 59 <img src="{:cmf_get_image_url($vo.show_img)}" alt="">
60 </div> 60 </div>
61 <div class="in_hotText"> 61 <div class="in_hotText">
62 - <div class="in_hotName txt-cut"><span>{$vo.name}</span>{$vo.book_name}</div> 62 + <div class="in_hotName txt-cut"><span>{$vo.grade}</span>{$vo.book_name}</div>
63 <div class="in_cam_shopPrice"> 63 <div class="in_cam_shopPrice">
64 <div class="in_hotPrice1"><span>{$vo.price0}</span>.{$vo.price01}</div> 64 <div class="in_hotPrice1"><span>{$vo.price0}</span>.{$vo.price01}</div>
65 </div> 65 </div>
@@ -116,7 +116,7 @@ @@ -116,7 +116,7 @@
116 for(var i=0;i<data_arr.length;i++){ 116 for(var i=0;i<data_arr.length;i++){
117 show_img = data_arr[i].show_img; 117 show_img = data_arr[i].show_img;
118 url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id; 118 url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
119 - $('.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>"); 119 + $('.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>");
120 } 120 }
121 }); 121 });
122 } 122 }
@@ -132,7 +132,7 @@ @@ -132,7 +132,7 @@
132 for(var i=0;i<data_arr.length;i++){ 132 for(var i=0;i<data_arr.length;i++){
133 show_img = data_arr[i].show_img; 133 show_img = data_arr[i].show_img;
134 url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id; 134 url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
135 - $('.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>"); 135 + $('.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>");
136 } 136 }
137 }); 137 });
138 } 138 }
@@ -149,7 +149,7 @@ @@ -149,7 +149,7 @@
149 for(var i=0;i<data_arr.length;i++){ 149 for(var i=0;i<data_arr.length;i++){
150 show_img = data_arr[i].show_img; 150 show_img = data_arr[i].show_img;
151 url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id; 151 url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
152 - $('.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>"); 152 + $('.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>");
153 } 153 }
154 }); 154 });
155 } 155 }
@@ -166,7 +166,7 @@ @@ -166,7 +166,7 @@
166 for(var i=0;i<data_arr.length;i++){ 166 for(var i=0;i<data_arr.length;i++){
167 show_img = data_arr[i].show_img; 167 show_img = data_arr[i].show_img;
168 url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id; 168 url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
169 - $('.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>"); 169 + $('.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>");
170 } 170 }
171 }); 171 });
172 } 172 }
@@ -184,7 +184,7 @@ @@ -184,7 +184,7 @@
184 for(var i=0;i<data_arr.length;i++){ 184 for(var i=0;i<data_arr.length;i++){
185 show_img = data_arr[i].show_img; 185 show_img = data_arr[i].show_img;
186 url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id; 186 url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
187 - $('.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>"); 187 + $('.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>");
188 } 188 }
189 }); 189 });
190 }else{ 190 }else{
@@ -194,7 +194,7 @@ @@ -194,7 +194,7 @@
194 for(var i=0;i<data_arr.length;i++){ 194 for(var i=0;i<data_arr.length;i++){
195 show_img = data_arr[i].show_img; 195 show_img = data_arr[i].show_img;
196 url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id; 196 url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
197 - $('.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>"); 197 + $('.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>");
198 } 198 }
199 }); 199 });
200 } 200 }
@@ -119,12 +119,31 @@ @@ -119,12 +119,31 @@
119 119
120 <!-- 底部 --> 120 <!-- 底部 -->
121 <div class="de_footer"> 121 <div class="de_footer">
  122 + <if condition="$is_collect eq 1">
122 <div class="de_footerLeft" onclick="goods_collection({$data.id})"> 123 <div class="de_footerLeft" onclick="goods_collection({$data.id})">
  124 + <div class="de_footerLeftLi" style="margin-top: 0.1rem">
  125 + <div class="de_footerLeftImg">
  126 + <img src="__TMPL__/public/assets/images/26.png" alt="" id="imgsss">
  127 + </div>
  128 + <p id="shoucang">收藏</p>
  129 + </div>
  130 + </div>
  131 + <else/>
  132 + <div class="de_footerLeft">
123 <div class="de_footerLeftLi"> 133 <div class="de_footerLeftLi">
124 <div class="de_footerLeftImg"> 134 <div class="de_footerLeftImg">
125 - <img src="__TMPL__/public/assets/images/26.png" alt=""> 135 + <img src="__TMPL__/public/assets/images/xin (1).png" alt="">
  136 + </div>
  137 + <p>已收藏</p>
  138 + </div>
  139 + </div>
  140 + </if>
  141 + <div class="de_footerLeft">
  142 + <div class="de_footerLeftLi" onclick="go_to_car()">
  143 + <div class="de_footerLeftImg" style="width: 0.45rem;height: 0.45rem;">
  144 + <img src="__TMPL__/public/assets/images/17.png" alt="">
126 </div> 145 </div>
127 - <p>收藏</p> 146 + <p>购物车</p>
128 </div> 147 </div>
129 </div> 148 </div>
130 <div class="de_footerRight"> 149 <div class="de_footerRight">
@@ -137,6 +156,13 @@ @@ -137,6 +156,13 @@
137 <script src="__TMPL__/public/assets/js/jquery.js"></script> 156 <script src="__TMPL__/public/assets/js/jquery.js"></script>
138 <script> 157 <script>
139 /** 158 /**
  159 + * 点击跳转购物车页面
  160 + */
  161 + function go_to_car(){
  162 + window.location.href = "{:url('Shopcart/shop_cart')}";
  163 + }
  164 +
  165 + /**
140 * 点击立即购买 166 * 点击立即购买
141 */ 167 */
142 function buy_now(id){ 168 function buy_now(id){
@@ -160,11 +186,18 @@ @@ -160,11 +186,18 @@
160 */ 186 */
161 function goods_collection(id){ 187 function goods_collection(id){
162 $.post("{:url('Goodsdetails/goods_collection')}",{goods_id:id},function(data){ 188 $.post("{:url('Goodsdetails/goods_collection')}",{goods_id:id},function(data){
  189 + if(data == 3){
  190 + alert('已收藏');
  191 + }else{
163 if(data){ 192 if(data){
  193 + $("#imgsss").attr("src","__TMPL__/public/assets/images/xin (1).png");
  194 + $('#shoucang').text('已收藏');
164 alert('收藏成功'); 195 alert('收藏成功');
165 }else{ 196 }else{
166 alert('收藏失败'); 197 alert('收藏失败');
167 } 198 }
  199 + }
  200 +
168 }); 201 });
169 } 202 }
170 203
@@ -126,11 +126,11 @@ @@ -126,11 +126,11 @@
126 phone = $('#phone').text(); 126 phone = $('#phone').text();
127 detailed = $('#detailed').text(); 127 detailed = $('#detailed').text();
128 if(name == ''){ 128 if(name == ''){
129 - alert('姓名不能为空'); 129 + alert('收货地址不能为空');
130 }else if(phone == ''){ 130 }else if(phone == ''){
131 - alert('手机号不能为空'); 131 + alert('收货地址不能为空');
132 }else if(detailed == ''){ 132 }else if(detailed == ''){
133 - alert('地址不能为空'); 133 + alert('收货地址不能为空');
134 }else{ 134 }else{
135 id = {$indent_id}; 135 id = {$indent_id};
136 liuyan = $('#liuyan').val(); 136 liuyan = $('#liuyan').val();
@@ -143,11 +143,11 @@ @@ -143,11 +143,11 @@
143 phone = $('#phone').text(); 143 phone = $('#phone').text();
144 detailed = $('#detailed').text(); 144 detailed = $('#detailed').text();
145 if(name == ''){ 145 if(name == ''){
146 - alert('姓名不能为空'); 146 + alert('收货地址不能为空');
147 }else if(phone == ''){ 147 }else if(phone == ''){
148 - alert('手机号不能为空'); 148 + alert('收货地址不能为空');
149 }else if(detailed == ''){ 149 }else if(detailed == ''){
150 - alert('地址不能为空'); 150 + alert('收货地址不能为空');
151 }else{ 151 }else{
152 liuyan = $('#liuyan').val(); 152 liuyan = $('#liuyan').val();
153 indet_id = {$indet_id}; 153 indet_id = {$indet_id};
@@ -68,7 +68,7 @@ @@ -68,7 +68,7 @@
68 alert('姓名不能为空'); 68 alert('姓名不能为空');
69 }else if($('#phone').val() == ''){ 69 }else if($('#phone').val() == ''){
70 alert('手机号不能为空'); 70 alert('手机号不能为空');
71 - }else if($('#city_text').text() == ''){ 71 + }else if($('#city_text').text() == '选择省市区'){
72 alert('地区不能为空'); 72 alert('地区不能为空');
73 }else if($('#address_content').val() == ''){ 73 }else if($('#address_content').val() == ''){
74 alert('详细地址不能为空'); 74 alert('详细地址不能为空');
@@ -248,12 +248,10 @@ @@ -248,12 +248,10 @@
248 <p>购物车</p> 248 <p>购物车</p>
249 </li> 249 </li>
250 </a> 250 </a>
251 - <a href="log_one.html">  
252 <li> 251 <li>
253 <img src="__TMPL__/public/assets/images/19.png" alt="" /> 252 <img src="__TMPL__/public/assets/images/19.png" alt="" />
254 <p style="color:#FF7700;">我的</p> 253 <p style="color:#FF7700;">我的</p>
255 </li> 254 </li>
256 - </a>  
257 </ul> 255 </ul>
258 </div> 256 </div>
259 <script src="__TMPL__/public/assets/js/jquery.js"></script> 257 <script src="__TMPL__/public/assets/js/jquery.js"></script>
@@ -137,6 +137,7 @@ @@ -137,6 +137,7 @@
137 for(i=0;i<ids.length;i++){ 137 for(i=0;i<ids.length;i++){
138 goods_id[i] = ids[i].dataset.id; 138 goods_id[i] = ids[i].dataset.id;
139 } 139 }
  140 + console.log(goods_id);
140 if(goods_id.length == 0){ 141 if(goods_id.length == 0){
141 alert('不能为空'); 142 alert('不能为空');
142 }else{ 143 }else{
@@ -257,10 +258,13 @@ @@ -257,10 +258,13 @@
257 if ($(this).attr("src") == "__TMPL__/public/assets/images/39_0.png") { 258 if ($(this).attr("src") == "__TMPL__/public/assets/images/39_0.png") {
258 $(this).attr("src", "__TMPL__/public/assets/images/39.png"); 259 $(this).attr("src", "__TMPL__/public/assets/images/39.png");
259 calcTotal(); 260 calcTotal();
  261 + $(this).parents('.sh_cartround').addClass('add');
260 } else { 262 } else {
261 $(this).attr("src", "__TMPL__/public/assets/images/39_0.png"); 263 $(this).attr("src", "__TMPL__/public/assets/images/39_0.png");
262 $(".shop_carts1 img").attr('src', "__TMPL__/public/assets/images/39_1.png"); 264 $(".shop_carts1 img").attr('src', "__TMPL__/public/assets/images/39_1.png");
263 calcTotal(); 265 calcTotal();
  266 + $(this).parents('.sh_cartround').removeClass('add');
  267 +
264 } 268 }
265 }); 269 });
266 }); 270 });