Commit 3f3633c1113852f1630d4164beee3bfcae2f31bd
1 parent
6d3288d9
我的礼包
Showing
7 changed files
with
459 additions
and
7 deletions
app.json
| @@ -137,8 +137,9 @@ | @@ -137,8 +137,9 @@ | ||
| 137 | "pages/my_service/tment_order_list", | 137 | "pages/my_service/tment_order_list", |
| 138 | "pages/my_service/beauty_deta", | 138 | "pages/my_service/beauty_deta", |
| 139 | "pages/profile/profile", | 139 | "pages/profile/profile", |
| 140 | - "pages/parseHtml/parseHtml" | ||
| 141 | - | 140 | + "pages/parseHtml/parseHtml", |
| 141 | + "pages/myGift/myGift", | ||
| 142 | + "pages/myGiftDetails/myGiftDetails" | ||
| 142 | ] | 143 | ] |
| 143 | 144 | ||
| 144 | }, | 145 | }, |
app.wxss
| @@ -50,6 +50,11 @@ | @@ -50,6 +50,11 @@ | ||
| 50 | .pdr40 { | 50 | .pdr40 { |
| 51 | padding-right: 40rpx; | 51 | padding-right: 40rpx; |
| 52 | } | 52 | } |
| 53 | + | ||
| 54 | +.pdr80 { | ||
| 55 | + padding-right: 80rpx; | ||
| 56 | +} | ||
| 57 | + | ||
| 53 | .pdh10 { | 58 | .pdh10 { |
| 54 | padding-left: 10rpx; | 59 | padding-left: 10rpx; |
| 55 | padding-right: 10rpx; | 60 | padding-right: 10rpx; |
| @@ -58,9 +63,13 @@ | @@ -58,9 +63,13 @@ | ||
| 58 | padding-left: 20rpx; | 63 | padding-left: 20rpx; |
| 59 | padding-right: 20rpx; | 64 | padding-right: 20rpx; |
| 60 | } | 65 | } |
| 66 | +.pdv10 { | ||
| 67 | + padding-top: 10rpx; | ||
| 68 | + padding-bottom: 10rpx; | ||
| 69 | +} | ||
| 61 | .pdv20 { | 70 | .pdv20 { |
| 62 | - padding-top: 30rpx; | ||
| 63 | - padding-bottom: 30rpx; | 71 | + padding-top: 20rpx; |
| 72 | + padding-bottom: 20rpx; | ||
| 64 | } | 73 | } |
| 65 | .pdv30 { | 74 | .pdv30 { |
| 66 | padding-top: 30rpx; | 75 | padding-top: 30rpx; |
| @@ -140,6 +149,14 @@ | @@ -140,6 +149,14 @@ | ||
| 140 | font-weight: bold; | 149 | font-weight: bold; |
| 141 | } | 150 | } |
| 142 | 151 | ||
| 152 | +.mgl10 { | ||
| 153 | + margin-left: 10rpx; | ||
| 154 | +} | ||
| 155 | + | ||
| 156 | +.mgb10 { | ||
| 157 | + margin-bottom: 10rpx; | ||
| 158 | +} | ||
| 159 | + | ||
| 143 | .mgl20 { | 160 | .mgl20 { |
| 144 | margin-left: 20rpx; | 161 | margin-left: 20rpx; |
| 145 | } | 162 | } |
| @@ -635,6 +652,10 @@ background: #ffe3e2; | @@ -635,6 +652,10 @@ background: #ffe3e2; | ||
| 635 | line-height: 1; | 652 | line-height: 1; |
| 636 | } | 653 | } |
| 637 | 654 | ||
| 655 | +.lh { | ||
| 656 | + line-height: 1.4; | ||
| 657 | +} | ||
| 658 | + | ||
| 638 | 659 | ||
| 639 | 660 | ||
| 640 | 661 | ||
| @@ -646,9 +667,9 @@ background: #ffe3e2; | @@ -646,9 +667,9 @@ background: #ffe3e2; | ||
| 646 | /* 图标字体(ty) */ | 667 | /* 图标字体(ty) */ |
| 647 | @font-face { | 668 | @font-face { |
| 648 | font-family: 'iconfont'; /* Project id 2054717 */ | 669 | font-family: 'iconfont'; /* Project id 2054717 */ |
| 649 | - src: url('//at.alicdn.com/t/font_2054717_hcnqrwwkh97.woff2?t=1620986106765') format('woff2'), | ||
| 650 | - url('//at.alicdn.com/t/font_2054717_hcnqrwwkh97.woff?t=1620986106765') format('woff'), | ||
| 651 | - url('//at.alicdn.com/t/font_2054717_hcnqrwwkh97.ttf?t=1620986106765') format('truetype'); | 670 | + src: url('//at.alicdn.com/t/font_2054717_f0lv6m3iryg.woff2?t=1621240949872') format('woff2'), |
| 671 | + url('//at.alicdn.com/t/font_2054717_f0lv6m3iryg.woff?t=1621240949872') format('woff'), | ||
| 672 | + url('//at.alicdn.com/t/font_2054717_f0lv6m3iryg.ttf?t=1621240949872') format('truetype'); | ||
| 652 | } | 673 | } |
| 653 | 674 | ||
| 654 | .iconfont { | 675 | .iconfont { |
packageA/pages/myGift/myGift.js
0 → 100644
| 1 | +// packageA//pages/myGift/myGift.js | ||
| 2 | +const app = getApp(); | ||
| 3 | +let self = null; | ||
| 4 | + | ||
| 5 | +Page({ | ||
| 6 | + | ||
| 7 | + /** | ||
| 8 | + * 页面的初始数据 | ||
| 9 | + */ | ||
| 10 | + data: { | ||
| 11 | + tabArr: ['礼包列表', '我的礼包'], | ||
| 12 | + currentIndex: 0, | ||
| 13 | + | ||
| 14 | + list: null, | ||
| 15 | + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 | ||
| 16 | + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 | ||
| 17 | + pageNum: 1, // 当前页数 | ||
| 18 | + }, | ||
| 19 | + | ||
| 20 | + clickTab(e) { | ||
| 21 | + let index = e.target.dataset.index; | ||
| 22 | + let url = ''; | ||
| 23 | + let data = { | ||
| 24 | + store_id: app.globalData.setting.stoid, | ||
| 25 | + }; | ||
| 26 | + | ||
| 27 | + this.setData({ | ||
| 28 | + list: null, | ||
| 29 | + pageNum: 1, | ||
| 30 | + noMore: false, | ||
| 31 | + currentIndex: index, | ||
| 32 | + }); | ||
| 33 | + | ||
| 34 | + if(index == 0) { | ||
| 35 | + url = '/api/weshop/libao/libaoFormvip/page'; | ||
| 36 | + data.user_id = app.globalData.user_id; | ||
| 37 | + } else if(index == 1) { | ||
| 38 | + url = '/api/weshop/libao/libaoForm/page'; | ||
| 39 | + }; | ||
| 40 | + | ||
| 41 | + this.getData(true, url, data); | ||
| 42 | + }, | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 生命周期函数--监听页面加载 | ||
| 46 | + */ | ||
| 47 | + onLoad: function (options) { | ||
| 48 | + self = this; | ||
| 49 | + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 | ||
| 50 | + self.setData({ | ||
| 51 | + userInfo: data, | ||
| 52 | + }); | ||
| 53 | + }); | ||
| 54 | + }, | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * 生命周期函数--监听页面初次渲染完成 | ||
| 58 | + */ | ||
| 59 | + onReady: function () { | ||
| 60 | + | ||
| 61 | + }, | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * 生命周期函数--监听页面显示 | ||
| 65 | + */ | ||
| 66 | + onShow: function () { | ||
| 67 | + if(app.globalData.userInfo) { | ||
| 68 | + if(!this.data.isLogin) { | ||
| 69 | + this.setData({ | ||
| 70 | + userInfo: app.globalData.userInfo, | ||
| 71 | + imghost: app.globalData.setting.imghost, | ||
| 72 | + isLogin: true, | ||
| 73 | + }); | ||
| 74 | + | ||
| 75 | + this.getData(true, '/api/weshop/libao/libaoFormvip/page', { | ||
| 76 | + store_id: app.globalData.setting.stoid, | ||
| 77 | + user_id: app.globalData.user_id, | ||
| 78 | + }); | ||
| 79 | + }; | ||
| 80 | + }; | ||
| 81 | + }, | ||
| 82 | + | ||
| 83 | + /** | ||
| 84 | + * 生命周期函数--监听页面隐藏 | ||
| 85 | + */ | ||
| 86 | + onHide: function () { | ||
| 87 | + | ||
| 88 | + }, | ||
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * 生命周期函数--监听页面卸载 | ||
| 92 | + */ | ||
| 93 | + onUnload: function () { | ||
| 94 | + | ||
| 95 | + }, | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
| 99 | + */ | ||
| 100 | + onPullDownRefresh: function () { | ||
| 101 | + | ||
| 102 | + }, | ||
| 103 | + | ||
| 104 | + /** | ||
| 105 | + * 页面上拉触底事件的处理函数 | ||
| 106 | + */ | ||
| 107 | + onReachBottom: function () { | ||
| 108 | + this.scrollToLower('/api/weshop/libao/libaoFormvip/page', { | ||
| 109 | + store_id: app.globalData.setting.stoid, | ||
| 110 | + user_id: app.globalData.user_id, | ||
| 111 | + }); | ||
| 112 | + }, | ||
| 113 | + | ||
| 114 | + /** | ||
| 115 | + * 用户点击右上角分享 | ||
| 116 | + */ | ||
| 117 | + onShareAppMessage: function () { | ||
| 118 | + | ||
| 119 | + }, | ||
| 120 | + | ||
| 121 | + /** | ||
| 122 | + * 请求数据 | ||
| 123 | + */ | ||
| 124 | + getData: function(isInit, url, data) { | ||
| 125 | + app.request.promiseGet(url, { | ||
| 126 | + data: data, | ||
| 127 | + isShowLoading: true, | ||
| 128 | + }) | ||
| 129 | + .then(function(res) { | ||
| 130 | + if(res.data.code == 0) { | ||
| 131 | + | ||
| 132 | + self.setData({ | ||
| 133 | + isLoading: false | ||
| 134 | + }); | ||
| 135 | + | ||
| 136 | + if(isInit) {// 第一次加载 | ||
| 137 | + self.setData({ | ||
| 138 | + list: res.data.data | ||
| 139 | + }); | ||
| 140 | + } else { | ||
| 141 | + self.setData({ | ||
| 142 | + 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) | ||
| 143 | + }); | ||
| 144 | + }; | ||
| 145 | + | ||
| 146 | + if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { | ||
| 147 | + self.setData({ | ||
| 148 | + noMore: true | ||
| 149 | + }); | ||
| 150 | + }; | ||
| 151 | + | ||
| 152 | + } else { | ||
| 153 | + self.setData({ | ||
| 154 | + 'list.pageData': [] | ||
| 155 | + }); | ||
| 156 | + }; | ||
| 157 | + | ||
| 158 | + }) | ||
| 159 | + .catch(function(err) { | ||
| 160 | + console.log('出错拉!!!!',err); | ||
| 161 | + self.setData({ | ||
| 162 | + 'list.pageData': [] | ||
| 163 | + }); | ||
| 164 | + }); | ||
| 165 | + }, | ||
| 166 | + | ||
| 167 | + | ||
| 168 | + /** | ||
| 169 | + * 上拉加载 | ||
| 170 | + */ | ||
| 171 | + scrollToLower(url, requestData) { | ||
| 172 | + // 数据总量 | ||
| 173 | + let total = this.data.list.total; | ||
| 174 | + // 单页最大数据量 | ||
| 175 | + let pageSize = this.data.list.pageSize; | ||
| 176 | + // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ | ||
| 177 | + if((total != 0)&&(total <= pageSize)) { | ||
| 178 | + this.setData({ | ||
| 179 | + noMore: true | ||
| 180 | + }); | ||
| 181 | + }; | ||
| 182 | + | ||
| 183 | + if(!this.data.isLoading && !this.data.noMore) { | ||
| 184 | + this.setData({ | ||
| 185 | + isLoading: true, | ||
| 186 | + pageNum: this.data.pageNum + 1 | ||
| 187 | + }); | ||
| 188 | + requestData.page = this.data.pageNum; | ||
| 189 | + this.getData(false, url, requestData); | ||
| 190 | + }; | ||
| 191 | + }, | ||
| 192 | + | ||
| 193 | + /** | ||
| 194 | + * 点击跳转 | ||
| 195 | + */ | ||
| 196 | + goto(e) { | ||
| 197 | + let url = ''; | ||
| 198 | + if(e.target.dataset.url) { | ||
| 199 | + url = e.target.dataset.url; | ||
| 200 | + } else { | ||
| 201 | + url = e.currentTarget.dataset.url; | ||
| 202 | + } | ||
| 203 | + app.goto(url); | ||
| 204 | + }, | ||
| 205 | +}) | ||
| 0 | \ No newline at end of file | 206 | \ No newline at end of file |
packageA/pages/myGift/myGift.json
0 → 100644
packageA/pages/myGift/myGift.wxml
0 → 100644
| 1 | +<wxs module="filter" src="../../../utils/filter.wxs"></wxs> | ||
| 2 | +<view> | ||
| 3 | + <view class="tab-title" bindtap="clickTab"> | ||
| 4 | + <view class="tab-title-item {{currentIndex == index ? 'active':''}}" wx:for="{{tabArr}}" data-index="{{index}}">{{item}}</view> | ||
| 5 | + </view> | ||
| 6 | + <view class="tab-content"> | ||
| 7 | + <block wx:if="{{currentIndex == 0}}"> | ||
| 8 | + <view class="tab-item" wx:for="{{list.pageData}}"> | ||
| 9 | + <!-- 图片 --> | ||
| 10 | + <view class="img-container"><image src="{{imghost + item.lburl}}" class="img" mode="aspectFit"/></view> | ||
| 11 | + <view class="desc-container"> | ||
| 12 | + <!-- 标题 --> | ||
| 13 | + <view class="mgb10 ellipsis-2 lh taj">{{item.lbtitle}}</view> | ||
| 14 | + <!-- 价格 --> | ||
| 15 | + <view class="flex jc_sb ai-center pdb10"> | ||
| 16 | + <view class="flex ai-center"> | ||
| 17 | + <view class="c-red fs28"><text class="rmb">{{item.lbprice}}</text>/{{item.lbintegral}}积分</view> | ||
| 18 | + <view class="fs22 c-a4 line-through mgl10">零售价{{item.oldprice}}</view> | ||
| 19 | + </view> | ||
| 20 | + <view class="fs24 c-a4">已售{{item.salenum}}件</view> | ||
| 21 | + </view> | ||
| 22 | + <!-- 时间 --> | ||
| 23 | + <view class="date pdb20">活动截止日期{{filter.format_time(item.expdate)}}</view> | ||
| 24 | + <!-- 按钮 --> | ||
| 25 | + <view class="btn-container"> | ||
| 26 | + <view class="btn exchange">立即兑换</view> | ||
| 27 | + <view class="btn buy">立即购买</view> | ||
| 28 | + </view> | ||
| 29 | + </view> | ||
| 30 | + </view> | ||
| 31 | + </block> | ||
| 32 | + | ||
| 33 | + <block wx:else> | ||
| 34 | + <view class="tab-item flex pd20" wx:for="{{list.pageData}}"> | ||
| 35 | + <view class="img-container2"><image src="{{imghost + item.lburl}}" class="img" mode="aspectFit"/></view> | ||
| 36 | + <view class="flex fdc jc_sb"> | ||
| 37 | + <view> | ||
| 38 | + <!-- 标题 --> | ||
| 39 | + <view class="mgb10 ellipsis-2 lh taj">{{item.lbtitle}}</view> | ||
| 40 | + <!-- 时间 --> | ||
| 41 | + <view class="date pdb20">活动截止日期{{filter.format_time(item.endtime)}}</view> | ||
| 42 | + </view> | ||
| 43 | + <!-- 说明 --> | ||
| 44 | + <view class="c-red fs24">*请到线下门店兑换</view> | ||
| 45 | + </view> | ||
| 46 | + </view> | ||
| 47 | + </block> | ||
| 48 | + | ||
| 49 | + <view class="noMore" hidden="{{!noMore}}" wx:if="{{list.pageData.length !== 0}}">—— 已经到底了 ——</view> | ||
| 50 | + </view> | ||
| 51 | +</view> |
packageA/pages/myGift/myGift.wxss
0 → 100644
| 1 | +@charset "utf-8"; | ||
| 2 | + | ||
| 3 | +.c-a4 { | ||
| 4 | + color: #a4a4a4; | ||
| 5 | +} | ||
| 6 | + | ||
| 7 | +.c-red { | ||
| 8 | + color: #FF6768; | ||
| 9 | +} | ||
| 10 | + | ||
| 11 | +.h88 { | ||
| 12 | + height: 88rpx; | ||
| 13 | +} | ||
| 14 | + | ||
| 15 | + | ||
| 16 | +page { | ||
| 17 | + background-color: #f0f0f0; | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +.tab-title { | ||
| 21 | + display: flex; | ||
| 22 | + position: sticky; | ||
| 23 | + background-color: white; | ||
| 24 | + top: 0; | ||
| 25 | + font-size: 30rpx; | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +.tab-title::after { | ||
| 29 | + position: absolute; | ||
| 30 | + content: ''; | ||
| 31 | + width: 2rpx; | ||
| 32 | + height: 40%; | ||
| 33 | + background-color: #f0f0f0; | ||
| 34 | + top: 0; | ||
| 35 | + bottom: 0; | ||
| 36 | + left: 0; | ||
| 37 | + right: 0; | ||
| 38 | + margin: auto; | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +.tab-title-item { | ||
| 42 | + flex: 1; | ||
| 43 | + text-align: center; | ||
| 44 | + padding-top: 20rpx; | ||
| 45 | + padding-bottom: 20rpx; | ||
| 46 | + position: relative; | ||
| 47 | +} | ||
| 48 | + | ||
| 49 | +.tab-title-item.active { | ||
| 50 | + color: #FF6768; | ||
| 51 | + font-weight: bold; | ||
| 52 | + | ||
| 53 | +} | ||
| 54 | + | ||
| 55 | +.tab-title-item::after { | ||
| 56 | + position: absolute; | ||
| 57 | + content: ''; | ||
| 58 | + left: 100%; | ||
| 59 | + bottom: 0; | ||
| 60 | + width: 0; | ||
| 61 | + border-bottom: 2rpx solid #FF6768; | ||
| 62 | + /* height: 3rpx; */ | ||
| 63 | + transition: 0.2s all linear; | ||
| 64 | +} | ||
| 65 | + | ||
| 66 | +.tab-title-item.active::after { | ||
| 67 | + /* left: 100%; */ | ||
| 68 | + width: 100%; | ||
| 69 | + left: 0; | ||
| 70 | + /* background-color: #FF6768; */ | ||
| 71 | + /* transition-delay: 0.1s; */ | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +.tab-title-item.active ~ .tab-title-item::after { | ||
| 75 | + /* width: 100%; */ | ||
| 76 | + left: 0; | ||
| 77 | +} | ||
| 78 | + | ||
| 79 | +.tab-content { | ||
| 80 | + padding-top: 20rpx; | ||
| 81 | + padding-left: 20rpx; | ||
| 82 | + padding-right: 20rpx; | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +.tab-item { | ||
| 86 | + background-color: white; | ||
| 87 | + border-radius: 10rpx; | ||
| 88 | + overflow: hidden; | ||
| 89 | +} | ||
| 90 | + | ||
| 91 | +.tab-item ~ .tab-item { | ||
| 92 | + margin-top: 20rpx; | ||
| 93 | +} | ||
| 94 | + | ||
| 95 | +.img-container { | ||
| 96 | + background-color: #dedede; | ||
| 97 | + height: 300rpx; | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +.img-container2 { | ||
| 101 | + width: 200rpx; | ||
| 102 | + height: 200rpx; | ||
| 103 | + background-color: #dedede; | ||
| 104 | + margin-right: 20rpx; | ||
| 105 | + flex-shrink: 0; | ||
| 106 | +} | ||
| 107 | + | ||
| 108 | +.img { | ||
| 109 | + display: block; | ||
| 110 | + width: 100%; | ||
| 111 | + height: 100%; | ||
| 112 | +} | ||
| 113 | + | ||
| 114 | +.desc-container { | ||
| 115 | + padding: 20rpx; | ||
| 116 | +} | ||
| 117 | + | ||
| 118 | + | ||
| 119 | + | ||
| 120 | +.rmb::before { | ||
| 121 | + content: '¥'; | ||
| 122 | +} | ||
| 123 | + | ||
| 124 | +.date { | ||
| 125 | + color: #a4a4a4; | ||
| 126 | + font-size: 24rpx; | ||
| 127 | +} | ||
| 128 | + | ||
| 129 | +.btn-container { | ||
| 130 | + display: flex; | ||
| 131 | + justify-content: space-around; | ||
| 132 | + font-size: 26rpx; | ||
| 133 | +} | ||
| 134 | + | ||
| 135 | +.btn { | ||
| 136 | + padding: 20rpx; | ||
| 137 | + flex: 1; | ||
| 138 | + text-align: center; | ||
| 139 | +} | ||
| 140 | + | ||
| 141 | +.btn.exchange { | ||
| 142 | + background-color: #FF6768; | ||
| 143 | + color: white; | ||
| 144 | +} | ||
| 145 | + | ||
| 146 | +.btn.buy { | ||
| 147 | + background-color: #FACAD6; | ||
| 148 | + color: #FF6768; | ||
| 149 | +} | ||
| 150 | + | ||
| 151 | +.noMore { | ||
| 152 | + padding: 20rpx; | ||
| 153 | + color: #bbb; | ||
| 154 | + text-align: center; | ||
| 155 | + font-size: 22rpx; | ||
| 156 | +} | ||
| 0 | \ No newline at end of file | 157 | \ No newline at end of file |
utils/filter.wxs
| @@ -118,6 +118,15 @@ var filters = { | @@ -118,6 +118,15 @@ var filters = { | ||
| 118 | }, | 118 | }, |
| 119 | 119 | ||
| 120 | 120 | ||
| 121 | + in_arr: function(index, arr) { | ||
| 122 | + if(arr.indexOf(index) != -1) { | ||
| 123 | + return true; | ||
| 124 | + } else { | ||
| 125 | + return false; | ||
| 126 | + }; | ||
| 127 | + }, | ||
| 128 | + | ||
| 129 | + | ||
| 121 | 130 | ||
| 122 | 131 | ||
| 123 | }; | 132 | }; |
| @@ -131,4 +140,5 @@ module.exports = { | @@ -131,4 +140,5 @@ module.exports = { | ||
| 131 | show_gui_ge: filters.show_gui_ge, | 140 | show_gui_ge: filters.show_gui_ge, |
| 132 | show_default: filters.show_default, | 141 | show_default: filters.show_default, |
| 133 | status: filters.status, | 142 | status: filters.status, |
| 143 | + in_arr: filters.in_arr, | ||
| 134 | } | 144 | } |
| 135 | \ No newline at end of file | 145 | \ No newline at end of file |