Initial commit of akmon project
This commit is contained in:
677
pages/mall/merchant/index.uvue
Normal file
677
pages/mall/merchant/index.uvue
Normal file
@@ -0,0 +1,677 @@
|
||||
<!-- 商家端首页 - UTS Android 兼容 -->
|
||||
<template>
|
||||
<view class="merchant-container">
|
||||
<!-- 头部导航 -->
|
||||
<view class="header">
|
||||
<view class="header-content">
|
||||
<view class="shop-info">
|
||||
<image :src="shopInfo.shop_logo || '/static/default-shop.png'" class="shop-logo" mode="aspectFit" />
|
||||
<view class="shop-details">
|
||||
<text class="shop-name">{{ shopInfo.shop_name }}</text>
|
||||
<view class="shop-stats">
|
||||
<text class="stat-item">评分: {{ shopInfo.rating }}</text>
|
||||
<text class="stat-item">销量: {{ shopInfo.total_sales }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="header-actions">
|
||||
<text class="action-btn" @click="goToMessages">消息</text>
|
||||
<text class="action-btn" @click="goToSettings">设置</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 数据概览 -->
|
||||
<view class="overview-section">
|
||||
<text class="section-title">今日数据</text>
|
||||
<view class="overview-grid">
|
||||
<view class="overview-item">
|
||||
<text class="overview-value">{{ todayStats.orders }}</text>
|
||||
<text class="overview-label">订单数</text>
|
||||
</view>
|
||||
<view class="overview-item">
|
||||
<text class="overview-value">¥{{ todayStats.sales }}</text>
|
||||
<text class="overview-label">销售额</text>
|
||||
</view>
|
||||
<view class="overview-item">
|
||||
<text class="overview-value">{{ todayStats.visitors }}</text>
|
||||
<text class="overview-label">访客数</text>
|
||||
</view>
|
||||
<view class="overview-item">
|
||||
<text class="overview-value">{{ todayStats.conversion }}</text>
|
||||
<text class="overview-label">转化率</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 待处理事项 -->
|
||||
<view class="pending-section">
|
||||
<text class="section-title">待处理</text>
|
||||
<view class="pending-list">
|
||||
<view class="pending-item" @click="goToOrders('pending')">
|
||||
<text class="pending-icon">📦</text>
|
||||
<text class="pending-text">待发货订单</text>
|
||||
<text class="pending-count">{{ pendingCounts.pending_shipment }}</text>
|
||||
</view>
|
||||
<view class="pending-item" @click="goToOrders('refund')">
|
||||
<text class="pending-icon">↩️</text>
|
||||
<text class="pending-text">退款处理</text>
|
||||
<text class="pending-count">{{ pendingCounts.refund_requests }}</text>
|
||||
</view>
|
||||
<view class="pending-item" @click="goToProducts('low_stock')">
|
||||
<text class="pending-icon">⚠️</text>
|
||||
<text class="pending-text">库存预警</text>
|
||||
<text class="pending-count">{{ pendingCounts.low_stock }}</text>
|
||||
</view>
|
||||
<view class="pending-item" @click="goToReviews">
|
||||
<text class="pending-icon">💬</text>
|
||||
<text class="pending-text">待回复评价</text>
|
||||
<text class="pending-count">{{ pendingCounts.pending_reviews }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 快捷功能 -->
|
||||
<view class="shortcuts-section">
|
||||
<text class="section-title">快捷功能</text>
|
||||
<view class="shortcuts-grid">
|
||||
<view class="shortcut-item" @click="goToProducts('add')">
|
||||
<text class="shortcut-icon">➕</text>
|
||||
<text class="shortcut-text">添加商品</text>
|
||||
</view>
|
||||
<view class="shortcut-item" @click="goToOrders('all')">
|
||||
<text class="shortcut-icon">📋</text>
|
||||
<text class="shortcut-text">订单管理</text>
|
||||
</view>
|
||||
<view class="shortcut-item" @click="goToProducts('manage')">
|
||||
<text class="shortcut-icon">📦</text>
|
||||
<text class="shortcut-text">商品管理</text>
|
||||
</view>
|
||||
<view class="shortcut-item" @click="goToPromotions">
|
||||
<text class="shortcut-icon">🎯</text>
|
||||
<text class="shortcut-text">营销活动</text>
|
||||
</view>
|
||||
<view class="shortcut-item" @click="goToStatistics">
|
||||
<text class="shortcut-icon">📊</text>
|
||||
<text class="shortcut-text">数据统计</text>
|
||||
</view>
|
||||
<view class="shortcut-item" @click="goToFinance">
|
||||
<text class="shortcut-icon">💰</text>
|
||||
<text class="shortcut-text">财务结算</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 最新订单 -->
|
||||
<view class="recent-orders-section">
|
||||
<view class="section-header">
|
||||
<text class="section-title">最新订单</text>
|
||||
<text class="section-more" @click="goToOrders('all')">查看全部</text>
|
||||
</view>
|
||||
<view class="orders-list">
|
||||
<view v-for="order in recentOrders" :key="order.id" class="order-item" @click="goToOrderDetail(order.id)">
|
||||
<view class="order-header">
|
||||
<text class="order-no">{{ order.order_no }}</text>
|
||||
<text class="order-status" :class="getOrderStatusClass(order.status)">{{ getOrderStatusText(order.status) }}</text>
|
||||
</view>
|
||||
<view class="order-products">
|
||||
<view v-for="item in order.items" :key="item.id" class="product-item">
|
||||
<image :src="item.product_image || '/static/default-product.png'" class="product-image" mode="aspectFit" />
|
||||
<view class="product-info">
|
||||
<text class="product-name">{{ item.product_name }}</text>
|
||||
<text class="product-spec">{{ item.sku_specifications || '' }}</text>
|
||||
<text class="product-price">¥{{ item.price }} × {{ item.quantity }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="order-footer">
|
||||
<text class="order-amount">合计: ¥{{ order.actual_amount }}</text>
|
||||
<text class="order-time">{{ formatTime(order.created_at) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="uts">
|
||||
import type {
|
||||
MerchantType,
|
||||
OrderType,
|
||||
OrderItemType,
|
||||
ProductType
|
||||
} from '@/types/mall-types.uts'
|
||||
|
||||
type TodayStatsType = {
|
||||
orders: number
|
||||
sales: string
|
||||
visitors: number
|
||||
conversion: string
|
||||
}
|
||||
|
||||
type PendingCountsType = {
|
||||
pending_shipment: number
|
||||
refund_requests: number
|
||||
low_stock: number
|
||||
pending_reviews: number
|
||||
}
|
||||
|
||||
type RecentOrderType = {
|
||||
id: string
|
||||
order_no: string
|
||||
status: number
|
||||
actual_amount: number
|
||||
created_at: string
|
||||
items: Array<OrderItemType & { product_image: string }>
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
shopInfo: {
|
||||
id: '',
|
||||
user_id: '',
|
||||
shop_name: '我的店铺',
|
||||
shop_logo: '',
|
||||
shop_banner: '',
|
||||
shop_description: '',
|
||||
contact_name: '',
|
||||
contact_phone: '',
|
||||
shop_status: 1,
|
||||
rating: 5.0,
|
||||
total_sales: 0,
|
||||
created_at: ''
|
||||
} as MerchantType,
|
||||
|
||||
todayStats: {
|
||||
orders: 0,
|
||||
sales: '0.00',
|
||||
visitors: 0,
|
||||
conversion: '0.00%'
|
||||
} as TodayStatsType,
|
||||
|
||||
pendingCounts: {
|
||||
pending_shipment: 0,
|
||||
refund_requests: 0,
|
||||
low_stock: 0,
|
||||
pending_reviews: 0
|
||||
} as PendingCountsType,
|
||||
|
||||
recentOrders: [] as Array<RecentOrderType>
|
||||
}
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.loadMerchantData()
|
||||
this.loadTodayStats()
|
||||
this.loadPendingCounts()
|
||||
this.loadRecentOrders()
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 加载商家信息
|
||||
loadMerchantData() {
|
||||
// TODO: 调用API获取商家信息
|
||||
console.log('Loading merchant data...')
|
||||
},
|
||||
|
||||
// 加载今日统计
|
||||
loadTodayStats() {
|
||||
// TODO: 调用API获取今日统计数据
|
||||
this.todayStats = {
|
||||
orders: 25,
|
||||
sales: '8,350.00',
|
||||
visitors: 156,
|
||||
conversion: '16.03%'
|
||||
}
|
||||
},
|
||||
|
||||
// 加载待处理数量
|
||||
loadPendingCounts() {
|
||||
// TODO: 调用API获取待处理数量
|
||||
this.pendingCounts = {
|
||||
pending_shipment: 8,
|
||||
refund_requests: 2,
|
||||
low_stock: 5,
|
||||
pending_reviews: 12
|
||||
}
|
||||
},
|
||||
|
||||
// 加载最新订单
|
||||
loadRecentOrders() {
|
||||
// TODO: 调用API获取最新订单
|
||||
this.recentOrders = [
|
||||
{
|
||||
id: '1',
|
||||
order_no: 'M202501081234',
|
||||
status: 2,
|
||||
actual_amount: 299.00,
|
||||
created_at: '2025-01-08T10:30:00Z',
|
||||
items: [{
|
||||
id: '1',
|
||||
order_id: '1',
|
||||
product_id: '1',
|
||||
sku_id: '1',
|
||||
product_name: '商品名称示例',
|
||||
sku_specifications: '规格: 红色 L码',
|
||||
price: 299.00,
|
||||
quantity: 1,
|
||||
total_amount: 299.00,
|
||||
created_at: '2025-01-08T10:30:00Z',
|
||||
product_image: '/static/product1.jpg'
|
||||
}]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// 获取订单状态样式
|
||||
getOrderStatusClass(status: number): string {
|
||||
switch (status) {
|
||||
case 1: return 'status-pending'
|
||||
case 2: return 'status-paid'
|
||||
case 3: return 'status-shipped'
|
||||
case 4: return 'status-delivered'
|
||||
case 5: return 'status-completed'
|
||||
default: return 'status-default'
|
||||
}
|
||||
},
|
||||
|
||||
// 获取订单状态文本
|
||||
getOrderStatusText(status: number): string {
|
||||
switch (status) {
|
||||
case 1: return '待付款'
|
||||
case 2: return '待发货'
|
||||
case 3: return '已发货'
|
||||
case 4: return '已收货'
|
||||
case 5: return '已完成'
|
||||
default: return '未知状态'
|
||||
}
|
||||
},
|
||||
|
||||
// 格式化时间
|
||||
formatTime(timeStr: string): string {
|
||||
const date = new Date(timeStr)
|
||||
const now = new Date()
|
||||
const diff = now.getTime() - date.getTime()
|
||||
const minutes = Math.floor(diff / (1000 * 60))
|
||||
|
||||
if (minutes < 60) {
|
||||
return `${minutes}分钟前`
|
||||
} else if (minutes < 1440) {
|
||||
return `${Math.floor(minutes / 60)}小时前`
|
||||
} else {
|
||||
return `${Math.floor(minutes / 1440)}天前`
|
||||
}
|
||||
},
|
||||
|
||||
// 导航方法
|
||||
goToMessages() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/merchant/messages'
|
||||
})
|
||||
},
|
||||
|
||||
goToSettings() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/merchant/settings'
|
||||
})
|
||||
},
|
||||
|
||||
goToOrders(type: string) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/mall/merchant/orders?type=${type}`
|
||||
})
|
||||
},
|
||||
|
||||
goToProducts(type: string) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/mall/merchant/products?type=${type}`
|
||||
})
|
||||
},
|
||||
|
||||
goToPromotions() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/merchant/promotions'
|
||||
})
|
||||
},
|
||||
|
||||
goToStatistics() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/merchant/statistics'
|
||||
})
|
||||
},
|
||||
|
||||
goToFinance() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/merchant/finance'
|
||||
})
|
||||
},
|
||||
|
||||
goToReviews() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/merchant/reviews'
|
||||
})
|
||||
},
|
||||
|
||||
goToOrderDetail(orderId: string) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/mall/merchant/order-detail?id=${orderId}`
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.merchant-container {
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.header {
|
||||
background-color: #fff;
|
||||
padding: 20rpx 30rpx;
|
||||
border-bottom: 1rpx solid #e5e5e5;
|
||||
}
|
||||
|
||||
.header-content {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.shop-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.shop-logo {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.shop-details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.shop-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.shop-stats {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
font-size: 28rpx;
|
||||
color: #007AFF;
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
|
||||
.overview-section {
|
||||
background-color: #fff;
|
||||
margin: 20rpx;
|
||||
padding: 30rpx;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.overview-grid {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.overview-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.overview-value {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #FF6B35;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.overview-label {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.pending-section {
|
||||
background-color: #fff;
|
||||
margin: 20rpx;
|
||||
padding: 30rpx;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.pending-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.pending-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20rpx 0;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.pending-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.pending-icon {
|
||||
font-size: 32rpx;
|
||||
margin-right: 20rpx;
|
||||
width: 40rpx;
|
||||
}
|
||||
|
||||
.pending-text {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.pending-count {
|
||||
font-size: 28rpx;
|
||||
color: #FF6B35;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.shortcuts-section {
|
||||
background-color: #fff;
|
||||
margin: 20rpx;
|
||||
padding: 30rpx;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.shortcuts-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.shortcut-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 30%;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.shortcut-icon {
|
||||
font-size: 48rpx;
|
||||
margin-bottom: 15rpx;
|
||||
}
|
||||
|
||||
.shortcut-text {
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.recent-orders-section {
|
||||
background-color: #fff;
|
||||
margin: 20rpx;
|
||||
padding: 30rpx;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.section-more {
|
||||
font-size: 24rpx;
|
||||
color: #007AFF;
|
||||
}
|
||||
|
||||
.orders-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.order-item {
|
||||
border: 1rpx solid #e5e5e5;
|
||||
border-radius: 12rpx;
|
||||
padding: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.order-item:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.order-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 15rpx;
|
||||
}
|
||||
|
||||
.order-no {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.order-status {
|
||||
font-size: 24rpx;
|
||||
padding: 8rpx 16rpx;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.status-pending {
|
||||
background-color: #FFF3CD;
|
||||
color: #856404;
|
||||
}
|
||||
|
||||
.status-paid {
|
||||
background-color: #D4EDDA;
|
||||
color: #155724;
|
||||
}
|
||||
|
||||
.status-shipped {
|
||||
background-color: #CCE5FF;
|
||||
color: #004085;
|
||||
}
|
||||
|
||||
.status-delivered {
|
||||
background-color: #E2E3E5;
|
||||
color: #383D41;
|
||||
}
|
||||
|
||||
.status-completed {
|
||||
background-color: #D1ECF1;
|
||||
color: #0C5460;
|
||||
}
|
||||
|
||||
.order-products {
|
||||
margin-bottom: 15rpx;
|
||||
}
|
||||
|
||||
.product-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.product-item:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.product-image {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 8rpx;
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
|
||||
.product-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.product-name {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
|
||||
.product-spec {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
|
||||
.product-price {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.order-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.order-amount {
|
||||
font-size: 28rpx;
|
||||
color: #FF6B35;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.order-time {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
707
pages/mall/merchant/product-detail.uvue
Normal file
707
pages/mall/merchant/product-detail.uvue
Normal file
@@ -0,0 +1,707 @@
|
||||
<!-- 商家端 - 商品管理详情页 -->
|
||||
<template>
|
||||
<view class="product-manage-detail">
|
||||
<!-- 商品基本信息 -->
|
||||
<view class="product-section">
|
||||
<view class="section-header">
|
||||
<text class="section-title">商品信息</text>
|
||||
<text class="edit-btn" @click="editProduct">编辑</text>
|
||||
</view>
|
||||
|
||||
<view class="product-images">
|
||||
<view class="image-list">
|
||||
<view v-for="(image, index) in product.images" :key="index" class="image-item">
|
||||
<image :src="image" class="product-image" mode="aspectFit" />
|
||||
</view>
|
||||
<view class="add-image" @click="addImage">+</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="product-info">
|
||||
<view class="info-item">
|
||||
<text class="info-label">商品名称</text>
|
||||
<text class="info-value">{{ product.name }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">商品描述</text>
|
||||
<text class="info-value">{{ product.description || '暂无描述' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">商品价格</text>
|
||||
<text class="info-value price">¥{{ product.price }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">原价</text>
|
||||
<text class="info-value">¥{{ product.original_price || '未设置' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">库存数量</text>
|
||||
<text class="info-value">{{ product.stock }}件</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">销量</text>
|
||||
<text class="info-value">{{ product.sales }}件</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">商品状态</text>
|
||||
<text class="info-value" :class="{ 'status-on': product.status === 1, 'status-off': product.status === 0 }">
|
||||
{{ product.status === 1 ? '上架' : '下架' }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- SKU规格管理 -->
|
||||
<view class="sku-section">
|
||||
<view class="section-header">
|
||||
<text class="section-title">规格管理</text>
|
||||
<text class="add-btn" @click="addSku">添加规格</text>
|
||||
</view>
|
||||
|
||||
<view v-if="productSkus.length === 0" class="empty-sku">
|
||||
<text class="empty-text">暂无规格,点击添加规格</text>
|
||||
</view>
|
||||
|
||||
<view v-for="sku in productSkus" :key="sku.id" class="sku-item">
|
||||
<view class="sku-info">
|
||||
<text class="sku-code">{{ sku.sku_code }}</text>
|
||||
<text class="sku-spec">{{ getSkuSpecText(sku) }}</text>
|
||||
</view>
|
||||
<view class="sku-details">
|
||||
<text class="sku-price">¥{{ sku.price }}</text>
|
||||
<text class="sku-stock">库存: {{ sku.stock }}</text>
|
||||
<text class="sku-status" :class="{ 'status-on': sku.status === 1, 'status-off': sku.status === 0 }">
|
||||
{{ sku.status === 1 ? '启用' : '禁用' }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="sku-actions">
|
||||
<text class="action-btn edit" @click="editSku(sku)">编辑</text>
|
||||
<text class="action-btn delete" @click="deleteSku(sku)">删除</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 销售数据 -->
|
||||
<view class="sales-section">
|
||||
<view class="section-header">
|
||||
<text class="section-title">销售数据</text>
|
||||
<text class="view-detail" @click="viewSalesDetail">查看详情</text>
|
||||
</view>
|
||||
|
||||
<view class="sales-stats">
|
||||
<view class="stat-item">
|
||||
<text class="stat-value">{{ salesData.today_sales }}</text>
|
||||
<text class="stat-label">今日销量</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="stat-value">{{ salesData.week_sales }}</text>
|
||||
<text class="stat-label">本周销量</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="stat-value">{{ salesData.month_sales }}</text>
|
||||
<text class="stat-label">本月销量</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="stat-value">¥{{ salesData.total_revenue }}</text>
|
||||
<text class="stat-label">总收入</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 评价管理 -->
|
||||
<view class="review-section">
|
||||
<view class="section-header">
|
||||
<text class="section-title">商品评价</text>
|
||||
<text class="view-all" @click="viewAllReviews">查看全部</text>
|
||||
</view>
|
||||
|
||||
<view class="review-summary">
|
||||
<view class="rating-info">
|
||||
<text class="rating-score">{{ reviewData.average_rating.toFixed(1) }}</text>
|
||||
<view class="rating-stars">
|
||||
<text v-for="i in 5" :key="i" class="star" :class="{ filled: i <= Math.floor(reviewData.average_rating) }">★</text>
|
||||
</view>
|
||||
<text class="review-count">{{ reviewData.total_reviews }}条评价</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="recentReviews.length > 0" class="recent-reviews">
|
||||
<view v-for="review in recentReviews" :key="review.id" class="review-item">
|
||||
<view class="review-header">
|
||||
<text class="reviewer-name">{{ review.user_name }}</text>
|
||||
<view class="review-rating">
|
||||
<text v-for="i in review.rating" :key="i" class="star filled">★</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="review-content">{{ review.content }}</text>
|
||||
<text class="review-time">{{ formatTime(review.created_at) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="action-buttons">
|
||||
<button class="action-btn primary" @click="toggleProductStatus">
|
||||
{{ product.status === 1 ? '下架商品' : '上架商品' }}
|
||||
</button>
|
||||
<button class="action-btn secondary" @click="editProduct">编辑商品</button>
|
||||
<button class="action-btn danger" @click="deleteProduct">删除商品</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ProductType, ProductSkuType } from '@/types/mall-types.uts'
|
||||
|
||||
type SalesDataType = {
|
||||
today_sales: number
|
||||
week_sales: number
|
||||
month_sales: number
|
||||
total_revenue: number
|
||||
}
|
||||
|
||||
type ReviewDataType = {
|
||||
average_rating: number
|
||||
total_reviews: number
|
||||
}
|
||||
|
||||
type ReviewType = {
|
||||
id: string
|
||||
user_name: string
|
||||
rating: number
|
||||
content: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
product: {
|
||||
id: '',
|
||||
merchant_id: '',
|
||||
category_id: '',
|
||||
name: '',
|
||||
description: '',
|
||||
images: [] as Array<string>,
|
||||
price: 0,
|
||||
original_price: 0,
|
||||
stock: 0,
|
||||
sales: 0,
|
||||
status: 0,
|
||||
created_at: ''
|
||||
} as ProductType,
|
||||
productSkus: [] as Array<ProductSkuType>,
|
||||
salesData: {
|
||||
today_sales: 0,
|
||||
week_sales: 0,
|
||||
month_sales: 0,
|
||||
total_revenue: 0
|
||||
} as SalesDataType,
|
||||
reviewData: {
|
||||
average_rating: 0,
|
||||
total_reviews: 0
|
||||
} as ReviewDataType,
|
||||
recentReviews: [] as Array<ReviewType>
|
||||
}
|
||||
},
|
||||
onLoad(options: any) {
|
||||
const productId = options.productId as string
|
||||
if (productId) {
|
||||
this.loadProductDetail(productId)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadProductDetail(productId: string) {
|
||||
// 模拟加载商品详情数据
|
||||
this.product = {
|
||||
id: productId,
|
||||
merchant_id: 'merchant_001',
|
||||
category_id: 'cat_001',
|
||||
name: '精选好物商品',
|
||||
description: '这是一个高品质的商品,具有优秀的性能和优美的外观设计。',
|
||||
images: [
|
||||
'/static/product1.jpg',
|
||||
'/static/product2.jpg',
|
||||
'/static/product3.jpg'
|
||||
],
|
||||
price: 199.99,
|
||||
original_price: 299.99,
|
||||
stock: 100,
|
||||
sales: 1256,
|
||||
status: 1,
|
||||
created_at: '2024-01-15'
|
||||
}
|
||||
|
||||
this.productSkus = [
|
||||
{
|
||||
id: 'sku_001',
|
||||
product_id: productId,
|
||||
sku_code: 'SKU001',
|
||||
specifications: { color: '红色', size: 'M' },
|
||||
price: 199.99,
|
||||
stock: 50,
|
||||
image_url: '/static/sku1.jpg',
|
||||
status: 1
|
||||
},
|
||||
{
|
||||
id: 'sku_002',
|
||||
product_id: productId,
|
||||
sku_code: 'SKU002',
|
||||
specifications: { color: '蓝色', size: 'L' },
|
||||
price: 219.99,
|
||||
stock: 30,
|
||||
image_url: '/static/sku2.jpg',
|
||||
status: 1
|
||||
}
|
||||
]
|
||||
|
||||
this.salesData = {
|
||||
today_sales: 5,
|
||||
week_sales: 28,
|
||||
month_sales: 156,
|
||||
total_revenue: 25680.50
|
||||
}
|
||||
|
||||
this.reviewData = {
|
||||
average_rating: 4.6,
|
||||
total_reviews: 89
|
||||
}
|
||||
|
||||
this.recentReviews = [
|
||||
{
|
||||
id: 'review_001',
|
||||
user_name: '用户***123',
|
||||
rating: 5,
|
||||
content: '商品质量很好,物流也很快,满意!',
|
||||
created_at: '2024-01-14 15:30:00'
|
||||
},
|
||||
{
|
||||
id: 'review_002',
|
||||
user_name: '用户***456',
|
||||
rating: 4,
|
||||
content: '整体不错,就是包装有点简单。',
|
||||
created_at: '2024-01-13 09:20:00'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
getSkuSpecText(sku: ProductSkuType): string {
|
||||
if (sku.specifications) {
|
||||
const specs: any = sku.specifications
|
||||
return Object.keys(specs).map(key => `${key}: ${specs[key]}`).join(', ')
|
||||
}
|
||||
return '无规格'
|
||||
},
|
||||
|
||||
formatTime(timeStr: string): string {
|
||||
return timeStr.replace('T', ' ').split('.')[0]
|
||||
},
|
||||
|
||||
editProduct() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/mall/merchant/product-edit?productId=${this.product.id}`
|
||||
})
|
||||
},
|
||||
|
||||
addImage() {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
success: (res) => {
|
||||
this.product.images.push(res.tempFilePaths[0])
|
||||
uni.showToast({
|
||||
title: '图片添加成功',
|
||||
icon: 'success'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
addSku() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/mall/merchant/sku-add?productId=${this.product.id}`
|
||||
})
|
||||
},
|
||||
|
||||
editSku(sku: ProductSkuType) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/mall/merchant/sku-edit?skuId=${sku.id}`
|
||||
})
|
||||
},
|
||||
|
||||
deleteSku(sku: ProductSkuType) {
|
||||
uni.showModal({
|
||||
title: '确认删除',
|
||||
content: `确定要删除规格 ${sku.sku_code} 吗?`,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.productSkus = this.productSkus.filter(item => item.id !== sku.id)
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
viewSalesDetail() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/mall/merchant/sales-detail?productId=${this.product.id}`
|
||||
})
|
||||
},
|
||||
|
||||
viewAllReviews() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/mall/merchant/product-reviews?productId=${this.product.id}`
|
||||
})
|
||||
},
|
||||
|
||||
toggleProductStatus() {
|
||||
const newStatus = this.product.status === 1 ? 0 : 1
|
||||
const actionText = newStatus === 1 ? '上架' : '下架'
|
||||
|
||||
uni.showModal({
|
||||
title: `确认${actionText}`,
|
||||
content: `确定要${actionText}这个商品吗?`,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.product.status = newStatus
|
||||
uni.showToast({
|
||||
title: `${actionText}成功`,
|
||||
icon: 'success'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
deleteProduct() {
|
||||
uni.showModal({
|
||||
title: '确认删除',
|
||||
content: '删除后将无法恢复,确定要删除这个商品吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.product-manage-detail {
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
padding-bottom: 200rpx;
|
||||
}
|
||||
|
||||
.product-section, .sku-section, .sales-section, .review-section {
|
||||
background-color: #fff;
|
||||
margin-bottom: 20rpx;
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 30rpx;
|
||||
padding-bottom: 20rpx;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.edit-btn, .add-btn, .view-detail, .view-all {
|
||||
font-size: 26rpx;
|
||||
color: #007aff;
|
||||
}
|
||||
|
||||
.product-images {
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.image-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.image-item, .add-image {
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.product-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.add-image {
|
||||
background-color: #f5f5f5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 48rpx;
|
||||
color: #999;
|
||||
border: 2rpx dashed #ddd;
|
||||
}
|
||||
|
||||
.product-info {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20rpx 0;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
width: 150rpx;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.info-value.price {
|
||||
color: #ff4444;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.status-on {
|
||||
color: #4caf50 !important;
|
||||
}
|
||||
|
||||
.status-off {
|
||||
color: #ff4444 !important;
|
||||
}
|
||||
|
||||
.empty-sku {
|
||||
text-align: center;
|
||||
padding: 60rpx 0;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.sku-item {
|
||||
padding: 25rpx 0;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
}
|
||||
|
||||
.sku-info {
|
||||
margin-bottom: 15rpx;
|
||||
}
|
||||
|
||||
.sku-code {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.sku-spec {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.sku-details {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 15rpx;
|
||||
}
|
||||
|
||||
.sku-price {
|
||||
font-size: 26rpx;
|
||||
color: #ff4444;
|
||||
font-weight: bold;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
|
||||
.sku-stock {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
|
||||
.sku-status {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.sku-actions {
|
||||
display: flex;
|
||||
gap: 30rpx;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
font-size: 24rpx;
|
||||
padding: 10rpx 20rpx;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
|
||||
.action-btn.edit {
|
||||
background-color: #e3f2fd;
|
||||
color: #007aff;
|
||||
}
|
||||
|
||||
.action-btn.delete {
|
||||
background-color: #ffebee;
|
||||
color: #ff4444;
|
||||
}
|
||||
|
||||
.sales-stats {
|
||||
display: flex;
|
||||
gap: 30rpx;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
padding: 30rpx 0;
|
||||
background-color: #f8f9fa;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.review-summary {
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.rating-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.rating-score {
|
||||
font-size: 48rpx;
|
||||
font-weight: bold;
|
||||
color: #ffa726;
|
||||
}
|
||||
|
||||
.rating-stars {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.star {
|
||||
font-size: 24rpx;
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.star.filled {
|
||||
color: #ffa726;
|
||||
}
|
||||
|
||||
.review-count {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.recent-reviews {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.review-item {
|
||||
padding: 25rpx 0;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
}
|
||||
|
||||
.review-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 15rpx;
|
||||
}
|
||||
|
||||
.reviewer-name {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.review-rating {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.review-content {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.review-time {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: #fff;
|
||||
padding: 30rpx;
|
||||
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.1);
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.action-buttons .action-btn {
|
||||
flex: 1;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
font-size: 28rpx;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.action-buttons .action-btn.primary {
|
||||
background-color: #4caf50;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.action-buttons .action-btn.secondary {
|
||||
background-color: #ffa726;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.action-buttons .action-btn.danger {
|
||||
background-color: #ff4444;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
761
pages/mall/merchant/profile.uvue
Normal file
761
pages/mall/merchant/profile.uvue
Normal file
@@ -0,0 +1,761 @@
|
||||
<!-- 商家端 - 个人中心 -->
|
||||
<template>
|
||||
<view class="merchant-profile">
|
||||
<!-- 店铺信息头部 -->
|
||||
<view class="profile-header">
|
||||
<image :src="shopInfo.shop_logo || '/static/default-shop.png'" class="shop-logo" @click="editShop" />
|
||||
<view class="shop-info">
|
||||
<text class="shop-name">{{ shopInfo.shop_name }}</text>
|
||||
<text class="shop-status">{{ getShopStatus() }}</text>
|
||||
<view class="shop-stats">
|
||||
<text class="stat-item">评分: {{ shopInfo.rating }}/5.0</text>
|
||||
<text class="stat-item">总销量: {{ shopInfo.total_sales }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="settings-icon" @click="goToSettings">⚙️</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单管理快捷入口 -->
|
||||
<view class="order-shortcuts">
|
||||
<view class="section-title">订单管理</view>
|
||||
<view class="order-tabs">
|
||||
<view class="order-tab" @click="goToOrders('all')">
|
||||
<text class="tab-icon">📋</text>
|
||||
<text class="tab-text">全部订单</text>
|
||||
<text v-if="orderCounts.total > 0" class="tab-badge">{{ orderCounts.total }}</text>
|
||||
</view>
|
||||
<view class="order-tab" @click="goToOrders('pending')">
|
||||
<text class="tab-icon">💰</text>
|
||||
<text class="tab-text">待发货</text>
|
||||
<text v-if="orderCounts.pending > 0" class="tab-badge alert">{{ orderCounts.pending }}</text>
|
||||
</view>
|
||||
<view class="order-tab" @click="goToOrders('shipped')">
|
||||
<text class="tab-icon">🚚</text>
|
||||
<text class="tab-text">已发货</text>
|
||||
<text v-if="orderCounts.shipped > 0" class="tab-badge">{{ orderCounts.shipped }}</text>
|
||||
</view>
|
||||
<view class="order-tab" @click="goToOrders('refund')">
|
||||
<text class="tab-icon">↩️</text>
|
||||
<text class="tab-text">退款</text>
|
||||
<text v-if="orderCounts.refund > 0" class="tab-badge alert">{{ orderCounts.refund }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 今日经营数据 -->
|
||||
<view class="today-stats">
|
||||
<view class="section-title">今日经营</view>
|
||||
<view class="stats-grid">
|
||||
<view class="stat-card">
|
||||
<text class="stat-value">¥{{ todayStats.revenue }}</text>
|
||||
<text class="stat-label">营业额</text>
|
||||
</view>
|
||||
<view class="stat-card">
|
||||
<text class="stat-value">{{ todayStats.orders }}</text>
|
||||
<text class="stat-label">订单数</text>
|
||||
</view>
|
||||
<view class="stat-card">
|
||||
<text class="stat-value">{{ todayStats.visitors }}</text>
|
||||
<text class="stat-label">访客数</text>
|
||||
</view>
|
||||
<view class="stat-card">
|
||||
<text class="stat-value">{{ todayStats.conversion }}%</text>
|
||||
<text class="stat-label">转化率</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 最近订单 -->
|
||||
<view class="recent-orders">
|
||||
<view class="section-header">
|
||||
<text class="section-title">最近订单</text>
|
||||
<text class="view-all" @click="goToOrders('all')">查看全部 ></text>
|
||||
</view>
|
||||
<view v-if="recentOrders.length > 0" class="order-list">
|
||||
<view v-for="order in recentOrders" :key="order.id" class="order-item" @click="viewOrderDetail(order.id)">
|
||||
<view class="order-header">
|
||||
<text class="order-no">订单号: {{ order.order_no }}</text>
|
||||
<text class="order-status" :class="'status-' + order.status">{{ getOrderStatusText(order.status) }}</text>
|
||||
</view>
|
||||
<view class="order-info">
|
||||
<text class="order-amount">¥{{ order.actual_amount }}</text>
|
||||
<text class="order-time">{{ formatTime(order.created_at) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="no-data">
|
||||
<text class="no-data-text">暂无最近订单</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 商品管理 -->
|
||||
<view class="product-management">
|
||||
<view class="section-title">商品管理</view>
|
||||
<view class="management-grid">
|
||||
<view class="management-item" @click="goToProducts">
|
||||
<text class="item-icon">📦</text>
|
||||
<text class="item-label">商品管理</text>
|
||||
<text class="item-count">{{ productStats.total }}</text>
|
||||
</view>
|
||||
<view class="management-item" @click="goToInventory">
|
||||
<text class="item-icon">📊</text>
|
||||
<text class="item-label">库存管理</text>
|
||||
<text class="item-count">{{ productStats.lowStock }}</text>
|
||||
</view>
|
||||
<view class="management-item" @click="goToPromotions">
|
||||
<text class="item-icon">🎉</text>
|
||||
<text class="item-label">促销活动</text>
|
||||
<text class="item-count">{{ promotionStats.active }}</text>
|
||||
</view>
|
||||
<view class="management-item" @click="goToReviews">
|
||||
<text class="item-icon">⭐</text>
|
||||
<text class="item-label">评价管理</text>
|
||||
<text class="item-count">{{ reviewStats.pending }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 经营分析 -->
|
||||
<view class="business-analysis">
|
||||
<view class="section-header">
|
||||
<text class="section-title">经营分析</text>
|
||||
<text class="view-more" @click="goToAnalytics">详细报表 ></text>
|
||||
</view>
|
||||
<view class="analysis-chart">
|
||||
<view class="chart-item">
|
||||
<text class="chart-label">本周销售趋势</text>
|
||||
<view class="chart-bar">
|
||||
<view v-for="(day, index) in weeklyData" :key="index"
|
||||
class="bar-item"
|
||||
:style="{ height: (day.amount / maxWeeklyAmount * 100) + '%' }">
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 功能菜单 -->
|
||||
<view class="function-menu">
|
||||
<view class="menu-group">
|
||||
<view class="menu-item" @click="goToFinance">
|
||||
<text class="menu-icon">💳</text>
|
||||
<text class="menu-label">财务管理</text>
|
||||
<text class="menu-arrow">></text>
|
||||
</view>
|
||||
<view class="menu-item" @click="goToCustomers">
|
||||
<text class="menu-icon">👥</text>
|
||||
<text class="menu-label">客户管理</text>
|
||||
<text class="menu-arrow">></text>
|
||||
</view>
|
||||
<view class="menu-item" @click="goToMarketing">
|
||||
<text class="menu-icon">📢</text>
|
||||
<text class="menu-label">营销工具</text>
|
||||
<text class="menu-arrow">></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="menu-group">
|
||||
<view class="menu-item" @click="goToHelp">
|
||||
<text class="menu-icon">❓</text>
|
||||
<text class="menu-label">帮助中心</text>
|
||||
<text class="menu-arrow">></text>
|
||||
</view>
|
||||
<view class="menu-item" @click="goToFeedback">
|
||||
<text class="menu-icon">💬</text>
|
||||
<text class="menu-label">意见反馈</text>
|
||||
<text class="menu-arrow">></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import type { MerchantType, OrderType, ApiResponseType } from '@/types/mall-types'
|
||||
|
||||
// 响应式数据
|
||||
const shopInfo = ref({
|
||||
id: '',
|
||||
shop_name: '我的店铺',
|
||||
shop_logo: '',
|
||||
rating: 4.8,
|
||||
total_sales: 1289,
|
||||
shop_status: 1
|
||||
} as MerchantType)
|
||||
|
||||
const orderCounts = ref({
|
||||
total: 0,
|
||||
pending: 0,
|
||||
shipped: 0,
|
||||
refund: 0
|
||||
})
|
||||
|
||||
const todayStats = ref({
|
||||
revenue: '2,368.50',
|
||||
orders: 45,
|
||||
visitors: 238,
|
||||
conversion: 18.9
|
||||
})
|
||||
|
||||
const productStats = ref({
|
||||
total: 156,
|
||||
lowStock: 8
|
||||
})
|
||||
|
||||
const promotionStats = ref({
|
||||
active: 3
|
||||
})
|
||||
|
||||
const reviewStats = ref({
|
||||
pending: 12
|
||||
})
|
||||
|
||||
const recentOrders = ref([] as Array<OrderType>)
|
||||
|
||||
const weeklyData = ref([
|
||||
{ day: '周一', amount: 1200 },
|
||||
{ day: '周二', amount: 1800 },
|
||||
{ day: '周三', amount: 2400 },
|
||||
{ day: '周四', amount: 1600 },
|
||||
{ day: '周五', amount: 2800 },
|
||||
{ day: '周六', amount: 3200 },
|
||||
{ day: '周日', amount: 2600 }
|
||||
])
|
||||
|
||||
// 计算属性
|
||||
const maxWeeklyAmount = computed(() => {
|
||||
return Math.max(...weeklyData.value.map(item => item.amount))
|
||||
})
|
||||
|
||||
// 生命周期
|
||||
onMounted(() => {
|
||||
loadShopInfo()
|
||||
loadOrderCounts()
|
||||
loadRecentOrders()
|
||||
})
|
||||
|
||||
// 方法
|
||||
function loadShopInfo() {
|
||||
// 模拟加载店铺信息
|
||||
shopInfo.value = {
|
||||
id: 'shop001',
|
||||
user_id: 'user001',
|
||||
shop_name: '时尚服饰专营店',
|
||||
shop_logo: '/static/shop-logo.png',
|
||||
shop_banner: '',
|
||||
shop_description: '专业的时尚服饰店铺',
|
||||
contact_name: '张老板',
|
||||
contact_phone: '13888888888',
|
||||
shop_status: 1,
|
||||
rating: 4.8,
|
||||
total_sales: 1289,
|
||||
created_at: '2024-01-01'
|
||||
}
|
||||
}
|
||||
|
||||
function loadOrderCounts() {
|
||||
// 模拟加载订单统计
|
||||
orderCounts.value = {
|
||||
total: 156,
|
||||
pending: 8,
|
||||
shipped: 12,
|
||||
refund: 3
|
||||
}
|
||||
}
|
||||
|
||||
function loadRecentOrders() {
|
||||
// 模拟加载最近订单
|
||||
recentOrders.value = [
|
||||
{
|
||||
id: 'order001',
|
||||
order_no: 'ORD20241201001',
|
||||
user_id: 'user001',
|
||||
merchant_id: 'shop001',
|
||||
status: 2,
|
||||
total_amount: 299.0,
|
||||
discount_amount: 0,
|
||||
delivery_fee: 10.0,
|
||||
actual_amount: 309.0,
|
||||
payment_method: 1,
|
||||
payment_status: 1,
|
||||
delivery_address: {},
|
||||
created_at: '2024-12-01 14:30:00'
|
||||
},
|
||||
{
|
||||
id: 'order002',
|
||||
order_no: 'ORD20241201002',
|
||||
user_id: 'user002',
|
||||
merchant_id: 'shop001',
|
||||
status: 1,
|
||||
total_amount: 599.0,
|
||||
discount_amount: 50.0,
|
||||
delivery_fee: 0,
|
||||
actual_amount: 549.0,
|
||||
payment_method: null,
|
||||
payment_status: 0,
|
||||
delivery_address: {},
|
||||
created_at: '2024-12-01 15:20:00'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
function getShopStatus(): string {
|
||||
const statusMap = {
|
||||
0: '待审核',
|
||||
1: '正常营业',
|
||||
2: '暂停营业',
|
||||
3: '已关闭'
|
||||
}
|
||||
return statusMap[shopInfo.value.shop_status] || '未知状态'
|
||||
}
|
||||
|
||||
function getOrderStatusText(status: number): string {
|
||||
const statusMap = {
|
||||
1: '待付款',
|
||||
2: '待发货',
|
||||
3: '已发货',
|
||||
4: '已送达',
|
||||
5: '已完成',
|
||||
6: '已取消'
|
||||
}
|
||||
return statusMap[status] || '未知'
|
||||
}
|
||||
|
||||
function formatTime(dateStr: string): string {
|
||||
const date = new Date(dateStr)
|
||||
const now = new Date()
|
||||
const diff = now.getTime() - date.getTime()
|
||||
const hours = Math.floor(diff / (1000 * 60 * 60))
|
||||
|
||||
if (hours < 1) {
|
||||
return '刚刚'
|
||||
} else if (hours < 24) {
|
||||
return `${hours}小时前`
|
||||
} else {
|
||||
return `${Math.floor(hours / 24)}天前`
|
||||
}
|
||||
}
|
||||
|
||||
// 导航方法
|
||||
function editShop() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/merchant/shop-edit'
|
||||
})
|
||||
}
|
||||
|
||||
function goToSettings() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/merchant/settings'
|
||||
})
|
||||
}
|
||||
|
||||
function goToOrders(type: string) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/mall/merchant/orders?type=${type}`
|
||||
})
|
||||
}
|
||||
|
||||
function viewOrderDetail(orderId: string) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/mall/merchant/order-detail?id=${orderId}`
|
||||
})
|
||||
}
|
||||
|
||||
function goToProducts() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/merchant/products'
|
||||
})
|
||||
}
|
||||
|
||||
function goToInventory() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/merchant/inventory'
|
||||
})
|
||||
}
|
||||
|
||||
function goToPromotions() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/merchant/promotions'
|
||||
})
|
||||
}
|
||||
|
||||
function goToReviews() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/merchant/reviews'
|
||||
})
|
||||
}
|
||||
|
||||
function goToAnalytics() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/merchant/analytics'
|
||||
})
|
||||
}
|
||||
|
||||
function goToFinance() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/merchant/finance'
|
||||
})
|
||||
}
|
||||
|
||||
function goToCustomers() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/merchant/customers'
|
||||
})
|
||||
}
|
||||
|
||||
function goToMarketing() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/merchant/marketing'
|
||||
})
|
||||
}
|
||||
|
||||
function goToHelp() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/common/help'
|
||||
})
|
||||
}
|
||||
|
||||
function goToFeedback() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/common/feedback'
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.merchant-profile {
|
||||
padding: 0 0 120rpx 0;
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.profile-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 40rpx 30rpx;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.shop-logo {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 60rpx;
|
||||
margin-right: 30rpx;
|
||||
border: 4rpx solid rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
.shop-info {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.shop-name {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.shop-status {
|
||||
font-size: 24rpx;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
margin-bottom: 15rpx;
|
||||
}
|
||||
|
||||
.shop-stats {
|
||||
display: flex;
|
||||
gap: 30rpx;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
font-size: 22rpx;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
|
||||
.settings-icon {
|
||||
font-size: 36rpx;
|
||||
color: white;
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.order-shortcuts, .today-stats, .recent-orders, .product-management, .business-analysis, .function-menu {
|
||||
margin: 20rpx 30rpx;
|
||||
background: white;
|
||||
border-radius: 20rpx;
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.view-all, .view-more {
|
||||
font-size: 24rpx;
|
||||
color: #667eea;
|
||||
}
|
||||
|
||||
.order-tabs {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.order-tab {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tab-icon {
|
||||
font-size: 48rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.tab-text {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.tab-badge {
|
||||
position: absolute;
|
||||
top: -10rpx;
|
||||
right: 20rpx;
|
||||
background: #ff6b6b;
|
||||
color: white;
|
||||
font-size: 20rpx;
|
||||
padding: 4rpx 8rpx;
|
||||
border-radius: 10rpx;
|
||||
min-width: 30rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tab-badge.alert {
|
||||
background: #ff4757;
|
||||
animation: pulse 2s infinite;
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0% { transform: scale(1); }
|
||||
50% { transform: scale(1.1); }
|
||||
100% { transform: scale(1); }
|
||||
}
|
||||
|
||||
.stats-grid {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
min-width: 150rpx;
|
||||
padding: 20rpx;
|
||||
background: #f8f9ff;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #667eea;
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.order-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.order-item {
|
||||
padding: 25rpx;
|
||||
background: #f8f9ff;
|
||||
border-radius: 15rpx;
|
||||
border-left: 6rpx solid #667eea;
|
||||
}
|
||||
|
||||
.order-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 15rpx;
|
||||
}
|
||||
|
||||
.order-no {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.order-status {
|
||||
font-size: 22rpx;
|
||||
padding: 6rpx 12rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #e3f2fd;
|
||||
color: #1976d2;
|
||||
}
|
||||
|
||||
.status-1 {
|
||||
background: #fff3e0;
|
||||
color: #f57c00;
|
||||
}
|
||||
|
||||
.status-2 {
|
||||
background: #e8f5e8;
|
||||
color: #388e3c;
|
||||
}
|
||||
|
||||
.status-3 {
|
||||
background: #e3f2fd;
|
||||
color: #1976d2;
|
||||
}
|
||||
|
||||
.order-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.order-amount {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #ff6b6b;
|
||||
}
|
||||
|
||||
.order-time {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.management-grid {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.management-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
min-width: 140rpx;
|
||||
padding: 25rpx 15rpx;
|
||||
background: #f8f9ff;
|
||||
border-radius: 15rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.item-icon {
|
||||
font-size: 48rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.item-label {
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
|
||||
.item-count {
|
||||
font-size: 20rpx;
|
||||
color: #667eea;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.analysis-chart {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
.chart-item {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.chart-label {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.chart-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: end;
|
||||
height: 200rpx;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.bar-item {
|
||||
flex: 1;
|
||||
background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
|
||||
border-radius: 8rpx 8rpx 0 0;
|
||||
min-height: 20rpx;
|
||||
}
|
||||
|
||||
.menu-group {
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.menu-group:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 25rpx 0;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.menu-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.menu-icon {
|
||||
font-size: 36rpx;
|
||||
width: 60rpx;
|
||||
margin-right: 25rpx;
|
||||
}
|
||||
|
||||
.menu-label {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.menu-arrow {
|
||||
font-size: 24rpx;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.no-data {
|
||||
text-align: center;
|
||||
padding: 60rpx 0;
|
||||
}
|
||||
|
||||
.no-data-text {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user