Commit 7edb4a71 by 赵雅纹

plus购买

parent 6deb6a94
// component/plus/plus.js // component/plus/plus.js
const wxService = require('../../utils/wxService')
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -14,7 +16,7 @@ Component({ ...@@ -14,7 +16,7 @@ Component({
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
currentTab:0 currentTab:'999'
}, },
/** /**
...@@ -22,10 +24,56 @@ Component({ ...@@ -22,10 +24,56 @@ Component({
*/ */
methods: { methods: {
switchNav(e){ switchNav(e){
console.log(e)
this.setData({ this.setData({
currentTab: e.currentTarget.dataset.current currentTab: e.currentTarget.dataset.current,
id: e.currentTarget.dataset.id
})
},
payPlus() {
if (!this.data.id){
wx.showToast({
title: '请先选择会员卡',
icon: 'none',
mask: true
}) })
return
} }
// 下单
wx.showLoading({
title: '加载中'
})
// 获取支付参数
wxService.post(`/sale/payment/premium/buyer/preorder/wxa`, {
premiumId: this.data.id
}).then(res => {
if (!res) return false;
const { result, data } = res && res.data || res && res.result
if (result == 0) {
console.log('data', data)
wx.requestPayment(Object.assign({
success(res) {
wx.hideLoading()
// wx.showToast({
// title: '支付成功',
// icon: 'none',
// mask: true
// })
// 支付成功页面
console.log(res)
wxService.router('/subPackage/page/pages/paymentStatus/paymentStatus')
},
fail(res) {
wx.hideLoading()
wx.showToast({
title: '支付失败',
icon: 'none',
mask: true
})
}
}, data))
}
})
},
} }
}) })
...@@ -16,16 +16,17 @@ ...@@ -16,16 +16,17 @@
data-btnText="{{navItem.buttonText}}" data-btnText="{{navItem.buttonText}}"
data-id="{{navItem.id}}" data-id="{{navItem.id}}"
bindtap="switchNav" bindtap="switchNav"
style="background-image:url({{navItem.coverImgUrl}})"
> >
<view class="plus-choose"> <view class="plus-choose">
<text>每月仅¥25</text> <text>每月仅¥{{navItem.price / navItem.duration * 30}}</text>
</view> </view>
<view class="card-kinds"> <view class="card-kinds">
全年卡· 366 天 {{navItem.name}}
</view> </view>
<view class="plus-price"> <view class="plus-price">
<text class="rmb">¥</text> <text class="rmb">¥</text>
<text class="amount">100</text> <text class="amount">{{navItem.price}}</text>
</view> </view>
<view class="select-plus" wx:if="{{idx == currentTab}}"> <view class="select-plus" wx:if="{{idx == currentTab}}">
<view class="circle-radio theme-color"> <view class="circle-radio theme-color">
...@@ -36,7 +37,7 @@ ...@@ -36,7 +37,7 @@
</block> </block>
</scroll-view> </scroll-view>
<view class="pay"> <view class="pay">
<button class="btn btn-primary"> <button class="btn btn-primary" bindtap="payPlus">
<text>立即支付</text> <text>立即支付</text>
<text>¥158</text> <text>¥158</text>
</button> </button>
......
...@@ -67,6 +67,7 @@ wxService.page({ ...@@ -67,6 +67,7 @@ wxService.page({
delete data.appId delete data.appId
wx.requestPayment(Object.assign({ wx.requestPayment(Object.assign({
success(res) { success(res) {
console.log('000000',res)
wx.hideLoading() wx.hideLoading()
// 支付成功页面 // 支付成功页面
wxService.router('/subPackage/page/pages/paymentStatus/paymentStatus') wxService.router('/subPackage/page/pages/paymentStatus/paymentStatus')
......
...@@ -6,36 +6,7 @@ wxService.page({ ...@@ -6,36 +6,7 @@ wxService.page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
skuVOList:[ skuVOList:[]
{
mainImgUrl:"http://testimg3.bigaka.com/group3/M00/00/17/Cv6CBF1Z9TKAU6T1AAAG8CvHO2o415.png",
amount:0.06
},
{
mainImgUrl:"http://testimg3.bigaka.com/group3/M00/00/17/Cv6CBF1Z9TKAU6T1AAAG8CvHO2o415.png",
amount:0.06
},
{
mainImgUrl:"http://testimg3.bigaka.com/group3/M00/00/17/Cv6CBF1Z9TKAU6T1AAAG8CvHO2o415.png",
amount:0.06
},
{
mainImgUrl:"http://testimg3.bigaka.com/group3/M00/00/17/Cv6CBF1Z9TKAU6T1AAAG8CvHO2o415.png",
amount:0.06
},
{
mainImgUrl: "http://testimg3.bigaka.com/group3/M00/00/17/Cv6CBF1Z9TKAU6T1AAAG8CvHO2o415.png",
amount: 0.06
},
{
mainImgUrl: "http://testimg3.bigaka.com/group3/M00/00/17/Cv6CBF1Z9TKAU6T1AAAG8CvHO2o415.png",
amount: 0.06
},
{
mainImgUrl: "http://testimg3.bigaka.com/group3/M00/00/17/Cv6CBF1Z9TKAU6T1AAAG8CvHO2o415.png",
amount: 0.06
}
],
}, },
/** /**
......
<!--subPackage/home/pages/plus/plus.wxml--> <!--subPackage/home/pages/plus/plus.wxml-->
<view class="plus">
<!-- plus 动态页面 -->
</view>
<plus sku-list="{{skuVOList}}"/> <plus sku-list="{{skuVOList}}"/>
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