Commit 34f10d79 by YangChengYuan

修改冲突

parents db9466e2 2fe64962
// pages/me/vip/index.js
import api from '../../../utils/Api.js'
import Wx from '../../../utils/Wx.js'
const app = getApp()
const {
$Toast
} = require('../../../iview/base/index');
Page({
/**
* 页面的初始数据
......@@ -13,7 +16,9 @@ Page({
vip_price: 49.9,
order: {},
user: {}
user: {},
visible1: false,
},
handleChange1({
......@@ -44,6 +49,8 @@ Page({
getUserInfo: function() {
api.me.info().then(res => {
if (!res.code) {
//授权手机号
this.dialogPhone(res.data)
app.globalData.userInfo = res.data
// 渲染数据
this.setData({
......@@ -53,6 +60,56 @@ Page({
})
},
/**
* 手机号授权弹窗
*/
dialogPhone: function(data) {
if (!data.phone) {
this.setData({
visible1: true
});
}
},
handlePhoneAuth: function(event) {
Wx.login().then(res => {
let encryptedData = event.detail.encryptedData
let iv = event.detail.iv
this.decodePhoneData(res.code, encryptedData, iv)
})
},
/**
* 解密手机号数据
*/
decodePhoneData: function(code, encryptedData, iv) {
let that = this
api.getPhoneNumber({
code: code,
encryptedData: encryptedData,
iv: iv
}).then(res => {
if (!res.code) {
that.setData({
visible1:false
})
$Toast({
content: '手机号授权成功',
type: 'success'
});
//更新下用户数据
that.getUserInfo()
} else {
$Toast({
content: '手机号授权失败',
type: 'error'
});
}
})
},
// 获取VIP单价
getVipPrice: function() {
api.me.vipPrice().then(res => {
......@@ -164,7 +221,7 @@ Page({
}
})
},
/**
* 同步支付结果回调:重置订单状态
*/
......
......@@ -2,10 +2,12 @@
"navigationBarTitleText": "会员VIP",
"backgroundColor": "#f5f5f5",
"usingComponents": {
"i-row": "/iview/row/index",
"i-col": "/iview/col/index",
"i-input-number": "/iview/input-number/index",
"i-button": "/iview/button/index",
"i-input": "/iview/input/index"
"i-row": "/iview/row/index",
"i-col": "/iview/col/index",
"i-input-number": "/iview/input-number/index",
"i-button": "/iview/button/index",
"i-input": "/iview/input/index",
"i-modal": "/iview/modal/index",
"i-toast": "/iview/toast/index"
}
}
\ No newline at end of file
......@@ -21,15 +21,25 @@
</view>
<!-- 用户输入的信息 -->
<i-input i-class="right-align" value="" title="姓名" type="text" placeholder="请输入您的姓名" />
<!-- <i-input i-class="right-align" value="" title="姓名" type="text" placeholder="请输入您的姓名" />
<view class='phoneGive'>
<text>手机号</text>
<button>授权</button>
</view>
<i-input i-class="right-align right-align-last" type="text" title="地址" placeholder="请输入您的地址" maxlength="50" />
<i-input i-class="right-align right-align-last" type="text" title="地址" placeholder="请输入您的地址" maxlength="50" /> -->
<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">立即{{user.is_vip==1?'续费':'购买'}} ¥{{common.numFixed(vip_price*value1, 2)}}</i-button>
</i-col>
</i-row>
\ No newline at end of file
</i-row>
<!-- 授权弹窗 -->
<i-modal title="请授权手机号" visible="{{ visible1 }}" show-cancel="{{false}}" show-ok="{{false}}" action-mode="{{ vertical }}">
<view class="auth_phone_container">
<i-button i-class="btn_auth_phone" type="info" shape="circle" size="default" bindgetphonenumber="handlePhoneAuth" open-type="getPhoneNumber">授权</i-button>
</view>
</i-modal>
<!-- toast弹窗 -->
<i-toast id="toast" />
\ No newline at end of file
......@@ -96,3 +96,9 @@ page {
.color-orange {
color: #ff4200;
}
/* 授权窗口 */
.auth_phone_container{
width: 80%;
margin: auto;
}
\ No newline at end of file
......@@ -15,7 +15,7 @@
"compileType": "miniprogram",
"libVersion": "2.3.2",
"appid": "wx1b834552a7d49bb3",
"projectname": "%E7%BE%8E%E8%A1%8C%E8%80%85%E4%BA%B2%E5%AD%90%E6%B8%B8(git)",
"projectname": "%E7%BE%8E%E8%A1%8C%E8%80%85",
"debugOptions": {
"hidedInDevtools": []
},
......
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