Skip to content

Commit

Permalink
增加“我的”功能菜单
Browse files Browse the repository at this point in the history
  • Loading branch information
gooking committed Aug 19, 2017
1 parent 886bd03 commit be1b366
Show file tree
Hide file tree
Showing 16 changed files with 228 additions and 15 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<img src="https://cdn.it120.cc/apifactory/2017/08/17/f3f7ddf9a47367fde19abb6db4c21619.png" width="200px">
<img src="https://cdn.it120.cc/apifactory/2017/08/17/413c6123f9c83e664587f1c0971ab52d.jpg" width="200px">
<img src="https://cdn.it120.cc/apifactory/2017/08/18/83bfd6a625fe50477bbeac65e9f1d0a7.jpg" width="200px">
<img src="https://cdn.it120.cc/apifactory/2017/08/18/742dba8ffd6e3ab0b6db92e452b6f4e4.png" width="200px">
</p>

## 使用说明
Expand Down
5 changes: 3 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ App({
})
}
})
},
},
globalData:{
userInfo:null,
subDomain: "mall"
subDomain: "mall",
version: "1.4.0"
}
})
15 changes: 9 additions & 6 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"pages/address-add/index",
"pages/order-list/index",
"pages/order-details/index",
"pages/wuliu/index"
"pages/wuliu/index",
"pages/mycoupons/index",
"pages/my/index"
],
"window":{
"backgroundTextStyle":"light",
Expand All @@ -32,11 +34,12 @@
"iconPath": "images/nav/cart-off.png",
"selectedIconPath": "images/nav/cart-on.png",
"text": "购物车"
}, {
"pagePath": "pages/order-list/index",
"iconPath": "images/nav/order-off.png",
"selectedIconPath": "images/nav/order-on.png",
"text": "订单"
},
{
"pagePath": "pages/my/index",
"iconPath": "images/nav/my-off.png",
"selectedIconPath": "images/nav/my-on.png",
"text": "我的"
}]
}
}
Binary file added images/nav/my-off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/nav/my-on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions pages/index/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
<view class="coupons" hidden="{{hasNoCoupons}}">
<scroll-view class="coupons-scroll" scroll-x="true">
<view class="coupons-item" wx:for-items="{{coupons}}" wx:for-index="idx" bindtap="gitCoupon" data-id="{{item.id}}">
<view style="font-size: 30rpx"> ¥ {{item.moneyMax}}元 </view>
<view> 本店满 {{item.moneyHreshold}} 元使用 </view>
<view style="font-size: 35rpx"> ¥ {{item.moneyMax}}元 </view>
<view> {{item.name}} </view>
<view> 满 {{item.moneyHreshold}} 元使用 </view>
<view wx:if="{{item.dateEndType == 0}}"> {{item.dateEnd}} 前有效 </view>
<view wx:if="{{item.dateEndType == 1}}"> 领取 {{item.dateEndDays}} 天内有效 </view>
</view>
Expand Down
8 changes: 4 additions & 4 deletions pages/index/index.wxss
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,19 @@ swiper-item image {
.coupons{
margin-top:10rpx;
width: 100%;
height: 140rpx;
height: 180rpx;
overflow: hidden;
}
.coupons-scroll{
display: flex;
white-space: nowrap;
height: 140rpx;
height: 180rpx;
width: 100%;
background-color: #fff;
}
.coupons-item{
width:240rpx;
height: 120rpx;
width:300rpx;
height: 180rpx;
margin: 10rpx;
padding-top: 20rpx;
padding-left: 15rpx;
Expand Down
34 changes: 34 additions & 0 deletions pages/my/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const app = getApp()

Page({
data: {
userInfo: {},
},
onLoad() {
this.getUserInfo();
this.setData({
version: app.globalData.version
});
},
getUserInfo: function (cb) {
var that = this
wx.login({
success: function () {
wx.getUserInfo({
success: function (res) {
that.setData({
userInfo: res.userInfo
});
}
})
}
})
},
aboutUs : function () {
wx.showModal({
title: '关于我们',
content: '本系统基于开源小程序商城系统 https://github.com/EastWorld/wechat-app-mall 搭建,祝大家使用愉快!',
showCancel:false
})
}
})
3 changes: 3 additions & 0 deletions pages/my/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"navigationBarTitleText": "我的"
}
24 changes: 24 additions & 0 deletions pages/my/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<view class="container">
<view bindtap="bindViewTap" class="userinfo">
<image class="userinfo-avatar" src="{{ userInfo.avatarUrl }}" background-size="cover"></image>
<text class="userinfo-nickname">{{ userInfo.nickName }}</text>
</view>
<view style="height:20rpx;background: #eee;width:100%;"></view>
<view class="my-item">
<navigator url="/pages/order-list/index" hover-class="navigator-hover">我的订单</navigator>
</view>
<view class="my-item">
<navigator url="/pages/select-address/index" hover-class="navigator-hover">我的收货地址</navigator>
</view>
<view class="my-item" style="border:none;">
<navigator url="/pages/mycoupons/index" hover-class="navigator-hover">我的优惠券</navigator>
</view>
<view style="height:20rpx;background: #eee;width:100%;"></view>
<view class="about" bindtap="aboutUs">
关于我们
</view>

<view style="height:20rpx;background: #eee;width:100%;"></view>
<view class="version">Powered by EastWorld v {{version}}</view>
<view style="height:20rpx;background: #eee;width:100%;"></view>
</view>
51 changes: 51 additions & 0 deletions pages/my/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
.userinfo {
display: flex;
flex-direction: column;
padding: 50rpx 0;
align-items: center;
background: #e85654;
width: 750rpx;
}

.userinfo-avatar {
width: 160rpx;
height: 160rpx;
margin: 20rpx;
border-radius: 50%;
}

.userinfo-nickname {
margin-top: 20rpx;
color: #FFF;
}


.version {
width:100%;
height: 40rpx;
line-height: 40rpx;
font-size: 24rpx;
text-align: center;
padding: 40rpx;
}

.my-item{
width: 100%;
background: url(https://cdn.it120.cc/images/weappshop/arrow-right.png) no-repeat 750rpx center;
background-size: 16rpx auto,750rpx auto;
margin: 20rpx 0;
border-bottom: 1px solid #eee;
height: 100rpx;
line-height: 100rpx;
padding-left: 100rpx;
}

.about{
width: 100%;
background: url(https://cdn.it120.cc/images/weappshop/arrow-right.png) no-repeat 750rpx center;
background-size: 16rpx auto,750rpx auto;
margin: 20rpx 0;
height: 80rpx;
line-height: 80rpx;
padding-left: 100rpx;
}
39 changes: 39 additions & 0 deletions pages/mycoupons/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//index.js
//获取应用实例
var app = getApp()
Page({
data: {
coupons:[]
},
onLoad: function () {
},
onShow : function () {
this.getMyCoupons();
},
getMyCoupons: function () {
var that = this;
wx.request({
url: 'https://api.it120.cc/' + app.globalData.subDomain + '/discounts/my',
data: {
token: app.globalData.token,
status: 0
},
success: function (res) {
if (res.data.code == 0) {
var coupons = res.data.data;
if (coupons.length > 0) {
that.setData({
coupons: coupons
});
}
}
}
})
},
goBuy:function(){
wx.reLaunch({
url: '/pages/index/index'
})
}

})
3 changes: 3 additions & 0 deletions pages/mycoupons/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"navigationBarTitleText": "我的优惠券"
}
15 changes: 15 additions & 0 deletions pages/mycoupons/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<view class="container">
<view class="coupons-list">
<view class="coupons-item" wx:for-items="{{coupons}}" wx:for-index="idx" bindtap="gitCoupon" data-id="{{item.id}}">
<view style="font-size: 50rpx"> ¥ {{item.money}}元 </view>
<view> {{item.name}} </view>
<view> 满 {{item.moneyHreshold}} 元使用 </view>
<view> {{item.dateEnd}} 前有效 </view>
</view>
</view>
<view style="height:100rpx;background-color:#fff;width:100%;"></view>
<view class="bottom-box">
<view class="add-btn" bindtap="goBuy">立即前往下单</view>
</view>

</view>
38 changes: 38 additions & 0 deletions pages/mycoupons/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.container {
background-color:#F2f2f2;
}
.coupons-list{
width: 100%;
background-color: #fff;
margin-top: 20rpx;
}

.bottom-box{
position: absolute;
width: 100%;
bottom: 0;
font-size:28rpx;
color:#000000;
border-top: 1rpx solid #eee;
height:100rpx;
line-height: 100rpx;
background-color: #fff;
background: url(https://cdn.it120.cc/images/weappshop/arrow-right.png) no-repeat 705rpx center;
background-size: 15rpx auto;
}
.bottom-box .add-btn{
margin-left: 30rpx;
padding-left: 70rpx;
background: url(https://cdn.it120.cc/images/weappshop/add-addr.png) no-repeat left center;
background-size: 40rpx auto;
}
.coupons-item{
width:630rpx;
height: 180rpx;
margin: 10rpx;
padding: 50rpx;
background-color: #f1a83b;
font-size: 30rpx;
line-height: 50rpx;
color: #fff;
}
2 changes: 1 addition & 1 deletion pages/to-pay-order/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Page({
}

// 下单成功,跳转到订单管理界面
wx.reLaunch({
wx.redirectTo({
url: "/pages/order-list/index"
});
}
Expand Down

0 comments on commit be1b366

Please sign in to comment.