From f0e229ddb3301f846252a79045ba8b2c967d46d9 Mon Sep 17 00:00:00 2001 From: meo <958484406@qq.com> Date: Mon, 27 Aug 2018 15:10:49 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=99=90=E6=97=B6=E6=8A=A2=E8=B4=AD=EF=BC=8C?= =?UTF-8?q?=E7=BA=A2=E8=89=B2=E7=9A=84=E5=AD=97=E4=BD=93=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=E8=89=B2=E5=8F=B7=E4=BF=AE=E6=94=B9=EF=BC=8Cbanner=E8=AF=A6?= =?UTF-8?q?=E6=83=85][=E5=A2=9E=E5=8A=A0,=E4=BF=AE=E6=94=B9]:=E9=99=90?= =?UTF-8?q?=E6=97=B6=E6=8A=A2=E8=B4=AD=E7=9A=84=E5=88=97=E8=A1=A8=E4=B8=8A?= =?UTF-8?q?=E6=8B=89=E5=8A=A0=E8=BD=BD=EF=BC=8Cbanner=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/bannerdetail/index.js | 92 ++++++++++++++--------------- pages/bannerdetail/index.wxml | 24 +++----- pages/bannerdetail/index.wxss | 3 +- pages/couponorder/detail/index.wxml | 2 +- pages/index/coupons/index.js | 14 ++--- pages/index/rushToBuy/index.js | 8 ++- pages/index/rushToBuy/index.wxml | 1 + pages/index/rushToBuy/index.wxss | 2 +- pages/rushToBuy/index.js | 69 ++++++++++++++++------ pages/rushToBuy/index.wxml | 5 +- pages/rushToBuy/index.wxss | 25 +++++--- 11 files changed, 137 insertions(+), 108 deletions(-) diff --git a/pages/bannerdetail/index.js b/pages/bannerdetail/index.js index 863fe30..ab95fd2 100644 --- a/pages/bannerdetail/index.js +++ b/pages/bannerdetail/index.js @@ -14,53 +14,49 @@ Page({ onLoad(options) { let that = this; console.log(options.id); - wx.showLoading({ - title: "加载中..." - }); - - if (options.flag) { - this.orderFunc(); - } else { - Http.get({ - url: config.api.couponDetail, - data: { - couponId: options.id, - targetAd:options.targetAd - } - }).then(res => { - console.log(res); - //当前时间与优惠券下架时间做计算 - var startTime = util.fmtDate(res.data.sendEndDate); - console.log(startTime); - var s1 = new Date(startTime.replace(/-/g, "/")); - var s2 = new Date(); - var runTime = parseInt((s1.getTime() - s2.getTime()) / 1000); - var year = Math.floor(runTime / 86400 / 365); - var runTime = runTime % (86400 * 365); - var month = Math.floor(runTime / 86400 / 30); - var runTime = runTime % (86400 * 30); - var day = Math.floor(runTime / 86400); - var runTime = runTime % 86400; - var hour = Math.floor(runTime / 3600); - var runTime = runTime % 3600; - var minute = Math.floor(runTime / 60); - var runTime = runTime % 60; - var second = runTime; - console.log(year, month, day, hour, minute, second); - that.setData({ - year: year, - month: month, - day: day, - hour: hour, - minute: minute - }); - console.log(that.data.day); - wx.hideLoading(); - that.setData({ - data: res.data, - couponId: options.id - }); - }); - } + // wx.showLoading({ + // title: "加载中..." + // }); + // Http.get({ + // url: config.api.couponDetail, + // data: { + // couponId: options.id, + // targetAd:options.targetAd + // } + // }).then(res => { + // console.log(res); + // //当前时间与优惠券下架时间做计算 + // var startTime = util.fmtDate(res.data.sendEndDate); + // console.log(startTime); + // var s1 = new Date(startTime.replace(/-/g, "/")); + // var s2 = new Date(); + // var runTime = parseInt((s1.getTime() - s2.getTime()) / 1000); + // var year = Math.floor(runTime / 86400 / 365); + // var runTime = runTime % (86400 * 365); + // var month = Math.floor(runTime / 86400 / 30); + // var runTime = runTime % (86400 * 30); + // var day = Math.floor(runTime / 86400); + // var runTime = runTime % 86400; + // var hour = Math.floor(runTime / 3600); + // var runTime = runTime % 3600; + // var minute = Math.floor(runTime / 60); + // var runTime = runTime % 60; + // var second = runTime; + // console.log(year, month, day, hour, minute, second); + // that.setData({ + // year: year, + // month: month, + // day: day, + // hour: hour, + // minute: minute + // }); + // console.log(that.data.day); + // wx.hideLoading(); + // that.setData({ + // data: res.data, + // couponId: options.id + // }); + // }); + } }); \ No newline at end of file diff --git a/pages/bannerdetail/index.wxml b/pages/bannerdetail/index.wxml index e528012..241d619 100644 --- a/pages/bannerdetail/index.wxml +++ b/pages/bannerdetail/index.wxml @@ -2,21 +2,21 @@ - {{data.title}}限购{{data.useLimitQuantity}}件 + 大餐券限购{{data.useLimitQuantity}}件 剩余时间:{{day}}天{{hour}}小时{{minute}}分钟 剩余件数:{{data.remainInventory}}件 - ¥{{data.salePriceStr}} - ¥{{data.priceStr}} + ¥100 + ¥10000 - + - - 购买须知 + 活动详情 - 有效期2018.01.16 至 2018.09.20 - 除特价酒水及特价菜外全场通用 - 无需预约,消费g高峰时可能需要等位 - 没人最多购买2张 - 不可使用包间 - 堂食外带均可,可免费打包 - 每桌限用2张 + 有效期2018.01.16 至 2018.09.20的话不得不大半夜的吧大本营的被的夜班的不的夜班的也别的也好不到大本营 diff --git a/pages/bannerdetail/index.wxss b/pages/bannerdetail/index.wxss index a1ffe6a..00ba845 100644 --- a/pages/bannerdetail/index.wxss +++ b/pages/bannerdetail/index.wxss @@ -14,12 +14,11 @@ .banner { width: 100%; - height: 465rpx; } .banner image { width: 100%; - height: 100%; + display: block; } .coupons_info { diff --git a/pages/couponorder/detail/index.wxml b/pages/couponorder/detail/index.wxml index c73f3d4..a78e1a2 100644 --- a/pages/couponorder/detail/index.wxml +++ b/pages/couponorder/detail/index.wxml @@ -7,7 +7,7 @@ ¥{{data.salePrice/100}} ¥{{data.price/100}} - 满{{data.usePrice}}元可用 + 满{{data.usePrice/100}}元可用 diff --git a/pages/index/coupons/index.js b/pages/index/coupons/index.js index 6baedb7..b7387e8 100644 --- a/pages/index/coupons/index.js +++ b/pages/index/coupons/index.js @@ -67,10 +67,6 @@ Component({ // 券list获取 if (that.data.allow_load) { - /** - * 用户在点击切换时 不showloadimg - * 只有用户在下拉加载的时候 showloading - */ wx.showLoading({ title: "飞速加载中" }); @@ -97,10 +93,10 @@ Component({ }).then(res => { console.log(res); if (pageNum >= res.data.pages) { - // wx.showToast({ - // title: "加载完成喽", - // icon: "success" - // }); + wx.showToast({ + title: "加载完成喽", + icon: "success" + }); that.setData({ allow_load: false }); @@ -148,7 +144,7 @@ Component({ }); }; if (app.globalData.token && app.globalData.token != null) { - app.couponListCallback(app.globalData.token); + app.businessListCallback(app.globalData.token); } that.getList(0, 1); } diff --git a/pages/index/rushToBuy/index.js b/pages/index/rushToBuy/index.js index 51b66d0..0548ae7 100644 --- a/pages/index/rushToBuy/index.js +++ b/pages/index/rushToBuy/index.js @@ -35,11 +35,13 @@ Component({ }, gotodetail: function(e) { console.log(e); - console.log("出错啦 大哥") + console.log("出错啦 大哥"); console.log(e.currentTarget.dataset.couponid); console.log(e.currentTarget.dataset.targetad); wx.navigateTo({ - url: `/pages/coupon/detail/index?id=${e.currentTarget.dataset.couponid}&targetAd=${e.currentTarget.dataset.targetad}` + url: `/pages/coupon/detail/index?id=${ + e.currentTarget.dataset.couponid + }&targetAd=${e.currentTarget.dataset.targetad}` }); } }, @@ -50,7 +52,7 @@ Component({ url: config.api.couponChannelList, data: { pageNum: 1, - pageSize: 2, + pageSize: 5, targetAd: 2 } }).then(res => { diff --git a/pages/index/rushToBuy/index.wxml b/pages/index/rushToBuy/index.wxml index d10334f..73aa91f 100644 --- a/pages/index/rushToBuy/index.wxml +++ b/pages/index/rushToBuy/index.wxml @@ -5,6 +5,7 @@ + {{item.title}} {{item.subTitle}} ¥{{item.salePriceStr}} diff --git a/pages/index/rushToBuy/index.wxss b/pages/index/rushToBuy/index.wxss index f31903a..6d4b046 100644 --- a/pages/index/rushToBuy/index.wxss +++ b/pages/index/rushToBuy/index.wxss @@ -65,7 +65,7 @@ .index-scroll-view .commodity-info-price-p { font-size: 30rpx; - color: #FF3434; + color: #f96563; } .index-scroll-view .commodity-info-price-o { display: inline-block; diff --git a/pages/rushToBuy/index.js b/pages/rushToBuy/index.js index 729e686..501f306 100644 --- a/pages/rushToBuy/index.js +++ b/pages/rushToBuy/index.js @@ -7,7 +7,9 @@ Page({ * 页面的初始数据 */ data: { - list: [] + list: [], + page: 2, + allow_load: true }, /** @@ -16,22 +18,48 @@ Page({ onLoad: function(options) {}, //列表 getList: function(page) { + let that = this; + + app.couponChannelListCallback = token => { Http.setToken(token); - Http.get({ - url: config.api.couponChannelList, - data: { - pageNum: page, - pageSize: 2, - targetAd: 2 - } - }).then(res => { - console.log(res); - console.log("限时抢购页面"); - this.setData({ - list: res.data.list + /** + * 判断用户是否加载完成 + */ + if (that.data.allow_load) { + wx.showLoading({ + title: "加载中" + }); + + setTimeout(function() { + wx.hideLoading(); + }, 1200); + Http.get({ + url: config.api.couponChannelList, + data: { + pageNum: page, + pageSize: 5, + targetAd: 2 + } + }).then(res => { + console.log(res); + if (page >= res.data.pages) { + wx.showToast({ + title: "加载完成喽", + icon: "success" + }); + that.setData({ + allow_load: false + }); + } + that.data.list = that.data.list.concat(res.data.list); + that.setData({ + list: that.data.list + }); }); - }); + } else { + console.info("allow_load==false 已禁止加载"); + } }; if (app.globalData.token && app.globalData.token != null) { console.log("couponChannelList init 1"); @@ -40,6 +68,9 @@ Page({ }, onReady: function() { let that = this; + that.setData({ + list: [] + }); that.getList(2); }, //限时抢购的强请页面 @@ -66,15 +97,17 @@ Page({ /** * 页面相关事件处理函数--监听用户下拉动作 */ - onPullDownRefresh: function() { - console.log("000"); - }, + onPullDownRefresh: function() {}, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() { - console.log("姐姐在搞上啦加载"); + let that = this; + that.data.page++; + console.log(that.data.page); + that.getList(that.data.page); + console.log("这是第:" + that.data.page); }, /** diff --git a/pages/rushToBuy/index.wxml b/pages/rushToBuy/index.wxml index 2ecda73..37be567 100644 --- a/pages/rushToBuy/index.wxml +++ b/pages/rushToBuy/index.wxml @@ -1,6 +1,7 @@ - + @@ -20,7 +21,7 @@ 剩余时间:2天 12小时25分钟 - 剩余件数:{{item.remainInventory}}件 + 剩余件数:{{item.remainInventory}}件 购买 diff --git a/pages/rushToBuy/index.wxss b/pages/rushToBuy/index.wxss index 215d2b7..18925a7 100644 --- a/pages/rushToBuy/index.wxss +++ b/pages/rushToBuy/index.wxss @@ -9,7 +9,6 @@ width: 100%; height: 410rpx; border-top: 1rpx solid #ededed; - border-bottom: 1rpx solid #ededed; } .flashSaleItem{ width: 90%; @@ -45,8 +44,13 @@ flex-direction: column; } .foodname{ - font-size: 34rpx; + font-size: 32rpx; + height: 40rpx; + line-height: 40rpx; color: #000; + display: inline-block; + width: 406rpx; + overflow: hidden; } .small{ font-size: 24rpx; @@ -58,7 +62,7 @@ } .presentPrice{ font-size: 36rpx; - color: #FF3434; + color: #f96563; } .originalPrice{ margin-left: 20rpx; @@ -68,6 +72,7 @@ } .flashSaleItemBottom{ margin-top: 20rpx; + position: relative; } .remainingTime{ font-size: 28rpx; @@ -75,23 +80,31 @@ } .realRemainingTime{ margin-left: 10rpx; - color:#FF3434; + color:#f96563; font-size: 28rpx; } .flashSaleItemBottomBottm{ display: flex; flex-direction: row; } +.view1{ + width: 550rpx; + display: block; +} .remainingNumber{ font-size: 28rpx; color: #B4B4B4; } .realnumber{ margin-left: 10rpx; - color: #FF3434; + color: #f96563; font-size: 28rpx; } .buy{ + position: absolute; + top: 34rpx; + bottom: 0; + right: 20rpx; width:114rpx; height: 50rpx; line-height: 50rpx; @@ -99,7 +112,5 @@ background: #00C0FF; color: #fff; border-radius: 10rpx; - margin-left: 350rpx; font-size: 28rpx; - margin-top: -23rpx; } \ No newline at end of file