第一次上传
This commit is contained in:
@@ -0,0 +1,897 @@
|
||||
<template>
|
||||
<view class="profile-page">
|
||||
<!-- 沉浸式状态栏 -->
|
||||
<view class="status-bar"></view>
|
||||
|
||||
<!-- 个人中心骨架屏 -->
|
||||
<SkeletonProfile v-if="pageLoading" />
|
||||
|
||||
<!-- 个人中心内容 -->
|
||||
<view v-else>
|
||||
|
||||
<!-- 顶部用户信息区 - 浅色清新设计 -->
|
||||
<view class="user-header">
|
||||
<view class="user-info">
|
||||
<image class="user-avatar" :src="Service.GetMateUrlByImg(user.headImg)" mode="aspectFill" />
|
||||
<view class="user-details">
|
||||
<text class="user-name">{{ user.nick }}</text>
|
||||
<!-- ID和会员等级标签在一排 -->
|
||||
<view class="tags-row">
|
||||
<view class="user-id-tag" @click="copyMemberId">
|
||||
<text class="ri-vip-crown-2-fill id-icon"></text>
|
||||
<text class="id-text">ID: {{user.userNo}}</text>
|
||||
<text class="ri-file-copy-line id-copy"></text>
|
||||
</view>
|
||||
<!-- <view class="user-member-tag" v-if="user.memberLevel">
|
||||
<text class="ri-vip-crown-fill member-icon"></text>
|
||||
<text class="member-text">{{ memberLevelText }}</text>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 数据统计卡片 - 白色背景独立区域 -->
|
||||
<view class="stats-card-wrapper">
|
||||
<view class="stats-card">
|
||||
<view class="stats-item" @click="Service.GoPage('/pages/userFunc/integration')">
|
||||
<view class="stats-icon-box">
|
||||
<text class="ri-coin-line stats-icon"></text>
|
||||
</view>
|
||||
<view class="stats-content">
|
||||
<text class="stats-value">{{ user.points }}</text>
|
||||
<text class="stats-label">积分</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="stats-divider"></view>
|
||||
<view class="stats-item" @click="Service.GoPage('/pages/userFunc/coupon')">
|
||||
<view class="stats-icon-box">
|
||||
<text class="ri-coupon-3-line stats-icon"></text>
|
||||
</view>
|
||||
<view class="stats-content">
|
||||
<text class="stats-value">{{ unusedCouponCount }}</text>
|
||||
<text class="stats-label">优惠券</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 会员码入口 -->
|
||||
<view class="member-code-section" @click="Service.GoPage('/pages/userFunc/vip')">
|
||||
<view class="member-code-card">
|
||||
<view class="code-left">
|
||||
<view class="code-title">
|
||||
<text class="ri-qr-code-line code-icon"></text>
|
||||
<text class="title-text">会员码</text>
|
||||
</view>
|
||||
<text class="code-desc">向商家出示会员码,享受积分优惠</text>
|
||||
</view>
|
||||
<view class="code-preview">
|
||||
<text class="ri-qr-code-line preview-icon"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 功能入口 - 网格布局 -->
|
||||
<view class="function-section">
|
||||
<view class="function-grid">
|
||||
<view class="function-item" @click="Service.GoPage('/pages/userFunc/vip')">
|
||||
<view class="function-icon-box" style="background: #FFF8E1;">
|
||||
<text class="ri-file-list-3-line function-icon" style="color: #FF9800;"></text>
|
||||
</view>
|
||||
<text class="function-name">我的订单</text>
|
||||
</view>
|
||||
|
||||
<view class="function-item" @click="Service.GoPage('/pages/userFunc/favorites')">
|
||||
<view class="function-icon-box" style="background: #FFEBEE;">
|
||||
<text class="ri-heart-line function-icon" style="color: #F44336;"></text>
|
||||
</view>
|
||||
<text class="function-name">我的收藏</text>
|
||||
</view>
|
||||
|
||||
<!-- <view class="function-item" @click="goToAddress">
|
||||
<view class="function-icon-box" style="background: #E3F2FD;">
|
||||
<text class="ri-map-pin-line function-icon" style="color: #2196F3;"></text>
|
||||
</view>
|
||||
<text class="function-name">收货地址</text>
|
||||
</view> -->
|
||||
|
||||
<view class="function-item" @click="serviceFunc">
|
||||
<view class="function-icon-box" style="background: #F3E5F5;">
|
||||
<text class="ri-customer-service-2-line function-icon" style="color: #9C27B0;"></text>
|
||||
</view>
|
||||
<text class="function-name">联系客服</text>
|
||||
</view>
|
||||
<view class="function-item" @click="showPhoneAuthModal = true">
|
||||
<view class="function-icon-box" style="background: #e7e7f5;">
|
||||
<text class="ri-smartphone-line function-icon" style="color: #8a77f5;"></text>
|
||||
</view>
|
||||
<text class="function-name">绑定手机号</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 功能列表 -->
|
||||
<view class="menu-section">
|
||||
<!-- 联盟卡功能块 -->
|
||||
<view class="scan-section" @click="Service.GoPage('/pages/userFunc/alliance-card')">
|
||||
<view class="scan-card">
|
||||
<view class="scan-icon-box">
|
||||
<text class="ri-bank-card-line scan-icon"></text>
|
||||
</view>
|
||||
<view class="scan-content">
|
||||
<text class="scan-title">我的联盟卡</text>
|
||||
<text class="scan-desc">绑定联盟卡,享受专属权益</text>
|
||||
</view>
|
||||
<text class="ri-arrow-right-s-line scan-arrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="menu-group">
|
||||
<view class="menu-item" @click="Service.GoPage('/pages/userFunc/member-benefits')">
|
||||
<view class="item-left">
|
||||
<text class="ri-gift-line item-icon" style="color: #FF6B00;"></text>
|
||||
<text class="item-name">会员权益</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="item-desc">积分抵扣 · 专享优惠</text>
|
||||
<text class="ri-arrow-right-s-line item-arrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="menu-item" @click="Service.GoPage('/pages/userFunc/promotion')" >
|
||||
<view class="item-left">
|
||||
<text class="ri-team-line item-icon" style="color: #9C27B0;"></text>
|
||||
<text class="item-name">我的推广</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="item-desc">{{ promotionCount }}人</text>
|
||||
<text class="ri-arrow-right-s-line item-arrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="menu-item" @click="Service.GoPage('/pages/userFunc/invite')" >
|
||||
<view class="item-left">
|
||||
<text class="ri-user-add-line item-icon" style="color: #10B981;"></text>
|
||||
<text class="item-name">邀请好友</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="item-tag">赚积分</text>
|
||||
<text class="ri-arrow-right-s-line item-arrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="menu-group">
|
||||
<view class="menu-item" @click="Service.GoPage('/pages/userFunc/feedback')" >
|
||||
<view class="item-left">
|
||||
<text class="ri-feedback-line item-icon" style="color: #3B82F6;"></text>
|
||||
<text class="item-name">意见反馈</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="ri-arrow-right-s-line item-arrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="menu-item" @click="Service.GoPage('/pages/userFunc/about-us')">
|
||||
<view class="item-left">
|
||||
<text class="ri-information-line item-icon" style="color: #64748B;"></text>
|
||||
<text class="item-name">关于我们</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="ri-arrow-right-s-line item-arrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="menu-item" @click="goToSettings">
|
||||
<view class="item-left">
|
||||
<text class="ri-settings-4-line item-icon" style="color: #64748B;"></text>
|
||||
<text class="item-name">设置</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="ri-arrow-right-s-line item-arrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 手机号授权弹窗 -->
|
||||
<view v-if="showPhoneAuthModal" class="phone-auth-overlay" @click="closePhoneAuthModal">
|
||||
<view class="phone-auth-modal" @click.stop>
|
||||
<!-- 关闭按钮 -->
|
||||
<view class="modal-close" @click="closePhoneAuthModal">
|
||||
<text class="ri-close-line close-icon"></text>
|
||||
</view>
|
||||
|
||||
<!-- 顶部图标 -->
|
||||
<view class="modal-header">
|
||||
<view class="header-icon-box">
|
||||
<text class="ri-wechat-fill header-icon"></text>
|
||||
</view>
|
||||
<text class="header-title">微信授权</text>
|
||||
<text class="header-desc">使用微信授权快速获取手机号</text>
|
||||
</view>
|
||||
|
||||
<!-- 微信授权按钮 -->
|
||||
<button class="auth-btn wechat" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
|
||||
<view class="btn-content">
|
||||
<text class="ri-wechat-fill btn-icon"></text>
|
||||
<text class="btn-text">微信授权手机号</text>
|
||||
</view>
|
||||
</button>
|
||||
|
||||
<!-- 温馨提示 -->
|
||||
<view class="auth-tips">
|
||||
<view class="tips-item">
|
||||
<text class="ri-checkbox-circle-fill tips-icon"></text>
|
||||
<text class="tips-text">授权后可快速联系在线客服</text>
|
||||
</view>
|
||||
<view class="tips-item">
|
||||
<text class="ri-shield-check-fill tips-icon"></text>
|
||||
<text class="tips-text">您的信息将严格保密</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onShow, onLoad } from "@dcloudio/uni-app";
|
||||
import { Service } from "@/Service/Service"
|
||||
import { ref } from "vue";
|
||||
import { vpUserService } from '@/Service/vp/vpUserService'
|
||||
import SkeletonProfile from '@/components/skeleton/skeleton-profile.vue'
|
||||
|
||||
let user = ref<any>({
|
||||
headImg: ''
|
||||
})
|
||||
|
||||
let pageLoading = ref<boolean>(true)
|
||||
|
||||
let showPhoneAuthModal = ref<boolean>(false)
|
||||
|
||||
|
||||
|
||||
onLoad(() => {
|
||||
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
getUserinfo()
|
||||
});
|
||||
|
||||
const gotopage = (item : any) => {
|
||||
if (item.path) {
|
||||
Service.GoPage(item.path)
|
||||
}
|
||||
}
|
||||
|
||||
const serviceFunc = (item : any, index : any) => {
|
||||
if (index == 0) {
|
||||
wx.openCustomerServiceChat({
|
||||
extInfo: { url: 'https://work.weixin.qq.com/kfid/kfc959c128ce7801256' },
|
||||
corpId: 'wwb1123fbb286554ab',
|
||||
success(res) { },
|
||||
fail(err) {
|
||||
console.log(err, '失败')
|
||||
// 失败回调
|
||||
}
|
||||
})
|
||||
} else {
|
||||
Service.GoPage(item.path)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
const getUserinfo = () => {
|
||||
vpUserService.GetUserInfo().then(res => {
|
||||
pageLoading.value = false
|
||||
user.value = res.data.userInfo
|
||||
})
|
||||
}
|
||||
|
||||
// 复制会员ID
|
||||
const copyMemberId = () => {
|
||||
console.log('000')
|
||||
uni.setClipboardData({
|
||||
data: user.value.userNo.toString(),
|
||||
success: () => {
|
||||
Service.Msg('会员ID已复制')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 关闭手机号授权弹窗
|
||||
const closePhoneAuthModal = () => {
|
||||
showPhoneAuthModal.value = false
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 引入全局标签样式 */
|
||||
@import '@/styles/member-tags.scss';
|
||||
|
||||
.profile-page {
|
||||
min-height: 100vh;
|
||||
background: #F5F5F5;
|
||||
padding-bottom: calc(100rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
/* 状态栏 */
|
||||
.status-bar {
|
||||
background: linear-gradient(135deg, #FFF4E6, #FFE0B2);
|
||||
height: var(--status-bar-height);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 顶部用户信息区 */
|
||||
.user-header {
|
||||
background: linear-gradient(135deg, #FFF4E6, #FFE0B2);
|
||||
padding: 20rpx 20rpx 50rpx;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.user-avatar {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 60rpx;
|
||||
border: 4rpx solid rgba(255, 255, 255, 0.5);
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.user-details {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.user-name {
|
||||
display: block;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #222222;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
/* 数据统计卡片 - 白色背景独立区域 */
|
||||
.stats-card-wrapper {
|
||||
background: #FFFFFF;
|
||||
margin: -20rpx 0 20rpx;
|
||||
border-radius: 0;
|
||||
border-top-left-radius: 24rpx;
|
||||
border-top-right-radius: 24rpx;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.stats-card {
|
||||
background: transparent;
|
||||
padding: 24rpx 24rpx;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.stats-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
/* 统计图标盒子 */
|
||||
.stats-icon-box {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
background: linear-gradient(135deg, #FFF4E6, #FFE0B2);
|
||||
}
|
||||
|
||||
.stats-icon {
|
||||
font-size: 32rpx;
|
||||
color: #FF6B00;
|
||||
}
|
||||
|
||||
/* 统计内容 */
|
||||
.stats-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 4rpx;
|
||||
}
|
||||
|
||||
.stats-value {
|
||||
font-size: 36rpx;
|
||||
font-weight: 700;
|
||||
color: #222222;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.stats-label {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.stats-divider {
|
||||
width: 1rpx;
|
||||
background: rgba(0, 0, 0, 0.08);
|
||||
height: 64rpx;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
/* 会员码入口 */
|
||||
.member-code-section {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.member-code-card {
|
||||
background: linear-gradient(135deg, #FFF4E6, #FFE0B2);
|
||||
border-radius: 16rpx;
|
||||
padding: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
box-shadow: 0 4rpx 12rpx rgba(255, 107, 0, 0.15);
|
||||
}
|
||||
|
||||
.code-left {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.code-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.code-icon {
|
||||
font-size: 32rpx;
|
||||
color: #FF9800;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.title-text {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #222222;
|
||||
}
|
||||
|
||||
.code-desc {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
margin-left: 40rpx;
|
||||
}
|
||||
|
||||
.code-preview {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.preview-icon {
|
||||
font-size: 48rpx;
|
||||
color: #FF9800;
|
||||
}
|
||||
|
||||
/* 功能入口 */
|
||||
.function-section {
|
||||
background: #FFFFFF;
|
||||
margin: 0 20rpx 20rpx;
|
||||
border-radius: 16rpx;
|
||||
padding: 32rpx 20rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.function-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 24rpx;
|
||||
}
|
||||
|
||||
.function-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.function-icon-box {
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.function-icon {
|
||||
font-size: 44rpx;
|
||||
}
|
||||
|
||||
.function-name {
|
||||
font-size: 24rpx;
|
||||
color: #222222;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 菜单列表 */
|
||||
.menu-section {
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
/* 扫一扫功能块 */
|
||||
.scan-section {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.scan-card {
|
||||
background: linear-gradient(135deg, #FF6B00, #FF9500);
|
||||
border-radius: 16rpx;
|
||||
padding: 28rpx 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-shadow: 0 4rpx 16rpx rgba(255, 107, 0, 0.25);
|
||||
}
|
||||
|
||||
.scan-icon-box {
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 16rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 20rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.scan-icon {
|
||||
font-size: 40rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.scan-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
}
|
||||
|
||||
.scan-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.scan-desc {
|
||||
font-size: 22rpx;
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
}
|
||||
|
||||
.scan-arrow {
|
||||
font-size: 32rpx;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
|
||||
|
||||
.menu-group {
|
||||
background: #FFFFFF;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 28rpx 24rpx;
|
||||
border-bottom: 1rpx solid #F5F5F5;
|
||||
}
|
||||
|
||||
.menu-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.item-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.item-icon {
|
||||
font-size: 40rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.item-name {
|
||||
font-size: 28rpx;
|
||||
color: #222222;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.item-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.item-desc {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.item-tag {
|
||||
background: linear-gradient(135deg, #FF6B00, #FF9800);
|
||||
color: #FFFFFF;
|
||||
font-size: 20rpx;
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 20rpx;
|
||||
margin-right: 8rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.item-arrow {
|
||||
font-size: 28rpx;
|
||||
color: #CCCCCC;
|
||||
}
|
||||
|
||||
/* 底部导航栏 - 精致简约风格 */
|
||||
.tabbar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: #FFFFFF;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
padding: 12rpx 0 calc(12rpx + env(safe-area-inset-bottom));
|
||||
box-shadow: 0 -2rpx 8rpx rgba(0, 0, 0, 0.04);
|
||||
z-index: 999;
|
||||
height: calc(90rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.tabbar-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 10rpx 0;
|
||||
position: relative;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.tabbar-icon {
|
||||
font-size: 44rpx;
|
||||
color: #CCCCCC;
|
||||
margin-bottom: 8rpx;
|
||||
transition: all 0.3s ease;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.tabbar-text {
|
||||
font-size: 22rpx;
|
||||
color: #CCCCCC;
|
||||
font-weight: 400;
|
||||
transition: all 0.3s ease;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
/* 激活状态 */
|
||||
.tabbar-item.active .tabbar-icon {
|
||||
color: #FF6B00;
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.tabbar-item.active .tabbar-text {
|
||||
color: #FF6B00;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 手机号授权弹窗 */
|
||||
.phone-auth-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
z-index: 9999;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
animation: fadeIn 0.3s ease;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.phone-auth-modal {
|
||||
width: 100%;
|
||||
background: #FFFFFF;
|
||||
border-radius: 32rpx 32rpx 0 0;
|
||||
padding: 48rpx 32rpx 40rpx;
|
||||
padding-bottom: calc(40rpx + env(safe-area-inset-bottom));
|
||||
animation: slideUp 0.3s ease;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@keyframes slideUp {
|
||||
from {
|
||||
transform: translateY(100%);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.modal-close {
|
||||
position: absolute;
|
||||
top: 24rpx;
|
||||
right: 24rpx;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #F5F5F5;
|
||||
border-radius: 30rpx;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
font-size: 32rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-bottom: 48rpx;
|
||||
}
|
||||
|
||||
.header-icon-box {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
|
||||
border-radius: 60rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.header-icon {
|
||||
font-size: 56rpx;
|
||||
color: #07C160;
|
||||
}
|
||||
|
||||
.header-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #222222;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.header-desc {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.auth-btn {
|
||||
width: 100%;
|
||||
height: 96rpx;
|
||||
border-radius: 48rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
margin-bottom: 20rpx;
|
||||
overflow: visible;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.auth-btn.wechat {
|
||||
background: linear-gradient(135deg, #07C160, #06AD56);
|
||||
}
|
||||
|
||||
.auth-btn.wechat::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.auth-btn.manual {
|
||||
background: #F5F5F5;
|
||||
}
|
||||
|
||||
.btn-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.btn-icon {
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
.auth-btn.wechat .btn-icon {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.auth-btn.manual .btn-icon {
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.btn-text {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.auth-btn.wechat .btn-text {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.auth-btn.manual .btn-text {
|
||||
color: #222222;
|
||||
}
|
||||
|
||||
.auth-tips {
|
||||
margin-top: 32rpx;
|
||||
padding: 24rpx;
|
||||
background: #FFF9F0;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.tips-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.tips-item:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.tips-icon {
|
||||
font-size: 28rpx;
|
||||
color: #FF9800;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.tips-text {
|
||||
font-size: 22rpx;
|
||||
color: #666666;
|
||||
line-height: 1.4;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,451 @@
|
||||
<template>
|
||||
<view class="member-code-page">
|
||||
<!-- 沉浸式状态栏 -->
|
||||
<view class="status-bar"></view>
|
||||
|
||||
<!-- 顶部导航 -->
|
||||
<view class="nav-bar">
|
||||
<image class="back-icon" src="/static/icons/back.svg" @click="Service.GoPageBack()" mode="aspectFit" />
|
||||
<text class="nav-title">会员码</text>
|
||||
<view class="nav-placeholder"></view>
|
||||
</view>
|
||||
|
||||
<!-- 主要内容区域 -->
|
||||
<view class="content">
|
||||
<!-- 会员卡片 -->
|
||||
<view class="member-card">
|
||||
<!-- 用户信息 -->
|
||||
<view class="user-section">
|
||||
<image class="user-avatar" :src="Service.GetMateUrlByImg(userData.headImg)" mode="aspectFill" />
|
||||
<view class="user-info">
|
||||
<text class="user-name">{{ userData.nick }}</text>
|
||||
<!-- ID和会员等级标签在一排 -->
|
||||
<view class="tags-row">
|
||||
<view class="user-id-tag" @click="copyMemberId">
|
||||
<text class="ri-vip-crown-2-fill id-icon"></text>
|
||||
<text class="id-text">ID: {{ userData.userNo }}</text>
|
||||
<text class="ri-file-copy-line id-copy"></text>
|
||||
</view>
|
||||
<!-- <view class="user-member-tag">
|
||||
<text class="ri-vip-crown-fill member-icon"></text>
|
||||
<text class="member-text">黄金会员</text>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 分割线 -->
|
||||
<view class="divider"></view>
|
||||
|
||||
<!-- 条形码区域 -->
|
||||
<view class="barcode-section">
|
||||
<u-barcode :value="code" :displayValue='false' :width="300" :height="40" />
|
||||
<text class="barcode-number">{{ code }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 二维码区域 -->
|
||||
<view v-if="!isZfb" class="qrcode-section">
|
||||
<view class="qrcode-wrapper" >
|
||||
<view class="qrcode-placeholder" v-if="erCode!=''">
|
||||
<up-qrcode cid="ex1" :size="180" :val="erCode"></up-qrcode>
|
||||
</view>
|
||||
</view>
|
||||
<text class="code-tip">向商家出示会员码,扫码享受积分优惠</text>
|
||||
</view>
|
||||
|
||||
<!-- 刷新提示 -->
|
||||
<view class="refresh-section">
|
||||
<text class="ri-time-line refresh-icon"></text>
|
||||
<text class="refresh-text">{{ refreshCountdown }}秒后自动刷新</text>
|
||||
<view class="refresh-btn" @click="refreshCode">
|
||||
<text class="ri-refresh-line btn-icon"></text>
|
||||
<text class="btn-text">刷新</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 温馨提示 -->
|
||||
<view class="tips-section">
|
||||
<view class="tips-title">
|
||||
<text class="ri-lightbulb-line tips-icon"></text>
|
||||
<text class="title-text">温馨提示</text>
|
||||
</view>
|
||||
<view class="tips-list">
|
||||
<text class="tips-item">• 会员码每分钟自动更新,确保使用安全</text>
|
||||
<text class="tips-item">• 结账时请向商家出示此码</text>
|
||||
<text class="tips-item">• 消费可获得积分,积分可抵扣现金</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
||||
import { vpUserService, Service } from '@/Service/vp/vpUserService'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
|
||||
// 用户数据
|
||||
const user = ref({
|
||||
nickname: '美食达人',
|
||||
avatar: 'https://picsum.photos/200/200?random=100',
|
||||
points: 2580,
|
||||
memberLevel: 'gold',
|
||||
memberId: '8888888',
|
||||
memberCode: 'VIP8888888888888'
|
||||
})
|
||||
let code = ref('')
|
||||
let erCode = ref('')
|
||||
|
||||
let userData = ref<any>({})
|
||||
|
||||
// 刷新倒计时(秒)
|
||||
const refreshCountdown = ref(60)
|
||||
let refreshTimer = ref(0)
|
||||
let countdownTimer = ref(0)
|
||||
let isZfb=ref(false)
|
||||
|
||||
onLoad(() => {
|
||||
|
||||
uni.getProvider({
|
||||
service: 'oauth',
|
||||
success: function (res : any) {
|
||||
isZfb.value=res.provider == 'weixin'?false:true
|
||||
}
|
||||
});
|
||||
|
||||
fetchUserInfo()
|
||||
getCode()
|
||||
startAutoRefresh()
|
||||
})
|
||||
|
||||
// 获取用户信息
|
||||
const fetchUserInfo = () => {
|
||||
vpUserService.GetUserInfo().then(res => {
|
||||
if (res.code == 0) {
|
||||
userData.value = res.data.userInfo
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const getCode=()=>{
|
||||
vpUserService.GetUserCode().then(res => {
|
||||
if (res.code==0){
|
||||
code.value=res.data.code
|
||||
erCode.value=res.data.erCode
|
||||
|
||||
console.log(erCode.value)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 刷新会员码
|
||||
const refreshCode = () => {
|
||||
getCode()
|
||||
// 重置倒计时
|
||||
refreshCountdown.value = 60
|
||||
Service.Msg('会员码已刷新')
|
||||
}
|
||||
|
||||
|
||||
// 复制会员ID
|
||||
const copyMemberId = () => {
|
||||
uni.setClipboardData({
|
||||
data: userData.value.userNo,
|
||||
success: () => {
|
||||
Service.Msg('会员ID已复制')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 开始自动刷新
|
||||
const startAutoRefresh = () => {
|
||||
// 清除之前的定时器
|
||||
if (refreshTimer.value) {
|
||||
clearInterval(refreshTimer.value)
|
||||
}
|
||||
if (countdownTimer.value) {
|
||||
clearInterval(countdownTimer.value)
|
||||
}
|
||||
|
||||
// 倒计时定时器(每秒更新)
|
||||
countdownTimer.value = setInterval(() => {
|
||||
refreshCountdown.value--
|
||||
if (refreshCountdown.value <= 0) {
|
||||
refreshCountdown.value = 60
|
||||
getCode()
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 清理定时器
|
||||
onUnmounted(() => {
|
||||
if (refreshTimer) {
|
||||
clearInterval(refreshTimer.value)
|
||||
}
|
||||
if (countdownTimer) {
|
||||
clearInterval(countdownTimer.value)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 引入全局标签样式 */
|
||||
@import '@/styles/member-tags.scss';
|
||||
|
||||
/* 现代化会员码页面 */
|
||||
.member-code-page {
|
||||
min-height: 100vh;
|
||||
background: linear-gradient(180deg, #FFF4E6 0%, #F5F5F5 100%);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* 状态栏 */
|
||||
.status-bar {
|
||||
background: linear-gradient(135deg, #FF6B00, #FF9500);
|
||||
height: var(--status-bar-height);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 导航栏 */
|
||||
.nav-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 60rpx 24rpx 20rpx 24rpx;
|
||||
background: linear-gradient(135deg, #FF6B00, #FF9500);
|
||||
}
|
||||
|
||||
.back-icon {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
padding: 8rpx;
|
||||
}
|
||||
|
||||
.nav-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.nav-placeholder {
|
||||
width: 40rpx;
|
||||
}
|
||||
|
||||
/* 内容区域 */
|
||||
.content {
|
||||
flex: 1;
|
||||
padding: 32rpx 24rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* 会员卡片 */
|
||||
.member-card {
|
||||
width: 100%;
|
||||
background: #FFFFFF;
|
||||
border-radius: 24rpx;
|
||||
padding: 32rpx;
|
||||
box-shadow: 0 4rpx 20rpx rgba(255, 107, 0, 0.12);
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
/* 用户信息区域 */
|
||||
.user-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.user-avatar {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
border-radius: 48rpx;
|
||||
margin-right: 20rpx;
|
||||
border: 3rpx solid #FF6B00;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.user-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #222222;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
/* 分割线 */
|
||||
.divider {
|
||||
height: 1rpx;
|
||||
background: linear-gradient(90deg, transparent, #E0E0E0, transparent);
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
/* 条形码区域 */
|
||||
.barcode-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.barcode-wrapper {
|
||||
width: 480rpx;
|
||||
background: #F8F8F8;
|
||||
border-radius: 12rpx;
|
||||
padding: 20rpx 32rpx;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.barcode-placeholder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.barcode-lines {
|
||||
font-size: 40rpx;
|
||||
color: #000000;
|
||||
letter-spacing: 2rpx;
|
||||
font-weight: 900;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.barcode-number {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #222222;
|
||||
letter-spacing: 4rpx;
|
||||
}
|
||||
|
||||
/* 二维码区域 */
|
||||
.qrcode-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.qrcode-wrapper {
|
||||
width: 360rpx;
|
||||
height: 360rpx;
|
||||
background: #F8F8F8;
|
||||
border-radius: 16rpx;
|
||||
padding: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.qrcode-placeholder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.qrcode-icon {
|
||||
font-size: 200rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.code-tip {
|
||||
font-size: 22rpx;
|
||||
color: #999999;
|
||||
text-align: center;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
/* 刷新区域 */
|
||||
.refresh-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.refresh-icon {
|
||||
font-size: 24rpx;
|
||||
color: #FF6B00;
|
||||
}
|
||||
|
||||
.refresh-text {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.refresh-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4rpx;
|
||||
background: linear-gradient(135deg, #FF6B00, #FF9500);
|
||||
padding: 10rpx 20rpx;
|
||||
border-radius: 24rpx;
|
||||
}
|
||||
|
||||
.btn-icon {
|
||||
font-size: 20rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.btn-text {
|
||||
font-size: 24rpx;
|
||||
color: #FFFFFF;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 温馨提示 */
|
||||
.tips-section {
|
||||
width: 100%;
|
||||
background: #FFFFFF;
|
||||
border-radius: 16rpx;
|
||||
padding: 24rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.tips-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.tips-icon {
|
||||
font-size: 28rpx;
|
||||
color: #FFA500;
|
||||
}
|
||||
|
||||
.title-text {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #222222;
|
||||
}
|
||||
|
||||
.tips-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.tips-item {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
line-height: 1.6;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,82 @@
|
||||
{
|
||||
"name": "uni-preset-vue",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"dev:app": "uni -p app",
|
||||
"dev:app-android": "uni -p app-android",
|
||||
"dev:app-ios": "uni -p app-ios",
|
||||
"dev:custom": "uni -p",
|
||||
"dev:h5": "uni",
|
||||
"dev:h5:ssr": "uni --ssr",
|
||||
"dev:mp-alipay": "uni -p mp-alipay",
|
||||
"dev:mp-baidu": "uni -p mp-baidu",
|
||||
"dev:mp-jd": "uni -p mp-jd",
|
||||
"dev:mp-kuaishou": "uni -p mp-kuaishou",
|
||||
"dev:mp-lark": "uni -p mp-lark",
|
||||
"dev:mp-qq": "uni -p mp-qq",
|
||||
"dev:mp-toutiao": "uni -p mp-toutiao",
|
||||
"dev:mp-weixin": "uni -p mp-weixin",
|
||||
"dev:mp-xhs": "uni -p mp-xhs",
|
||||
"dev:quickapp-webview": "uni -p quickapp-webview",
|
||||
"dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
|
||||
"dev:quickapp-webview-union": "uni -p quickapp-webview-union",
|
||||
"build:app": "uni build -p app",
|
||||
"build:app-android": "uni build -p app-android",
|
||||
"build:app-ios": "uni build -p app-ios",
|
||||
"build:custom": "uni build -p",
|
||||
"build:h5": "uni build",
|
||||
"build:h5:ssr": "uni build --ssr",
|
||||
"build:mp-alipay": "uni build -p mp-alipay",
|
||||
"build:mp-baidu": "uni build -p mp-baidu",
|
||||
"build:mp-jd": "uni build -p mp-jd",
|
||||
"build:mp-kuaishou": "uni build -p mp-kuaishou",
|
||||
"build:mp-lark": "uni build -p mp-lark",
|
||||
"build:mp-qq": "uni build -p mp-qq",
|
||||
"build:mp-toutiao": "uni build -p mp-toutiao",
|
||||
"build:mp-weixin": "uni build -p mp-weixin",
|
||||
"build:mp-xhs": "uni build -p mp-xhs",
|
||||
"build:quickapp-webview": "uni build -p quickapp-webview",
|
||||
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
|
||||
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
|
||||
"type-check": "vue-tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@climblee/uv-ui": "^1.1.20",
|
||||
"@dcloudio/uni-app": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-app-harmony": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-app-plus": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-components": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-h5": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-mp-alipay": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-mp-baidu": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-mp-harmony": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-mp-jd": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-mp-kuaishou": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-mp-lark": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-mp-qq": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-mp-toutiao": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-mp-weixin": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-mp-xhs": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-quickapp-webview": "3.0.0-4070620250821001",
|
||||
"clipboard": "^2.0.11",
|
||||
"dayjs": "^1.11.13",
|
||||
"echarts": "^5.5.1",
|
||||
"uview-plus": "^3.3.54",
|
||||
"vue": "3.4.21",
|
||||
"vue-i18n": "9.14.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@dcloudio/types": "3.4.21",
|
||||
"@dcloudio/uni-automator": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-cli-shared": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-stacktracey": "3.0.0-4070620250821001",
|
||||
"@dcloudio/vite-plugin-uni": "3.0.0-4070620250821001",
|
||||
"@vue/runtime-core": "3.5.22",
|
||||
"@vue/tsconfig": "^0.1.3",
|
||||
"sass": "1.63.2",
|
||||
"sass-loader": "^10.4.1",
|
||||
"typescript": "^4.9.4",
|
||||
"vite": "5.2.8",
|
||||
"vue-tsc": "^1.0.24"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
@@ -0,0 +1,303 @@
|
||||
<template>
|
||||
<view style="margin: 20rpx 30rpx;">
|
||||
<view class="" style="border-radius: 20rpx; background-color: #fff; padding: 20rpx; ">
|
||||
<view class="" style="font-weight: 600; font-size: 30rpx;">
|
||||
商品封面
|
||||
</view>
|
||||
<view class="" @click="uploadFImg(650,650,'MerchShow','showImg')"
|
||||
style=" margin-top: 20rpx; width: 100%; height: 650rpx; box-sizing: content-box; border: 4rpx dashed #e2e2e2; border-radius: 20rpx; overflow: hidden; ">
|
||||
<image v-if="goodsInfo.img" :src="Service.GetMateUrlByImg(goodsInfo.img)" mode="aspectFill" style="width: 100%; height: 100%; " alt="" />
|
||||
<view class="" v-else
|
||||
style="width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; ">
|
||||
<img :src="Service.GetIconImg('/static/goods/photo.png')" style="width: 80rpx; height: 80rpx;"
|
||||
alt="" />
|
||||
<view class="" style=" color: #666666; font-size: 28rpx;">
|
||||
上传图片
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<view class="" style=" margin-top: 20rpx; border-radius: 20rpx; background-color: #fff; padding: 20rpx; ">
|
||||
<up-form labelWidth='90' :labelStyle="{'font-weight': 600 }" labelPosition="top" :model="goodsInfo"
|
||||
ref="form1">
|
||||
<up-form-item label="商品名称" prop="goodsInfo.name" :borderBottom="false" ref="item1">
|
||||
<up-input v-if="!upImgShow" :customStyle="{'border-radius': '15rpx' }" placeholder="请输入商品名称" border='surround'
|
||||
v-model="goodsInfo.name"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="价格" prop="goodsInfo.sex" :borderBottom="false">
|
||||
<up-input v-if="!upImgShow" prefixIcon='rmb' :prefixIconStyle="{ 'color':'#000','font-weight': 600 }"
|
||||
:customStyle="{'border-radius': '15rpx' }" placeholder="请输入价格" v-model="goodsInfo.price"
|
||||
border="surround"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="描述" prop="goodsInfo.sex" :borderBottom="false">
|
||||
<up-textarea v-if="!upImgShow" v-model="goodsInfo.brief" placeholder="请输入商品描述"></up-textarea>
|
||||
</up-form-item>
|
||||
<!-- <up-form-item label="分类" prop="goodsInfo.sex" :borderBottom="false">
|
||||
<view class=""
|
||||
style="padding: 12rpx 18rpx; border-radius: 7px; border: 1rpx solid #e2e2e2; width: 100%; ">
|
||||
<view class="" @click="showClass=true"
|
||||
style="display: flex; height: 48rpx; align-items: center; justify-content: space-between;">
|
||||
<view class="" :style="{ 'color':goodsInfo.class? '#000':'#c0c4cc' } ">
|
||||
{{ goodsInfo.class?goodsInfo.class:'请选择分类'}}
|
||||
</view>
|
||||
<view class="">
|
||||
<up-icon name="arrow-right" size="14" color='#666666' :bold='true'></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-form-item> -->
|
||||
<up-form-item label="状态" prop="goodsInfo.status" :borderBottom="false">
|
||||
<up-radio-group :modelValue="goodsInfo.status" placement="row">
|
||||
<up-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in radiolist" :key="index"
|
||||
:label="item.name" :name="item.value" @change="radioChange">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</up-form-item>
|
||||
<!-- <up-form-item label="标签" :borderBottom="false">
|
||||
<view v-for="(item, index) in tabsList" @click="clickTab(index)" :key="index"
|
||||
:class="{active:!goodsInfo.tabs.includes(index),actived:goodsInfo.tabs.includes(index)}">
|
||||
{{item}}
|
||||
</view>
|
||||
</up-form-item> -->
|
||||
</up-form>
|
||||
</view>
|
||||
|
||||
<view class="" style="width: 100%; height: 200rpx;">
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 底部操作按钮 -->
|
||||
<view class="action-buttons">
|
||||
<u-button type="primary" @click="Service.GoPageBack()" :custom-style="ButtonStyle">取消</u-button>
|
||||
<u-button type="primary" @click="save()" :custom-style="ButtonStyle">{{ goodsInfo.goodsId?'修改':'添加' }}</u-button>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- <up-picker :show="showClass" @cancel="showClass=!showClass" @confirm="confirmClass"
|
||||
:columns="columns"></up-picker> -->
|
||||
</view>
|
||||
|
||||
<ImageCropperFunc style="z-index: 200;" :show="upImgShow" :url="upImgUrl" :imgName="imgName" :width="upImgwidth"
|
||||
:height="upImgheight" :upType="upImgType" :retFun="upImgData">
|
||||
</ImageCropperFunc>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onShow, onLoad } from "@dcloudio/uni-app";
|
||||
import { Service } from "@/Service/Service"
|
||||
import { ref } from "vue";
|
||||
import ImageCropperFunc from "@/components/ImageCropper"
|
||||
import { vpMerchService } from '@/Service/vp/vpMerchService'
|
||||
|
||||
interface Goods{
|
||||
img:string
|
||||
name: string
|
||||
price: number
|
||||
brief: string
|
||||
status: number
|
||||
goodsId:string
|
||||
}
|
||||
|
||||
let goodsInfo = ref<Goods>({
|
||||
img:'',
|
||||
name: "",
|
||||
price: 0,
|
||||
brief: "",
|
||||
status: 0,
|
||||
goodsId:''
|
||||
})
|
||||
|
||||
let radioStatus=ref('上架中')
|
||||
let showClass = ref(false)
|
||||
const columns = ref([
|
||||
['中国', '美国', '日本']
|
||||
]);
|
||||
|
||||
const radiolist = ref([
|
||||
{
|
||||
name: '上架中',
|
||||
value: 1
|
||||
|
||||
},
|
||||
{
|
||||
name: '已下架',
|
||||
value: 0
|
||||
}
|
||||
]);
|
||||
|
||||
|
||||
let tabsList = ref([
|
||||
'新品',
|
||||
'热销',
|
||||
'推荐',
|
||||
'折扣',
|
||||
'特惠'
|
||||
])
|
||||
|
||||
|
||||
const ButtonStyle = ref({
|
||||
backgroundColor: '#FF6600',
|
||||
borderColor: '#FF6600',
|
||||
color: '#FFFFFF',
|
||||
fontSize: '28rpx',
|
||||
height: '75rpx',
|
||||
borderRadius: '45rpx',
|
||||
marginLeft: '20rpx'
|
||||
});
|
||||
|
||||
// 裁剪图片参数
|
||||
let upImgShow = ref<boolean>(false)
|
||||
let upImgUrl = ref<string>('')
|
||||
let upImgwidth = ref<number>(0)
|
||||
let upImgheight = ref<number>(0)
|
||||
let upImgType = ref<string>('')
|
||||
let imgName = ref<string>('')
|
||||
|
||||
onLoad((dada:any) => {
|
||||
if(dada.goodsId){
|
||||
goodsInfo.value.goodsId=dada.goodsId
|
||||
getData()
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
|
||||
});
|
||||
|
||||
|
||||
const getData=()=>{
|
||||
vpMerchService.GetGoodsInfo(goodsInfo.value.goodsId,1).then(res=>{
|
||||
goodsInfo.value=res.data.goodsInfo
|
||||
console.log(goodsInfo.value.status);
|
||||
})
|
||||
}
|
||||
|
||||
// const confirmClass = (e) => {
|
||||
// goodsInfo.value.class = e.value[0]
|
||||
// showClass.value = !showClass.value
|
||||
// }
|
||||
|
||||
|
||||
const radioChange = (e) => {
|
||||
|
||||
goodsInfo.value.status = e
|
||||
}
|
||||
|
||||
// const clickTab = (e : any) => {
|
||||
// if (goodsInfo.value.tabs.includes(e)) {
|
||||
// let a = goodsInfo.value.tabs.findIndex((x) => {
|
||||
// return x == e
|
||||
// })
|
||||
// goodsInfo.value.tabs.splice(a, 1)
|
||||
// return
|
||||
// }
|
||||
|
||||
// goodsInfo.value.tabs.push(e)
|
||||
// }
|
||||
|
||||
const save=()=>{
|
||||
if(!goodsInfo.value.img){
|
||||
Service.Msg('请上传图片!')
|
||||
return
|
||||
}
|
||||
if(!goodsInfo.value.name){
|
||||
Service.Msg('请输入商品名称!')
|
||||
return
|
||||
}
|
||||
if(!goodsInfo.value.price){
|
||||
Service.Msg('请输入商品价格!')
|
||||
return
|
||||
}
|
||||
if(!goodsInfo.value.brief){
|
||||
Service.Msg('请输入商品描述!')
|
||||
return
|
||||
}
|
||||
if(!goodsInfo.value.status){
|
||||
Service.Msg('请选择商品当前状态!')
|
||||
return
|
||||
}
|
||||
vpMerchService.UpdateMerchGoods(goodsInfo.value.goodsId==''?'':goodsInfo.value.goodsId,goodsInfo.value.name,goodsInfo.value.img,goodsInfo.value.price,goodsInfo.value.brief,goodsInfo.value.status).then(res=>{
|
||||
if(res.code==0){
|
||||
Service.Msg(goodsInfo.value.goodsId?'修改成功':'添加成功')
|
||||
setTimeout(()=>{
|
||||
Service.GoPageBack()
|
||||
},2500)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
const uploadFImg = (width : any, height : any, Type : any, Name : any) => {
|
||||
uni.chooseImage({
|
||||
count: 1, // 最多选择3张图片
|
||||
sizeType: ['original', 'compressed'], // 支持原图和压缩图
|
||||
sourceType: ['album', 'camera'], // 可从相册选择或使用相机拍照
|
||||
success: function (res) {
|
||||
let path = res.tempFiles[0].path
|
||||
upImgUrl.value = path
|
||||
upImgwidth.value = width
|
||||
upImgheight.value = height
|
||||
upImgType.value = Type
|
||||
imgName.value = Name
|
||||
upImgShow.value = true
|
||||
},
|
||||
fail: function (err) {
|
||||
console.error('选择失败:', err.errMsg);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const upImgData = (e : any) => {
|
||||
upImgShow.value = false
|
||||
goodsInfo.value.img = e.url
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
.active {
|
||||
color: #b5b5b5;
|
||||
border: 1rpx solid #b5b5b5;
|
||||
margin-right: 15rpx;
|
||||
border-radius: 23rpx;
|
||||
padding: 5rpx 16rpx;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.actived {
|
||||
color: var(--nav-mian);
|
||||
border: 1rpx solid var(--nav-mian);
|
||||
margin-right: 15rpx;
|
||||
border-radius: 23rpx;
|
||||
padding: 5rpx 16rpx;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
/* 底部操作按钮 */
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
padding: 30rpx 30rpx;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background-color: #ffffff;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user