diff --git a/app/app.json b/app/app.json index d848aff..8373225 100644 --- a/app/app.json +++ b/app/app.json @@ -1,15 +1,16 @@ { "pages": [ - "pages/order/list", - "pages/order/show", - "pages/order/review", "pages/index/index", - "pages/index/search", - "pages/index/category", + "pages/order/show", + "pages/order/quasi", + "pages/mine/coupon", "pages/shop/show", "pages/mine/mine", + "pages/order/list", + "pages/order/review", + "pages/index/search", + "pages/index/category", "pages/address/select", - "pages/order/quasi", "pages/address/list", "pages/index/address", "pages/address/add", diff --git a/app/images/icon_hongbao2.png b/app/images/icon_hongbao2.png new file mode 100644 index 0000000..e521bd5 Binary files /dev/null and b/app/images/icon_hongbao2.png differ diff --git a/app/pages/login/login.js b/app/pages/login/login.js index 7c4445e..85d309b 100644 --- a/app/pages/login/login.js +++ b/app/pages/login/login.js @@ -7,7 +7,7 @@ var initCount = 60 Page({ data: { codeLabel: '获取验证码', - phone: '13000000004', + phone: '', }, onLoad: function (options) { // 页面初始化 options为页面跳转所带来的参数 diff --git a/app/pages/mine/coupon.js b/app/pages/mine/coupon.js new file mode 100644 index 0000000..03733b6 --- /dev/null +++ b/app/pages/mine/coupon.js @@ -0,0 +1,139 @@ +// pages/mine/coupon.js +import { + getShareUserList +} from '../../utils/apis' + +import { + getPrevPage +} from '../../utils/util' + +Page({ + + /** + * 页面的初始数据 + */ + data: { + page: 0, + hasMore: true, + loading: false, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.id = options.id || 30 + this.callback = options.callback || 'callback' + this.setData({ + selectedId: this.id + }) + this.loadData() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom(e) { + var { + hasMore, loading + } = this.data + if (hasMore && !loading) { + this.loadData() + } + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + loadData() { + var that = this + var { + loading, page + } = this.data + if (loading) { + return + } + this.setData({ + loading: true + }) + getShareUserList({ + page, + success(data) { + var {list} = that.data + var {list: list2, has_more, page} = data + list2 = list2.map(item => { + item['deadline_time_format'] = item.deadline_time.split(' ')[0] + return item + }) + that.setData({ + loading: false, + list: list ? list.concat(list2) : list2, + hasMore: has_more, + page: page + 1 + }) + } + }) + }, + onItemTap(e) { + var {id} = e.currentTarget + var {selectedId} = this.data + if (id == selectedId) { + return; + } + var callback = getPrevPage()[this.callback] + callback && callback(id) + wx.navigateBack() + } +}) \ No newline at end of file diff --git a/app/pages/mine/coupon.json b/app/pages/mine/coupon.json new file mode 100644 index 0000000..b56266c --- /dev/null +++ b/app/pages/mine/coupon.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "我的红包" +} \ No newline at end of file diff --git a/app/pages/mine/coupon.wxml b/app/pages/mine/coupon.wxml new file mode 100644 index 0000000..1864378 --- /dev/null +++ b/app/pages/mine/coupon.wxml @@ -0,0 +1,28 @@ + + + + + + + + + {{item.name}} + + + 有效期至 {{item.deadline_time_format}} + + + + + ¥ + {{item.money}} + + + + + 仅限{{item.phone}}使用 + + + + + \ No newline at end of file diff --git a/app/pages/mine/coupon.wxss b/app/pages/mine/coupon.wxss new file mode 100644 index 0000000..70262a6 --- /dev/null +++ b/app/pages/mine/coupon.wxss @@ -0,0 +1,53 @@ +/* pages/mine/coupon.wxss */ +@import '/templates/load-more.wxss'; + +.coupon-list { + padding: 0 15px; +} + +.coupon-item { + position: relative; + margin-top: 10px; + padding: 0 15px; + background-color: #fff; + border-radius: 5px; +} + +.coupon-item__bd { + padding: 15px 0 10px 0; +} + +.coupon-item__name { + color: #ff5801; +} + +.coupon-item__deadline { + color: #999; + font-size: 0.8em; +} + +.coupon-item__ft { + padding: 5px 0; + font-size: 0.8em; + color: #999; + border-top: 1rpx dashed #e8e8e8; +} + +.coupon-item__money { + padding: 5px 10px; + color: #ff5801; + font-size: 1.2em; + line-height: 1; +} + +.coupon-item__money-num { + font-size: 2em; +} + +.coupon-item__selected-img { + position: absolute; + left: 0; + top: 0; + width: 40px; + height: 39px; +} \ No newline at end of file diff --git a/app/pages/mine/mine.wxml b/app/pages/mine/mine.wxml index 41b8e6d..4a4b5ca 100644 --- a/app/pages/mine/mine.wxml +++ b/app/pages/mine/mine.wxml @@ -11,16 +11,23 @@ {{loginInfo.phone}} - - + + 收货地址 + + 我的红包 + + + + 客服热线 400-926-2108 +