purchase-let/pages/my/my.vue

518 lines
12 KiB
Vue
Raw Normal View History

2024-06-14 16:31:41 +08:00
<style lang="scss">
.rest {
display: flex;
2024-06-27 14:00:57 +08:00
justify-content: space-around;
2024-06-14 16:31:41 +08:00
margin: 20rpx;
.rest-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.rest-item-num {
font-size: 30rpx;
margin-bottom: 16rpx;
}
.rest-item-txt {
font-size: 28rpx;
}
}
}
</style>
2024-04-25 18:02:30 +08:00
<template>
2024-06-28 19:53:27 +08:00
<view style="flex-grow: 1;overflow-y: auto;">
<view class="user-info"
2024-07-11 16:46:19 +08:00
:style="{backgroundImage: [0].includes(userInfo.user_ship)?'url(https://lihai001.oss-cn-chengdu.aliyuncs.com/def/e3a7b202404261113002322.webp)':'url(https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/aace1202407021022357574.png)' }">
2024-05-09 16:43:34 +08:00
<view class="u-card">
2024-06-27 20:15:39 +08:00
<view style="display: flex;" @click="updataInfp">
2024-06-28 19:53:27 +08:00
<up-image :src="userInfo.avatar" mode="aspectFill" width="112rpx" height="112rpx"
shape="circle"></up-image>
2024-06-05 18:45:30 +08:00
<view class="content">
2024-06-28 19:53:27 +08:00
<view style="font-size: 32rpx;">{{userInfo.nickname}}</view>
<view class="uid">
<text>ID:</text>
<view style="margin:0 20rpx;">
{{userInfo.id}}
</view>
2024-07-11 16:46:19 +08:00
<view v-if="![0].includes(userInfo.user_ship)"
2024-06-28 19:53:27 +08:00
style="display: flex;align-items: center;background-color: #F6EECD;padding: 4rpx 10rpx;border-radius: 20rpx;">
<view style="margin-right: 10rpx;">
<up-icon
name="https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/e8621202406281618363287.png"></up-icon>
</view>
2024-07-02 17:06:39 +08:00
{{userInfo.vip_name}}会员
2024-06-28 19:53:27 +08:00
</view>
</view>
2024-06-05 18:45:30 +08:00
</view>
</view>
2024-06-17 08:38:39 +08:00
<view class="to-vip-btn" @click="navgo('/pageQuota/vipUser/index')">
会员报备
</view>
2024-06-05 18:45:30 +08:00
</view>
2024-06-28 19:53:27 +08:00
<view class="balance" @click="navgo('/pageQuota/balanceDetail/index?type=2')">
<view class="" style="font-size: 28rpx;transform: translateY(10rpx);">
余额:
</view>
<view style="font-size: 50rpx;">
{{userInfo.now_money||"0.00"}}<text style="font-size: 28rpx;"> ()</text>
</view>
2024-06-27 14:00:57 +08:00
</view>
</view>
2024-06-28 19:53:27 +08:00
2024-06-14 16:31:41 +08:00
<view class="rest">
2024-06-24 15:03:11 +08:00
<view class="rest-item" @click="navgo('/pageQuota/balanceDetail/index?type=1')">
2024-06-20 16:28:19 +08:00
<view class="rest-item-num">{{userInfo.purchase_funds||'0.00'}}</view>
2024-06-14 16:31:41 +08:00
<view class="rest-item-txt">采购款</view>
</view>
2024-06-28 19:53:27 +08:00
<view class="rest-item" @click="navgo('/pageQuota/balanceDetail/index?type=4')">
2024-06-26 15:53:52 +08:00
<view class="rest-item-num">{{userInfo.return_money||'0.00'}}</view>
<view class="rest-item-txt">返还金</view>
</view>
2024-06-28 19:53:27 +08:00
<view class="rest-item" @click="navgo('/pageQuota/balanceDetail/index?type=3')">
2024-06-26 16:48:29 +08:00
<view class="rest-item-num">{{userInfo.GetNumber ||"0.00"}}</view>
2024-06-27 14:00:57 +08:00
<view class="rest-item-txt">礼品券</view>
</view>
2024-06-29 18:25:37 +08:00
<view class="rest-item" @click="navgo('/pageQuota/balanceDetail/index?type=5')">
2024-06-27 14:00:57 +08:00
<view class="rest-item-num">{{userInfo.number ||"0.00"}}</view>
<view class="rest-item-txt">冻结券</view>
2024-06-14 16:31:41 +08:00
</view>
</view>
2024-05-09 16:43:34 +08:00
<view class="order-info-box">
<view class="order-info">
<view class="info-head">我的订单</view>
<view class="info-list">
<view class="list-item" @click="navTo(1)">
<image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/f335a202404261401535608.png">
</image>
<view class="">待付款</view>
<view class="badge" v-if="orderCount.no_pay">{{orderCount.no_pay}}</view>
</view>
2024-06-05 18:45:30 +08:00
2024-05-09 16:43:34 +08:00
<view class="list-item" @click="navTo(2)">
2024-06-09 20:32:49 +08:00
<image src="/static/icon/wait.jpg">
2024-05-09 16:43:34 +08:00
</image>
2024-06-05 18:45:30 +08:00
<view class="">待核销</view>
2024-06-06 18:26:47 +08:00
<view class="badge" v-if="orderCount.waiting">{{orderCount.waiting}}</view>
2024-05-09 16:43:34 +08:00
</view>
2024-06-05 18:45:30 +08:00
2024-06-08 13:42:16 +08:00
<view class="list-item" @click="navTo(3)">
2024-06-09 20:32:49 +08:00
<image src="/static/icon/done.jpg">
2024-06-05 18:45:30 +08:00
</image>
<view class="">已核销</view>
<view class="badge" v-if="orderCount.receiving">{{orderCount.receiving}}</view>
</view>
2024-06-08 13:42:16 +08:00
<view class="list-item" @click="navTo(4)">
2024-06-09 20:32:49 +08:00
<image src="/static/icon/back.jpg">
2024-05-09 16:43:34 +08:00
</image>
2024-06-06 18:26:47 +08:00
<view class="">售后/退款</view>
<view class="badge" v-if="orderCount.applyRefund">{{orderCount.applyRefund}}</view>
2024-05-09 16:43:34 +08:00
</view>
</view>
</view>
</view>
<view class="card">
<up-cell-group>
2024-07-06 16:20:28 +08:00
<!-- <up-cell v-if="userInfo.user_ship==1" title="赠品区" :isLink="true" url="/pageQuota/Gifts/index"></up-cell> -->
2024-07-11 16:46:19 +08:00
<!-- <up-cell title="我的资产" :isLink="true" url="/pageQuota/asset/index"></up-cell>
<up-cell title="预约记录" :isLink="true" url="/pageQuota/asset/lists"></up-cell> -->
2024-05-09 16:43:34 +08:00
<up-cell title="我的地址" :isLink="true" url="/pagesOrder/addressList/addressList"></up-cell>
2024-06-21 10:59:01 +08:00
<up-cell title="支付密码" :isLink="true" url="/pagesOrder/setPayPassword/index"></up-cell>
2024-05-09 16:43:34 +08:00
</up-cell-group>
</view>
<view class="card">
<up-cell-group>
<up-cell title="意见反馈" :isLink="true" url="/pageQuota/feedBack/index"></up-cell>
<up-cell title="关于我们" :isLink="true" url="/pageQuota/aboutUs/index"></up-cell>
<up-cell title="退出登录" :isLink="true" @click="logout"></up-cell>
</up-cell-group>
</view>
</view>
2024-06-27 20:15:39 +08:00
<up-popup :show="showPop" @close="showPop=false" @open="showPop=true">
2024-06-28 19:53:27 +08:00
<view class="popContent" :style="{paddingBottom:isFoucs?'500rpx':'50rpx'}">
2024-06-27 20:15:39 +08:00
<view style="text-align: center;font-size: 30rpx;font-weight: bold;">
2024-06-28 19:53:27 +08:00
修改个人信息
2024-06-27 20:15:39 +08:00
</view>
<up-form labelPosition="left">
2024-06-28 19:53:27 +08:00
<up-form-item label="呢称" prop="userInfo.name" borderBottom ref="item1" @tap="isFoucs=true">
<up-input :adjustPosition="false" @blur="isFoucs=false" v-model="formData.nick_name" border="none"
2024-06-28 11:50:22 +08:00
placeholder="请输入个人呢称"></up-input>
2024-06-28 19:53:27 +08:00
</up-form-item>
2024-06-27 20:15:39 +08:00
<up-form-item label="头像" prop="userInfo.sex" borderBottom ref="item1">
<up-image :src="formData.avatar" width="80px" height="80px" @click="uploadAvatar"></up-image>
</up-form-item>
</up-form>
<view style="display: flex;margin-top: 40rpx;justify-content: space-around;">
<view style="width: 200rpx;">
<up-button color="#20b128" @click="updataFn">保存</up-button>
</view>
<view style="width: 200rpx;">
<up-button @click="showPop=false">取消</up-button>
</view>
</view>
<!-- <button></button> -->
</view>
</up-popup>
2024-04-25 18:02:30 +08:00
</template>
<script setup>
2024-05-09 16:43:34 +08:00
import {
2024-06-27 20:15:39 +08:00
reactive,
2024-05-09 16:43:34 +08:00
ref
} from "vue";
import useUserStore from "@/store/user";
import {
orderCountApi
} from "@/api/order.js";
import {
2024-06-29 18:25:37 +08:00
onLoad,
2024-06-24 16:57:04 +08:00
onPullDownRefresh
2024-05-09 16:43:34 +08:00
} from "@dcloudio/uni-app"
2024-06-24 16:57:04 +08:00
import {
2024-06-27 20:15:39 +08:00
userInfoApi,
uploadImg,
loginUpdateUserApi
2024-06-24 16:57:04 +08:00
} from "@/api/user.js"
2024-06-27 20:15:39 +08:00
import {
config
} from "@/config/app.js"
2024-06-28 11:50:22 +08:00
let isFoucs = ref(false);
2024-06-24 16:57:04 +08:00
const userStore = useUserStore();
const userInfo = ref({});
2024-06-27 20:15:39 +08:00
let token = uni.getStorageSync('token') || ''
2024-05-09 16:43:34 +08:00
const orderCount = ref({
no_pay: 0,
receiving: 0,
2024-06-06 18:26:47 +08:00
waiting: 0,
applyRefund: 0
2024-05-09 16:43:34 +08:00
})
const getOrderCount = () => {
orderCountApi().then(res => {
orderCount.value = res.data;
})
}
2024-06-06 17:50:25 +08:00
// 返回下单 或者充值
const handleBack = (e) => {
if (e > 0) {
uni.navigateTo({
url: "/pages/charge/charge"
})
} else {
uni.navigateBack()
}
}
2024-05-09 16:43:34 +08:00
const navTo = (type = 0) => {
uni.navigateTo({
url: `/pagesOrder/order/order?type=${type}`
})
}
2024-06-08 22:50:09 +08:00
const navgo = (url) => {
uni.navigateTo({
url
})
}
2024-06-27 20:15:39 +08:00
const showPop = ref(false)
2024-06-27 17:59:54 +08:00
2024-06-27 20:15:39 +08:00
const updataInfp = () => {
showPop.value = true
}
const formData = reactive({
nick_name: "",
avatar: ""
})
const updataFn = () => {
loginUpdateUserApi({
nickname: formData.nick_name,
avatar: formData.avatar
}).then(res => {
uni.$u.toast('修改成功');
showPop.value = false
userInfoApi().then(res => {
userInfo.value = res.data;
})
})
}
const uploadAvatar = () => {
uni.chooseImage({
success: (chooseImageRes) => {
uni.showLoading({
title: '上传中...'
});
const tempFilePaths = chooseImageRes.tempFilePaths;
2024-06-28 19:53:27 +08:00
console.log('ewser', config.HTTP_REQUEST_URL)
2024-06-27 20:15:39 +08:00
uni.uploadFile({
url: config.HTTP_REQUEST_URL + '/api/Upload/image', //仅为示例,非真实的接口地址
filePath: tempFilePaths[0],
name: 'file',
header: {
token: token,
},
success: (uploadFileRes) => {
let data = JSON.parse(uploadFileRes.data)
formData.avatar = data.data.uri
uni.hideLoading()
}
});
}
});
}
2024-06-27 17:59:54 +08:00
2024-05-09 16:43:34 +08:00
const logout = () => {
userStore.setToken('');
userStore.setUserInfo({});
2024-06-18 11:17:39 +08:00
uni.removeStorageSync('SHARE_INFO');
2024-06-17 20:47:54 +08:00
uni.setStorageSync("STORE_INFO", '')
2024-05-09 16:43:34 +08:00
uni.reLaunch({
url: '/pages/login/login'
})
}
2024-06-29 18:25:37 +08:00
onLoad(() => {
2024-06-24 16:57:04 +08:00
userInfoApi().then(res => {
userInfo.value = res.data;
2024-06-27 20:15:39 +08:00
formData.avatar = res.data.avatar
formData.nick_name = res.data.nickname
2024-07-11 16:46:19 +08:00
if (![0].includes(res.data.user_ship)) {
2024-06-28 19:53:27 +08:00
uni.setNavigationBarColor({
frontColor: "#000000",
2024-07-02 10:20:26 +08:00
backgroundColor: "#EAFFE1"
2024-06-28 19:53:27 +08:00
})
}
2024-06-24 16:57:04 +08:00
})
2024-05-09 16:43:34 +08:00
getOrderCount();
})
2024-06-24 16:57:04 +08:00
onPullDownRefresh(() => {
userInfoApi().then(res => {
userInfo.value = res.data;
uni.stopPullDownRefresh()
})
})
2024-04-25 18:02:30 +08:00
</script>
<style lang="scss">
2024-05-09 16:43:34 +08:00
.user-info {
2024-06-28 19:53:27 +08:00
// background-color: red;
width: 100vw;
height: 300rpx;
background-size: 100% 100%;
box-sizing: border-box;
padding: 70rpx 50rpx 0 50rpx;
2024-06-29 18:25:37 +08:00
position: relative;
2024-05-09 16:43:34 +08:00
.u-card {
2024-06-17 08:38:39 +08:00
display: flex;
justify-content: space-between;
2024-06-28 19:53:27 +08:00
align-items: center;
2024-05-09 16:43:34 +08:00
.content {
padding-left: 30rpx;
display: flex;
flex-direction: column;
justify-content: center;
2024-06-28 19:53:27 +08:00
.uid {
margin-top: 15rpx;
display: flex;
align-items: center;
font-size: 22rpx;
2024-05-09 16:43:34 +08:00
}
}
2024-06-05 18:45:30 +08:00
2024-06-28 19:53:27 +08:00
.to-vip-btn {
color: white;
padding: 10rpx 20rpx;
height: 34rpx;
background-color: #39BE40;
border-radius: 30rpx;
2024-06-29 18:25:37 +08:00
z-index: 2;
2024-06-28 19:53:27 +08:00
}
}
2024-06-05 18:45:30 +08:00
2024-06-29 18:25:37 +08:00
.logo {
position: absolute;
width: 236rpx;
height: 236rpx;
right: 20rpx;
z-index: 1;
opacity: 0.5
}
2024-06-05 18:45:30 +08:00
2024-06-28 19:53:27 +08:00
.balance {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 35rpx;
2024-06-05 18:45:30 +08:00
}
}
.member {
width: 710rpx;
margin: 0 auto;
background: linear-gradient(135deg, #FFF9E8 0%, #F3E7C0 100%);
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(113, 113, 113, 0.11);
border-radius: 12rpx;
padding: 0 18rpx 22rpx 22rpx;
box-sizing: border-box;
.member-wrap {
display: flex;
align-items: center;
justify-content: space-between;
height: 78rpx;
margin-bottom: 20rpx;
.member-left {
display: flex;
align-items: center;
text {
font-weight: bold;
font-size: 26rpx;
color: #060606;
}
view {
font-size: 24rpx;
color: #060606;
}
}
.member-right {
width: 136rpx;
height: 56rpx;
line-height: 56rpx;
background: #FFFFFF;
border-radius: 28rpx;
font-weight: 600;
font-size: 24rpx;
color: #7D661E;
text-align: center;
}
}
.member-progress {
&>view {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10rpx;
text {
font-size: 22rpx;
color: #A26341;
}
}
2024-05-09 16:43:34 +08:00
}
}
.order-info-box {
.order-info {
width: 710rpx;
background-color: #fff;
border-radius: 14rpx;
background-image: url('https://lihai001.oss-cn-chengdu.aliyuncs.com/def/a8863202404261349533191.png');
2024-06-05 18:45:30 +08:00
background-size: 28% 100%;
2024-05-09 16:43:34 +08:00
background-position: right;
background-repeat: no-repeat;
2024-06-05 18:45:30 +08:00
margin: 0 auto;
padding: 28rpx 0 40rpx 0;
2024-05-09 16:43:34 +08:00
.info-head {
font-size: 32rpx;
2024-06-05 18:45:30 +08:00
font-weight: bold;
margin: 0 0 30rpx 30rpx;
2024-05-09 16:43:34 +08:00
}
.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;
position: relative;
image {
width: 64rpx;
height: 64rpx;
}
.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;
}
}
}
}
}
.card {
margin: 20rpx;
background-color: #fff;
border-radius: 14rpx;
overflow: hidden;
}
2024-06-08 22:50:09 +08:00
2024-06-27 20:15:39 +08:00
.popContent {
padding: 30rpx 20rpx 50rpx 20rpx;
}
2024-06-08 22:50:09 +08:00
.gift {
width: 710rpx;
margin: 20rpx;
margin-bottom: 0;
box-sizing: border-box;
padding: 20rpx;
align-items: center;
height: 96rpx;
display: flex;
justify-content: space-between;
box-sizing: border-box;
background-color: #FAF1D7;
font-size: 26rpx;
.gift-buy {
font-size: 24rpx;
width: 136rpx;
height: 56rpx;
background-color: white;
border-radius: 28rpx;
line-height: 56rpx;
text-align: center;
color: #7D661E;
}
}
2024-04-26 18:04:56 +08:00
</style>