Commit e8258cbd authored by chenwei's avatar chenwei

个人信息手机号获取

parent 3c13d787
......@@ -78,7 +78,7 @@
</view>
</view>
<view class="main-footer">
<view class="mobile">{{ $store.state.userInfo.mobile }}</view>
<view class="mobile">{{ mobile }}</view>
<input class="inp" :placeholder="integral.codePlaceloader" v-model="code" />
<view class="btn" @click="handleCode">{{
codeTime == 0 ? integral.code : integral.codeTimeText(codeTime)
......@@ -164,9 +164,7 @@
</view>
<view
>{{ $lang.lang.integral.exchangeType }}
{{
locale === 'zh' ? handleExchangeSelected().labelZh : handleExchangeSelected().labelEn
}}
{{ handleExchangeSelected() }}
</view>
<view v-if="current != 1 && addressId"
>{{ $lang.lang.integral.deliveryAddress }}
......@@ -211,7 +209,8 @@ export default {
// 验证码
code: '',
// 验证码倒计时
codeTime: 0
codeTime: 0,
mobile: ''
}
},
onLoad(route) {
......@@ -223,6 +222,7 @@ export default {
},
onShow() {
this.getAddress()
this.getUserInfo()
},
computed: {
locale() {
......@@ -240,6 +240,14 @@ export default {
}
},
methods: {
async getUserInfo() {
try {
const { code, data } = await this.$request.get('/app-api/member/user/get')
if (code === 0 && data) {
this.mobile = data.mobile
}
} catch (err) {}
},
// 送货类型切换
menuChange(i) {
this.current = i
......@@ -355,9 +363,17 @@ export default {
},
//获取选中的兑换类型
handleExchangeSelected() {
return this.orderInfo.pickMethodList.filter((element) => {
return this.current == element.value
})[0]
if (this.orderInfo?.pickMethodList?.length > 0) {
if (this.locale === 'zh') {
return this.orderInfo.pickMethodList.filter((element) => {
return this.current == element.value
})[0].labelZh
} else {
return this.orderInfo.pickMethodList.filter((element) => {
return this.current == element.value
})[0].labelEn
}
}
},
// 提交订单
bindSubmitOrder() {
......
......@@ -3,6 +3,7 @@ import Vuex from 'vuex'
import http from '@/utils/request'
import user from './modules/user'
import storage from '../utils/storage'
Vue.use(Vuex)
let userInfo = null
......@@ -17,13 +18,16 @@ try {
const store = new Vuex.Store({
state: {
userInfo: userInfo || null,
mobile: uni.getStorageSync('mobile'),
config: null
},
mutations: {
logout(state) {
console.log('logout')
state.userInfo = null
uni.removeStorageSync('userInfo')
uni.removeStorageSync('token')
uni.removeStorageSync('mobile')
storage.clean()
// uni.switchTab({
// url: '/pages/tabbar/user/user.vue'
......@@ -33,6 +37,8 @@ const store = new Vuex.Store({
state.userInfo = userInfo
console.log('userInfo.data', userInfo)
uni.setStorageSync('userInfo', JSON.stringify(userInfo))
uni.setStorageSync('mobile', userInfo.mobile)
console.log('mobile', uni.getStorageSync('mobile'))
uni.setStorageSync('token', userInfo.api_token)
},
setConfig(state, config) {
......@@ -54,7 +60,8 @@ const store = new Vuex.Store({
},
getters: {
id: (state) => state.user.id,
areaCode: (state) => state.user.areaCode
areaCode: (state) => state.user.areaCode,
mobile: (state) => state.mobile
},
modules: {
user
......
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