|
@@ -2,11 +2,11 @@
|
|
|
<view class="userInfo-container">
|
|
|
<u-cell-group>
|
|
|
<u-cell-item title="头像" :arrow="false" center>
|
|
|
- <u-avatar src="" :size="70" slot="right-icon"></u-avatar>
|
|
|
+ <view class="user-photo"><open-data type="userAvatarUrl"></open-data></view>
|
|
|
</u-cell-item>
|
|
|
- <u-cell-item title="手机号码" value="15709284545" :arrow="false"></u-cell-item>
|
|
|
- <u-cell-item title="收货地址" index="0" @click="toPage"></u-cell-item>
|
|
|
- <u-cell-item title="支付密码" index="1" @click="toPage"></u-cell-item>
|
|
|
+ <u-cell-item title="手机号码" :value="userDate.mobile" :arrow="false"></u-cell-item>
|
|
|
+ <u-cell-item v-if="address!=null" title="收货地址" :value="address?'修改收货地址':'设置收货地址'" index="0" @click="editAddress"></u-cell-item>
|
|
|
+ <u-cell-item v-if="existPayPwd!=null" title="支付密码" :value="existPayPwd?'修改密码':'设置密码'" @click="setPayPwd"></u-cell-item>
|
|
|
</u-cell-group>
|
|
|
<!-- 退出 -->
|
|
|
<view class="user-btn">
|
|
@@ -16,6 +16,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import {existPayPwd} from '@/api/order.js'
|
|
|
+ import {findAddressBycustomerNo} from '@/api/receiveAddress.js'
|
|
|
import {logout} from '@/api/login.js'
|
|
|
export default {
|
|
|
data() {
|
|
@@ -24,22 +26,60 @@
|
|
|
borderRadius:'100rpx',
|
|
|
fontSize:'30rpx',
|
|
|
background: '#01c9b2'
|
|
|
- }
|
|
|
+ },
|
|
|
+ userDate: {},
|
|
|
+ existPayPwd: null,
|
|
|
+ address: null,
|
|
|
+ userInfo: {}
|
|
|
}
|
|
|
},
|
|
|
onShow() {
|
|
|
- },
|
|
|
- onLoad() {
|
|
|
+ this.userDate = this.$store.state.vuex_userData
|
|
|
+ this.getPayPwd()
|
|
|
+ this.getAddress()
|
|
|
},
|
|
|
methods:{
|
|
|
- // 打开对应的页面
|
|
|
- toPage(index){
|
|
|
- let pageUrl=[
|
|
|
- '/pages/toOrder/editAddress',
|
|
|
- '/pages/userCenter/userInfo/changePayPwd'
|
|
|
- // '/pages/userCenter/userInfo/smsVerification'
|
|
|
- ]
|
|
|
- uni.navigateTo({ url: pageUrl[index] })
|
|
|
+ // 获取用户位置
|
|
|
+ getAddress() {
|
|
|
+ findAddressBycustomerNo({}).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.status == 200&&res.data.length) {
|
|
|
+ this.address = res.data[0].receiveAddress
|
|
|
+ this.userInfo = res.data[0]
|
|
|
+ } else {
|
|
|
+ this.address = ''
|
|
|
+ this.userInfo = {}
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 判断是否设置过支付密码
|
|
|
+ getPayPwd(){
|
|
|
+ existPayPwd().then(res=>{
|
|
|
+ if(res.status == 200) {
|
|
|
+ if(res.data) {
|
|
|
+ this.existPayPwd = true
|
|
|
+ } else {
|
|
|
+ this.existPayPwd = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 修改收货地址
|
|
|
+ editAddress(index){
|
|
|
+ this.$u.vuex("vuex_OrderAddress",this.userInfo)
|
|
|
+ uni.navigateTo({
|
|
|
+ url:"/pages/toOrder/editAddress"
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 设置密码
|
|
|
+ setPayPwd(){
|
|
|
+ // 设置过支付密码,则修改密码
|
|
|
+ if(this.existPayPwd){
|
|
|
+ uni.navigateTo({ url: '/pages/userCenter/userInfo/paymentPwd' })
|
|
|
+ }else{
|
|
|
+ // 没设置过支付密码,提示设置密码
|
|
|
+ uni.navigateTo({ url: '/pages/userCenter/userInfo/changePayPwd' })
|
|
|
+ }
|
|
|
},
|
|
|
// 退出登录
|
|
|
quitSys(){
|
|
@@ -76,5 +116,13 @@
|
|
|
.user-btn{
|
|
|
padding: 85rpx 200rpx;
|
|
|
}
|
|
|
+ .user-photo{
|
|
|
+ width: 100rpx;
|
|
|
+ height: 100rpx;
|
|
|
+ border-radius: 50%;
|
|
|
+ overflow: hidden;
|
|
|
+ margin-right: 5rpx;
|
|
|
+ float: right;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|