From 4331631f1d9a852b22d0c12d403d1115ff5ef4b0 Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Wed, 7 Aug 2019 11:32:58 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=97=A8=E5=BA=97=E5=88=97=E8=A1=A8][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]:[=E5=B0=86=E9=97=A8=E5=BA=97=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=B0=81=E8=A3=85=E6=88=90=E7=BB=84=E4=BB=B6]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/banner/index.json | 5 +-- components/banner/index.wxss | 4 +- components/navbar/navbar.js | 1 - components/store/index.js | 78 ++++++++++++++++++++++++++++++++++ components/store/index.json | 3 ++ components/store/index.wxml | 19 +++++++++ components/store/index.wxss | 72 +++++++++++++++++++++++++++++++ pages/coupon/detail/index.js | 53 +++-------------------- pages/coupon/detail/index.json | 3 +- pages/coupon/detail/index.wxml | 21 +-------- pages/coupon/detail/index.wxss | 76 --------------------------------- 11 files changed, 184 insertions(+), 151 deletions(-) create mode 100644 components/store/index.js create mode 100644 components/store/index.json create mode 100644 components/store/index.wxml create mode 100644 components/store/index.wxss diff --git a/components/banner/index.json b/components/banner/index.json index 3bd5dd3..32640e0 100644 --- a/components/banner/index.json +++ b/components/banner/index.json @@ -1,6 +1,3 @@ { - "component": true, - "usingComponents": { - - } + "component": true } \ No newline at end of file diff --git a/components/banner/index.wxss b/components/banner/index.wxss index fadbf3f..8ad3b5d 100644 --- a/components/banner/index.wxss +++ b/components/banner/index.wxss @@ -57,12 +57,12 @@ .itemImg{ position: absolute; width: 640rpx; - height: 248rpx; + height: 227rpx; border-radius: 15rpx; overflow: hidden; z-index: 5; opacity: 0.7; - top: 15%; + top: 20%; margin: 0 20rpx; } .active{ diff --git a/components/navbar/navbar.js b/components/navbar/navbar.js index 60cf7fe..48f045a 100644 --- a/components/navbar/navbar.js +++ b/components/navbar/navbar.js @@ -48,6 +48,5 @@ Component({ back: false }) } - console.debug() } }) diff --git a/components/store/index.js b/components/store/index.js new file mode 100644 index 0000000..f164d79 --- /dev/null +++ b/components/store/index.js @@ -0,0 +1,78 @@ +const imgurl = require("../../utils/imgurl"); +Component({ + /** + * 组件的属性列表 + */ + properties: { + merchantVoList: { + value: [], + type: Array + } + }, + + /** + * 组件的初始数据 + */ + data: { + teljpgUrl: imgurl.teljpg.url, + showMore:true, + more: "点击查看更多", + hidden:"hidden", + height: "" + }, + + /** + * 组件的方法列表 + */ + methods: { + /** + * 跳转到门店列表的详情页面 + */ + gotoDetail(e) { + wx.navigateTo({ + url: `/pages/index/searchbar/detail/index?id=${e.currentTarget.dataset.id}` + }) + }, + // 点击查看更多 + more: function () { + let that = this; + if (that.data.more == '点击查看更多') { + this.setData({ + hidden: "", + height: 'auto!important', + more: "点击收起", + showMore: true + }) + } else { + that.setData({ + hidden: "hidden", + height: 4 * 140 + 'rpx', + more: "点击查看更多", + showMore: true + }) + } + }, + phone: function (e) { + let that = this; + wx.makePhoneCall({ + phoneNumber: e.target.dataset.merchantlinkphone + }); + } + }, + ready: function () { + let merchantVoList = this.properties.merchantVoList; + if (merchantVoList.length>0){ + if (merchantVoList.length <= 4) { + this.setData({ + height: merchantVoList.length * 140 + 'rpx', + showMore: false, + hidden:"hidden" + }) + } else if (merchantVoList && merchantVoList.length > 4) { + this.setData({ + height: 4 * 140 + 'rpx' + }) + } + } + } +}); diff --git a/components/store/index.json b/components/store/index.json new file mode 100644 index 0000000..32640e0 --- /dev/null +++ b/components/store/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/components/store/index.wxml b/components/store/index.wxml new file mode 100644 index 0000000..53728ab --- /dev/null +++ b/components/store/index.wxml @@ -0,0 +1,19 @@ +适用门店 + + + +{{more}} \ No newline at end of file diff --git a/components/store/index.wxss b/components/store/index.wxss new file mode 100644 index 0000000..06b7703 --- /dev/null +++ b/components/store/index.wxss @@ -0,0 +1,72 @@ + + +.applyshop { + font-size: 30rpx; + height: 70rpx; + line-height: 70rpx; + color: #333; + text-indent: 1em; + background: #fff; +} + +.posi { + position: relative; + width: 100%; + background: #FFF; +} +.posi_logo { + position: relative; + width: 92%; + display: flex; + padding: 20rpx 0; + background: #fff; + z-index: 10; + margin: 0 auto; +} + +.posi_logo view:nth-child(1) { + /* width: 100rpx; *//* margin-right: 16rpx; */ + border-radius: 16rpx; + /* height: 100rpx; */ +} + +.posi_logo view:nth-child(1) image { + display: block; + width: 100rpx; + height: 100rpx; + border-radius: 16rpx; + margin-right: 16rpx; + border: 1px solid #e5e5e5; +} +.name{ + font-size: 32rpx; + color: #333; + letter-spacing: 0; + width: 500rpx; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} +.posi_logo view:nth-child(2) view:nth-child(1) { + font-size: 32rpx; + color: #333; + letter-spacing: 0; +} + +.shopVoList { + display: flex !important; + padding-left: 0 !important; + flex-direction: row !important; +} + +.shopVoList text { + font-size: 20rpx !important; + color: #b8b8b8 !important; +} +.bottom{ + background: #fff; + color: #666; + text-align: center; + padding: 20rpx 0; + font-size: 32rpx; +} diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index f2de195..cbeb04c 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -22,12 +22,8 @@ Page({ fail: imgurl.fail.url, wmhome: imgurl.wmhome.url, swiperCurrent: 0, - hidden: "hidden", - height: "", detailPicture:[], coverPicture:[], - more: "点击查看更多", - showMore: true, data: { title: null }, @@ -105,14 +101,7 @@ Page({ isshowposter: false, }) }, - /** - * 跳转到门店列表的详情页面 - */ - gotoDetail(e) { - wx.navigateTo({ - url: `/pages/index/searchbar/detail/index?id=${e.currentTarget.dataset.id}` - }) - }, + /** * 显示分享海报 */ @@ -127,31 +116,8 @@ Page({ swiperCurrent: e.detail.current }); }, - phone: function(e) { - let that = this; - wx.makePhoneCall({ - phoneNumber: e.target.dataset.merchantlinkphone - }); - }, - // 点击查看更多 - more: function() { - let that = this; - if (that.data.more == '点击查看更多') { - this.setData({ - hidden: "", - height: that.data.data.merchantVoList.length * 140 + 'rpx', - more: "点击收起", - showMore: true - }) - } else { - this.setData({ - hidden: "hidden", - height: 4 * 140 + 'rpx', - more: "点击查看更多", - showMore: true - }) - } - }, + + //获取当前登录用户信息 getUserInfo: function() { let that = this; @@ -546,19 +512,10 @@ Page({ } wx.hideLoading(); that.setData({ - data: res.data + data: res.data, + merchantVoList: res.data.merchantVoList }); - if (that.data.data.merchantVoList && that.data.data.merchantVoList.length <= 4) { - that.setData({ - height: that.data.data.merchantVoList.length * 140 + 'rpx', - showMore: false - }) - } else if (that.data.data.merchantVoList && that.data.data.merchantVoList.length > 4) { - that.setData({ - height: 4 * 140 + 'rpx' - }) - } if (res.data.validType == 1) { that.setData({ validStartDate: util.formatTime(res.data.validStartDate, "yyyy-MM-dd"), diff --git a/pages/coupon/detail/index.json b/pages/coupon/detail/index.json index 9972df0..ef321ac 100644 --- a/pages/coupon/detail/index.json +++ b/pages/coupon/detail/index.json @@ -1,7 +1,8 @@ { "usingComponents": { "c-shareposter": "../../../../components/shareposter/index", - "navbar": "../../../../components/navbar/navbar" + "navbar": "../../../../components/navbar/navbar", + "store": "../../../../components/store/index" }, "navigationBarTitleText": "", "backgroundColor":"#f4f4f4", diff --git a/pages/coupon/detail/index.wxml b/pages/coupon/detail/index.wxml index aee6dac..679b8ff 100644 --- a/pages/coupon/detail/index.wxml +++ b/pages/coupon/detail/index.wxml @@ -89,25 +89,8 @@ - - - - - {{more}} + + 购买须知 diff --git a/pages/coupon/detail/index.wxss b/pages/coupon/detail/index.wxss index 5b6f66e..424304e 100644 --- a/pages/coupon/detail/index.wxss +++ b/pages/coupon/detail/index.wxss @@ -220,74 +220,6 @@ button::after { float: right; } -.posi { - position: relative; - width: 100%; - background: #FFF; - margin: 18rpx 0 0; -} - -/* .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 { - position: relative; - width: 92%; - display: flex; - padding: 20rpx 0; - background: #fff; - z-index: 10; - margin: 0 auto; -} - -.posi_logo view:nth-child(1) { - /* width: 100rpx; *//* margin-right: 16rpx; */ - border-radius: 16rpx; - /* height: 100rpx; */ -} - -.posi_logo view:nth-child(1) image { - display: block; - width: 100rpx; - height: 100rpx; - border-radius: 16rpx; - margin-right: 16rpx; - border: 1px solid #e5e5e5; -} -.name{ - font-size: 32rpx; - color: #333; - letter-spacing: 0; - width: 500rpx; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; -} -.posi_logo view:nth-child(2) view:nth-child(1) { - font-size: 32rpx; - color: #333; - letter-spacing: 0; -} - -.shopVoList { - display: flex !important; - padding-left: 0 !important; - flex-direction: row !important; -} - -.shopVoList text { - font-size: 20rpx !important; - color: #b8b8b8 !important; -} - .notes view:nth-child(1) { height: 87rpx; line-height: 87rpx; @@ -544,14 +476,6 @@ button::after { padding: 0 6rpx; } -.applyshop { - font-size: 30rpx; - height: 70rpx; - line-height: 70rpx; - color: #333; - text-indent: 1em; -} - .btns { /* padding: 0 33rpx; */ position: fixed;