purchase-let/pages/my/my.vue

211 lines
5.3 KiB
Vue
Raw Normal View History

2024-04-25 18:02:30 +08:00
<template>
2024-04-26 18:04:56 +08:00
<view>
2024-04-29 10:44:50 +08:00
<up-navbar title="我的" bgColor="rgba(0,0,0,0)" :autoBack="true">
2024-04-26 18:04:56 +08:00
</up-navbar>
<view class="user-info">
<image class="bg" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/e3a7b202404261113002322.webp"
mode="widthFix"></image>
<view class="u-card">
2024-04-30 18:08:36 +08:00
<up-avatar :src="userInfo.avatar" size="80"></up-avatar>
2024-04-26 18:04:56 +08:00
<view class="content">
2024-04-30 18:08:36 +08:00
<view class="u-phone">{{userInfo.nickname}}</view>
<view class="u-id">ID: {{userInfo.id}}</view>
2024-04-26 18:04:56 +08:00
</view>
</view>
</view>
<view class="order-info-box">
<view class="order-info">
<view class="info-head">我的订单</view>
<view class="info-list">
2024-04-27 18:02:43 +08:00
<view class="list-item" @click="navTo(1)">
2024-04-26 18:04:56 +08:00
<image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/f335a202404261401535608.png"></image>
<view class="">待付款</view>
2024-05-06 15:32:45 +08:00
<view class="badge" v-if="orderCount.no_pay">{{orderCount.no_pay}}</view>
2024-04-26 18:04:56 +08:00
</view>
2024-04-27 18:02:43 +08:00
<view class="list-item" @click="navTo(2)">
2024-04-26 18:04:56 +08:00
<image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/45241202404261403353935.png"></image>
<view class="">待收货</view>
2024-05-08 14:50:27 +08:00
<view class="badge" v-if="orderCount.receiving">{{orderCount.receiving}}</view>
2024-04-26 18:04:56 +08:00
</view>
2024-04-27 18:02:43 +08:00
<!-- <view class="list-item">
2024-04-26 18:04:56 +08:00
<image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/96915202404261403582769.png"></image>
<view class="">售后/退款</view>
2024-04-27 18:02:43 +08:00
</view> -->
2024-04-26 18:04:56 +08:00
<view class="list-item" @click="navTo()">
<image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/abdcd202404261406199643.png"></image>
<view class="">全部订单</view>
</view>
</view>
</view>
</view>
<view class="card">
<up-cell-group>
2024-04-27 18:02:43 +08:00
<up-cell title="我的地址" :isLink="true" url="/pagesOrder/addressList/addressList"></up-cell>
2024-04-26 18:04:56 +08:00
</up-cell-group>
</view>
<view class="card">
<up-cell-group>
<up-cell title="意见反馈" :isLink="true"></up-cell>
<up-cell title="关于我们" :isLink="true"></up-cell>
2024-05-06 17:58:41 +08:00
<up-cell title="退出登录" :isLink="true" @click="logout"></up-cell>
2024-04-26 18:04:56 +08:00
</up-cell-group>
</view>
</view>
2024-04-25 18:02:30 +08:00
</template>
<script setup>
2024-04-26 18:04:56 +08:00
import { ref } from "vue";
2024-04-30 18:08:36 +08:00
import useUserStore from "@/store/user";
2024-05-06 15:32:45 +08:00
import { orderCountApi } from "@/api/order.js";
2024-05-08 14:50:27 +08:00
import { onShow } from "@dcloudio/uni-app"
2024-04-30 18:08:36 +08:00
const userStore = useUserStore();
const userInfo = userStore.userInfo;
2024-04-26 18:04:56 +08:00
2024-05-06 15:32:45 +08:00
const orderCount = ref({
no_pay: 0,
receiving: 0,
waiting: 0
})
const getOrderCount = ()=>{
orderCountApi().then(res=>{
orderCount.value = res.data;
})
}
2024-04-26 18:04:56 +08:00
const navTo = (type=0) => {
uni.navigateTo({
url: `/pagesOrder/order/order?type=${type}`
})
}
2024-05-06 17:58:41 +08:00
const logout = ()=>{
userStore.setToken('');
userStore.setUserInfo({});
uni.reLaunch({
url: '/pages/login/login'
})
}
2024-05-08 14:50:27 +08:00
onShow(()=>{
getOrderCount();
})
2024-04-25 18:02:30 +08:00
</script>
<style lang="scss">
2024-04-26 18:04:56 +08:00
.user-info {
overflow: hidden;
position: relative;
width: 750rpx;
height: 450rpx;
/* #ifdef H5 */
height: 350rpx;
/* #endif */
.bg {
width: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 1;
}
.u-card {
box-sizing: border-box;
padding: 50rpx 0 50rpx 50rpx;
display: flex;
position: absolute;
bottom: 50rpx;
left: 0;
z-index: 2;
.content {
width: 500rpx;
padding-left: 30rpx;
display: flex;
flex-direction: column;
justify-content: center;
.u-phone {
font-size: 32rpx;
margin-bottom: 16rpx;
}
.u-id {
font-size: 24rpx;
}
}
}
}
.order-info-box {
margin: 20rpx;
height: 140rpx;
position: relative;
2024-04-25 18:02:30 +08:00
2024-04-26 18:04:56 +08:00
.order-info {
height: 220rpx;
width: 710rpx;
background-color: #fff;
border-radius: 14rpx;
position: absolute;
top: -80rpx;
left: 0;
z-index: 3;
background-image: url('https://lihai001.oss-cn-chengdu.aliyuncs.com/def/a8863202404261349533191.png');
2024-05-08 14:50:27 +08:00
background-size: 35% 100%;
2024-04-26 18:04:56 +08:00
background-position: right;
background-repeat: no-repeat;
.info-head{
margin-left: 20rpx;
margin-top: 20rpx;
margin-bottom: 20rpx;
font-size: 32rpx;
}
.info-list{
height: 110rpx;
display: flex;
font-size: 26rpx;
.list-item{
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
2024-05-06 15:32:45 +08:00
position: relative;
2024-04-26 18:04:56 +08:00
image{
width: 64rpx;
height: 64rpx;
}
2024-05-06 15:32:45 +08:00
.badge{
position: absolute;
top: 0;
right: 20%;
width: 30rpx;
height: 30rpx;
border-radius: 50%;
text-align: center;
line-height: 30rpx;
font-size: 22rpx;
color: #fff;
background-color: #F55726;
}
2024-04-26 18:04:56 +08:00
}
}
}
}
.card{
margin: 20rpx;
background-color: #fff;
border-radius: 14rpx;
overflow: hidden;
}
</style>