diff --git a/app.wxss b/app.wxss index 6a43593..5677590 100644 --- a/app.wxss +++ b/app.wxss @@ -2,6 +2,9 @@ .flex { display: flex; } +.ib{ + display: inline-block; +} .flex_auto { flex: 1; } @@ -10,6 +13,7 @@ display: flex; flex-direction: column; justify-content: space-between; box-sizing: border-box; + overflow-x:hidden; } page { overflow-x: hidden; @@ -240,9 +244,7 @@ justify-content:space-around; .t-l{ text-align: right; } -.white{ - color: #fff; -} + .img_gray{ -webkit-filter: grayscale(1);/* Webkit */ filter:gray;/* IE6-9 */ @@ -273,6 +275,7 @@ justify-content:space-around; font-size:30rpx; } + .fs35{ font-size:35rpx; } @@ -285,7 +288,9 @@ justify-content:space-around; /* 7.26 */ - +.white{ + color: #fff; +} .red-b{ background: #d60021; } @@ -306,15 +311,21 @@ color: #b9b9b9; .xc-black{ color: #000; } +.xc-black3{ + color: #333; +} .xc-fixed{ position: fixed; } -.yellow{ +.yellow-b{ background-color: #ffb03f; } +.yellow-co{ + color: #ffb03f; +} .green{ background-color: #16ba63; } @@ -342,8 +353,11 @@ background: #ffe3e2; font-size: 24rpx; } .fs36 { - font-size: 36rpx; + font-size: 36rpx; } .fs40 { font-size: 40rpx; -} \ No newline at end of file +} +.ai_and{ + align-items:flex-end; +} diff --git a/components/goods_list/goods_list.js b/components/goods_list/goods_list.js new file mode 100644 index 0000000..810ad76 --- /dev/null +++ b/components/goods_list/goods_list.js @@ -0,0 +1,85 @@ +// pages/user/yhq/qr_code/qr_code.js + + +var + t = getApp(), a = t.request, o = t.globalData.setting, os = o, + i = require("../../utils/util.js"), ut = i, s = require("../../utils/common.js"); + + +Component({ + data: { + url: o.imghost, + object: null, + curPage:1, + is_no_more:1,//加载完所有数据的控制器 + load_complete:0//加载完成 + }, + properties: { + // 这里定义了innerText属性,属性值可以在组件使用时指定 + }, + ready: function () { + }, + + + methods: { + + get_list:function(){ + + var that = this; + if(that.data.is_no_more==0) return false; + + + var curPage = that.data.curPage; + getApp().request.get('/api/weshop/goods/page?page',{ + data: { is_mainshow: 1, isonsale: 1, + is_recommend: 1, is_on_sale: 1, + store_id: o.stoid, + page: curPage, + pageSize:6, + }, + success: function (res){ + var data=res.data; + var total=data.data.total; + if (total <= curPage*6){ + that.setData({ is_no_more: 0 }); + }else{ + that.data.curPage++; + } + + + //加载完成 + if (data.data.pageData) { + that.setData({load_complete:1}); + } + if(that.data.recommend!=null){ + var ra=that.data.recommend.concat(data.data.pageData); + that.setData({ recommend: ra }); + }else{ + that.setData({recommend:data.data.pageData}); + } + } + }) + }, + bind_bnerr_xc: function (e) { + var _errImg = e.target.dataset.errorimg; + var _errurl = e.target.dataset.url; + + var _errObj = {}; + _errObj[_errImg] = "/miniapp/images/default_g_img.gif"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + + }, + + reset:function(){ + curPage=1; + }, + + + + }, + + + + + +}) \ No newline at end of file diff --git a/components/goods_list/goods_list.json b/components/goods_list/goods_list.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/components/goods_list/goods_list.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/goods_list/goods_list.wxml b/components/goods_list/goods_list.wxml new file mode 100644 index 0000000..1f8dfd5 --- /dev/null +++ b/components/goods_list/goods_list.wxml @@ -0,0 +1,38 @@ + + + + + + + + + + + + {{item.goods_name}} + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + {{item.market_price}} + + + + + + + + + 没有更多内容了 + + + + + + \ No newline at end of file diff --git a/components/goods_list/goods_list.wxss b/components/goods_list/goods_list.wxss new file mode 100644 index 0000000..28e2283 --- /dev/null +++ b/components/goods_list/goods_list.wxss @@ -0,0 +1,137 @@ +.collects { + margin-top: 40rpx; +} +.ib{ + display: inline-block; +} +.fs24{ + font-size: 24rpx; +} +.flex-center{ +display:flex; +justify-content:center; +align-items:center; +} +.xc-wc{ + color: #d60021; + +} +.fs22{ + font-size: 22rpx; +} +.xc-ash{ +color: #b9b9b9; +} +.choice_box .choice_list .choice_footer .price { + color: #f23030; height: 10px +} +.fs35{ + font-size:35rpx; +} +.flex{display: flex} +.ellipsis-2 { + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} +.goods_name{ + height: 62rpx; + margin-top: 6rpx; + line-height: 30rpx; + + +} +.hang { + width: 100%; + margin: auto; + padding-left: 21rpx; +} +.fs28{ + font-size: 28rpx; +} + +.hang .collect { + width: 347rpx; + height: 495rpx; + border-radius: 25rpx; + border: 1rpx solid rgb(214, 214, 214); + overflow: hidden; + margin-right: 14rpx; + margin-bottom: 5rpx; +} + +.collect .bottom { + padding: 0rpx 20rpx; +} + +.collect .sp { + width: 100%; + height: 326rpx; +} + +.collect .money { + margin-top: 30rpx; + margin-bottom: 18rpx; + line-height: 28rpx; + align-items: baseline; +} +.collect .money view{ + line-height: 28rpx; +} +.collect .money .flex { + font-weight: bold; +} +.collect .money .flex .fs24{ + padding-top: 5rpx; +} +.collect .Discount { + width: 156rpx; + height: 28rpx; + border-radius: 20rpx; + background-color: rgb(56, 56, 56); + font-size: 18rpx; + color: rgb(255, 255, 255); +} + +.collect .Discount image { + height: 18rpx; + width: 18rpx; + line-height: 28rpx; + margin-right: 3rpx; +} + +.collect.ml20 { + margin-left: 13rpx; +} + +.fs24.dollar { + padding: 0rpx; +} + +.money .price { + margin-left: 12rpx; + text-decoration: line-through; + line-height: 23rpx; +} + +.province { + line-height: 26rpx; +} + +.nothing { + height: 75rpx; + width: 100%; +} + +.nothing .no_content { + margin: 0rpx 11rpx; + color: rgb(138, 138, 138); +} + +.nothing .Foil { + width: 80rpx; + height: 2rpx; + background-color: rgb(138, 138, 138); +} \ No newline at end of file diff --git a/pages/activity/pind_list/pind_list.js b/pages/activity/pind_list/pind_list.js index 8c8ac17..f6e3289 100644 --- a/pages/activity/pind_list/pind_list.js +++ b/pages/activity/pind_list/pind_list.js @@ -1,7 +1,10 @@ -var e = getApp(), i = e.request, a = e.globalData.setting,os=a,ut = require("../../../utils/util.js"); +var e = getApp(), +i = e.request, + a = e.globalData.setting, + os=a,ut = require("../../../utils/util.js"); var regeneratorRuntime = require('../../../utils/runtime.js'); -Page({ +Page({ data: { url: a.imghost, killtime: null, @@ -11,6 +14,7 @@ Page({ timer:null, ismore:1, isshow:0, + iurl: os.imghost, }, onShow: function(t) { @@ -60,7 +64,7 @@ Page({ let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); obj = { - day: this.timeFormat(day), hou: this.timeFormat(hou), min: this.timeFormat(min), sec: this.timeFormat(sec) + day: this.timeFormat(day), hou: this.timeFormat(hou), min: this.timeFormat(min), sec: this.timeFormat(sec),hide:1 } }else{ //活动已结束,全部设置为'00' @@ -101,6 +105,7 @@ Page({ alllist.push(plist[i]); } e.data.currentPage++; + th.setData({goodlist:alllist,isshow:1}); }, diff --git a/pages/activity/pind_list/pind_list.wxml b/pages/activity/pind_list/pind_list.wxml index 2ebf03f..e19716e 100644 --- a/pages/activity/pind_list/pind_list.wxml +++ b/pages/activity/pind_list/pind_list.wxml @@ -1,38 +1,62 @@ - - - 进行中 - 即将开始 - - + + + + + + - - + + - 商家团 - 会员团 - 阶梯团 + {{item.title}} - 已团{{item.buy_num}}件 {{item.ct_num}}人团 - - - ¥{{item.price}}¥{{item.market_price}} - + + + + 已拼{{item.buy_num}}份 + + + + + {{item.ct_num}}人团 + + + 距开始: + {{item.djs.day}}天 + {{item.djs.hou}}时 + {{item.djs.min}}分 + {{item.djs.sec}}秒 + + + + + {{item.djs.day}}{{item.djs.hou}}{{item.djs.min}}{{item.djs.sec}} + + + + + + {{item.price}} + 零售价¥{{item.market_price}} + + - - 去参团 - 去开团 - 去开团 + + 即将开始 + 即将开始 + 即将开始 - 去参团 + 去参团 去开团 去开团 @@ -41,7 +65,23 @@ + + + + + + + + 火热进行中 + + + 即将开始 + + 没有相关内容 + \ No newline at end of file diff --git a/pages/activity/pind_list/pind_list.wxss b/pages/activity/pind_list/pind_list.wxss index d1cba2a..8fb81f6 100644 --- a/pages/activity/pind_list/pind_list.wxss +++ b/pages/activity/pind_list/pind_list.wxss @@ -1,35 +1,58 @@ +page{ + background: #eee +} +.kill-list{ + width: 95%; + margin-top: -50rpx; + position:absolute; + left: 2.5%; + +} + .kill-time { text-align: center; justify-content: space-around; align-items: center; - height: 178rpx; + height: 101rpx; border-bottom: 1px solid #ddd; border-top: 1px solid #ddd; background-color: #f6f6f6; } .kill-time .theader{ - width: 86%; display: flex; margin: 0 auto; + display: flex; margin: 0 auto; align-items: center; + height: 100rpx; + } + .kill-time .theader .timeac { - font-size: 32rpx; height: 78rpx; line-height:78rpx; width: 50%; margin-top: 50rpx; + font-size: 32rpx; height:100%; width: 50%; color: #333; background-color: #fff; + } -.kill-time .theader .timeac.left{border-top-left-radius: 86rpx; border-bottom-left-radius: 86rpx;} -.kill-time .theader .timeac.right{border-top-right-radius: 86rpx; border-bottom-right-radius: 86rpx;} -.kill-time .theader .timeac.active{background-color: #c4182e;color: #fff} + +/* .kill-time .theader .timeac.left{border-top-left-radius: 86rpx; border-bottom-left-radius: 86rpx;} +.kill-time .theader .timeac.right{border-top-right-radius: 86rpx; border-bottom-right-radius: 86rpx;} */ +.kill-time .theader .timeac.active{color: #c4182e} + .kill-item { - display: flex; + display: flex; justify-content: space-between; background-color: #fff; padding: 10rpx 20rpx; margin-bottom: 10rpx; + border-radius: 10rpx; + height: 249rpx; + align-items: center; + padding-left: 20rpx; + + } .kill-pic { - width: 200rpx; - height: 200rpx; + width: 215rpx; + height: 215rpx; position: relative; } @@ -40,23 +63,28 @@ } .kill-cont { - width: 480rpx; + width: 440rpx; + height: 215rpx; + margin-left: 16rpx; } .goods-name { - height: 48rpx; - line-height: 48rpx; - font-size: 24rpx; - color: #555; + height: 60rpx; + margin-bottom: 18rpx; + font-size: 27rpx; + color: #555; + line-height: 30rpx; + } .goods-num { - padding-top: 10rpx; + height: 60rpx; display: flex; justify-content: space-between; - line-height: 42rpx; + margin-top: 10rpx; font-size: 24rpx; color: #999; + align-items: center; } .goods-num .co-red { @@ -70,12 +98,18 @@ .kill-btn { text-align: right; + padding-top: 15rpx; + } + .kill-btn>navigator { padding: 0 20rpx; background: #e23245; color: #fff; + border-radius: 20rem; +line-height: 43rpx; +margin-top: 4rpx; } .kill-btn .gray { @@ -89,5 +123,76 @@ color: #333; } -.kill-btn>navigator.huise{background-color: gainsboro;} -.tneirong{color:#555; font-size: 21rpx;} \ No newline at end of file +.kill-btn>navigator.huise{background-color:#999999;} +.tneirong{ + color:#fff; + font-size: 20rpx; + border-radius:20rpx; + padding-left: 32rpx; + padding-right: 15rpx; + padding-bottom: 2rpx; + height: 28rpx; + line-height: 28rpx; + + + } +.body_frame { +width: 100%; +height: 100%; + +} +.xc-top-img{ + width: 100%; + height: 333rpx; + margin-top: 5rpx; + +} +.xc-seckill-bottom{ + position: fixed; +bottom: 0rpx; +width: 100%; +} +.xc-bottom{ + width: 45rpx; + height: 45rpx; + margin-right: 13rpx; +} +.xc-border-right{ + border-right: 4rpx solid #eee; +} +.xc-team-img{ +width:38rpx; +height: 45rpx; +left: -1rpx; +top: -16rpx; +} + +.xc-people-val-frame{ + border: 3rpx solid #d60021;border-radius: 8rpx;overflow: hidden; + +} +.xc-people-val-frame .val-img{ +width:33rpx;height:28rpx;border-radius: 8rpx;margin-left: -2rpx; +} +.xc-top15{ + padding-top: 15rpx; + margin-top: 6rpx; +} +.people-img{ + width:20rpx;height:20rpx +} +.time-blue{ +margin-left: 10rpx; +} +.martop13{ +margin-top:4rpx; + +} +.martop18{ +margin-top: 8rpx; + +} +.xc-lihe42{ + height: 60rpx; + +} \ No newline at end of file diff --git a/pages/activity/seckill_list/seckill_list.js b/pages/activity/seckill_list/seckill_list.js index d96241a..469bc0b 100644 --- a/pages/activity/seckill_list/seckill_list.js +++ b/pages/activity/seckill_list/seckill_list.js @@ -58,11 +58,11 @@ Page({ let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); obj = { - day: this.timeFormat(day), hou: this.timeFormat(hou), min: this.timeFormat(min), sec: this.timeFormat(sec) + day: this.timeFormat(day), hou: this.timeFormat(hou), min: this.timeFormat(min), sec: this.timeFormat(sec), hide: 1 } }else{ //活动已结束,全部设置为'00' - obj = { day: '00', hou: '00', min: '00', sec: '00' } + obj = { day: '00', hou: '00', min: '00', sec: '00' } } var txt ="goodlist["+i+"].djs"; th.setData({ [txt]: obj}); @@ -80,6 +80,7 @@ Page({ {isShowLoading:1,data:{store_id:os.stoid,timetype:th.data.type,is_end:0,is_show:1}} ).then(res=>{ plist=res.data.data.pageData; + console.log("是什么即将开始",plist); }); if(plist.length<=0){ @@ -101,6 +102,7 @@ Page({ alllist.push(plist[i]); } e.data.currentPage++; + console.log("秒杀商品列表", alllist); th.setData({goodlist:alllist,isshow:1}); }, diff --git a/pages/activity/seckill_list/seckill_list.wxml b/pages/activity/seckill_list/seckill_list.wxml index 7a29f65..0d65de3 100644 --- a/pages/activity/seckill_list/seckill_list.wxml +++ b/pages/activity/seckill_list/seckill_list.wxml @@ -1,36 +1,74 @@ + - - - 秒杀中 - 即将秒杀 - - - - - + + + + + + + + + + {{item.title}} + + + + + + + 剩余{{type==1?filters.toFix(100-(item.buy_num+item.virtual)/(item.goods_num+item.virtual)*100,0):'100'}}% + + + + 已抢{{item.buy_num+item.virtual}}件 + + + - ¥{{item.price}}¥{{item.market_price}} - - {{item.djs.day}}天 + + 剩余: + {{item.djs.day}}{{item.djs.hou}}{{item.djs.min}}{{item.djs.sec}} + + + {{item.price}} + 零售价¥{{item.market_price}} + - 马上抢 + 立即开始 马上抢 - 已抢光 + 已抢光 + + + + + + 火热进行中 + + + 即将开始 + + + + 没有相关内容 + + diff --git a/pages/activity/seckill_list/seckill_list.wxss b/pages/activity/seckill_list/seckill_list.wxss index 7b82501..196e138 100644 --- a/pages/activity/seckill_list/seckill_list.wxss +++ b/pages/activity/seckill_list/seckill_list.wxss @@ -1,45 +1,81 @@ + page{ + background: #eee; + color: #333; + } + .body_frame{ + width: 100%; + height: 100%; + + } +.xc-top-img{ + width: 100%; + height: 333rpx; + margin-top: 5rpx; +} +.kill-list{ + /* height: 807rpx; */ + /* overflow-y: scroll; */ +} +.seckill_list{ +margin-top: -50rpx; +left: 2%; +} +.seckill{ + width: 95%; +margin: auto; + +} .kill-time { text-align: center; justify-content: space-around; align-items: center; - height: 178rpx; + height: 101rpx; border-bottom: 1px solid #ddd; border-top: 1px solid #ddd; background-color: #f6f6f6; } .kill-time .theader{ - width: 86%; display: flex; margin: 0 auto; + display: flex; margin: 0 auto; align-items: center; + height: 100rpx; + } .kill-time .theader .timeac { - font-size: 32rpx; height: 78rpx; line-height:78rpx; width: 50%; margin-top: 50rpx; + font-size: 32rpx; height:100%; width: 50%; color: #333; background-color: #fff; + } -.kill-time .theader .timeac.left{border-top-left-radius: 86rpx; border-bottom-left-radius: 86rpx;} -.kill-time .theader .timeac.right{border-top-right-radius: 86rpx; border-bottom-right-radius: 86rpx;} -.kill-time .theader .timeac.active{background-color: #c4182e;color: #fff} +/* .kill-time .theader .timeac.left{border-top-left-radius: 86rpx; border-bottom-left-radius: 86rpx;} +.kill-time .theader .timeac.right{border-top-right-radius: 86rpx; border-bottom-right-radius: 86rpx;} */ +.kill-time .theader .timeac.active{color: #c4182e} .kill-item { display: flex; justify-content: space-between; background-color: #fff; - padding: 10rpx 20rpx; + padding: 10rpx 10rpx; margin-bottom: 10rpx; + border-radius: 10rpx; + height: 249rpx; + align-items: center; } .kill-pic { - width: 200rpx; - height: 200rpx; + width: 215rpx; + height: 215rpx; } .kill-cont { - width: 480rpx; + width: 465rpx; + margin-left:20rpx; + margin-right: 5rpx; } .goods-name { - height: 96rpx; - line-height: 48rpx; - font-size: 24rpx; + height: 60rpx; + font-size: 27rpx; color: #555; + line-height: 30rpx; + } .goods-num { @@ -57,17 +93,28 @@ } .underline { - text-decoration: line-through; color:#999999; font-size: 20rpx; margin-left: 5rpx; + text-decoration: line-through; + color:#999999; font-size: 20rpx; + margin-left: 10rpx; + line-height: 30rpx; } .kill-btn { text-align: right; + display: flex; +height: 100%; +align-items: flex-end; +padding-top: 4rpx; + } .kill-btn>navigator { padding: 0 20rpx; background: #e23245; color: #fff; + border-radius: 20rpx; + margin-top: 37px; + } .kill-btn .gray { @@ -81,4 +128,51 @@ color: #333; } -.kill-btn>navigator.huise{background-color: gainsboro;} \ No newline at end of file +.kill-btn>navigator.huise{background-color: #999;} +.xc-seckill-bottom{ + position: fixed; +bottom: 0rpx; +width: 100%; + +} +.xc-bottom{ + width: 45rpx; + height: 45rpx; + margin-right: 13rpx; +} +.xc-border-right{ + border-right: 4rpx solid #eee; + +} +.ml10{ +margin-left: 45rpx; +} +.total{ + width:215rpx;height:26rpx;border-radius:20rpx; + background: #ffe3e2; +} +.xc-buttom-money{ + align-items: baseline; +padding-top: 43rpx; +} + +.xc-miaosha{ +width: 68rpx; +height: 40rpx; + +} +.xc-strip-frame{ + width:440rpx;margin-top: 10rpx; +} +.xc-strip-blank{ + width:180rpx; +height: 26rpx; +} +.xc-fill{ +border-radius:20rpx;height:26rpx; +} +.xc-fill-text{ + left:34%; + line-height: 26rpx; + +} \ No newline at end of file diff --git a/pages/goods/categoryList/categoryList.js b/pages/goods/categoryList/categoryList.js index 1860cbd..4b20b70 100644 --- a/pages/goods/categoryList/categoryList.js +++ b/pages/goods/categoryList/categoryList.js @@ -9,7 +9,7 @@ Page({ windowHeight:0, windowWidth: 0, eachLetterHeight:0, - lettersPosition:0, + lettersPosition:0, catelist:null, //分类读取 nationlist: null,//国家读取 groups: null, //品牌读取 diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index ff845c4..b7a0545 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -8,7 +8,7 @@ var t = require("../../../utils/util.js"), oo = s.globalData, o = s.globalData.setting, os = o; -//评价加载更多 +//评价加载更多 var more = function(e) { return e && e.__esModule ? e : { default: e @@ -1402,6 +1402,7 @@ Page({ prom_start_time: prom_start_time, isshow:1, }); + var newTime = ut.gettimestamp(); var endTime2 = t.data.data.end_time; diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml index 9ec8f0a..2910be3 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -266,7 +266,7 @@ 零售价¥{{data.market_price}} - + 已抢:{{prom_act.buy_num+prom_act.virtual}}件 秒杀立省¥{{filters.toFix(data.market_price-prom_price,2)}} diff --git a/pages/goods/goodsInfo/goodsInfo.wxss b/pages/goods/goodsInfo/goodsInfo.wxss index b14758a..c619b24 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxss +++ b/pages/goods/goodsInfo/goodsInfo.wxss @@ -1139,7 +1139,7 @@ left:31rpx;} width: 100%; height: 42rpx; padding-left: 34rpx; - color: #948485; + color: #333; } .xc_comment-have-pictures{ @@ -2228,6 +2228,8 @@ right:17rpx; top:55rpx; .no_pj_list{text-align: center; width: 100%; color: #999; margin-top: 30rpx; display: inline-block; font-size: 28rpx} + .join-cart>view.no_store { width: 58%; background-color: #adadad; } + diff --git a/pages/goods/search/search.js b/pages/goods/search/search.js index ad1e46f..4422ca4 100644 --- a/pages/goods/search/search.js +++ b/pages/goods/search/search.js @@ -44,6 +44,14 @@ Page({ }) e.init(this, "", "requestData"); var url = this.data.baseUrl; + + //扫一扫过来,显示搜索的内容 + var s_key = t.s_key; + if (s_key){ + this.search(s_key); this.openSearchModal(); + return; + } + if (0 != t.brand_id && t.brand_id!=undefined){ url += "&brand_id=" + t.brand_id;} if (0 != t.nation_id && t.nation_id!=undefined) { url += "&nation_id=" + t.nation_id;} if (0 != t.max_price && t.max_price!=undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price;} @@ -73,7 +81,7 @@ Page({ requestSearch: function(t) { var a = this; console.log('requestSearch'); - console.log(t); + console.log(t,"扫描商品的搜索商品1111111111111111111111111111"); this.data.requestUrl = t, //t += "&orderField=" + a.data.tabname; @@ -136,6 +144,7 @@ Page({ //-----点击搜索按钮---- search: function(t) { + console.log(t,"是什么的"); if ("string" != typeof t || "" == t) return a.showWarning("请输入搜索关键词"); this.resetData(), this.requestSearch(this.data.baseUrl + "&key_str=" + encodeURIComponent(t)); }, diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 948c5b6..c75cbfa 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -6,7 +6,7 @@ var e = function (e) { i = require("../../../utils/util.js"), ut = i, s = require("../../../utils/common.js"), n = new e.default(); var regeneratorRuntime = require('../../../utils/runtime.js'); var api = require('../../../api/api.js'); - + Page({ data: { url: o.imghost, @@ -34,7 +34,6 @@ Page({ pindGoods: null,//拼单数据 newGoods:null,//新商品 hotGoods:null,//hot商品 - //----控制是是否显示计时器--- is_timer:1, ishow:0, @@ -42,32 +41,95 @@ Page({ isTemplate:0, template_arr:null, bgcolor_t:'', + + banner_index:0, + flash_index:0, + pt_index:0, + + pt_timer_item:null, + pt_timer_arr:null, + pt_timer:null, + pt_timer_active:0, + + //看下商家是否开通会员权益 + is_boot:0, + gd_category:null, + is_no_more:0, }, + onLoad: function () { var th = this; - n.init(th, "", "recommend"); + // n.init(th, "", "recommend"); + + //看一下商家是否开通了权益 + //--初始化是否有打勾-- + getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", { + data: { storeId: os.stoid} + }).then(res => { + if(res.data.data){ + var is_init=res.data.data.isBool; + th.setData({is_boot:is_init}); + } + }) + + + }, + + async onShow() { + var th=this; + await this.init_load(); //显示的时候要开启计时器 - this.data.is_timer=1; + this.data.is_timer = 1; //如果是自定义模板 - if(this.data.isTemplate) { + if (this.data.isTemplate) { //---先获取会员--- - t.getUserFir(function () {}); - }else{ + t.getUserFir(function () { + }); + } else { await this.init_fir(); } - }, + //--正再拼团中的处理-- + var url = "/api/weshop/order/pageTuan?pt_status=2&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1" + await getApp().request.promiseGet(url, {}).then(res => { + if (res.data.code == 0 && res.data.data && res.data.data.pageData) { + th.data.pt_timer_arr = res.data.data.pageData; + } + }) + if (th.data.pt_timer_arr && th.data.pt_timer_arr.length > 0) { + for (var i in th.data.pt_timer_arr) { + var p_item = th.data.pt_timer_arr[i]; + await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + p_item.user_id, {1: 1}).then(res => { + th.data.pt_timer_arr[i].head_pic = res.data.data.head_pic; + th.data.pt_timer_arr[i].nickname = res.data.data.nickname; + }) + } + th.Interval_pt(); + } + + //---处理正在6个分类---- + await getApp().request.promiseGet("/api/weshop/goodscategory/page", { + data: {store_id: os.stoid, pageSize: 5,is_show:1} + }).then(res => { + if(res.data.data) { + var gd_category = res.data.data.pageData; + + th.setData({gd_category: gd_category}); + } + }) + }, + //当隐藏的时候就关闭计时器 onHide:function(){ this.data.is_timer=0; + clearInterval(this.data.pt_timer) }, //同步初始加载 async init_load(){ - var th=this; await getApp().get_isbuy(); this.setappdata(getApp().globalData.wxapp_buy_obj); @@ -83,8 +145,8 @@ Page({ th.setData({ template_arr: t_arr, isTemplate: 1, bgcolor_t: temp_data.bkcolor}); } }) - console.log("init_load"); - console.log(getApp().globalData.config); + + //--首页的问题-- if(getApp().globalData.config && getApp().globalData.config.store_name!=undefined && getApp().globalData.config.store_name!=null ){ wx.setNavigationBarTitle({ @@ -113,6 +175,7 @@ Page({ } console.log(arr); if (arr.length>0) e.setData({ banner: arr, }); + wx.stopPullDownRefresh(); }) @@ -133,8 +196,7 @@ Page({ flash_data = e.data.data.pageData; if (flash_data == null || flash_data.length <= 0) return false; - console.log('flash_data'); - console.log(flash_data); + //当前时间戳 var nt = ut.gettimestamp(); console.log(nt); @@ -153,7 +215,7 @@ Page({ th.setData({ saleGoods: arr }); - th.countDown(); + //th.countDown(); } }); @@ -163,31 +225,45 @@ Page({ store_id: os.stoid, is_end: 0, is_show: 1, - pageSize: 9 + pageSize: 6 } }).then(res => { var e = res; if (e.data.code == 0) { var pd_data = e.data.data.pageData; + if (pd_data.length == 0) return; - - //当前时间戳 + + //获取当前 var nt = ut.gettimestamp(); pd_data.forEach(function (val,ind) { if(val.start_time>nt) pd_data[ind].status=0; else if(val.end_time>nt) pd_data[ind].status=1; if(val.buy_num>=val.goods_num) pd_data[ind].status=2; }); - + + //获取当前时间,比较拼团中还在未开始 + var timestamp = new Date().getTime(); + var is_team_tepy; + for (var j = 0; j < pd_data.length;j++ ){ + pd_data[j].is_team_tepy = 1; + if (timestamp 10 ? wx.setNavigationBarColor({ + "pages/index/index/index" == t[t.length - 1].route; + /*-- + && (e.scrollTop > 10 ? wx.setNavigationBarColor({ frontColor: "#ffffff", backgroundColor: "#f95959" }) : wx.setNavigationBarColor({ frontColor: "#000000", backgroundColor: "#eeeeee" - })); + }));--*/ + }, jumpSearch: function () { wx.navigateTo({ @@ -327,12 +403,10 @@ Page({ bind_bnerr2: function (e) { var _errImg = e.target.dataset.errorimg; var _errurl = e.target.dataset.url; - var ii = _errurl.indexOf(o.imghost); - if (ii != -1) { var _errObj = {}; - _errObj[_errImg] = this.data.url + "/miniapp/images/default_g_img.gif"; - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; - } + _errObj[_errImg] = "/miniapp/images/default_g_img.gif"; + this.setData(_errObj); //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + }, //图片失败,默认图片 bind_bnerr3: function (e) { @@ -404,6 +478,9 @@ Page({ //----拼单倒计时函数----- countDown2() { if(!this.data.is_timer) return false; + + + var th = this; // 获取当前时间,同时得到活动结束时间数组 var newTime = ut.gettimestamp(); @@ -441,6 +518,9 @@ Page({ } } var txt = "pindGoods[" + j + "][" + i + "].djs"; + + + th.setData({ [txt]: obj }); @@ -449,5 +529,85 @@ Page({ setTimeout(th.countDown2, 1000); }, + bannerSwiperChange:function (e) { + var index=e.detail.current; + this.setData({banner_index:index}); + }, + flashSwiperChange:function (e) { + var index=e.detail.current; + this.setData({flash_index:index}); + }, + ptSwiperChange:function (e) { + var index=e.detail.current; + this.setData({pt_index:index}); + }, + + Interval_pt() { + var th=this; + this.data.pt_timer=setInterval(function () { + var item=ut.get_rand_item(th.data.pt_timer_arr); + + console.log("Interval_pt"); + console.log(item); + + th.setData({pt_timer_active:1,pt_timer_item:item}); + setTimeout(function () { + th.setData({pt_timer_active:0}); + },1500) + },4000); + }, + + + //---扫一扫的函数--- + getScancode: function () { + var _this = this; + // 允许从相机和相册扫码 + wx.scanCode({ + success: (res) => { + var result = res.result; + console.log(res,"是什么所扫码的内容"+result); + wx.navigateTo({ + url: "/pages/goods/search/search?s_key="+result, + }); + } + }) + }, + + //跳转到分类 + go_cate:function(){ + getApp().goto("/pages/goods/categoryList/categoryList"); + }, + + go_url:function(e){ + var url=e.currentTarget.dataset.url; + getApp().goto(url); + }, + + bind_bnerr_icon:function (e) { + var def = "/miniapp/images/no_cate_def.png"; + var _err = e.currentTarget.dataset.err; + var ob={}; + ob[_err]=def; + this.setData(ob); + }, + + //跳转到分类的商品列表 + go_cate2: function (t) { + var cid = t.currentTarget.dataset.cid; + var pid = t.currentTarget.dataset.pid; + var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid; + wx.navigateTo({ url: lurl }); + }, + + //跳转到权益 + go_quanyi:function(t){ + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ url: '/pages/getphone/getphone', }) + return false; + } + getApp().goto("/pages/user/userqy/userqy"); + } + }); \ No newline at end of file diff --git a/pages/index/index/index.json b/pages/index/index/index.json index 7b00316..4fc1363 100644 --- a/pages/index/index/index.json +++ b/pages/index/index/index.json @@ -1,10 +1,12 @@ { - "navigationBarBackgroundColor": "#eeeeee", + "navigationBarBackgroundColor": "#ff7295", + "navigationBarTextStyle": "white", "usingComponents": { + "goods_recommend":"/components/goods_list/goods_list", "nav": "/components/diy_nav/diy_nav", "advertising":"/components/diy_advertising/diy_advertising", "groupbuy": "/components/diy_groupbuy/diy_groupbuy", - "goodsGroup": "/components/diy_goodsGroup/diy_goodsGroup", + "goodsGroup": "/components/diy_goodsGroup/diy_goodsGroup", "seckill": "/components/diy_seckill/diy_seckill", "searchbox":"/components/diy_searchbox/diy_searchbox", "shopname": "/components/diy_shopname/diy_shopname", diff --git a/pages/index/index/index.wxml b/pages/index/index/index.wxml index 7d8f151..7ef9037 100644 --- a/pages/index/index/index.wxml +++ b/pages/index/index/index.wxml @@ -1,23 +1,41 @@ - - - + + + + + + + + + + + - + + + + + + 扫一扫 - - + + - - - + + + + + + + + @@ -56,183 +74,226 @@ + + + + + + + 人工优先 + + + + + + + 正品保证 + + + + + + 售后无忧 + + + + + + + + + {{item.name}} + + + + + + + + + + + - - 秒杀特区 + + + + + 查看全部 + - - - + + - + - - - - - - + - {{aitem.title}} - ¥{{aitem.price}} + {{aitem.title}} + {{aitem.price}} ¥{{aitem.market_price}} + + + + - + - - 天天拼单 + + + + + + + {{pt_timer_item.nickname}} + 刚拼团成功 + + + + 查看全部 + - - - - - - - + + + + + + + + + + - - - + + + {{aitem.title}} + + + + + + 已拼{{aitem.buy_num}}份 + + + + + {{aitem.ct_num}}人团 + + + + 距开始: + {{aitem.djs.day}}天 + {{aitem.djs.hou}}时 + {{aitem.djs.min}}分 + {{aitem.djs.sec}} + 秒 + + + + + + + + + + {{aitem.price}} + 零售价¥{{aitem.market_price}} + + + - 商家团 - 会员团 - 阶梯团 - - {{aitem.title}} - ¥{{aitem.price}} - {{aitem.ct_num}}人团 + + + + - 去参团 - 去开团 - 去开团 - 已抢光 - + + + + + + + + - - - - - - - 新品上市 - - - - - - - - - - - - - {{aitem.goods_name}} - ¥{{aitem.shop_price}} - ¥{{aitem.market_price}} - - - - - - - - - - - 热销商品 - - - - - - - - - - - - - {{aitem.goods_name}} - ¥{{aitem.shop_price}} - ¥{{aitem.market_price}} - - - - - - - 推荐商品 - - + + + + + + + + + + + + + + + - - - - - - - - {{item.goods_name}} - - - - ¥{{item.shop_price}} ¥{{item.market_price}} - - 已售{{item.sales_sum}} - - - + + 好物推荐 + + + + + + + + + + + GOOD HOT THING + + + - + + + + + + + diff --git a/pages/index/index/index.wxss b/pages/index/index/index.wxss index 95e0318..ecbfd97 100644 --- a/pages/index/index/index.wxss +++ b/pages/index/index/index.wxss @@ -1,13 +1,19 @@ +.pink-b{ + background: #ff7295; +} .search-box { position: fixed; top: 0; left: 0; - width: 100%; + width: 100%; height: 88rpx; z-index: 10; - background: linear-gradient(rgba(0,0,0,.2),rgba(255,255,255,0)); + /* background: linear-gradient(rgba(0,0,0,.2),rgba(255,255,255,0)); */ +} +.classify-img{ + width: 50rpx; + height: 45rpx } - .logo { width: 48rpx; height: 48rpx; @@ -19,48 +25,59 @@ .search-inner { display: flex; align-items: center; - margin: 15rpx 30rpx; - width: 675rpx; + margin: 20rpx 25rpx; + width: 566rpx; height: 58rpx; border-radius: 29rpx; background-color: #fff; + justify-content: center; } .search-img { - margin-right: 12rpx; + width: 30rpx; height: 30rpx; - margin-top: -6rpx; - margin-left: 20rpx; + margin-left: 36rpx; +display: flex; +align-items: center; +position: absolute; +left: 10%; } .search-cont { height: 58rpx; - width: 536rpx; + width: 530rpx; padding-left: 12rpx; line-height: 58rpx; font-size: 24rpx; color: #666; + margin-left: 56rpx; + } .search-fixed { - background: rgba(242,48,48,0.8); + background: #ff7295; } .swiper_box { width: 100%; - height: 380rpx; -} + +} .s_prom{ width: 100%; - height: 380rpx; + height: 340rpx; +} +.s_proms{ + width: 100%; + height:590rpx; } -swiper-item image { +.slide-image{ width: 100%; - height: 380rpx; display: inline-block; overflow: hidden; + border-radius: 14rpx; + } .venues_box { @@ -103,6 +120,12 @@ swiper-item image { width: 100%; height: 368rpx; } +.title-img{ + margin-top: 110rpx; + + margin-bottom: 15rpx; + +} .choice_box .choice_list .title { height: 36rpx; @@ -177,6 +200,7 @@ swiper-item image { align-items: center; height: 72rpx; color: #333; + margin-bottom: 20rpx; } .sk-tips { @@ -221,34 +245,39 @@ swiper-item image { } .seckill-list { - height: 360rpx; + overflow: hidden; } -.seckill-list navigator { +/* .seckill-list navigator { width: 236rpx; margin-right: 10rpx; position: relative; -} +} */ + -.seckill-list image { - width: 236rpx; - height: 236rpx; -} .seckill-list view { - height: 45rpx; + height: 62rpx; padding: 0 10rpx; - line-height: 45rpx; + line-height: 33rpx; overflow: hidden; - font-size: 30rpx; + font-size: 28rpx; + width: 203rpx } .seckill-list view.imgview{ - width: 236rpx; - height: 236rpx; + width: 203rpx; + height: 210rpx; position: relative; - overflow: hidden + overflow: hidden; + + +} +.imgview image{ + width: 203rpx; + height: 203rpx; + border-radius: 10rpx; + } - .seckill-list view.djs_view{ background:rgba(9,9,9,0.5);color: #fff; font-size: 20rpx; width: 216rpx; height: 36rpx; line-height: 36rpx; @@ -258,7 +287,7 @@ swiper-item image { .seckill-list image.status_img{ width: 100rpx; height: 35rpx; position: absolute; - top: 5rpx; left: 10rpx; z-index: 5; + top: 0rpx; left: 10rpx; z-index: 5; } .seckill-list view.status_view{ @@ -292,10 +321,414 @@ swiper-item image { bottom: 30rpx; right: 10rpx; z-index: 5; border-radius: 5rpx;padding: 0; } -.arrow-right{width: 30rpx; height: 30rpx;} +.arrow-right{width: 24rpx; height: 24rpx;} .pd-view{height: 80rpx;} + .xc-grow-ups{ margin-left:8rpx; margin-top:6rpx; } +.xc-top-img{ +width: 100%; +top: -1rpx; +height: 315rpx; + +} + +.classify-frame{ +line-height: 25rpx; +} +.slide-image-frame{ + width: 95%; +margin: auto; +border-radius: 10rpx; + +} +.xc-hook{ + width: 52rpx; + height: 52rpx; + + +} +.margin-left{ +margin-left: 10rpx; +} +.xc-class-img{ + width: 83rpx; + height: 83rpx; +} +.xc-class-frame{ + line-height: 40rpx; + margin-top: 40rpx; + margin-bottom: 20rpx; + + +} +.xc-title-img{ + height: 220rpx; + width: 100%; +} + +.title-img-frame{ + width: 95%; +margin: auto; +margin-top: 30rpx; + +} +.seckill-list{ + line-height: 24rpx; +} +.seckill-lists{ + line-height: 30rpx; +} + +.xc-marfin-right{ +margin-right: 8rpx; +} +.classname .clock-img{ + width:36rpx; + height: 36rpx; + margin-right: 10rpx; +} +.classname .seckill-ttitle-img{ + width:150rpx; + height: 40rpx; +} +.seckill-ttitle-img.height{ + height: 35rpx +} +.split-line{ + width:100%;height:10rpx;background:#eee; +} +.mar-top10{ +margin-top: 10rpx; +} +.classname .user-img{ +width: 30rpx; +height:30rpx; +margin-left:20rpx; +margin-right: 10rpx; +} +.user-frame{ + + /* border-left: 5rpx solid #eee; */ + height: 35rpx; + line-height: 35rpx; + margin-left: 10rpx; + +} +.user-name{ + width: 66rpx; + border-left: 5rpx solid #eee; +} + + +/* 团购列表 */ + +.kill-item { + + display: flex; + justify-content: space-between; + background-color: #fff; + padding: 10rpx 10rpx; + margin-bottom: 10rpx; + border-radius: 10rpx; + height: 249rpx; + align-items: center; + + +} +.kill-pic { + width: 215rpx; + height: 215rpx; + position: relative; +} +.teamheight{ +height: 289rpx; +border-bottom:6rpx solid #eee; + +} + + +.kill-cont { + width: 440rpx; + height: 215rpx; + margin-left: 16rpx; +} +.goods-name { + max-height: 60rpx; + font-size: 24rpx; + color: #555; + line-height: 55rpx; + +} + +.xc-team-img{ +width:38rpx; +height: 45rpx; +left: -1rpx; +top: -16rpx; +} + +.tneirong{ + color:#fff; + font-size: 20rpx; + border-radius:20rpx; + padding-left: 32rpx; + padding-right: 15rpx; + padding-bottom: 2rpx; + height: 28rpx; + line-height: 28rpx; + +white-space: nowrap; + } + .xc-people-val-frame{ + border: 3rpx solid #d60021;border-radius: 8rpx;white-space: nowrap; +height: 28rpx; + +} +.xc-people-val-frame .val-img{ +width:33rpx;height:28rpx;border-radius: 8rpx;margin-left: -2rpx; +} +.people-img{ + width:20rpx;height:20rpx +} +.goods-num { + height: 50rpx; + display: flex; + justify-content: space-between; +margin-top: 10rpx; + font-size: 24rpx; + color: #999; + +} +.xc-top15{ + padding-top: 15rpx; + margin-top: 25rpx; +} +.underline { + text-decoration: line-through; color:#999999; font-size: 20rpx; margin-left: 5rpx;margin-top: 5rpx; +} +.navigator.navwidth{ + width: 100%; +} +.view.left{ + padding: 0 5rpx; + +} + + + +/* 热门好物 */ + +.title .China { + width: 100%; + margin-top: 10rpx; + margin-bottom: 10rpx; + line-height: 0rpx; +} + +.title .China .line view { + width: 2rpx; +} + +.title .China .line { + height: 40rpx; + color: rgb(51,51, 51); +} +.title .China .line view{ + border-left: 3rpx solid #000; + margin-left: 5rpx; +} +.title .China .line .one { + height: 23rpx; +} + +.title .China .line .two { + height: 15rpx; +} + +.title .China .line .three { + height: 18rpx; +} + +.title .China .Recommend { + margin: 0rpx 20rpx; + font-size: 28rpx; + line-height: 39rpx; + font-weight: bold; +} + +.title .english .silk { + width: 214rpx; + height: 2rpx; + background-color: #000; +} + +.title .english .esh { + margin: 0rpx 15rpx; +} + +.collects { + margin-top: 40rpx; +} + +.hang { + width: 100%; + margin: auto; + padding-left: 21rpx; +} + +.hang .collect { + width: 347rpx; + height: 571rpx; + border-radius: 25rpx; + border: 1rpx solid rgb(214, 214, 214); + overflow: hidden; + margin-right: 14rpx; + margin-bottom: 5rpx; +} + +.collect .bottom { + padding: 0rpx 20rpx; +} + +.collect .sp { + width: 100%; + height: 326rpx; +} + +.collect .money { + margin-top: 60rpx; + margin-bottom: 18rpx; + line-height: 28rpx; + align-items: baseline; +} +.collect .money view{ + line-height: 28rpx; +} +.collect .money .flex { + font-weight: bold; +} +.collect .money .flex .fs24{ + padding-top: 5rpx; +} +.collect .Discount { + width: 156rpx; + height: 28rpx; + border-radius: 20rpx; + background-color: rgb(56, 56, 56); + font-size: 18rpx; + color: rgb(255, 255, 255); +} + +.collect .Discount image { + height: 18rpx; + width: 18rpx; + line-height: 28rpx; + margin-right: 3rpx; +} + +.collect.ml20 { + margin-left: 13rpx; +} + +.fs24.dollar { + padding: 0rpx; +} + +.money .price { + margin-left: 12rpx; + text-decoration: line-through; + line-height: 23rpx; +} + +.province { + line-height: 26rpx; +} + +.nothing { + height: 75rpx; + width: 100%; +} + +.nothing .no_content { + margin: 0rpx 11rpx; + color: rgb(138, 138, 138); +} + +.nothing .Foil { + width: 80rpx; + height: 2rpx; + background-color: rgb(138, 138, 138); +} +.goods_name{ + height: 70rpx; + margin-top: 6rpx; +} +.seckill-list view.translation{ + width:108rpx;height:20rpx; border-radius: 20rpx;background:#dfdfdf;margin: auto;line-height: 20rpx; +} +.seckill-list view.spot{ + width:10rpx; + height:10rpx; + padding: 0rpx; + +} + +.spot{ + width:10rpx; + height:10rpx; + padding: 0rpx; + +} +.translation{ + width:108rpx;height:20rpx; border-radius: 20rpx;background:#e0e0e0;line-height: 20rpx; + bottom: 45rpx; +left: 43%; + +} + +.translation{ + width:108rpx;height:20rpx; border-radius: 20rpx;background:#b8d1d6;line-height: 20rpx; + bottom: 12rpx; +left: 43%; +} +.translations{ + width:108rpx;height:20rpx; border-radius: 20rpx;background:#dfdfdf;line-height: 20rpx; + bottom: 25rpx; +left: 43%; +} +.mar-top{ + margin-top: 20rpx; +} +.mar-tops{ + margin-top: 10rpx; +} + +.pt_active{ animation: sport 0.5s;} +@keyframes sport { + 0% {transform: translateY(80rpx);opacity: 0;} + 100% {transform: translateY(0rpx);opacity: 1} +} +.m-left{ + margin-left: 18rpx; +} +.martop4{ +margin-top: 4rpx; + +} +.time-blue{ +margin-left: 10rpx; +} +.is_seckill_height{ + height:40rpx;line-height:32rpx; +} + + +.assemble-top-border{ + border-top: 10rpx solid #eee; + padding-top:20rpx; + margin-top:0rpx; +} diff --git a/pages/team/team_success/team_success.js b/pages/team/team_success/team_success.js index f97ba75..4081d8e 100644 --- a/pages/team/team_success/team_success.js +++ b/pages/team/team_success/team_success.js @@ -4,7 +4,7 @@ var t = require("../../../utils/util.js"), a = require("../../../utils/wxParse/wxParse.js"), s = getApp(), i = s.request, - rq = i, + rq = i, oo = s.globalData, o = s.globalData.setting, os = o; diff --git a/utils/LoadMore.js b/utils/LoadMore.js index 75d47ff..be27638 100644 --- a/utils/LoadMore.js +++ b/utils/LoadMore.js @@ -76,32 +76,33 @@ var e = function() { //格式化 var glist=""; - for (var i = 0; i < g.length; i++) { + + for (var ii = 0; ii < g.length; ii++) { //if(g[i].prom_type == 1 || g[i].prom_type == 2 || g[i].prom_type == 6) { - if (g[i].prom_type == 1) { - glist += g[i].goods_id+","; + if (g[ii].prom_type == 1) { + glist += g[ii].goods_id+","; } - if (g[i].original_img!=undefined){ - if (g[i].original_img.indexOf(oo.imghost)==-1) - g[i].original_img = oo.imghost + g[i].original_img; + if (g[ii].original_img!=undefined){ + if (g[ii].original_img.indexOf(oo.imghost)==-1) + g[ii].original_img = oo.imghost + g[ii].original_img; } - if (g[i].add_time != undefined){ - var tx = g[i].add_time + ""; + if (g[ii].add_time != undefined){ + var tx = g[ii].add_time + ""; if (tx.indexOf('-') == -1) { - g[i].add_time = ut.formatTime(g[i].add_time, 'yyyy-MM-dd hh:mm:ss'); + g[ii].add_time = ut.formatTime(g[ii].add_time, 'yyyy-MM-dd hh:mm:ss'); } } if (rurl.indexOf('comment/page')!=-1){ console.log('comment/page'); - console.log(g[i].img); - var tx1 = g[i].img; + console.log(g[ii].img); + var tx1 = g[ii].img; if (tx1 != "" && tx1 != null && ut.isString(tx1)){ var arr = ut.unserialize(tx1); - g[i].img=arr; + g[ii].img=arr; } else if (!ut.isArray(tx1)){ - g[i].img=""; + g[ii].img=""; } } } diff --git a/utils/filter.wxs b/utils/filter.wxs index 1f2b8cb..b652f86 100644 --- a/utils/filter.wxs +++ b/utils/filter.wxs @@ -2,7 +2,7 @@ var filters = { toFix:function(val,count){ return val.toFixed(count) }, - replace_time:function(val){ + replace_time:function(val){ if(!val) return "不限"; return val.replace("00:00:00",""); }, diff --git a/utils/util.js b/utils/util.js index 9d1d4a5..169e371 100644 --- a/utils/util.js +++ b/utils/util.js @@ -248,6 +248,16 @@ function check_mobile(phoneMobile){ return ob; } +//获取随机元素 +function get_rand_item(arr){ + if(!arr) return null; + if(arr.length<=0) return null; + if(arr.length==1) return arr[0]; + var ind=Math.floor(Math.random()*arr.length); + if(ind==arr.length) ind=arr.length-1; + return arr[ind]; +} + module.exports = { formatTime: function(e, r) { var t = e ? new Date(1e3 * e) : new Date(), n = t.getFullYear(), o = t.getMonth() + 1, a = t.getDate(), u = t.getHours(), i = t.getMinutes(), f = t.getSeconds(), s = function(e) { @@ -337,5 +347,6 @@ module.exports = { sub_last: sub_last,//去掉末尾一个字符 measureText: measureText,//画布需要的函数 check_mobile: check_mobile,//验证手机 + get_rand_item:get_rand_item, //随机获取元素 };