From 0df386298ad0d52ea06faf8345ae7f1e8171f1e8 Mon Sep 17 00:00:00 2001 From: meo <958484406@qq.com> Date: Mon, 27 Aug 2018 13:37:45 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=88=B8=E5=8C=85=E5=A2=9E=E5=8A=A0=E5=8E=BB?= =?UTF-8?q?=E9=A2=86=E5=88=B8=E6=8C=89=E9=92=AE][=E5=A2=9E=E5=8A=A0]:?= =?UTF-8?q?=E6=88=91=E7=9A=84=E5=88=B8=E5=8C=85=E5=A2=9E=E5=8A=A0=E2=80=9C?= =?UTF-8?q?=E5=8E=BB=E9=A2=86=E5=88=B8=E2=80=9D=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 1 + components/banner/index.js | 8 ++ components/banner/index.wxml | 2 +- pages/bannerdetail/index.js | 66 +++++++++ pages/bannerdetail/index.json | 3 + pages/bannerdetail/index.wxml | 52 +++++++ pages/bannerdetail/index.wxss | 213 +++++++++++++++++++++++++++++ pages/coupon/detail/index.js | 2 +- pages/couponorder/index/index.wxml | 5 +- pages/couponorder/index/index.wxss | 12 +- pages/index/coupons/index.js | 4 +- pages/rushToBuy/index.js | 38 ++--- pages/rushToBuy/index.wxml | 2 +- 13 files changed, 375 insertions(+), 33 deletions(-) create mode 100644 pages/bannerdetail/index.js create mode 100644 pages/bannerdetail/index.json create mode 100644 pages/bannerdetail/index.wxml create mode 100644 pages/bannerdetail/index.wxss diff --git a/app.json b/app.json index c62e9e3..17ce9cc 100644 --- a/app.json +++ b/app.json @@ -1,6 +1,7 @@ { "pages": [ "pages/index/index", + "pages/bannerdetail/index", "pages/getuserinfo/index", "pages/getphoneInfo/index", "pages/market/index", diff --git a/components/banner/index.js b/components/banner/index.js index bbf0dca..27376c7 100644 --- a/components/banner/index.js +++ b/components/banner/index.js @@ -17,6 +17,7 @@ Component({ swiperCurrent: 0, }, + /** * 组件的方法列表 */ @@ -28,5 +29,12 @@ Component({ swiperCurrent: e.detail.current }) }, + gotobannerdetail:function(e){ + console.log("我要点击进入banner详情页面") + console.log(e.currentTarget.dataset.id); + wx.navigateTo({ + url: `/pages/bannerdetail/index?id=${e.currentTarget.dataset.id}`, + }) + } } }) diff --git a/components/banner/index.wxml b/components/banner/index.wxml index bad38af..e29c4d3 100644 --- a/components/banner/index.wxml +++ b/components/banner/index.wxml @@ -2,7 +2,7 @@ - + diff --git a/pages/bannerdetail/index.js b/pages/bannerdetail/index.js new file mode 100644 index 0000000..863fe30 --- /dev/null +++ b/pages/bannerdetail/index.js @@ -0,0 +1,66 @@ +let config = require("../../config/config.js"); +let app = getApp(); +const Http = require("../../utils/HttpBasics"); +const util = require("../../utils/util"); +Page({ + data: { + data: {}, + couponId: null, + orderId: "", + day: "", + hour: "", + minute: "" + }, + 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 + }); + }); + } + } +}); \ No newline at end of file diff --git a/pages/bannerdetail/index.json b/pages/bannerdetail/index.json new file mode 100644 index 0000000..9fabb8c --- /dev/null +++ b/pages/bannerdetail/index.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "活动详情" +} \ No newline at end of file diff --git a/pages/bannerdetail/index.wxml b/pages/bannerdetail/index.wxml new file mode 100644 index 0000000..e528012 --- /dev/null +++ b/pages/bannerdetail/index.wxml @@ -0,0 +1,52 @@ + + + + + + + {{data.title}}限购{{data.useLimitQuantity}}件 + 剩余时间:{{day}}天{{hour}}小时{{minute}}分钟 + 剩余件数:{{data.remainInventory}}件 + + + ¥{{data.salePriceStr}} + ¥{{data.priceStr}} + + + + + + + + + + 购买须知 + + + 有效期2018.01.16 至 2018.09.20 + 除特价酒水及特价菜外全场通用 + 无需预约,消费g高峰时可能需要等位 + 没人最多购买2张 + 不可使用包间 + 堂食外带均可,可免费打包 + 每桌限用2张 + + + + + + + \ No newline at end of file diff --git a/pages/bannerdetail/index.wxss b/pages/bannerdetail/index.wxss new file mode 100644 index 0000000..a1ffe6a --- /dev/null +++ b/pages/bannerdetail/index.wxss @@ -0,0 +1,213 @@ +@import "../../app.wxss"; +.coupons { + width: 100%; + background: #f6f6f6; + position: relative; + overflow: hidden; + padding-bottom: 120rpx; +} + +.coupons-body { + flex: 1; + /* overflow: auto; */ +} + +.banner { + width: 100%; + height: 465rpx; +} + +.banner image { + width: 100%; + height: 100%; +} + +.coupons_info { + width: 92%; + height: 186rpx; + display: flex; + justify-content: space-between; + padding: 0 4%; + background: #fff; +} + +.coupons_info view { + display: flex; + flex-direction: column; +} + +.coupons_info view:nth-child(1) text { + font-size: 30rpx; + margin-top: 3%; +} + +.coupons_info view:nth-child(1) text:nth-child(1) text { + color: #ff3434; + font-size: 24rpx; + border: 1px solid #ff3434; + border-radius: 6rpx; + margin-left: 2%; + padding: 0 5rpx; +} + +.coupons_info view:nth-child(1) text:nth-child(2), +.coupons_info view:nth-child(1) text:nth-child(3) { + color: #b8b8b8; + font-size: 24rpx; + margin-top: 4%; +} + +.coupons_info view:nth-child(1) text:nth-child(2) text, +.coupons_info view:nth-child(1) text:nth-child(3) text { + color: #ff3434; + font-size: 24rpx; +} + +.coupons_info view:nth-child(2) text:nth-child(1) { + font-size: 36rpx; + color: #ff3434; + margin-top: 40rpx; + font-weight: bold; +} + +.coupons_info view:nth-child(2) text:nth-child(2) { + font-size: 24rpx; + color: #b4b4b4; + text-decoration: line-through; + padding-left: 10rpx; + padding-top: 4rpx; +} + +.posi { + width: 92%; + display: flex; + flex-direction: column; + padding: 0 4%; + background: #fff; + margin-top: 2%; +} + +.posi>view:nth-child(2) { + width: 100%; + height: 87rpx; + display: flex; + justify-content: space-between; + border-top: 1px solid #f6f6f6; + line-height: 87rpx; +} + +.posi>view:nth-child(2) text:nth-child(1) { + font-size: 30rpx; + color: #a9a9a9; +} + +.posi>view:nth-child(2) text:nth-child(2) { + font-size: 30rpx; + color: #a9a9a9; +} + +.posi_logo { + width: 100%; + height: 156rpx; + display: flex; + margin-top: 30rpx; +} + +.posi_logo view:nth-child(1) { + width: 126rpx; + height: 126rpx; + border-radius: 50%; + overflow: hidden; + flex: 2; +} + +.posi_logo view:nth-child(1) image { + width: 100%; + height: 100%; +} + +.posi_logo view:nth-child(2) { + display: flex; + flex-direction: column; + flex: 8; + padding-top: 20rpx; + padding-left: 30rpx; +} + +.posi_logo view:nth-child(2) text:nth-child(1) { + font-size: 30rpx; +} + +.posi_logo view:nth-child(2) text:nth-child(2) { + font-size: 24rpx; + color: #b8b8b8; + padding-top: 10rpx; +} + +.notes { + margin-top: 2%; +} + +.notes view:nth-child(1) { + width: 92%; + height: 87rpx; + padding: 0 4%; + line-height: 87rpx; + background: #fff; + border-bottom: 1rpx solid #f5f5f5; + border-top: 1rpx solid #f5f5f5; +} + +.notes view:nth-child(1) text { + font-size: 30rpx; + font-weight: bold; +} + +.notes view:nth-child(2) { + width: 92%; + height: 400rpx; + padding: 0 4%; + background: #fff; + border-bottom: 1rpx solid #f5f5f5; + display: flex; + flex-direction: column; + padding-top: 2%; +} + +.notes view:nth-child(2)>text { + font-size: 28rpx; + color: #a9a9a9; + line-height: 56rpx; +} + +.spot { + width: 12rpx; + height: 12rpx; + display: inline-block; + background: #a9a9a9; + margin-right: 16rpx; + position: relative; + bottom: 4rpx; + border-radius: 50%; +} + +.buy-view { + background: #fff; + position: fixed; + padding-top: 10rpx; + height:98rpx; + bottom: 0rpx; + left: 0; + right: 0; +} + +.buy { + background: #00c0ff; + height: 88rpx; + width: 98%; + margin: 0 auto; + color: #fff; + font-size: 36rpx; + line-height: 88rpx; + border-radius: 6rpx; +} diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index 5343e8c..19d3cf9 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -31,7 +31,7 @@ Page({ }).then(res => { console.log(res); //当前时间与优惠券下架时间做计算 - var startTime = util.fmtDate(res.data.sendEndDate); + var startTime = util.fmtDate(res.data.endTime); console.log(startTime); var s1 = new Date(startTime.replace(/-/g, "/")); var s2 = new Date(); diff --git a/pages/couponorder/index/index.wxml b/pages/couponorder/index/index.wxml index 1da9a4a..f77430e 100644 --- a/pages/couponorder/index/index.wxml +++ b/pages/couponorder/index/index.wxml @@ -6,7 +6,10 @@ - 没有优惠券哦 + 暂无优惠券可用 + + + diff --git a/pages/couponorder/index/index.wxss b/pages/couponorder/index/index.wxss index 3c9fb7d..11c3bab 100644 --- a/pages/couponorder/index/index.wxss +++ b/pages/couponorder/index/index.wxss @@ -93,7 +93,7 @@ } .nocoupon image{ - width: 100rpx; + width: 203rpx; display: block; margin: 200rpx auto 0; } @@ -101,6 +101,12 @@ display: block; text-align: center; font-size:30rpx; - color: #999; + color: #00C0FF; +} +.nocoupon button{ + background: #00C0FF; + color: #fff; + font-style: 30rpx; + width: 70%; + margin: 30rpx auto 0; } - diff --git a/pages/index/coupons/index.js b/pages/index/coupons/index.js index 0e801bf..6baedb7 100644 --- a/pages/index/coupons/index.js +++ b/pages/index/coupons/index.js @@ -79,13 +79,13 @@ Component({ if (key == 0) { var param = { pageNum: pageNum, - pageSize: 2, + pageSize: 8, targetAd: 1 }; } else { var param = { pageNum: pageNum, - pageSize: 2, + pageSize: 8, business: key, targetAd: 1 }; diff --git a/pages/rushToBuy/index.js b/pages/rushToBuy/index.js index bda8e9d..729e686 100644 --- a/pages/rushToBuy/index.js +++ b/pages/rushToBuy/index.js @@ -14,21 +14,14 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function(options) {}, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - - /** - * 生命周期函数--监听页面显示 - */ - onReady: function() { + //列表 + getList: function(page) { app.couponChannelListCallback = token => { Http.setToken(token); Http.get({ url: config.api.couponChannelList, data: { - pageNum: 2, + pageNum: page, pageSize: 2, targetAd: 2 } @@ -45,14 +38,20 @@ Page({ app.couponChannelListCallback(app.globalData.token); } }, + onReady: function() { + let that = this; + that.getList(2); + }, //限时抢购的强请页面 gotodetail: function(e) { - console.log(e) - console.log("姐姐在测试") + console.log(e); + 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}`, success: function(res) { // success }, @@ -64,27 +63,18 @@ Page({ } }); }, - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function() {}, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function() {}, - /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function() { - console.log(""); + console.log("000"); }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() { + console.log("姐姐在搞上啦加载"); }, /** diff --git a/pages/rushToBuy/index.wxml b/pages/rushToBuy/index.wxml index fad732c..2ecda73 100644 --- a/pages/rushToBuy/index.wxml +++ b/pages/rushToBuy/index.wxml @@ -1,4 +1,4 @@ - +