Commit 4b52425f65845bd5f68405c18f85547a3eed61c3
1 parent
21dd8727
商品分组的修改
Showing
4 changed files
with
140 additions
and
125 deletions
components/diy_goodsGroup/diy_goodsGroup.js
| ... | ... | @@ -44,6 +44,7 @@ Component({ |
| 44 | 44 | is_nav:0, |
| 45 | 45 | nav_list:null, |
| 46 | 46 | title_index:0, |
| 47 | + swiper_hei:0, | |
| 47 | 48 | }, |
| 48 | 49 | |
| 49 | 50 | ready: function () {}, |
| ... | ... | @@ -70,16 +71,21 @@ Component({ |
| 70 | 71 | if(idlist) idlist=ut.sub_last(idlist); |
| 71 | 72 | nav_list[ij].idlist=idlist; |
| 72 | 73 | } |
| 73 | - this.setData({nav_list:nav_list,is_nav:this.data.object.is_nav}); | |
| 74 | + this.setData({nav_list:nav_list,is_nav:parseInt(this.data.object.is_nav)}); | |
| 74 | 75 | } |
| 75 | - | |
| 76 | - | |
| 76 | + | |
| 77 | 77 | // 在组件实例进入页面节点树时执行 |
| 78 | 78 | this.data.classstyle_id = nav_item.classstyle; |
| 79 | 79 | this.data.goodscount = this.data.object.goodscount; |
| 80 | 80 | this.data.wgroup =nav_item.wgroup; |
| 81 | - | |
| 82 | - | |
| 81 | + | |
| 82 | + var hei=280; | |
| 83 | + if(this.data.object.goodstit) hei+=80; | |
| 84 | + if(this.data.object.goodsprice) hei+=80; | |
| 85 | + if(this.data.object.goodsnum) hei+=80; | |
| 86 | + | |
| 87 | + this.setData({swiper_hei:hei}); | |
| 88 | + | |
| 83 | 89 | if (nav_item.goodsclass == 1) { |
| 84 | 90 | this.data.is_recommend = 1 |
| 85 | 91 | } |
| ... | ... | @@ -203,60 +209,8 @@ Component({ |
| 203 | 209 | total: res.data.data.total |
| 204 | 210 | }) |
| 205 | 211 | th.data.currentPage++; |
| 206 | - var now=ut.gettimestamp(); | |
| 207 | - | |
| 208 | - goods.forEach(async function (val, ind) { | |
| 209 | - var item = {}; | |
| 210 | - var prom_id = null; | |
| 211 | - console.log(val.goodsid); | |
| 212 | - //app.request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + val.goods_id, {}).then(res => { | |
| 213 | - //商品地址 | |
| 214 | - //var goods = res.data.data; | |
| 215 | - | |
| 216 | - item.goods_name = val.goods_name; | |
| 217 | - item.goods_img = th.data.imghost + val.original_img; | |
| 218 | - item.market_price = val.market_price; | |
| 219 | - item.shop_price = val.shop_price; | |
| 220 | - item.sales_sum = val.sales_sum; | |
| 221 | - item.goods_id = val.goods_id; | |
| 222 | - | |
| 223 | - item.cardprice1 = val.cardprice1; | |
| 224 | - item.cardprice2 = val.cardprice2; | |
| 225 | - item.cardprice3 = val.cardprice3; | |
| 226 | - | |
| 227 | - prom_id = val.prom_id; | |
| 228 | - | |
| 229 | - var prom_type = val.prom_type; //0普通商品 1秒杀 6拼单 | |
| 230 | - | |
| 231 | - var url = ""; | |
| 232 | - if (prom_type == 6) { | |
| 233 | - url = "/api/weshop/teamlist/get/" + os.stoid + "/" + prom_id; | |
| 234 | - } else if (prom_type == 1) { | |
| 235 | - url = "/api/ms/flash_sale/get/" + os.stoid + "/" + prom_id; | |
| 236 | - } | |
| 237 | - if(url!="") { | |
| 238 | - await app.request.promiseGet(url, {}).then(res => { | |
| 239 | - var prom = null | |
| 240 | - if (res && res.data) prom=res.data.data; | |
| 241 | - if (prom != null && prom.is_end==0 && prom.end_time>now && prom.show_time<now) { | |
| 242 | - item.prom_price = res.data.data.price; | |
| 243 | - } | |
| 244 | - th.data.requestData.push(item); | |
| 245 | - th.setData({ | |
| 246 | - goods_array: th.data.requestData, | |
| 247 | - page: th.data.currentPage - 1, | |
| 248 | - }); | |
| 249 | - }) | |
| 250 | - }else{ | |
| 251 | - th.data.requestData.push(item); | |
| 252 | - th.setData({ | |
| 253 | - goods_array: th.data.requestData, | |
| 254 | - page: th.data.currentPage - 1, | |
| 255 | - }); | |
| 256 | - } | |
| 257 | - | |
| 258 | - | |
| 259 | - }) | |
| 212 | + //设置商品熏染 | |
| 213 | + th.set_good(goods); | |
| 260 | 214 | |
| 261 | 215 | }) |
| 262 | 216 | break; |
| ... | ... | @@ -277,60 +231,10 @@ Component({ |
| 277 | 231 | goods_btn: res.data.data.pageData, total: res.data.data.total |
| 278 | 232 | }) |
| 279 | 233 | |
| 280 | - th.data.currentPage++; | |
| 281 | - var now=ut.gettimestamp(); | |
| 282 | - goods.forEach(async function (val, ind) { | |
| 283 | - var item = {}; | |
| 284 | - var prom_id = null; | |
| 285 | - console.log(val.goodsid); | |
| 286 | - //app.request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + val.goods_id, {}).then(res => { | |
| 287 | - //商品地址 | |
| 288 | - var goods = res.data.data; | |
| 289 | - | |
| 290 | - item.goods_name = val.goods_name; | |
| 291 | - item.goods_img = th.data.imghost + val.original_img; | |
| 292 | - item.market_price = val.market_price; | |
| 293 | - item.shop_price = val.shop_price; | |
| 294 | - item.sales_sum = val.sales_sum; | |
| 295 | - item.goods_id = val.goods_id; | |
| 296 | - | |
| 297 | - item.cardprice1 = val.cardprice1; | |
| 298 | - item.cardprice2 = val.cardprice2; | |
| 299 | - item.cardprice3 = val.cardprice3; | |
| 300 | - | |
| 301 | - prom_id = val.prom_id; | |
| 302 | - | |
| 303 | - var prom_type = res.data.data.prom_type; //0普通商品 1秒杀 6拼单 | |
| 304 | - | |
| 305 | - var url = ""; | |
| 306 | - if (prom_type == 6) { | |
| 307 | - url = "/api/weshop/teamlist/get/" + os.stoid + "/" + prom_id; | |
| 308 | - } else if (prom_type == 1) { | |
| 309 | - url = "/api/ms/flash_sale/get/" + os.stoid + "/" + prom_id; | |
| 310 | - } | |
| 311 | - | |
| 312 | - if(url!=null){ | |
| 313 | - await app.request.promiseGet(url, {}).then(res => { | |
| 314 | - var prom =null; | |
| 315 | - if(res && res.data) res.data.data; | |
| 316 | - if (prom != null && prom.is_end==0 && prom.end_time>now && prom.show_time<now) { | |
| 317 | - item.prom_price = res.data.data.price; | |
| 318 | - } | |
| 319 | - th.data.requestData.push(item); | |
| 320 | - th.setData({ | |
| 321 | - goods_array: th.data.requestData, | |
| 322 | - page: th.data.currentPage - 1, | |
| 323 | - }); | |
| 324 | - }) | |
| 325 | - }else{ | |
| 326 | - th.data.requestData.push(item); | |
| 327 | - th.setData({ | |
| 328 | - goods_array: th.data.requestData, | |
| 329 | - page: th.data.currentPage - 1, | |
| 330 | - }); | |
| 331 | - } | |
| 332 | - }) | |
| 333 | - | |
| 234 | + th.data.currentPage++; | |
| 235 | + //设置商品熏染 | |
| 236 | + th.set_good(goods); | |
| 237 | + | |
| 334 | 238 | }) |
| 335 | 239 | break; |
| 336 | 240 | } |
| ... | ... | @@ -434,7 +338,7 @@ Component({ |
| 434 | 338 | |
| 435 | 339 | var nav_item=this.data.object.nav_list[title_idx]; |
| 436 | 340 | |
| 437 | - this.data.g_id = this.data.object.nav_list[0].data; | |
| 341 | + this.data.g_id = this.data.object.nav_list[title_idx].data; | |
| 438 | 342 | var arr = []; |
| 439 | 343 | for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) { |
| 440 | 344 | arr.push(this.data.g_id.slice(i, i + this.data.goodscount)); |
| ... | ... | @@ -465,6 +369,71 @@ Component({ |
| 465 | 369 | //初始化 |
| 466 | 370 | this.init(this.data.classstyle_id, this.data.wgroup); |
| 467 | 371 | setTimeout(function(){ wx.hideLoading();},1000) |
| 372 | + }, | |
| 373 | + | |
| 374 | + //--- 设置 --- | |
| 375 | + set_good:async function(goods){ | |
| 376 | + var now=ut.gettimestamp(); | |
| 377 | + var th=this; | |
| 378 | + for(var i in goods){ | |
| 379 | + var val=goods[i]; | |
| 380 | + var item = {}; | |
| 381 | + var prom_id = null; | |
| 382 | + console.log(val.goodsid); | |
| 383 | + //app.request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + val.goods_id, {}).then(res => { | |
| 384 | + | |
| 385 | + item.goods_name = val.goods_name; | |
| 386 | + item.goods_img = th.data.imghost + val.original_img; | |
| 387 | + item.market_price = val.market_price; | |
| 388 | + item.shop_price = val.shop_price; | |
| 389 | + item.sales_sum = val.sales_sum; | |
| 390 | + item.goods_id = val.goods_id; | |
| 391 | + | |
| 392 | + item.cardprice1 = val.cardprice1; | |
| 393 | + item.cardprice2 = val.cardprice2; | |
| 394 | + item.cardprice3 = val.cardprice3; | |
| 395 | + | |
| 396 | + prom_id = val.prom_id; | |
| 397 | + | |
| 398 | + var prom_type = val.prom_type; //0普通商品 1秒杀 6拼单 | |
| 399 | + | |
| 400 | + var url = ""; | |
| 401 | + if (prom_type == 6) { | |
| 402 | + url = "/api/weshop/teamlist/get/" + os.stoid + "/" + prom_id; | |
| 403 | + } else if (prom_type == 1) { | |
| 404 | + url = "/api/ms/flash_sale/get/" + os.stoid + "/" + prom_id; | |
| 405 | + } | |
| 406 | + | |
| 407 | + if(url!=null){ | |
| 408 | + await getApp().request.promiseGet(url, {}).then(res => { | |
| 409 | + var prom =null; | |
| 410 | + if(res && res.data) res.data.data; | |
| 411 | + if (prom != null && prom.is_end==0 && prom.end_time>now && prom.show_time<now) { | |
| 412 | + item.prom_price = res.data.data.price; | |
| 413 | + } | |
| 414 | + th.data.requestData.push(item); | |
| 415 | + | |
| 416 | + }) | |
| 417 | + }else{ | |
| 418 | + th.data.requestData.push(item); | |
| 419 | + } | |
| 420 | + } | |
| 421 | + | |
| 422 | + if(th.data.object.column==5){ | |
| 423 | + var arr = new Array(); | |
| 424 | + var rData=th.data.requestData; | |
| 425 | + //--三个三个一组--- | |
| 426 | + for(var i=0;i< rData.length;i+=3){ | |
| 427 | + arr.push(rData.slice(i,i+3)); | |
| 428 | + } | |
| 429 | + th.setData({ goods_array: arr,page: th.data.currentPage - 1, }); | |
| 430 | + }else{ | |
| 431 | + th.setData({ | |
| 432 | + goods_array: th.data.requestData, | |
| 433 | + page: th.data.currentPage - 1, | |
| 434 | + }); | |
| 435 | + } | |
| 436 | + | |
| 468 | 437 | } |
| 469 | 438 | |
| 470 | 439 | } | ... | ... |
components/diy_goodsGroup/diy_goodsGroup.wxml
| ... | ... | @@ -588,15 +588,34 @@ |
| 588 | 588 | |
| 589 | 589 | |
| 590 | 590 | <!--商品展示--> |
| 591 | - <swiper class="s_prom" indicator-active-color='red' indicator-dots="false" wx:if="{{object.column==5}}"> | |
| 591 | + <swiper class="s_prom" indicator-active-color='red' indicator-dots="false" wx:if="{{object.column==5}}" style="height: {{swiper_hei}}rpx;"> | |
| 592 | 592 | <view class="sp"> |
| 593 | 593 | <swiper-item class="s_it" wx:for="{{goods_array}}"> |
| 594 | 594 | <block wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind"> |
| 595 | 595 | <navigator url="/pages/goods/goodsInfo/goodsInfo?goods_id={{aitem.goods_id}}" > |
| 596 | 596 | <view class='one'> |
| 597 | 597 | <view class='sp_top'> |
| 598 | - <view class='s_img'> | |
| 599 | - <image src="{{imghost+aitem.original_img}}" data-errorimg="goods_array[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3"></image> | |
| 598 | + <view class='s_img' style="position: relative;"> | |
| 599 | + <image src="{{aitem.goods_img}}" data-errorimg="goods_array[{{index}}][{{aind}}].goods_img" binderror="bind_bnerr3"></image> | |
| 600 | + | |
| 601 | + <block wx:if="{{object.goodicon==3}}"> | |
| 602 | + <image class='{{g_filter.get_class(object.column,object.position)}}' | |
| 603 | + src='{{object.customicon}}'></image> | |
| 604 | + </block> | |
| 605 | + <block wx:if="{{object.goodicon==1}}"> | |
| 606 | + <image class='{{g_filter.get_class(object.column,object.position)}}' src=''></image> | |
| 607 | + </block> | |
| 608 | + <block wx:if="{{object.goodicon==2}}"> | |
| 609 | + <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==1}}" | |
| 610 | + src='{{imghost}}/miniapp/images/Recommend.png'></image> | |
| 611 | + <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==2 }}" | |
| 612 | + src='{{imghost}}/miniapp/images/hot.png'></image> | |
| 613 | + <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==3}}" | |
| 614 | + src='{{imghost}}/miniapp/images/new.png'></image> | |
| 615 | + <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==4 }}" | |
| 616 | + src='{{imghost}}/miniapp/images/Promotion.png'></image> | |
| 617 | + </block> | |
| 618 | + | |
| 600 | 619 | </view> |
| 601 | 620 | <view class='clear'></view> |
| 602 | 621 | </view> | ... | ... |
components/diy_goodsGroup/diy_goodsGroup.wxss
| ... | ... | @@ -398,7 +398,7 @@ |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | .zs_goods_3l { |
| 401 | - width: 236rpx; | |
| 401 | + width: 228rpx; | |
| 402 | 402 | min-height: 300rpx; |
| 403 | 403 | margin: 0 auto; |
| 404 | 404 | padding: 2rpx; |
| ... | ... | @@ -419,7 +419,6 @@ |
| 419 | 419 | |
| 420 | 420 | .zs_center_3l { |
| 421 | 421 | width: 100%; |
| 422 | - min-height: 200rpx; | |
| 423 | 422 | font-size: 28rpx; |
| 424 | 423 | color: #333; |
| 425 | 424 | text-align: left; |
| ... | ... | @@ -575,7 +574,7 @@ |
| 575 | 574 | .ai-center{align-items: center;} |
| 576 | 575 | |
| 577 | 576 | .gr_title_list{ width:95%; margin-left:2.5%} |
| 578 | -.gr_title_item{ padding:0 10rpx;flex-shrink: 0;} | |
| 577 | +.gr_title_item{ padding:0 10rpx;flex-shrink: 0;flex-grow: 1; text-align: center;} | |
| 579 | 578 | |
| 580 | 579 | |
| 581 | 580 | .border_zhijiao{ |
| ... | ... | @@ -606,12 +605,10 @@ |
| 606 | 605 | .s_prom { |
| 607 | 606 | width: 100%; |
| 608 | 607 | background-color: white; |
| 609 | - min-height: 200rpx; | |
| 610 | 608 | } |
| 611 | 609 | |
| 612 | 610 | swiper { |
| 613 | 611 | display: block; |
| 614 | - height: 400rpx; | |
| 615 | 612 | } |
| 616 | 613 | |
| 617 | 614 | .right_k { |
| ... | ... | @@ -630,7 +627,6 @@ swiper { |
| 630 | 627 | |
| 631 | 628 | |
| 632 | 629 | .sp { |
| 633 | - min-height: 300rpx; | |
| 634 | 630 | width: 100%; |
| 635 | 631 | background-color: white; |
| 636 | 632 | padding: 18rpx; |
| ... | ... | @@ -651,7 +647,6 @@ swiper { |
| 651 | 647 | width: 210rpx; |
| 652 | 648 | height: 100%; |
| 653 | 649 | position: relative; |
| 654 | - top: -74rpx; | |
| 655 | 650 | left: 0rpx; |
| 656 | 651 | } |
| 657 | 652 | |
| ... | ... | @@ -689,7 +684,6 @@ swiper { |
| 689 | 684 | |
| 690 | 685 | .sp_wz { |
| 691 | 686 | width: 210rpx; |
| 692 | - min-height: 100rpx; | |
| 693 | 687 | } |
| 694 | 688 | |
| 695 | 689 | .sp_wz .sp_wzi { |
| ... | ... | @@ -785,3 +779,34 @@ swiper { |
| 785 | 779 | |
| 786 | 780 | .t_red{ color:red;} |
| 787 | 781 | |
| 782 | +.sp .sp_top .s_img image.zs_t3_3l{ | |
| 783 | + width: 56rpx; | |
| 784 | + height: 56rpx; | |
| 785 | + position: absolute; | |
| 786 | + left: 0rpx; | |
| 787 | + bottom: 10rpx; | |
| 788 | +} | |
| 789 | +.sp .sp_top .s_img image.zs_t1_3l{ | |
| 790 | +width: 56rpx; | |
| 791 | +height: 56rpx; | |
| 792 | +position: absolute; | |
| 793 | +left: 0rpx; | |
| 794 | +top: 10rpx; | |
| 795 | +} | |
| 796 | + | |
| 797 | +.sp .sp_top .s_img image.zs_t2_3l{ | |
| 798 | + width: 56rpx; | |
| 799 | + height: 56rpx; | |
| 800 | + position: absolute; | |
| 801 | + right: 0rpx; | |
| 802 | + top: 10rpx; | |
| 803 | + | |
| 804 | +} | |
| 805 | +.sp .sp_top .s_img image.zs_t4_3l{ | |
| 806 | + width: 56rpx; | |
| 807 | + height: 56rpx; | |
| 808 | + position: absolute; | |
| 809 | + right: 0rpx; | |
| 810 | + bottom: 10rpx; | |
| 811 | + | |
| 812 | +} | |
| 788 | 813 | \ No newline at end of file | ... | ... |
components/diy_goodsGroup/g_filter.wxs