Commit dff3310e8d283d1c104e810acb540ba8d02753b6
Merge branch 'dev' into 'test'
Dev See merge request !510
Showing
8 changed files
with
191 additions
and
162 deletions
app.js
| @@ -45,7 +45,7 @@ App({ | @@ -45,7 +45,7 @@ App({ | ||
| 45 | config2: null, //门店配置 | 45 | config2: null, //门店配置 |
| 46 | code: null, | 46 | code: null, |
| 47 | heigth:0, | 47 | heigth:0, |
| 48 | - user_id:6519826,// 3674923,// 4379287,// null,// 5682068, | 48 | + user_id:null,// 3674923,// 4379287,// null,// 5682068, |
| 49 | buy_now:null, | 49 | buy_now:null, |
| 50 | picklist:null, //门店列表 | 50 | picklist:null, //门店列表 |
| 51 | wuliuprice: null, //物流价格表 | 51 | wuliuprice: null, //物流价格表 |
components/diy_goodsGroup/diy_goodsGroup.js
| @@ -44,6 +44,7 @@ Component({ | @@ -44,6 +44,7 @@ Component({ | ||
| 44 | is_nav:0, | 44 | is_nav:0, |
| 45 | nav_list:null, | 45 | nav_list:null, |
| 46 | title_index:0, | 46 | title_index:0, |
| 47 | + swiper_hei:0, | ||
| 47 | }, | 48 | }, |
| 48 | 49 | ||
| 49 | ready: function () {}, | 50 | ready: function () {}, |
| @@ -70,16 +71,21 @@ Component({ | @@ -70,16 +71,21 @@ Component({ | ||
| 70 | if(idlist) idlist=ut.sub_last(idlist); | 71 | if(idlist) idlist=ut.sub_last(idlist); |
| 71 | nav_list[ij].idlist=idlist; | 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 | this.data.classstyle_id = nav_item.classstyle; | 78 | this.data.classstyle_id = nav_item.classstyle; |
| 79 | this.data.goodscount = this.data.object.goodscount; | 79 | this.data.goodscount = this.data.object.goodscount; |
| 80 | this.data.wgroup =nav_item.wgroup; | 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 | if (nav_item.goodsclass == 1) { | 89 | if (nav_item.goodsclass == 1) { |
| 84 | this.data.is_recommend = 1 | 90 | this.data.is_recommend = 1 |
| 85 | } | 91 | } |
| @@ -203,60 +209,8 @@ Component({ | @@ -203,60 +209,8 @@ Component({ | ||
| 203 | total: res.data.data.total | 209 | total: res.data.data.total |
| 204 | }) | 210 | }) |
| 205 | th.data.currentPage++; | 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 | break; | 216 | break; |
| @@ -277,60 +231,10 @@ Component({ | @@ -277,60 +231,10 @@ Component({ | ||
| 277 | goods_btn: res.data.data.pageData, total: res.data.data.total | 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 | break; | 239 | break; |
| 336 | } | 240 | } |
| @@ -434,7 +338,7 @@ Component({ | @@ -434,7 +338,7 @@ Component({ | ||
| 434 | 338 | ||
| 435 | var nav_item=this.data.object.nav_list[title_idx]; | 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 | var arr = []; | 342 | var arr = []; |
| 439 | for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) { | 343 | for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) { |
| 440 | arr.push(this.data.g_id.slice(i, i + this.data.goodscount)); | 344 | arr.push(this.data.g_id.slice(i, i + this.data.goodscount)); |
| @@ -465,6 +369,71 @@ Component({ | @@ -465,6 +369,71 @@ Component({ | ||
| 465 | //初始化 | 369 | //初始化 |
| 466 | this.init(this.data.classstyle_id, this.data.wgroup); | 370 | this.init(this.data.classstyle_id, this.data.wgroup); |
| 467 | setTimeout(function(){ wx.hideLoading();},1000) | 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,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 | <view class="sp"> | 592 | <view class="sp"> |
| 593 | <swiper-item class="s_it" wx:for="{{goods_array}}"> | 593 | <swiper-item class="s_it" wx:for="{{goods_array}}"> |
| 594 | <block wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind"> | 594 | <block wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind"> |
| 595 | <navigator url="/pages/goods/goodsInfo/goodsInfo?goods_id={{aitem.goods_id}}" > | 595 | <navigator url="/pages/goods/goodsInfo/goodsInfo?goods_id={{aitem.goods_id}}" > |
| 596 | <view class='one'> | 596 | <view class='one'> |
| 597 | <view class='sp_top'> | 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 | </view> | 619 | </view> |
| 601 | <view class='clear'></view> | 620 | <view class='clear'></view> |
| 602 | </view> | 621 | </view> |
components/diy_goodsGroup/diy_goodsGroup.wxss
| @@ -398,7 +398,7 @@ | @@ -398,7 +398,7 @@ | ||
| 398 | } | 398 | } |
| 399 | 399 | ||
| 400 | .zs_goods_3l { | 400 | .zs_goods_3l { |
| 401 | - width: 236rpx; | 401 | + width: 228rpx; |
| 402 | min-height: 300rpx; | 402 | min-height: 300rpx; |
| 403 | margin: 0 auto; | 403 | margin: 0 auto; |
| 404 | padding: 2rpx; | 404 | padding: 2rpx; |
| @@ -419,7 +419,6 @@ | @@ -419,7 +419,6 @@ | ||
| 419 | 419 | ||
| 420 | .zs_center_3l { | 420 | .zs_center_3l { |
| 421 | width: 100%; | 421 | width: 100%; |
| 422 | - min-height: 200rpx; | ||
| 423 | font-size: 28rpx; | 422 | font-size: 28rpx; |
| 424 | color: #333; | 423 | color: #333; |
| 425 | text-align: left; | 424 | text-align: left; |
| @@ -575,7 +574,7 @@ | @@ -575,7 +574,7 @@ | ||
| 575 | .ai-center{align-items: center;} | 574 | .ai-center{align-items: center;} |
| 576 | 575 | ||
| 577 | .gr_title_list{ width:95%; margin-left:2.5%} | 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 | .border_zhijiao{ | 580 | .border_zhijiao{ |
| @@ -606,12 +605,10 @@ | @@ -606,12 +605,10 @@ | ||
| 606 | .s_prom { | 605 | .s_prom { |
| 607 | width: 100%; | 606 | width: 100%; |
| 608 | background-color: white; | 607 | background-color: white; |
| 609 | - min-height: 200rpx; | ||
| 610 | } | 608 | } |
| 611 | 609 | ||
| 612 | swiper { | 610 | swiper { |
| 613 | display: block; | 611 | display: block; |
| 614 | - height: 400rpx; | ||
| 615 | } | 612 | } |
| 616 | 613 | ||
| 617 | .right_k { | 614 | .right_k { |
| @@ -630,7 +627,6 @@ swiper { | @@ -630,7 +627,6 @@ swiper { | ||
| 630 | 627 | ||
| 631 | 628 | ||
| 632 | .sp { | 629 | .sp { |
| 633 | - min-height: 300rpx; | ||
| 634 | width: 100%; | 630 | width: 100%; |
| 635 | background-color: white; | 631 | background-color: white; |
| 636 | padding: 18rpx; | 632 | padding: 18rpx; |
| @@ -651,8 +647,6 @@ swiper { | @@ -651,8 +647,6 @@ swiper { | ||
| 651 | width: 210rpx; | 647 | width: 210rpx; |
| 652 | height: 100%; | 648 | height: 100%; |
| 653 | position: relative; | 649 | position: relative; |
| 654 | - top: -74rpx; | ||
| 655 | - left: 0rpx; | ||
| 656 | } | 650 | } |
| 657 | 651 | ||
| 658 | .sp .sp_top .s_top_kill { | 652 | .sp .sp_top .s_top_kill { |
| @@ -689,7 +683,6 @@ swiper { | @@ -689,7 +683,6 @@ swiper { | ||
| 689 | 683 | ||
| 690 | .sp_wz { | 684 | .sp_wz { |
| 691 | width: 210rpx; | 685 | width: 210rpx; |
| 692 | - min-height: 100rpx; | ||
| 693 | } | 686 | } |
| 694 | 687 | ||
| 695 | .sp_wz .sp_wzi { | 688 | .sp_wz .sp_wzi { |
| @@ -785,3 +778,34 @@ swiper { | @@ -785,3 +778,34 @@ swiper { | ||
| 785 | 778 | ||
| 786 | .t_red{ color:red;} | 779 | .t_red{ color:red;} |
| 787 | 780 | ||
| 781 | +.sp .sp_top .s_img image.zs_t3_3l{ | ||
| 782 | + width: 56rpx; | ||
| 783 | + height: 56rpx; | ||
| 784 | + position: absolute; | ||
| 785 | + left: 0rpx; | ||
| 786 | + bottom: 10rpx; | ||
| 787 | +} | ||
| 788 | +.sp .sp_top .s_img image.zs_t1_3l{ | ||
| 789 | +width: 56rpx; | ||
| 790 | +height: 56rpx; | ||
| 791 | +position: absolute; | ||
| 792 | +left: 0rpx; | ||
| 793 | +top: 10rpx; | ||
| 794 | +} | ||
| 795 | + | ||
| 796 | +.sp .sp_top .s_img image.zs_t2_3l{ | ||
| 797 | + width: 56rpx; | ||
| 798 | + height: 56rpx; | ||
| 799 | + position: absolute; | ||
| 800 | + right: 0rpx; | ||
| 801 | + top: 10rpx; | ||
| 802 | + | ||
| 803 | +} | ||
| 804 | +.sp .sp_top .s_img image.zs_t4_3l{ | ||
| 805 | + width: 56rpx; | ||
| 806 | + height: 56rpx; | ||
| 807 | + position: absolute; | ||
| 808 | + right: 0rpx; | ||
| 809 | + bottom: 10rpx; | ||
| 810 | + | ||
| 811 | +} | ||
| 788 | \ No newline at end of file | 812 | \ No newline at end of file |
components/diy_goodsGroup/g_filter.wxs
| @@ -8,6 +8,8 @@ var get_class = function(column,position) { | @@ -8,6 +8,8 @@ var get_class = function(column,position) { | ||
| 8 | if(column==3){ return "zs_t"+position+"_3l"; } | 8 | if(column==3){ return "zs_t"+position+"_3l"; } |
| 9 | //----列表的情况----- | 9 | //----列表的情况----- |
| 10 | if(column==4 ){ return "zs_t1_x"+position; } | 10 | if(column==4 ){ return "zs_t1_x"+position; } |
| 11 | + //--滑动的情况 | ||
| 12 | + if(column==5){ return "zs_t"+position+"_3l"; } | ||
| 11 | } | 13 | } |
| 12 | 14 | ||
| 13 | 15 |
pages/goods/categoryList/categoryList.js
| @@ -522,42 +522,47 @@ Page({ | @@ -522,42 +522,47 @@ Page({ | ||
| 522 | var arr=new Array(); | 522 | var arr=new Array(); |
| 523 | var dda = e.data.data.pageData; | 523 | var dda = e.data.data.pageData; |
| 524 | s.setData({brand_list:dda}); | 524 | s.setData({brand_list:dda}); |
| 525 | - for (var i = 0; i < dda.length; i++) { | ||
| 526 | - //console.log(dda[i].logo) | ||
| 527 | - if(dda[i].logo && dda[i].logo.indexOf("http")<0){ | ||
| 528 | - dda[i].logo = oo.imghost+dda[i].logo; | ||
| 529 | - } | ||
| 530 | - if (arr.length>0){ | ||
| 531 | - var find = 0; | ||
| 532 | - //寻找字母在arr数组中是否存在,不存在就要添加,存在就在要这个数组添加元素 | ||
| 533 | - for (var k = 0; k < arr.length;k++){ | ||
| 534 | - if(dda[i].zm == arr[k].zm){ find=k+1; break;} | ||
| 535 | - } | ||
| 536 | - if (find == 0) { | ||
| 537 | - var item = { zm: dda[i].zm, array: new Array() } | ||
| 538 | - item.array.push(dda[i]); | ||
| 539 | - arr.push(item); | ||
| 540 | - } else{ | ||
| 541 | - arr[find - 1].array.push(dda[i]); | ||
| 542 | - } | ||
| 543 | - }else{ | ||
| 544 | - var item = { zm: dda[i].zm, array: new Array() } | ||
| 545 | - item.array.push(dda[i]); | ||
| 546 | - arr.push(item); | ||
| 547 | - } | ||
| 548 | - } | ||
| 549 | - //进行排序,只有是默认排序的时候,才按首字母排序 | ||
| 550 | - if(parseInt(s.data.is_used_share)==0){ | ||
| 551 | - arr.sort(compare("zm")); | ||
| 552 | - } | ||
| 553 | 525 | ||
| 554 | - for(var i=0;i< arr.length;i++){ | ||
| 555 | - for(var j=0;j<arr[i].array.length;j++){ | ||
| 556 | - if(arr[i].array[j].logo == ""){ | ||
| 557 | - arr[i].array[j].logo= s.data.iurl+"/miniapp/images/no_brand_def.jpg"; | ||
| 558 | - } | ||
| 559 | - } | ||
| 560 | - } | 526 | + |
| 527 | + for (var i = 0; i < dda.length; i++) { | ||
| 528 | + //console.log(dda[i].logo) | ||
| 529 | + if(dda[i].logo==""){ | ||
| 530 | + dda[i].logo= s.data.iurl+"/miniapp/images/no_brand_def.jpg"; | ||
| 531 | + }else if(dda[i].logo && dda[i].logo.indexOf("http")<0){ | ||
| 532 | + dda[i].logo = oo.imghost+dda[i].logo; | ||
| 533 | + } | ||
| 534 | + | ||
| 535 | + //进行排序,只有是默认排序的时候,才按首字母排序 | ||
| 536 | + if(parseInt(s.data.is_used_share)!=0) continue; | ||
| 537 | + | ||
| 538 | + if (arr.length>0){ | ||
| 539 | + var find = 0; | ||
| 540 | + //寻找字母在arr数组中是否存在,不存在就要添加,存在就在要这个数组添加元素 | ||
| 541 | + for (var k = 0; k < arr.length;k++){ | ||
| 542 | + if(dda[i].zm == arr[k].zm){ find=k+1; break;} | ||
| 543 | + } | ||
| 544 | + if (find == 0) { | ||
| 545 | + var item = { zm: dda[i].zm, array: new Array() } | ||
| 546 | + item.array.push(dda[i]); | ||
| 547 | + arr.push(item); | ||
| 548 | + } else{ | ||
| 549 | + arr[find - 1].array.push(dda[i]); | ||
| 550 | + } | ||
| 551 | + }else{ | ||
| 552 | + var item = { zm: dda[i].zm, array: new Array() } | ||
| 553 | + item.array.push(dda[i]); | ||
| 554 | + arr.push(item); | ||
| 555 | + } | ||
| 556 | + } | ||
| 557 | + if(parseInt(s.data.is_used_share)==0){ | ||
| 558 | + arr.sort(compare("zm")); | ||
| 559 | + }else{ | ||
| 560 | + var ob={array:dda}; | ||
| 561 | + arr.push(ob); | ||
| 562 | + } | ||
| 563 | + | ||
| 564 | + | ||
| 565 | + | ||
| 561 | s.setData({ groups: arr }); | 566 | s.setData({ groups: arr }); |
| 562 | //console.log(s.data.groups) | 567 | //console.log(s.data.groups) |
| 563 | } | 568 | } |
pages/index/index/index.js
| @@ -90,6 +90,12 @@ Page({ | @@ -90,6 +90,12 @@ Page({ | ||
| 90 | th.setData({ | 90 | th.setData({ |
| 91 | is_boot: is_init | 91 | is_boot: is_init |
| 92 | }); | 92 | }); |
| 93 | + | ||
| 94 | + if(!is_init){ | ||
| 95 | + th.setData({ | ||
| 96 | + swiperimage: [] | ||
| 97 | + }); | ||
| 98 | + } | ||
| 93 | } | 99 | } |
| 94 | }) | 100 | }) |
| 95 | 101 | ||
| @@ -408,6 +414,7 @@ Page({ | @@ -408,6 +414,7 @@ Page({ | ||
| 408 | this.setData({ | 414 | this.setData({ |
| 409 | ishow: 1 | 415 | ishow: 1 |
| 410 | }); | 416 | }); |
| 417 | + | ||
| 411 | //---先获取会员--- | 418 | //---先获取会员--- |
| 412 | t.getUserFir(function() { | 419 | t.getUserFir(function() { |
| 413 | th.is_festival(); | 420 | th.is_festival(); |
| @@ -723,6 +730,7 @@ Page({ | @@ -723,6 +730,7 @@ Page({ | ||
| 723 | var user_info = getApp().globalData.userInfo; | 730 | var user_info = getApp().globalData.userInfo; |
| 724 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 731 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 725 | wx.navigateTo({ | 732 | wx.navigateTo({ |
| 733 | + //url: '/pages/togoin/togoin', | ||
| 726 | url: '/pages/getphone/getphone', | 734 | url: '/pages/getphone/getphone', |
| 727 | }) | 735 | }) |
| 728 | return false; | 736 | return false; |
pages/index/index/index.wxml
| @@ -111,6 +111,7 @@ | @@ -111,6 +111,7 @@ | ||
| 111 | </view> | 111 | </view> |
| 112 | </view> | 112 | </view> |
| 113 | <!-- 轮播 --> | 113 | <!-- 轮播 --> |
| 114 | + <block wx:if="{{swiperimage.length>0}}"> | ||
| 114 | <swiper class="swiper" autoplay="true" interval="5000" circular="{{true}}" indicator-dots="{{true}}" indicator-active-color="rgb(255,255,255)"> | 115 | <swiper class="swiper" autoplay="true" interval="5000" circular="{{true}}" indicator-dots="{{true}}" indicator-active-color="rgb(255,255,255)"> |
| 115 | <!-- 活动轮播 --> | 116 | <!-- 活动轮播 --> |
| 116 | <block wx:for="{{swiperimage}}" wx:for-item="adver" wx:for-index="key"> | 117 | <block wx:for="{{swiperimage}}" wx:for-item="adver" wx:for-index="key"> |
| @@ -121,6 +122,7 @@ | @@ -121,6 +122,7 @@ | ||
| 121 | </swiper-item> | 122 | </swiper-item> |
| 122 | </block> | 123 | </block> |
| 123 | </swiper> | 124 | </swiper> |
| 125 | + </block> | ||
| 124 | 126 | ||
| 125 | <view class="split-line"></view> | 127 | <view class="split-line"></view> |
| 126 | 128 |