Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wxapp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
亲子游项目
wxapp
Commits
05984c50
Commit
05984c50
authored
Oct 07, 2018
by
汪睦雄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
123
parent
bf04ed01
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
136 additions
and
66 deletions
+136
-66
components/banners/index.js
+6
-13
components/navs/index.js
+12
-12
pages/detail/enroll/index.js
+53
-2
pages/index/index.js
+2
-0
pages/me/index.wxml
+1
-1
pages/me/vip/index.js
+54
-32
pages/me/vip/index.wxml
+5
-4
utils/Api.js
+2
-2
utils/Request.js
+1
-0
No files found.
components/banners/index.js
View file @
05984c50
...
...
@@ -40,23 +40,16 @@ Component({
*/
methods
:
{
_tapBanner
(
event
)
{
let
oid
=
event
.
currentTarget
.
dataset
.
oid
let
type
=
event
.
currentTarget
.
dataset
.
type
let
url
=
event
.
currentTarget
.
dataset
.
url
let
type_text
=
event
.
currentTarget
.
dataset
.
txt
if
(
type
==
1
)
{
let
type_text
=
'网页详情'
if
(
type
==
1
&&
Util
.
isString
(
url
))
{
// 小程序页面
wx
.
navigateTo
({
url
:
'/pages/course/single/index?id='
+
oid
,
url
:
url
,
})
}
else
if
(
type
==
2
)
{
wx
.
navigateTo
({
url
:
'/pages/course/multiple/index?id='
+
oid
,
})
}
else
if
(
type
==
3
)
{
wx
.
navigateTo
({
url
:
'/pages/courses/coach/index?id='
+
oid
,
})
}
else
if
(
type
==
4
&&
Util
.
isString
(
url
))
{
}
else
if
(
type
==
2
&&
Util
.
isString
(
url
))
{
// 网页链接
wx
.
navigateTo
({
url
:
'/pages/webview/index?url='
+
url
+
'&t='
+
type_text
,
})
...
...
components/navs/index.js
View file @
05984c50
...
...
@@ -12,61 +12,61 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad
:
function
(
options
)
{
onLoad
:
function
(
options
)
{
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady
:
function
()
{
onReady
:
function
()
{
},
/**
* 生命周期函数--监听页面显示
*/
onShow
:
function
()
{
onShow
:
function
()
{
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide
:
function
()
{
onHide
:
function
()
{
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload
:
function
()
{
onUnload
:
function
()
{
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh
:
function
()
{
onPullDownRefresh
:
function
()
{
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom
:
function
()
{
onReachBottom
:
function
()
{
},
/**
* 用户点击右上角分享
*/
onShareAppMessage
:
function
()
{
onShareAppMessage
:
function
()
{
},
// 分类点击
catalogClick
:
function
(
event
)
{
catalogClick
:
function
(
event
)
{
let
_catalog
=
event
.
currentTarget
.
dataset
.
catalog
let
_ptitle
=
event
.
currentTarget
.
dataset
.
name
wx
.
navigateTo
({
...
...
@@ -75,16 +75,16 @@ Page({
},
// 美行攻略
gotoGuides
:
function
(
event
)
{
gotoGuides
:
function
(
event
)
{
wx
.
navigateTo
({
url
:
'/pages/guide/index'
,
})
},
// 商家合作
gotoShopJoin
:
function
(
event
)
{
gotoShopJoin
:
function
(
event
)
{
wx
.
navigateTo
({
url
:
'/pages/webview/index?url='
+
Config
.
shopJoinPath
,
url
:
'/pages/webview/index?url='
+
Config
.
shopJoinPath
+
'&t=商家合作'
,
})
}
...
...
pages/detail/enroll/index.js
View file @
05984c50
...
...
@@ -23,7 +23,9 @@ Page({
adultNum
:
0
,
childrenNum
:
0
,
childrenAge
:
0
,
remark
:
''
remark
:
''
,
// 订单
order
:
{}
},
/**
* 生命周期函数--监听页面加载
...
...
@@ -144,6 +146,7 @@ Page({
},
handleSubmit
:
function
()
{
let
that
=
this
if
(
!
this
.
data
.
familyNum
||
!
this
.
data
.
nickname
||
!
this
.
data
.
phone
)
{
$Toast
({
content
:
'请完善必要信息'
,
...
...
@@ -173,8 +176,55 @@ Page({
content
:
res
.
msg
,
type
:
'error'
});
}
else
{
console
.
log
(
"获取支付参数"
,
res
)
that
.
setData
({
order
:
res
.
data
})
// 发起微信支付
wx
.
requestPayment
({
timeStamp
:
''
+
res
.
result
.
timeStamp
,
nonceStr
:
''
+
res
.
result
.
nonceStr
,
package
:
''
+
res
.
result
.
package
,
signType
:
''
+
res
.
result
.
signType
,
paySign
:
''
+
res
.
result
.
paySign
,
success
:
function
(
ret
)
{
console
.
log
(
ret
)
if
(
ret
.
errMsg
===
'requestPayment:ok'
)
{
that
.
setOrderPaid
(
that
.
data
.
order
.
order_id
,
function
(
res
)
{
// 支付同步回调结果
console
.
log
(
"发送模版消息"
,
res
)
// 跳转到订单页面
wx
.
showToast
({
title
:
'支付成功'
,
})
setTimeout
(()
=>
{
wx
.
navigateTo
({
url
:
'/pages/me/order/index?order=1'
,
})
},
800
)
})
}
else
{
wx
.
showToast
({
title
:
ret
.
errMsg
,
})
}
}
})
}
console
.
log
(
res
)
})
},
/**
* 同步支付结果回调:发送模版消息
*/
setOrderPaid
(
id
,
callback
)
{
let
params
=
{
order_id
:
id
}
api
.
me
.
vipOrderSendTemplate
(
params
).
then
(
res
=>
{
typeof
callback
==
"function"
&&
callback
(
res
)
})
}
})
\ No newline at end of file
pages/index/index.js
View file @
05984c50
...
...
@@ -109,6 +109,7 @@ Page({
url
:
'/pages/prjlist/list?type='
+
_type
+
'&ptitle='
+
_ptitle
,
})
},
// 更多:按分类筛选
gotoSearchProjects
:
function
(
event
)
{
let
_catalog
=
event
.
target
.
dataset
.
catalog
...
...
@@ -118,6 +119,7 @@ Page({
})
},
// 跳转详情页
handleProjectDetail
:
function
(
event
)
{
const
id
=
event
.
currentTarget
.
dataset
.
id
wx
.
navigateTo
({
...
...
pages/me/index.wxml
View file @
05984c50
...
...
@@ -41,7 +41,7 @@
<i-cell-group i-class='vip'>
<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
_str
}}</text>
</i-cell>
<i-cell title="我的收藏" is-link url="/pages/me/collection/index"></i-cell>
</i-cell-group>
...
...
pages/me/vip/index.js
View file @
05984c50
...
...
@@ -10,20 +10,23 @@ Page({
value1
:
1
,
value2
:
0.1
,
is_vip
:
0
,
vip_endtime
:
null
,
vip_price
:
49.9
,
order
:
{}
order
:
{},
user
:
{}
},
handleChange1
({
detail
})
{
handleChange1
({
detail
})
{
this
.
setData
({
value1
:
detail
.
value
})
},
handleChange2
({
detail
})
{
handleChange2
({
detail
})
{
this
.
setData
({
value2
:
detail
.
value
})
...
...
@@ -32,24 +35,32 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad
:
function
(
options
)
{
let
userInfo
=
app
.
globalData
.
userInfo
let
is_vip
=
userInfo
.
is_vip
let
vip_endtime
=
userInfo
.
vip_endtime
this
.
setData
({
is_vip
:
is_vip
,
vip_endtime
:
vip_endtime
onLoad
:
function
(
options
)
{
this
.
getUserInfo
()
this
.
getVipPrice
()
},
// 获取个人资料
getUserInfo
:
function
()
{
api
.
me
.
info
().
then
(
res
=>
{
if
(
!
res
.
code
)
{
app
.
globalData
.
userInfo
=
res
.
data
// 渲染数据
this
.
setData
({
user
:
res
.
data
})
}
})
},
// 获取VIP单价
getVipPrice
:
function
()
{
getVipPrice
:
function
()
{
api
.
me
.
vipPrice
().
then
(
res
=>
{
if
(
!
res
.
code
)
{
this
.
setData
({
vip_price
:
res
.
price
})
}
else
{
}
else
{
wx
.
showToast
({
title
:
res
.
msg
})
...
...
@@ -60,56 +71,56 @@ Page({
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady
:
function
()
{
onReady
:
function
()
{
},
/**
* 生命周期函数--监听页面显示
*/
onShow
:
function
()
{
onShow
:
function
()
{
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide
:
function
()
{
onHide
:
function
()
{
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload
:
function
()
{
onUnload
:
function
()
{
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh
:
function
()
{
onPullDownRefresh
:
function
()
{
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom
:
function
()
{
onReachBottom
:
function
()
{
},
/**
* 用户点击右上角分享
*/
onShareAppMessage
:
function
()
{
onShareAppMessage
:
function
()
{
},
/**
* 立即购买/续费
*/
handleClick
:
function
()
{
handleClick
:
function
()
{
let
that
=
this
let
year
=
this
.
data
.
value1
let
params
=
{
...
...
@@ -118,7 +129,6 @@ Page({
// 获取支付参数
api
.
me
.
vipOrder
(
params
).
then
(
res
=>
{
if
(
res
.
code
==
0
)
{
console
.
log
(
"获取支付参数"
,
res
)
that
.
setData
({
order
:
res
.
data
})
...
...
@@ -129,30 +139,41 @@ Page({
package
:
''
+
res
.
result
.
package
,
signType
:
''
+
res
.
result
.
signType
,
paySign
:
''
+
res
.
result
.
paySign
,
success
:
function
(
ret
)
{
that
.
setOrderPaid
(
that
.
data
.
order
.
order_id
,
function
(
res
)
{
// 支付同步回调结果
console
.
log
(
res
)
})
success
:
function
(
ret
)
{
console
.
log
(
ret
)
if
(
ret
.
errMsg
===
'requestPayment:ok'
)
{
that
.
setOrderPaid
(
that
.
data
.
order
.
order_id
,
function
(
res
)
{
// 支付同步回调结果
console
.
log
(
"发送模版消息"
,
res
)
// 刷新当前页面
setTimeout
(()
=>
{
that
.
getUserInfo
()
},
500
)
})
}
else
{
wx
.
showToast
({
title
:
ret
.
errMsg
,
})
}
}
})
}
else
{
}
else
{
wx
.
showToast
({
title
:
res
.
msg
,
})
}
})
},
/**
* 同步支付结果回调:重置订单状态
*/
setOrderPaid
(
id
,
callback
)
{
let
that
=
this
let
params
=
{
order_id
:
id
}
api
.
me
.
vipOrder
Paied
(
params
).
then
(
res
=>
{
typeof
callback
==
"function"
&&
callback
()
api
.
me
.
vipOrder
SendTemplate
(
params
).
then
(
res
=>
{
typeof
callback
==
"function"
&&
callback
(
res
)
})
}
})
\ No newline at end of file
pages/me/vip/index.wxml
View file @
05984c50
...
...
@@ -2,13 +2,13 @@
<wxs src="../../../pages/common.wxs" module="common"></wxs>
<view class='card-box'>
<image src="/images/background-{{is_vip==1?'':'no'}}vip.png"></image>
<text> {{
is_vip==1?
vip_endtime:''}}</text>
<image src="/images/background-{{
user.
is_vip==1?'':'no'}}vip.png"></image>
<text> {{
user.is_vip==1?user.
vip_endtime:''}}</text>
</view>
<view class='calculation-box'>
<i-row class='height'>
<i-col span="6" offset='1' i-class="col-class">{{is_vip==1?'续费':'购买'}}会员</i-col>
<i-col span="6" offset='1' i-class="col-class">{{
user.
is_vip==1?'续费':'购买'}}会员</i-col>
<i-col span="4" i-class="col-class color-orange">¥ {{vip_price}}</i-col>
<i-col span="12" offset='1' i-class="col-class">
<i-input-number i-class="vip_num_input" value="{{ value1 }}" min="1" max="10" bindchange="handleChange1" />
...
...
@@ -22,6 +22,6 @@
<i-row class='height'>
<i-col span="20" offset='2' i-class="col-class">
<i-button bind:click="handleClick" type="primary" shape="circle" size="small">立即{{is_vip==1?'续费':'购买'}} ¥{{common.numFixed(vip_price*value1, 2)}}</i-button>
<i-button bind:click="handleClick" type="primary" shape="circle" size="small">立即{{
user.
is_vip==1?'续费':'购买'}} ¥{{common.numFixed(vip_price*value1, 2)}}</i-button>
</i-col>
</i-row>
\ No newline at end of file
utils/Api.js
View file @
05984c50
...
...
@@ -61,8 +61,8 @@ export const me = {
vipOrder
:
params
=>
{
return
req
.
post
(
'order/vipOrder'
,
params
).
then
(
res
=>
res
.
data
)
},
vipOrder
Paied
:
params
=>
{
return
req
.
post
(
'order/
vipOrderPaied
'
,
params
).
then
(
res
=>
res
.
data
)
vipOrder
SendTemplate
:
params
=>
{
return
req
.
post
(
'order/
sendTemplate
'
,
params
).
then
(
res
=>
res
.
data
)
},
uploadAvatar
:
(
name
,
filePath
,
params
)
=>
{
return
req
.
upload
(
'User/uploadAvatar'
,
name
,
filePath
,
params
).
then
(
res
=>
res
.
data
)
...
...
utils/Request.js
View file @
05984c50
...
...
@@ -15,6 +15,7 @@ class Request {
interceptors
=
[]
// 构造方法
constructor
()
{
const
token
=
wx
.
getStorageSync
(
'token'
)
if
(
token
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment