Commit 171ae531 by 汪睦雄

修改了我的模块

parent 83d042ee
...@@ -83,7 +83,6 @@ Page({ ...@@ -83,7 +83,6 @@ Page({
// 商家合作 // 商家合作
gotoShopJoin: function (event) { gotoShopJoin: function (event) {
let _url = ""
wx.navigateTo({ wx.navigateTo({
url: '/pages/webview/index?url=' + Config.shopJoinPath, url: '/pages/webview/index?url=' + Config.shopJoinPath,
}) })
......

197 KB | W: | H:

319 KB | W: | H:

images/background-vip.png
images/background-vip.png
images/background-vip.png
images/background-vip.png
  • 2-up
  • Swipe
  • Onion skin
// pages/me/collection/index.js // pages/me/collection/index.js
Page({ import api from '../../../utils/Api.js'
import Wx from '../../../utils/Wx.js'
import Schedule from '../../../utils/Schedule.js'
const {
$Toast
} = require('../../../iview/base/index');
Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
projects: [],
currentPage: 1,
loading: true,
hasMore: true
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.getListData()
},
/**
* 加载
*/
getListData: function (callback) {
const p = this.data.currentPage
let params = {
p: p
}
// 请求数据接口
api.me.collections(params).then(res => {
if (res.code) {
this.setData({
hasMore: false,
loading: false,
currentPage: 2
})
$Toast({
content: res.msg,
type: 'error'
})
} else {
let _projects = this.data.projects
this.setData({
projects: _projects.concat(res.data),
loading: false,
hasMore: res.data && res.data.length > 0 ? true : false,
currentPage: res.data && res.data.length > 0 ? p : (p - 1)
})
typeof callback == "function" && callback()
}
})
}, },
/** /**
...@@ -47,14 +89,39 @@ Page({ ...@@ -47,14 +89,39 @@ Page({
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function () {
this.setData({
projects: [],
loading: true,
hasMore: true,
currentPage: 1
})
wx.showNavigationBarLoading()
wx.showLoading({
title: '加载中...',
})
new Schedule().task(this.getListData).delay(1600).task(() => {
wx.hideNavigationBarLoading()
wx.stopPullDownRefresh()
wx.hideLoading()
})
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function () {
let that = this
if (that.data.loading || !that.data.hasMore) {
return;
} else {
let page = that.data.currentPage + 1
new Schedule().task(() => {
that.setData({
loading: true,
currentPage: page
})
}).delay(1000).task(that.getListData)
}
}, },
/** /**
......
{} {
\ No newline at end of file "navigationBarTitleText": "我的收藏",
"enablePullDownRefresh": true,
"usingComponents": {
"project-item": "/components/project-item/index",
"more": "/components/more/index",
"i-toast": "/iview/toast/index"
}
}
\ No newline at end of file
<!--pages/me/collection/index.wxml--> <!--pages/me/collection/index.wxml-->
<text>pages/me/collection/index.wxml</text>
<view class="page-wrapper">
<view class="projects-wrapper">
<project-item wx:for="{{projects}}" wx:for-index="idx" wx:for-item="item" wx:key="n.id" project-item="{{item}}" />
</view>
<i-toast id="toast" />
</view>
<more hasMore="{{hasMore}}" loading="{{loading}}" page="{{currentPage}}" />
\ No newline at end of file
/* pages/me/collection/index.wxss */ /* pages/me/collection/index.wxss */
.page-wrapper{
background: white;
}
\ No newline at end of file
...@@ -54,7 +54,6 @@ Page({ ...@@ -54,7 +54,6 @@ Page({
// 商家合作 // 商家合作
gotoShopJoin: function (event) { gotoShopJoin: function (event) {
let _url = ""
wx.navigateTo({ wx.navigateTo({
url: '/pages/webview/index?url=' + Config.shopJoinPath, url: '/pages/webview/index?url=' + Config.shopJoinPath,
}) })
......
...@@ -40,14 +40,16 @@ ...@@ -40,14 +40,16 @@
</i-cell-group> </i-cell-group>
<i-cell-group i-class='vip'> <i-cell-group i-class='vip'>
<i-cell title="VIP会员" is-link url="/pages/me/vip/index"> <i-cell title="VIP会员" is-link url="/pages/me/vip/index?is_vip={{user.is_vip}}&vip_endtime={{user.vip_endtime}}">
<text slot="footer" class='text-gray'>{{user.vip_endtime==null?'':user.vip_endtime}}</text> <text slot="footer" class='text-gray'>{{user.vip_endtime==null?'':user.vip_endtime}}</text>
</i-cell> </i-cell>
<i-cell title="我的收藏" is-link url="/pages/collection/index"></i-cell> <i-cell title="我的收藏" is-link url="/pages/me/collection/index"></i-cell>
</i-cell-group> </i-cell-group>
<i-cell-group> <i-cell-group>
<i-cell title="商家合作" is-link url="/pages/dashboard/index"></i-cell> <i-cell title="商家合作" is-link catchtap="gotoShopJoin"></i-cell>
<i-cell title="官方客服" is-link url="/pages/dashboard/index"></i-cell> <i-cell is-link>
<button open-type='contact' class='my-btn-contact'>官方客服</button>
</i-cell>
</i-cell-group> </i-cell-group>
</view> </view>
\ No newline at end of file
...@@ -89,3 +89,17 @@ page { ...@@ -89,3 +89,17 @@ page {
.vip { .vip {
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.my-btn-contact{
background-color: transparent;
font-size: 14px;
margin-left: 0;
line-height: 1.75;
width: 100%;
text-align: left;
border: none;
padding-left: 0;
}
.my-btn-contact::after{
display: none;
}
\ No newline at end of file
// pages/me/vip/index.js // pages/me/vip/index.js
Page({
Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
value1: 1, value1: 1,
value2: 0.1 value2: 0.1,
is_vip: 0,
vip_endtime: null,
vip_price: 49.9
}, },
handleChange1({ detail }) { handleChange1({ detail }) {
...@@ -25,7 +29,27 @@ Page({ ...@@ -25,7 +29,27 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
let is_vip = options.is_vip
let vip_endtime = options.vip_endtime
this.setData({
is_vip: is_vip,
vip_endtime: vip_endtime
})
},
// 获取VIP单价
getVipPrice: function () {
api.me.vipPrice().then(res => {
if (!res.code) {
this.setData({
vip_price: res.price
})
}else{
wx.showToast({
title: res.msg
})
}
})
}, },
/** /**
......
<!--pages/me/vip/index.wxml--> <!--pages/me/vip/index.wxml-->
<wxs src="../../../pages/common.wxs" module="common"></wxs>
<view class='card-box'> <view class='card-box'>
<image src='/images/background-vip.png'></image> <image src="/images/background-{{is_vip==1?'':'no'}}vip.png"></image>
<text>2018-09-27</text> <text> {{is_vip==1?vip_endtime:''}}</text>
</view> </view>
<view class='calculation-box'> <view class='calculation-box'>
<i-row class='height'> <i-row class='height'>
<i-col span="6" offset='1' i-class="col-class">续费会员</i-col> <i-col span="6" offset='1' i-class="col-class">{{is_vip==1?'续费':'购买'}}会员</i-col>
<i-col span="6" i-class="col-class color-orange">¥ 49.00</i-col> <i-col span="6" i-class="col-class color-orange">¥ {{vip_price}}</i-col>
<i-col span="9" offset='1' i-class="col-class"> <i-col span="9" offset='1' i-class="col-class">
<i-input-number value="{{ value1 }}" min="0" max="100" bindchange="handleChange1" /> <i-input-number value="{{ value1 }}" min="1" max="10" bindchange="handleChange1" />
</i-col> </i-col>
</i-row> </i-row>
</view> </view>
<view class='vip_intro'> <view class='vip_intro'>
会员卡说明:用户购买一次会员卡后,增加一年的会员时限,多次购买则在先有的基础上延长时间,单词以1年为标准。 会员卡说明:用户购买一次会员卡后,增加一年的会员时限,多次购买则在先有的基础上延长时间,单词以1年为标准。
</view> </view>
<i-row class='height'> <i-row class='height'>
<i-col span="20" offset='2' i-class="col-class"> <i-col span="20" offset='2' i-class="col-class">
<i-button bind:click="handleClick" type="primary" shape="circle" size="small">立即续费</i-button> <i-button bind:click="handleClick" type="primary" shape="circle" size="small">立即{{is_vip==1?'续费':'购买'}} ¥{{common.numFixed(vip_price*value1, 2)}}</i-button>
</i-col> </i-col>
</i-row> </i-row>
\ No newline at end of file \ No newline at end of file
...@@ -36,6 +36,7 @@ page { ...@@ -36,6 +36,7 @@ page {
font-size: 25rpx; font-size: 25rpx;
color: #969696; color: #969696;
margin-bottom: 30rpx; margin-bottom: 30rpx;
line-height: 45rpx;
} }
.height { .height {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment