Commit 555741c7 authored by zhangjianguo's avatar zhangjianguo

个人中心页面和收货地址的初始页面

parent 2190ac56
<template>
<view class="addressStyle" v-if="!isloading" :style="{'height':contentHeight}">
<scroll-view
:scroll-y="true"
:enable-back-to-top="true"
:enable-flex="true"
:style="{ height: '100%' }">
<view v-for="(item, index) in list" :key="index" class="addresbox">
<view class="addresclo">
<Text>收件人:{{item.name}}</Text>
<Text>{{item.mobile}}</Text>
</view>
<Text>收货地址:{{item.address}}</Text>
<view style="width: 100%;height: 2rpx;background: #EEEEEE;margin-top: 15rpx;"></view>
<view class="addresclo">
<u-checkbox-group @change='isdefault(item)'>
<u-checkbox v-model="item.is_default==1?true:false" shape="circle" active-color="red">{{item.is_default==1?'已设为默认':'设为默认'}}</u-checkbox>
</u-checkbox-group>
<view style="display: flex;flex-direction: row;">
<view>
<van-icon name="chat" color="red" />
</view>
</view>
</view>
</view>
</scroll-view>
<!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> -->
</view>
</template>
<script>
import auth from "../../components/auth/index.vue";
export default {
data() {
return {
loading: true,
list: [],
showAuth:false,
u: {},
contentHeight:0
}
},
components:{
auth
},
created(){
this.contentHeight = this.$utils.calcContentHeight(-40)+'px';
},
onLoad(){
this.u = wx.getStorageSync("userinfo");
if (!this.u) {
this.u = {
nickName: "未登录",
avatarUrl: ""
};
this.showAuth = true;
}
},
methods: {
init(){
this.loading = false;
uni.showNavigationBarLoading();
this.request(
{
url: "",
header:{
'X-Access-Token': 'Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ',
'X-App-Platform': 'wxapp',
'X-App-Version':'4.2.47',
'X-Form-Id-List': JSON.stringify([]),
'X-Requested-With': 'XMLHttpRequest',
'X-User-Id': 21269
},
data: {
r: "api/user/address",
},
},
(res) => {
uni.hideNavigationBarLoading()
this.isloading = false;
this.list = res.data.list
}
);
},
reloadUserinfo() {
this.u = uni.getStorageSync("userinfo");
this.showAuth=false
},
isdefault(item){ //默认地址
uni.showNavigationBarLoading();
this.request(
{
url: "",
method:"POST",
header:{
'content-type': 'application/x-www-form-urlencoded',
'X-Access-Token': 'Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ',
'X-App-Platform': 'wxapp',
'X-App-Version':'4.2.47',
'X-Form-Id-List':JSON.stringify([{"value":"873015dc76a242cc8c7ae1c25cdbdf4c","type":0,"remains":1,"expires_at":"2020-05-25 19:03:25"}]),
'X-Requested-With': 'XMLHttpRequest',
'X-User-Id': 21269,
},
data: {
r: "api/user/address-default",
id:item.id ,
is_default:item.is_default==1?0:1 ,
},
},
(res) => {
this.init()
uni.hideNavigationBarLoading()
}
);
},
},
mounted(){
this.init();
}
}
</script>
<style>
.addressStyle{
background: #f3f4f6;
}
.addressStyle .addresbox{
width: 94%;
margin-left: 3%;
border-radius: 10rpx;
background: #fff;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
padding: 0 20rpx;
margin-top: 30rpx;
}
.addressStyle .addresclo{
display: flex;
flex-direction: row;
width: 100%;
padding: 20rpx 0 ;
align-items: center;
justify-content: space-between;
}
</style>
......@@ -6,12 +6,8 @@
<Text @click='edit' v-if='editType==true' class='grid-text_r'>完成</Text>
</view>
<view style="width: 100%;height: 30rpx;background: #F7F7F7;margin: 20rpx 0;"></view>
<view v-if="list.length==0" style="width: 100%;height: 400rpx;display: flex;flex-direction: column;justify-content: center;align-items: center;">
<view style="width: 180rpx;height: 180rpx;border-radius: 50%;background: #DFDFE9;display: flex;align-items: center;justify-content: center;">
<image src='../../static/images/icon/Shopping.png' style='width:60rpx ;height: 60rpx;'></image>
</view>
<Text style='margin-top: 20rpx;color: #939393;'>购物车还是空的哦</Text>
</view>
<u-empty v-if="list.length==0" text="购物车还是空的哦" mode="car"></u-empty>
<view style="padding: 25rpx;border-bottom: 1rpx solid #E4E4E4;" v-if="list.length>0">
<u-checkbox-group @change='SelectAll'>
<u-checkbox v-model="allchecked" shape="circle" active-color="red">赞羊严选</u-checkbox>
......
This diff is collapsed.
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