Commit 09fca1c5 authored by chenwei's avatar chenwei

Merge branch 'feature' into 'dev'

个人信息手机号获取

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