123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- <template>
- <mobile-frame :frameStyle="frameStyle" @toPath="toPath">
- <view class="main">
- <view class="one">
- <view class="one_1" v-if="!user._id">
- <text class="iconfont icon-geren2" @click="toCommon('pages/login/index')"></text>
- <view class="name">未登录</view>
- </view>
- <view class="one_1" v-else>
- <image class="image" :src="user.icon&&user.icon.length>0?user.icon[0].url:''"></image>
- <view class="name">
- <text>{{user.name||'暂无名称'}}</text>
- <text>普通会员</text>
- </view>
- </view>
- <view class="one_2">
- <view class="one_2_1">
- <text v-if="user._id">{{user.collect||0}}</text>
- <text @click="toCommon('pagesMy/collection/market')">收藏的商品</text>
- </view>
- <text class="link">|</text>
- <view class="one_2_1">
- <text v-if="user._id">{{user.collect||0}}</text>
- <text @click="toCommon('pagesMy/collection/shop')">收藏的店铺</text>
- </view>
- </view>
- </view>
- <view class="two">
- <view class="two_1">
- <view class="title">我的订单</view>
- <view class="title">
- <text @click="toCommon('pagesMy/order/index')">全部订单</text>
- <text class="iconfont icon-dayufuhao"></text>
- </view>
- </view>
- <view class="two_2">
- <view class="orderList" v-for="(item, index) in orderList" :key="index"
- @click="toOrrder(item.type)">
- <view class="icon">
- <text class="iconfont" :class="[item.icon]"></text>
- </view>
- <text class="title">{{item.title}}</text>
- </view>
- </view>
- <view class="two_1" v-for="(item, index) in menuList" :key="index" @click="toCommon(item.route)">
- <view class="title">{{item.title}}</view>
- <view class="title">
- <text v-if="user._id&&item.title=='我的积分'">{{user.integral||0}}分</text>
- <text v-if="user._id&&item.title=='客服电话'">{{user.phone||'123-345-6780'}}</text>
- <text class="iconfont icon-dayufuhao"></text>
- </view>
- </view>
- </view>
- </view>
- </mobile-frame>
- </template>
- <script>
- export default {
- data() {
- return {
- frameStyle: {
- useBar: true
- },
- // 用户信息
- user: {},
- // 图标菜单
- orderList: [{
- icon: 'icon-daifukuan',
- title: '待付款',
- type: 'a'
- },
- {
- icon: 'icon-daifahuo',
- title: '待发货',
- type: 'b'
- },
- {
- icon: 'icon-daishouhuo',
- title: '待收货/消费',
- type: 'c'
- },
- {
- icon: 'icon-daipinglun',
- title: '待评论',
- type: 'd'
- },
- {
- icon: 'icon-shouhoufuwuicon',
- title: '售后',
- type: 'e'
- },
- ],
- // 菜单
- menuList: [{
- title: '我的优惠劵',
- route: 'pagesMy/discount/index'
- },
- {
- title: '我的积分',
- route: 'pagesMy/integral/index'
- },
- {
- title: '我的资产',
- route: 'pagesMy/assets/index'
- },
- {
- title: '我的拼团',
- route: 'pagesMy/dough/index'
- },
- {
- title: '我的收货地址',
- route: 'pagesMy/address/index'
- },
- {
- title: '账号管理',
- route: 'pagesMy/account/index'
- },
- {
- title: '客服电话',
- route: ''
- },
- ],
- };
- },
- onShow: function() {
- const that = this;
- that.watchLogin();
- },
- methods: {
- watchLogin() {
- const that = this;
- uni.getStorage({
- key: 'token',
- success: (res) => {
- let user = that.$jwt(res.data);
- console.log(user);
- if (user) that.$set(that, `user`, user);
- },
- fail: (err) => {}
- })
- },
- toPath(e) {
- if (e && e.route) uni.redirectTo({
- url: `/${e.route}`
- })
- },
- // 公共跳转
- toCommon(e) {
- uni.getStorage({
- key: 'token',
- success: function(res) {
- uni.navigateTo({
- url: `/${e}`
- })
- },
- fail: function(err) {
- uni.navigateTo({
- url: `/${e}`
- })
- }
- });
- },
- // 跳转页面
- toOrrder(e) {
- const that = this;
- uni.navigateTo({
- url: `/${e}`
- })
- },
- }
- }
- </script>
- <style lang="scss">
- .main {
- display: flex;
- flex-direction: column;
- width: 100vw;
- height: 100vh;
- .one {
- text-align: center;
- padding: 4vw 0;
- background-color: var(--fFB1Color);
- color: var(--mainColor);
- .one_1 {
- margin: 0 0 5vw 0;
- image {
- width: 25vw;
- height: 25vw;
- border-radius: 25vw;
- }
- .iconfont {
- font-size: 80px;
- }
- .name {
- display: flex;
- justify-content: space-evenly;
- margin: 2vw 0;
- font-size: var(--font18Szie);
- }
- .image {
- border: 1px solid var(--f1Color);
- }
- }
- .one_2 {
- display: flex;
- flex-direction: row;
- justify-content: space-around;
- font-size: var(--font16Szie);
- .one_2_1 {
- display: flex;
- flex-direction: column;
- }
- .link {
- font-weight: bold;
- }
- }
- }
- .two {
- background-color: var(--f1Color);
- .two_1 {
- display: flex;
- justify-content: space-between;
- padding: 4vw;
- background-color: var(--mainColor);
- margin: 0 0 0.1vw 0;
- .title {
- font-size: var(--font16Szie);
- text:first-child {
- margin: 0 1vw 0 0;
- }
- }
- .title:last-child {
- color: var(--f85Color);
- font-size: var(--font14Size);
- }
- }
- .two_1:nth-last-child(2) {
- margin: 0 0 2vw 0;
- }
- .two_1:nth-last-child(4) {
- margin: 0 0 2vw 0;
- }
- .two_2 {
- display: flex;
- justify-content: space-between;
- padding: 5vw;
- background-color: var(--mainColor);
- margin: 0 0 2vw 0;
- .orderList {
- text-align: center;
- .icon {
- .iconfont {
- font-size: 25px;
- }
- }
- .title {
- display: inline-block;
- margin: 2vw 0 0 0;
- font-size: var(--font12Size);
- }
- }
- }
- }
- }
- </style>
|