From 4da823c84c8f9671732c12199e77e6ac7fc40948 Mon Sep 17 00:00:00 2001 From: LengYingxin Date: Sat, 18 Aug 2018 17:25:57 +0800 Subject: [PATCH] update --- components/coupons/index.js | 2 +- components/coupons/index.wxml | 38 ++--- pages/coupons/details/index.js | 13 +- pages/coupons/details/index.wxml | 12 +- pages/coupons/details/index.wxss | 268 +++++++++++++++++-------------- pages/index/rushToBuy/index.js | 69 ++++---- 6 files changed, 223 insertions(+), 179 deletions(-) diff --git a/components/coupons/index.js b/components/coupons/index.js index d80a081..195a983 100644 --- a/components/coupons/index.js +++ b/components/coupons/index.js @@ -17,7 +17,7 @@ Component({ }, methods: { - onLogin(e){ + navigateTo(e){ let { id } = e.currentTarget.dataset.date; wx.navigateTo({ url: `../../pages/coupons/details/index?id=${id}`, diff --git a/components/coupons/index.wxml b/components/coupons/index.wxml index 5d2fd6b..3c0ae5c 100644 --- a/components/coupons/index.wxml +++ b/components/coupons/index.wxml @@ -1,21 +1,23 @@ - - - - - - {{data.name}} - - ¥{{data.salePrice}} - ¥{{data.price}} + + + + - - - {{data.salePrice}} + + {{data.name}} + + ¥{{data.salePrice}} + ¥{{data.price}} + + + + {{data.salePrice}} + + {{data.salePrice}} - {{data.salePrice}} - - - 购买 + + 购买 + + - - \ No newline at end of file + \ No newline at end of file diff --git a/pages/coupons/details/index.js b/pages/coupons/details/index.js index b09297d..ffdfa85 100644 --- a/pages/coupons/details/index.js +++ b/pages/coupons/details/index.js @@ -3,20 +3,24 @@ var app = getApp() const Http = require("../../../utils/HttpBasics") Page({ data: { - list: {}, + data: {}, couponId: null, orderId: '' }, onLoad(e) { - console.log(e.id) + console.log(e) + wx.showLoading({ + title: '加载中...', + }) Http.get({ url: Http.config.api.couponDetail, data: { id: e.id } }).then(res => { + wx.hideLoading(); this.setData({ - list: res, + data: res, couponId: e.id }) }) @@ -52,10 +56,11 @@ Page({ if (res.payment > 0) { return Http.post({ url: Http.config.api.payOrderCreate, data: { orderId: orderId } }) } else { + // 免费卷 this.payOrderUpdate(orderId, "0", 1) // 支付成功 .then(res => { wx.showToast({ - title: "支付状态更新成功", + title: "支付成功", duration: 3000 }) }) diff --git a/pages/coupons/details/index.wxml b/pages/coupons/details/index.wxml index 4a88ddd..ad113a8 100644 --- a/pages/coupons/details/index.wxml +++ b/pages/coupons/details/index.wxml @@ -1,15 +1,16 @@ + - 黑椒牛排限购一件 + {{data.title}}限购一件 剩余时间:2天12小时25分钟 剩余件数:19件 - ¥1.00 + ¥{{data.salePriceStr}} ¥59.00 @@ -42,5 +43,8 @@ 每桌限用2张 - + + + + \ No newline at end of file diff --git a/pages/coupons/details/index.wxss b/pages/coupons/details/index.wxss index 0e93f9d..6921eb9 100644 --- a/pages/coupons/details/index.wxss +++ b/pages/coupons/details/index.wxss @@ -1,190 +1,210 @@ @import '../../../app.wxss'; - .coupons { - width: 100%; - height: 100%; - position: absolute; - background: #f6f6f6; + width: 100%; + height: 100vh; + background: #f6f6f6; + position: relative; + display: flex; + flex-direction: column; +} +.coupons-body{ + flex: 1; + overflow: auto; } - .banner { - width: 100%; - height: 465rpx; + width: 100%; + height: 465rpx; } .banner image { - width: 100%; - height: 100%; + width: 100%; + height: 100%; } .coupons_info { - width: 92%; - height: 186rpx; - display: flex; - justify-content: space-between; - padding: 0 4%; - background: #fff; + width: 92%; + height: 186rpx; + display: flex; + justify-content: space-between; + padding: 0 4%; + background: #fff; } .coupons_info view { - display: flex; - flex-direction: column; + display: flex; + flex-direction: column; } .coupons_info view:nth-child(1) text { - font-size: 30rpx; - margin-top: 3%; + 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; + 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%; + 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; + 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; + 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; + 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%; + 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; + 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; + font-size: 30rpx; + color: #a9a9a9; } .posi>view:nth-child(2) text:nth-child(2) { - font-size: 30rpx; - color: #a9a9a9; + font-size: 30rpx; + color: #a9a9a9; } .posi_logo { - width: 100%; - height: 156rpx; - display: flex; - margin-top: 30rpx; + 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) { + 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(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; + 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; + 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; + 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%; + width: 12rpx; + height: 12rpx; + display: inline-block; + background: #A9A9A9; + margin-right: 16rpx; + position: relative; + bottom: 4rpx; + border-radius: 50%; +} + +.buy-view { + width: 100%; + padding: 10rpx; + /* position: fixed; */ + /* bottom: 0; */ + background: #fff; + box-sizing: border-box; } + .buy { - width: 100%; - height: 88rpx; - background: #00C0FF; - color: #fff; - font-size: 36rpx; - line-height: 88rpx; + /* width: 100%; */ + height: 88rpx; + background: #00C0FF; + color: #fff; + font-size: 36rpx; + line-height: 88rpx; + border-radius: 0; } \ No newline at end of file diff --git a/pages/index/rushToBuy/index.js b/pages/index/rushToBuy/index.js index 8175a49..03e4721 100644 --- a/pages/index/rushToBuy/index.js +++ b/pages/index/rushToBuy/index.js @@ -1,4 +1,5 @@ // pages/index/sw/index.js +let Http = require('../../../utils/HttpBasics') Component({ /** * 组件的属性列表 @@ -12,34 +13,34 @@ Component({ */ data: { list: [ - { - img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg", - name: "海鲜焗饭", - time: "2天12小时25分钟", - oPrice: "59.00", - pPrice: "1.00", - }, - { - img: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg", - name: "海鲜焗饭", - time: "2天12小时25分钟", - oPrice: "59.00", - pPrice: "1.00", - }, - { - img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg", - name: "海鲜焗饭", - time: "2天12小时25分钟", - oPrice: "59.00", - pPrice: "1.00", - }, - { - img: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg", - name: "海鲜焗饭", - time: "2天12小时25分钟", - oPrice: "59.00", - pPrice: "1.00", - }, + // { + // img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg", + // name: "海鲜焗饭", + // time: "2天12小时25分钟", + // oPrice: "59.00", + // pPrice: "1.00", + // }, + // { + // img: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg", + // name: "海鲜焗饭", + // time: "2天12小时25分钟", + // oPrice: "59.00", + // pPrice: "1.00", + // }, + // { + // img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg", + // name: "海鲜焗饭", + // time: "2天12小时25分钟", + // oPrice: "59.00", + // pPrice: "1.00", + // }, + // { + // img: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg", + // name: "海鲜焗饭", + // time: "2天12小时25分钟", + // oPrice: "59.00", + // pPrice: "1.00", + // }, ] }, @@ -48,5 +49,17 @@ Component({ */ methods: { + }, + ready() { + Http.get({ + url: "/wxCouponChannel/list", data: { + pageNum: 1, + pageSize: 10 + } + }).then(res=>{ + this.setData({ + list: res.list + }) + }) } })