Commit 37f33818e98777e56ac8edd5f2fc0c4c26717fc8
1 parent
3577a3c5
小程序首页1.1
Showing
7 changed files
with
144 additions
and
89 deletions
pages/goods/goodsInfo/goodsInfo.wxss
| ... | ... | @@ -2226,4 +2226,5 @@ right:17rpx; top:55rpx; |
| 2226 | 2226 | line-height:15rpx; |
| 2227 | 2227 | } |
| 2228 | 2228 | |
| 2229 | -.no_pj_list{text-align: center; width: 100%; color: #999; margin-top: 30rpx; display: inline-block; font-size: 28rpx} | |
| 2230 | 2229 | \ No newline at end of file |
| 2230 | +.no_pj_list{text-align: center; width: 100%; color: #999; margin-top: 30rpx; display: inline-block; font-size: 28rpx} | |
| 2231 | + | ... | ... |
pages/goods/search/search.js
| ... | ... | @@ -44,6 +44,14 @@ Page({ |
| 44 | 44 | }) |
| 45 | 45 | e.init(this, "", "requestData"); |
| 46 | 46 | var url = this.data.baseUrl; |
| 47 | + | |
| 48 | + //扫一扫过来,显示搜索的内容 | |
| 49 | + var s_key = t.s_key; | |
| 50 | + if (s_key){ | |
| 51 | + this.search(s_key); his.openSearchModal(); | |
| 52 | + return; | |
| 53 | + } | |
| 54 | + | |
| 47 | 55 | if (0 != t.brand_id && t.brand_id!=undefined){ url += "&brand_id=" + t.brand_id;} |
| 48 | 56 | if (0 != t.nation_id && t.nation_id!=undefined) { url += "&nation_id=" + t.nation_id;} |
| 49 | 57 | if (0 != t.max_price && t.max_price!=undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price;} | ... | ... |
pages/index/index/index.js
| ... | ... | @@ -55,6 +55,7 @@ Page({ |
| 55 | 55 | //看下商家是否开通会员权益 |
| 56 | 56 | is_boot:0, |
| 57 | 57 | gd_category:null, |
| 58 | + is_no_more:0, | |
| 58 | 59 | }, |
| 59 | 60 | |
| 60 | 61 | onLoad: function () { |
| ... | ... | @@ -67,7 +68,7 @@ Page({ |
| 67 | 68 | data: { storeId: os.stoid} |
| 68 | 69 | }).then(res => { |
| 69 | 70 | if(res.data.data){ |
| 70 | - is_init=res.data.data.isBool; | |
| 71 | + var is_init=res.data.data.isBool; | |
| 71 | 72 | th.setData({is_boot:is_init}); |
| 72 | 73 | } |
| 73 | 74 | }) |
| ... | ... | @@ -88,7 +89,7 @@ Page({ |
| 88 | 89 | } |
| 89 | 90 | |
| 90 | 91 | //--正再拼团中的处理-- |
| 91 | - var url = "/api/weshop/order/pageTuan?pt_status=1&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1" | |
| 92 | + var url = "/api/weshop/order/pageTuan?pt_status=2&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1" | |
| 92 | 93 | await getApp().request.promiseGet(url, {}).then(res => { |
| 93 | 94 | if (res.data.code == 0 && res.data.data && res.data.data.pageData) { |
| 94 | 95 | th.data.pt_timer_arr = res.data.data.pageData; |
| ... | ... | @@ -99,6 +100,7 @@ Page({ |
| 99 | 100 | var p_item = th.data.pt_timer_arr[i]; |
| 100 | 101 | await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + p_item.user_id, {1: 1}).then(res => { |
| 101 | 102 | th.data.pt_timer_arr[i].head_pic = res.data.data.head_pic; |
| 103 | + th.data.pt_timer_arr[i].nickname = res.data.data.nickname; | |
| 102 | 104 | }) |
| 103 | 105 | } |
| 104 | 106 | th.Interval_pt(); |
| ... | ... | @@ -106,10 +108,12 @@ Page({ |
| 106 | 108 | |
| 107 | 109 | //---处理正在6个分类---- |
| 108 | 110 | await getApp().request.promiseGet("/api/weshop/goodscategory/page", { |
| 109 | - data: {store_id: os.stoid, pageSize: 6,is_show:1} | |
| 111 | + data: {store_id: os.stoid, pageSize: 5,is_show:1} | |
| 110 | 112 | }).then(res => { |
| 111 | - var gd_category=res.data.data.pageData; | |
| 112 | - th.seData({gd_category:gd_category}); | |
| 113 | + if(res.data.data) { | |
| 114 | + var gd_category = res.data.data.pageData; | |
| 115 | + th.setData({gd_category: gd_category}); | |
| 116 | + } | |
| 113 | 117 | }) |
| 114 | 118 | }, |
| 115 | 119 | |
| ... | ... | @@ -166,6 +170,7 @@ Page({ |
| 166 | 170 | } |
| 167 | 171 | console.log(arr); |
| 168 | 172 | if (arr.length>0) e.setData({ banner: arr, }); |
| 173 | + | |
| 169 | 174 | wx.stopPullDownRefresh(); |
| 170 | 175 | }) |
| 171 | 176 | |
| ... | ... | @@ -216,7 +221,7 @@ Page({ |
| 216 | 221 | store_id: os.stoid, |
| 217 | 222 | is_end: 0, |
| 218 | 223 | is_show: 1, |
| 219 | - pageSize: 9 | |
| 224 | + pageSize: 6 | |
| 220 | 225 | } |
| 221 | 226 | }).then(res => { |
| 222 | 227 | var e = res; |
| ... | ... | @@ -233,9 +238,9 @@ Page({ |
| 233 | 238 | }); |
| 234 | 239 | |
| 235 | 240 | var arr = new Array(); |
| 236 | - //--三个三个一组--- | |
| 237 | - for(var i=0;i< pd_data.length;i+=3){ | |
| 238 | - arr.push(pd_data.slice(i,i+3)); | |
| 241 | + //--2个2个一组--- | |
| 242 | + for(var i=0;i< pd_data.length;i+=2){ | |
| 243 | + arr.push(pd_data.slice(i,i+2)); | |
| 239 | 244 | } |
| 240 | 245 | th.setData({ |
| 241 | 246 | pindGoods: arr |
| ... | ... | @@ -308,7 +313,13 @@ Page({ |
| 308 | 313 | }, |
| 309 | 314 | //---加载更多是靠这个函数---- |
| 310 | 315 | onReachBottom: function () { |
| 316 | + //if (!n.canloadMore()) this.setData({ is_no_more:1}); | |
| 317 | + var n1 = n.data.goodsLoadFinishFlag | |
| 318 | + if (n1) { | |
| 319 | + this.setData({ is_no_more: 1 }); return false; | |
| 320 | + } | |
| 311 | 321 | n.canloadMore() && this.requestRecommend(); |
| 322 | + | |
| 312 | 323 | }, |
| 313 | 324 | |
| 314 | 325 | //--更多商品-- |
| ... | ... | @@ -522,11 +533,67 @@ Page({ |
| 522 | 533 | var th=this; |
| 523 | 534 | this.data.pt_timer=setInterval(function () { |
| 524 | 535 | var item=ut.get_rand_item(th.data.pt_timer_arr); |
| 536 | + | |
| 537 | + console.log("Interval_pt"); | |
| 538 | + console.log(item); | |
| 539 | + | |
| 525 | 540 | th.setData({pt_timer_active:1,pt_timer_item:item}); |
| 526 | 541 | setTimeout(function () { |
| 527 | 542 | th.setData({pt_timer_active:0}); |
| 528 | - },1000) | |
| 529 | - },3000); | |
| 530 | - } | |
| 543 | + },1500) | |
| 544 | + },4000); | |
| 545 | + }, | |
| 546 | + | |
| 547 | + | |
| 548 | + //---扫一扫的函数--- | |
| 549 | + getScancode: function () { | |
| 550 | + var _this = this; | |
| 551 | + // 允许从相机和相册扫码 | |
| 552 | + wx.scanCode({ | |
| 553 | + success: (res) => { | |
| 554 | + var result = res.result; | |
| 555 | + wx.navigateTo({ | |
| 556 | + url: "/pages/goods/search/search?s_key=" + result, | |
| 557 | + }); | |
| 558 | + } | |
| 559 | + }) | |
| 560 | + }, | |
| 561 | + | |
| 562 | + //跳转到分类 | |
| 563 | + go_cate:function(){ | |
| 564 | + getApp().goto("/pages/goods/categoryList/categoryList"); | |
| 565 | + }, | |
| 566 | + | |
| 567 | + go_url:function(e){ | |
| 568 | + var url=e.currentTarget.dataset.url; | |
| 569 | + getApp().goto(url); | |
| 570 | + }, | |
| 571 | + | |
| 572 | + bind_bnerr_icon:function (e) { | |
| 573 | + var def= "/miniapp/images/default_g_img.gif"; | |
| 574 | + var _err = e.currentTarget.dataset.err; | |
| 575 | + var ob={}; | |
| 576 | + ob[_err]=def; | |
| 577 | + this.setData(ob); | |
| 578 | + }, | |
| 579 | + | |
| 580 | + //跳转到分类的商品列表 | |
| 581 | + go_cate2: function (t) { | |
| 582 | + var cid = t.currentTarget.dataset.cid; | |
| 583 | + var pid = t.currentTarget.dataset.pid; | |
| 584 | + var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid; | |
| 585 | + wx.navigateTo({ url: lurl }); | |
| 586 | + }, | |
| 587 | + | |
| 588 | + //跳转到权益 | |
| 589 | + go_quanyi:function(t){ | |
| 590 | + var user_info = getApp().globalData.userInfo; | |
| 591 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | |
| 592 | + wx.navigateTo({ url: '/pages/getphone/getphone', }) | |
| 593 | + return false; | |
| 594 | + } | |
| 595 | + getApp().goto("/pages/user/userqy/userqy"); | |
| 596 | + } | |
| 597 | + | |
| 531 | 598 | |
| 532 | 599 | }); |
| 533 | 600 | \ No newline at end of file | ... | ... |
pages/index/index/index.wxml
| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | </block> |
| 6 | 6 | <!--搜索框--> |
| 7 | 7 | <view class="{{banner==null?'pink-b ':''}} search-box {{scrollTop>10?'search-fixed':''}} flex-center white "> |
| 8 | - <view class="classify-frame t-c"> | |
| 8 | + <view class="classify-frame t-c" bindtap="go_cate"> | |
| 9 | 9 | <image class="classify-img" src="{{url}}/miniapp/images/classify.png"></image> |
| 10 | 10 | <view class="fs20">分<text class="white fs22">类</text></view> |
| 11 | 11 | </view> |
| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | </view> |
| 19 | 19 | <view class="classify-frame t-c"> |
| 20 | 20 | <image class="classify-img" src="{{url}}/miniapp/images/scanning.png"></image> |
| 21 | - <view class="fs20">扫一扫</view> | |
| 21 | + <view bindtap="getScancode" class="fs20">扫一扫</view> | |
| 22 | 22 | </view> |
| 23 | 23 | </view> |
| 24 | 24 | <!--滚动广告--> |
| ... | ... | @@ -97,51 +97,24 @@ |
| 97 | 97 | </view> |
| 98 | 98 | </view> |
| 99 | 99 | |
| 100 | - | |
| 100 | + <!---大分类---> | |
| 101 | 101 | <view class="flex-center-around"> |
| 102 | - <view> | |
| 103 | - <view class="circle xc-class-frame t-c"> | |
| 104 | - <image class="xc-class-img" src="{{url}}/miniapp/images/skincare.png"></image> | |
| 105 | - <view class="fs24">护肤</view> | |
| 106 | - </view> | |
| 107 | - </view> | |
| 108 | - | |
| 109 | - <view> | |
| 110 | - <view class="circle xc-class-frame t-c"> | |
| 111 | - <image class="xc-class-img" src="{{url}}/miniapp/images/cosmetics.png"></image> | |
| 112 | - <view class="fs24">彩妆</view> | |
| 113 | - </view> | |
| 114 | - </view> | |
| 115 | - | |
| 116 | - <view> | |
| 117 | - <view class="circle xc-class-frame t-c"> | |
| 118 | - <image class="xc-class-img" src="{{url}}/miniapp/images/mask.png"></image> | |
| 119 | - <view class="fs24">面膜</view> | |
| 120 | - </view> | |
| 121 | - </view> | |
| 122 | - | |
| 123 | - | |
| 124 | - <view> | |
| 125 | - <view class="circle xc-class-frame t-c"> | |
| 126 | - <image class="xc-class-img" src="{{url}}/miniapp/images/nursing.png"></image> | |
| 127 | - <view class="fs24">个人护理</view> | |
| 128 | - </view> | |
| 129 | - </view> | |
| 130 | - | |
| 131 | - | |
| 132 | - <view> | |
| 133 | - <view class="circle xc-class-frame t-c"> | |
| 134 | - <image class="xc-class-img" src="{{url}}/miniapp/images/man_region.png"></image> | |
| 135 | - <view class="fs24">男士专区</view> | |
| 102 | + <view wx:for="{{gd_category}}" | |
| 103 | + bindtap="go_cate2" data-cid="{{item.id}}" data-pid="0"> | |
| 104 | + <view class="circle xc-class-frame t-c"> | |
| 105 | + <image class="xc-class-img" src="{{url+item.icon}}" binderror="bind_bnerr_icon" | |
| 106 | + data-err="gd_category[{{index}}].icon"></image> | |
| 107 | + <view class="fs24">{{item.name}}</view> | |
| 108 | + </view> | |
| 136 | 109 | </view> |
| 137 | - </view> | |
| 138 | 110 | </view> |
| 139 | 111 | |
| 140 | - <view class="title-img-frame"> | |
| 112 | + <!---跳转我的权益---> | |
| 113 | + <view class="title-img-frame" wx:if="{{is_boot}}" bindtap="go_quanyi" > | |
| 141 | 114 | <image class="xc-title-img"src="{{url}}/miniapp/images/title.png"></image> |
| 142 | - </view> | |
| 143 | - <view class="split-line"> | |
| 144 | - </view> | |
| 115 | + </view> | |
| 116 | + | |
| 117 | + <view class="split-line"></view> | |
| 145 | 118 | |
| 146 | 119 | <!--秒杀--> |
| 147 | 120 | <view class="seckill" wx:if="{{saleGoods!=null && pindGoods.length!=0 }}"> |
| ... | ... | @@ -197,13 +170,15 @@ |
| 197 | 170 | <navigator url="/pages/activity/pind_list/pind_list"> |
| 198 | 171 | <view class="seckill-time"> |
| 199 | 172 | <view class="classname flex"> |
| 200 | - <image class="clock-img" src="{{url}}/miniapp/images/clock.png"></image> | |
| 173 | + <image class="clock-img" src="{{url}}/miniapp/images/clock.png"></image> | |
| 201 | 174 | <image class="seckill-ttitle-img"src="{{url}}/miniapp/images/team.png"></image> |
| 202 | - <image class="user-img circle" src="{{url}}/miniapp/images/nursing.png"></image> | |
| 203 | - <view class="flex user-frame t-c xc-ash"> | |
| 204 | - <view class="ellipsis-1 user-name fs24">张大仙</view> | |
| 205 | - <text class="fs20">刚拼团成功</text> | |
| 206 | - </view> | |
| 175 | + <block wx:if="{{pt_timer_item}}"> | |
| 176 | + <view class="flex user-frame t-c xc-ash {{pt_timer_active==1?'pt_active':''}}"> | |
| 177 | + <image class="user-img circle" src="{{pt_timer_item.head_pic}}"></image> | |
| 178 | + <view class="ellipsis-1 user-name fs24">{{pt_timer_item.nickname}}</view> | |
| 179 | + <text class="fs20">刚拼团成功</text> | |
| 180 | + </view> | |
| 181 | + </block> | |
| 207 | 182 | </view> |
| 208 | 183 | <view class="flex seckill-list"> |
| 209 | 184 | <text class="fs24 xc-marfin-right">查看全部</text> |
| ... | ... | @@ -404,12 +379,10 @@ |
| 404 | 379 | |
| 405 | 380 | <view class="collects"> |
| 406 | 381 | <view class="hang "> |
| 407 | - | |
| 408 | 382 | <!-- 商品详情 --> |
| 409 | - <view class="collect ib" wx:for="{{recommend}}"> | |
| 410 | - <!-- 商品图片 --> | |
| 411 | - | |
| 412 | - <image class="sp" src="{{item.original_img}}"mode="scaleToFill"></image> | |
| 383 | + <view class="collect ib" wx:for="{{recommend}}" bindtap="go_url" data-url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}"> | |
| 384 | + <!-- 商品图片 --> | |
| 385 | + <image class="sp" src="{{item.original_img}}" mode="scaleToFill" binderror="bind_bnerr2" data-url="{{item.original_img}}" data-errorimg="recommend[{{index}}].original_img"></image> | |
| 413 | 386 | <view class="bottom"> |
| 414 | 387 | <!-- 商品名称 --> |
| 415 | 388 | <view class="goods_name ellipsis-2 fs24">{{item.goods_name}}</view> |
| ... | ... | @@ -428,21 +401,18 @@ |
| 428 | 401 | |
| 429 | 402 | </view> |
| 430 | 403 | |
| 431 | - <!-- 办卡优惠多少 --> | |
| 404 | + <!-- 办卡优惠多少 | |
| 432 | 405 | <view class="Discount flex-center"> |
| 433 | 406 | <image src="{{url}}/miniapp/images/Member.png"></image> |
| 434 | 407 | <view class="province">黑卡省11.9元</view> |
| 435 | - </view> | |
| 436 | - | |
| 408 | + </view>--> | |
| 437 | 409 | </view> |
| 438 | 410 | |
| 439 | - | |
| 440 | - | |
| 441 | 411 | |
| 442 | 412 | </view> |
| 443 | 413 | |
| 444 | 414 | </view> |
| 445 | - <view class="nothing flex-center" wx:if="{{ismore!=0}}"> | |
| 415 | + <view class="nothing flex-center" wx:if="{{is_no_more}}"> | |
| 446 | 416 | <view class="Foil"></view> |
| 447 | 417 | <view class="no_content fs24">没有更多内容了</view> |
| 448 | 418 | <view class="Foil"></view> | ... | ... |
pages/index/index/index.wxss
| ... | ... | @@ -404,14 +404,15 @@ margin-left:20rpx; |
| 404 | 404 | } |
| 405 | 405 | .user-frame{ |
| 406 | 406 | width:220rpx; |
| 407 | - border-left: 5rpx solid #eee; | |
| 407 | + /* border-left: 5rpx solid #eee; */ | |
| 408 | 408 | height: 35rpx; |
| 409 | 409 | line-height: 35rpx; |
| 410 | 410 | margin-left: 10rpx; |
| 411 | 411 | |
| 412 | 412 | } |
| 413 | 413 | .user-name{ |
| 414 | - width: 66rpx | |
| 414 | + width: 66rpx; | |
| 415 | + border-left: 5rpx solid #eee; | |
| 415 | 416 | } |
| 416 | 417 | |
| 417 | 418 | |
| ... | ... | @@ -693,5 +694,10 @@ left: 43%; |
| 693 | 694 | } |
| 694 | 695 | .mar-top{ |
| 695 | 696 | margin-top: 20rpx; |
| 697 | +} | |
| 696 | 698 | |
| 699 | +.pt_active{ animation: sport 0.5s;} | |
| 700 | +@keyframes sport { | |
| 701 | + 0% {transform: translateY(80rpx);opacity: 0;} | |
| 702 | + 100% {transform: translateY(0rpx);opacity: 1} | |
| 697 | 703 | } |
| 698 | 704 | \ No newline at end of file | ... | ... |
utils/LoadMore.js
| ... | ... | @@ -65,6 +65,7 @@ var e = function() { |
| 65 | 65 | console.log('loadmore'); |
| 66 | 66 | console.log(t.data.data.pageData); |
| 67 | 67 | console.log(c ); |
| 68 | + | |
| 68 | 69 | |
| 69 | 70 | //如果已经的第二页的时候,就是把数据加入数组 |
| 70 | 71 | if (c !=undefined && c.data[l]) { |
| ... | ... | @@ -73,35 +74,35 @@ var e = function() { |
| 73 | 74 | f = "" != d ? c.data[l][d] : c.data[l], [].push.apply(f, i), g = c.data[l]; |
| 74 | 75 | } else g = t.data.data.pageData; |
| 75 | 76 | |
| 76 | - | |
| 77 | + | |
| 77 | 78 | //格式化 |
| 78 | 79 | var glist=""; |
| 79 | - for (var i = 0; i < g.length; i++) { | |
| 80 | + for (var ij = 0; ij < g.length; ij++) { | |
| 80 | 81 | //if(g[i].prom_type == 1 || g[i].prom_type == 2 || g[i].prom_type == 6) { |
| 81 | - if (g[i].prom_type == 1) { | |
| 82 | - glist += g[i].goods_id+","; | |
| 82 | + if (g[ij].prom_type == 1) { | |
| 83 | + glist += g[ij].goods_id+","; | |
| 83 | 84 | } |
| 84 | - if (g[i].original_img!=undefined){ | |
| 85 | - if (g[i].original_img.indexOf(oo.imghost)==-1) | |
| 86 | - g[i].original_img = oo.imghost + g[i].original_img; | |
| 85 | + if (g[ij].original_img!=undefined){ | |
| 86 | + if (g[ij].original_img.indexOf(oo.imghost)==-1) | |
| 87 | + g[ij].original_img = oo.imghost + g[ij].original_img; | |
| 87 | 88 | } |
| 88 | 89 | |
| 89 | - if (g[i].add_time != undefined){ | |
| 90 | - var tx = g[i].add_time + ""; | |
| 90 | + if (g[ij].add_time != undefined){ | |
| 91 | + var tx = g[ij].add_time + ""; | |
| 91 | 92 | if (tx.indexOf('-') == -1) { |
| 92 | - g[i].add_time = ut.formatTime(g[i].add_time, 'yyyy-MM-dd hh:mm:ss'); | |
| 93 | + g[ij].add_time = ut.formatTime(g[i].add_time, 'yyyy-MM-dd hh:mm:ss'); | |
| 93 | 94 | } |
| 94 | 95 | } |
| 95 | 96 | if (rurl.indexOf('comment/page')!=-1){ |
| 96 | 97 | console.log('comment/page'); |
| 97 | - console.log(g[i].img); | |
| 98 | - var tx1 = g[i].img; | |
| 98 | + console.log(g[ij].img); | |
| 99 | + var tx1 = g[ij].img; | |
| 99 | 100 | |
| 100 | 101 | if (tx1 != "" && tx1 != null && ut.isString(tx1)){ |
| 101 | 102 | var arr = ut.unserialize(tx1); |
| 102 | - g[i].img=arr; | |
| 103 | + g[ij].img=arr; | |
| 103 | 104 | } else if (!ut.isArray(tx1)){ |
| 104 | - g[i].img=""; | |
| 105 | + g[ij].img=""; | |
| 105 | 106 | } |
| 106 | 107 | } |
| 107 | 108 | } | ... | ... |
utils/util.js
| ... | ... | @@ -252,7 +252,9 @@ function check_mobile(phoneMobile){ |
| 252 | 252 | function get_rand_item(arr){ |
| 253 | 253 | if(!arr) return null; |
| 254 | 254 | if(arr.length<=0) return null; |
| 255 | - var ind=Math.floor(Math.random()*arr.length*10); | |
| 255 | + if(arr.length==1) return arr[0]; | |
| 256 | + var ind=Math.floor(Math.random()*arr.length); | |
| 257 | + if(ind==arr.length) ind=arr.length-1; | |
| 256 | 258 | return arr[ind]; |
| 257 | 259 | } |
| 258 | 260 | ... | ... |