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 @@ ...@@ -6,12 +6,8 @@
<Text @click='edit' v-if='editType==true' class='grid-text_r'>完成</Text> <Text @click='edit' v-if='editType==true' class='grid-text_r'>完成</Text>
</view> </view>
<view style="width: 100%;height: 30rpx;background: #F7F7F7;margin: 20rpx 0;"></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;"> <u-empty v-if="list.length==0" text="购物车还是空的哦" mode="car"></u-empty>
<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>
<view style="padding: 25rpx;border-bottom: 1rpx solid #E4E4E4;" v-if="list.length>0"> <view style="padding: 25rpx;border-bottom: 1rpx solid #E4E4E4;" v-if="list.length>0">
<u-checkbox-group @change='SelectAll'> <u-checkbox-group @change='SelectAll'>
<u-checkbox v-model="allchecked" shape="circle" active-color="red">赞羊严选</u-checkbox> <u-checkbox v-model="allchecked" shape="circle" active-color="red">赞羊严选</u-checkbox>
......
<template> <template>
<view class="userStyle" v-if="!isloading"> <view class="userStyle" v-if="!isloading">
<view class="userBox"></view> <view class="userBox" :style="{'margin-bottom':bottommargin}">
<image :src='meueData.user_center.style_bg_pic_url' class="imgbg"> <view :style="{'background-image':'url('+meueData.user_center.top_pic_url+')',backgroundSize: '100% 330rpx'}" class="imgbg" >
<!-- <image :src='user_info.avatar' class="headimg"></image> --> <view style="display: flex;flex-direction: row;align-items: center;width: 100%;" v-if='meueData.user_center.top_style==1'>
<!-- <view style="width: 140rpx;height: 140rpx;background: #007AFF;"></view> --> <u-avatar :src="user_info.avatar" size='140' style='margin-left: 50rpx;'></u-avatar>
</image> <Text style="color: #FFF;margin-left: 20rpx;font-size: 36rpx;" @click='login(user_info)'>{{user_info.nickname?user_info.nickname:'立即登录'}}</Text>
</view>
<view style="display: flex;flex-direction: column;align-items: center;" v-if='meueData.user_center.top_style==2'>
<u-avatar :src="user_info.avatar" size='140' ></u-avatar>
<Text style="color: #FFF;margin-left: 20rpx;font-size: 36rpx;" @click='login(user_info)'>{{user_info.nickname?user_info.nickname:'立即登录'}}</Text>
</view>
<view class="ReceiptAdder" @click="goUrl('/pages/address/address')">
<van-icon name="close" />
<Text style='color: #fff;font-size: 32;'>收货地址</Text>
</view>
</view>
<view class="footprint" v-if='meueData.user_center.is_foot_bar_status==1'>
<view class="footprint_item" @click="goUrl()">
<text>{{user_info.favorite}}</text>
<view class="footprint_item_bottom">
<image :src='meueData.user_center.foot_bar[0].icon_url' style="width: 40rpx;height: 40rpx;"></image>
<Text style='margin-left: 10rpx;'>{{meueData.user_center.foot_bar[0].name}}</Text>
</view>
</view>
<view style="width: 1rpx;height: 60rpx;background: #000000;"></view>
<view class="footprint_item" @click="goUrl()">
<text>{{user_info.footprint}}</text>
<view class="footprint_item_bottom">
<image :src='meueData.user_center.foot_bar[1].icon_url' style="width: 40rpx;height: 40rpx;"></image>
<Text style='margin-left: 10rpx;'>{{meueData.user_center.foot_bar[1].name}}</Text>
</view>
</view>
</view>
<view class="account_bar" v-if="meueData.user_center.is_account_status==1">
<view class="account_bar_item">
<Text style="color: #F4BD61;">{{user_info.integral}}</Text>
<view class="footprint_item_bottom">
<image :src='meueData.user_center.account_bar.integral.icon' style="width: 26rpx;height: 26rpx;"></image>
<Text style='margin-left: 10rpx;'>{{meueData.user_center.account_bar.integral.text}}</Text>
</view>
</view>
<view style="width: 1rpx;height: 60rpx;background: #EEEEEE;"></view>
<view class="account_bar_item">
<Text style="color: #F4BD61;">{{user_info.coupon}}</Text>
<view class="footprint_item_bottom">
<image :src='meueData.user_center.account_bar.coupon.icon' style="width: 26rpx;height: 26rpx;"></image>
<Text style='margin-left: 10rpx;'>{{meueData.user_center.account_bar.coupon.text}}</Text>
</view>
</view>
<view style="width: 1rpx;height: 60rpx;background: #EEEEEE;"></view>
<view class="account_bar_item">
<Text style="color: #F4BD61;">{{user_info.card}}</Text>
<view class="footprint_item_bottom">
<image :src='meueData.user_center.account_bar.card.icon' style="width: 26rpx;height: 26rpx;"></image>
<Text style='margin-left: 10rpx;'>{{meueData.user_center.account_bar.card.text}}</Text>
</view>
</view>
</view>
<view class="order_bar" v-if='meueData.user_center.is_order_bar_status==1'>
<u-section title="我的订单" sub-title="查看更多" style='width: 100%;padding: ;'></u-section>
<view class="order_bar_list">
<view class="order_bar_item" v-for="(item, index) in meueData.user_center.order_bar" :key="index"
:name="item.name" @click="goUrl(item.link_url)">
<image :src='item.icon_url' style="width: 66rpx;height: 60rpx;"></image>
<Text style='margin-top: 10rpx;'>{{item.name}}</Text>
</view>
</view>
</view>
<view :class="meueData.user_center.menu_style==1?'menus2':'menus'" v-if='meueData.user_center.is_menu_status==1'>
<view :class="meueData.user_center.menu_style==1?'menus_item2':'menus_item'" v-for="(item, index) in meueData.user_center.menus" :key="index"
:name="item.name" @click="goUrl(item.link_url)">
<image :src='item.icon_url' style="width: 48rpx;height: 48rpx;"></image>
<Text :style="{'margin-top':meueData.user_center.menu_style == 1 ? '0rpx':'10rpx','margin-left':meueData.user_center.menu_style == 1 ? '10rpx':'0rpx'}">
{{item.name}}
</Text>
</view>
</view>
<view class="copyright">
<image :src='meueData.copyright.pic_url' style="width: 95px;height: 28px;"></image>
<Text style='margin-top: 10rpx;'>{{meueData.copyright.description}}</Text>
</view>
</view>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth>
<tabbars></tabbars> <tabbars></tabbars>
</view> </view>
</template> </template>
<script> <script>
import tabbars from "@/components/tabbar/index"; import tabbars from "@/components/tabbar/index";
import auth from "../../components/auth/index.vue";
export default{ export default{
data(){ data(){
return{ return{
...@@ -24,13 +107,24 @@ ...@@ -24,13 +107,24 @@
user_info:{},//个人信息 user_info:{},//个人信息
bottommargin:0, bottommargin:0,
listbottom:0, listbottom:0,
showAuth:false,
u: {},
} }
}, },
components:{ components:{
tabbars tabbars,
auth
}, },
onLoad() { onLoad() {
this.navHeight = this.$navHeight - 2; this.navHeight = this.$navHeight - 2;
this.u = wx.getStorageSync("userinfo");
if (!this.u) {
this.u = {
nickName: "未登录",
avatarUrl: ""
};
this.showAuth = true;
}
this.cstyle = uni.getStorageSync("basedata") this.cstyle = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").cat_style ? uni.getStorageSync("basedata").cat_style
: []; : [];
...@@ -45,13 +139,13 @@ ...@@ -45,13 +139,13 @@
this.bottommargin = (c-2)+'px'; this.bottommargin = (c-2)+'px';
this.listbottom = (c-2+50)+'px'; this.listbottom = (c-2+50)+'px';
this.contentHeight = this.$utils.calcContentHeight(c); this.contentHeight = this.$utils.calcContentHeight(c);
let u = "/" + currentPages[currentPages.length - 1].route; let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata") let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title ? wx.getStorageSync("basedata").bar_title
: []; : [];
console.log(wx.getStorageSync("basedata")) console.log(wx.getStorageSync("basedata"))
console.log(u)
pages.forEach((x) => { pages.forEach((x) => {
if (x.value == u) { if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name; this.pageTitle = x.new_name ? x.new_name : x.name;
...@@ -71,7 +165,7 @@ ...@@ -71,7 +165,7 @@
{ {
url: "", url: "",
header:{ header:{
'X-Access-Token': 'Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ', 'X-Access-Token': '_4Y_WpUZ4a6SI5uJgsZ4Lb7t9mvqJTyr',
'X-App-Platform': 'wxapp', 'X-App-Platform': 'wxapp',
'X-App-Version':'4.2.47', 'X-App-Version':'4.2.47',
'X-Form-Id-List': JSON.stringify([]), 'X-Form-Id-List': JSON.stringify([]),
...@@ -88,7 +182,6 @@ ...@@ -88,7 +182,6 @@
(res) => { (res) => {
uni.hideNavigationBarLoading() uni.hideNavigationBarLoading()
this.isloading = false; this.isloading = false;
console.log(res)
} }
); );
}, },
...@@ -98,20 +191,19 @@ ...@@ -98,20 +191,19 @@
{ {
url: "", url: "",
header:{ header:{
'X-Access-Token': 'Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ', 'X-Access-Token': '_4Y_WpUZ4a6SI5uJgsZ4Lb7t9mvqJTyr',
'X-App-Platform': 'wxapp', 'X-App-Platform': 'wxapp',
'X-App-Version':'4.2.47', 'X-App-Version': '4.2.47',
'X-Form-Id-List': JSON.stringify([]), 'X-Form-Id-List': [{"value":"7567542b600b46ac9d1945822f697123","type":0,"remains":1,"expires_at":"2020-05-25 11:25:17"}],
'X-Requested-With': 'XMLHttpRequest', 'X-Requested-With': 'XMLHttpRequest',
'X-User-Id': 21269 'X-User-Id': 19992,
}, },
data: { data: {
r: "api/user/config", r: "api/user/config",
}, },
}, },
(res) => { (res) => {
uni.hideNavigationBarLoading() uni.hideNavigationBarLoading()
this.isloading = false; this.isloading = false;
...@@ -120,6 +212,21 @@ ...@@ -120,6 +212,21 @@
this.user_info = res.data.user_info; this.user_info = res.data.user_info;
} }
); );
},
goUrl(url){
console.log(url )
uni.navigateTo({
url: url
})
},
reloadUserinfo() {
this.u = uni.getStorageSync("userinfo");
this.showAuth=false
},
login(name){
if(!name){
this.showAuth = true;
}
} }
} }
...@@ -127,19 +234,23 @@ ...@@ -127,19 +234,23 @@
</script> </script>
<style> <style>
.body{
background: #f3f4f6;
}
.userStyle .userBox{ .userStyle .userBox{
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
background: #f3f4f6;;
} }
.userStyle .imgbg{ .userStyle .imgbg{
width: 100%; width: 100%;
height: 330rpx; height: 330rpx;
position: relative;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: center;
} }
.userStyle .headimg{ .userStyle .headimg{
width: 140rpx; width: 140rpx;
...@@ -147,4 +258,126 @@ ...@@ -147,4 +258,126 @@
border-radius: 50%; border-radius: 50%;
margin-left: 60rpx; margin-left: 60rpx;
} }
.userStyle .footprint{
width: 80%;
height:140rpx ;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-around;
}
.userStyle .footprint_item{
width: 200rpx;
height: 100rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
}
.userStyle .footprint_item_bottom{
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.userStyle .account_bar{
width: 94%;
height: 110rpx;
border-radius: 10rpx;
background: #fff;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-around;
padding: 0 20rpx;
}
.userStyle .account_bar_item{
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
}
.userStyle .order_bar{
width: 94%;
border-radius: 10rpx;
background: #fff;
display: flex;
flex-direction: column;
align-items: center;
padding: 30rpx;
margin-top: 30rpx;
}
.userStyle .order_bar .order_bar_list{
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.userStyle .order_bar_item{
display: flex;
flex-direction: column;
align-items: center;
margin-top: 20rpx;
}
.userStyle .menus{
width: 94%;
border-radius: 10rpx;
background: #fff;
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
margin-top: 30rpx;
}
.userStyle .menus2{
width: 94%;
border-radius: 10rpx;
background: #fff;
display: flex;
flex-direction: column;
margin-top: 20rpx;
}
.userStyle .menus .menus_item{
width: 25%;
height: 110rpx;
margin: 20rpx 0 10rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
}
.userStyle .menus2 .menus_item2{
width: 100%;
height: 80rpx;
display: flex;
flex-direction: row;
align-items: center;
margin-left: 30rpx;
}
.userStyle .copyright{
padding: 70rpx 0;
display: flex;
flex-direction: column;
align-items: center;
}
.userStyle .ReceiptAdder{
position: absolute;
right: 0;
top:125rpx;
width: 230rpx;
height:80rpx ;
background: #EA554D;
border-top-left-radius: 40rpx;
border-bottom-left-radius: 40rpx;
display: flex;
flex-direction: row;
align-items: center;
padding: 0 20rpx;
}
</style> </style>
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