diff --git a/pages.json b/pages.json
index 6cac3ba5..49ccff18 100644
--- a/pages.json
+++ b/pages.json
@@ -39,6 +39,48 @@
"navigationBarTitleText": "搜索",
"navigationStyle": "custom"
}
+ },
+ {
+ "path": "pages/mall/consumer/product-detail",
+ "style": {
+ "navigationBarTitleText": "商品详情"
+ }
+ },
+ {
+ "path": "pages/mall/consumer/shop-detail",
+ "style": {
+ "navigationBarTitleText": "店铺详情"
+ }
+ },
+ {
+ "path": "pages/mall/consumer/coupons",
+ "style": {
+ "navigationBarTitleText": "我的优惠券"
+ }
+ },
+ {
+ "path": "pages/mall/consumer/favorites",
+ "style": {
+ "navigationBarTitleText": "我的收藏"
+ }
+ },
+ {
+ "path": "pages/mall/consumer/footprint",
+ "style": {
+ "navigationBarTitleText": "我的足迹"
+ }
+ },
+ {
+ "path": "pages/mall/consumer/address-list",
+ "style": {
+ "navigationBarTitleText": "收货地址"
+ }
+ },
+ {
+ "path": "pages/mall/consumer/address-edit",
+ "style": {
+ "navigationBarTitleText": "编辑地址"
+ }
}
],
"tabBar": {
diff --git a/pages/mall/consumer/address-edit.uvue b/pages/mall/consumer/address-edit.uvue
index ef81282c..d88f1c20 100644
--- a/pages/mall/consumer/address-edit.uvue
+++ b/pages/mall/consumer/address-edit.uvue
@@ -1,793 +1,319 @@
-
-
-
-
-
-
-
-
-
- 收货人
-
-
-
-
- 手机号码
-
-
-
-
- 所在地区
- {{ regionText || '请选择省市区' }}
- ›
-
-
-
- 详细地址
-
-
-
-
- 邮政编码
-
-
-
-
-
- 设为默认地址
-
-
-
-
-
-
-
- 地址簿
-
-
- {{ address.recipient_name }}
- {{ address.phone }}
-
- {{ getFullAddress(address) }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ province.name }}
-
-
-
-
- {{ city.name }}
-
-
-
-
- {{ district.name }}
-
-
-
-
-
-
+
+
+
+ 收货人
+
+
+
+ 手机号码
+
+
+
+ 所在地区
+
+
+
+ 详细地址
+
+
+
+
+
+
+ 标签
+
+ {{ tag }}
+
+
+
+ 设为默认收货地址
+
+
+
+
+
+
-
\ No newline at end of file
diff --git a/pages/mall/consumer/address-list.uvue b/pages/mall/consumer/address-list.uvue
new file mode 100644
index 00000000..d094e1a9
--- /dev/null
+++ b/pages/mall/consumer/address-list.uvue
@@ -0,0 +1,221 @@
+
+
+
+
+ 📍
+ 暂无收货地址
+
+
+
+
+
+ {{ getFullAddress(item) }}
+
+
+ 📝
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/mall/consumer/cart.uvue b/pages/mall/consumer/cart.uvue
index 1b3aa382..bd066495 100644
--- a/pages/mall/consumer/cart.uvue
+++ b/pages/mall/consumer/cart.uvue
@@ -1,529 +1,1095 @@
-
-
-
-
-
-
-
-
- 🛒
- 购物车是空的
- 快去挑选喜欢的商品吧
-
-
-
-
-
-
-
- ✓
-
-
-
-
-
-
- {{ item.name }}
- {{ item.spec }}
-
-
-
-
-
-
-
-
-
-
-
-
- {{ product.name }}
- ¥{{ product.price }}
-
-
-
-
-
-
-
-
+
+
+
+
+ 购物车
+
+
+ {{ isManageMode ? '✓' : '⚙️' }}
+ {{ isManageMode ? '完成' : '管理' }}
+
+
+
+
+
+
+
+
+
+
+
+
+ 🛒
+ 购物车是空的
+ 快去挑选喜欢的商品吧
+
+
+
+
+
+
+
+
+
+
+
+
+ ✓
+
+
+
+
+
+
+
+ {{ item.name }}
+ {{ item.spec }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ product.name }}
+
+ ¥{{ product.price }}
+
+ +
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/mall/consumer/category.uvue b/pages/mall/consumer/category.uvue
index ab0d75de..324ce61b 100644
--- a/pages/mall/consumer/category.uvue
+++ b/pages/mall/consumer/category.uvue
@@ -1,18 +1,38 @@
-
-
- 🔍
- 症状/药品/品牌智能搜索
+
+
+ 请输入药品名称、症状或品牌
+
+
+
+ 🔳
+
+
+
+
+ 📷
+
+
+
+
+ 搜索
+
-
+
([])
const productList = ref([])
const activePrimary = ref('cold')
@@ -126,6 +147,8 @@ const mockProducts = {
cold: [
{
id: 'cold1',
+ shopId: 'shop_001',
+ shopName: '修正药业官方旗舰店',
name: '布洛芬缓释胶囊',
specification: '0.3g*24粒',
price: 18.5,
@@ -137,6 +160,8 @@ const mockProducts = {
},
{
id: 'cold2',
+ shopId: 'shop_002',
+ shopName: '白云山大药房',
name: '板蓝根颗粒',
specification: '10g*20袋',
price: 22.8,
@@ -148,6 +173,8 @@ const mockProducts = {
},
{
id: 'cold3',
+ shopId: 'shop_003',
+ shopName: '以岭药业自营店',
name: '连花清瘟胶囊',
specification: '0.35g*36粒',
price: 42.8,
@@ -159,6 +186,8 @@ const mockProducts = {
},
{
id: 'cold4',
+ shopId: 'shop_004',
+ shopName: '强生制药旗舰店',
name: '对乙酰氨基酚片',
specification: '0.5g*12片',
price: 8.9,
@@ -170,6 +199,8 @@ const mockProducts = {
},
{
id: 'cold5',
+ shopId: 'shop_005',
+ shopName: '同仁堂大药房',
name: '感冒清热颗粒',
specification: '3g*10袋',
price: 16.5,
@@ -181,6 +212,8 @@ const mockProducts = {
},
{
id: 'cold6',
+ shopId: 'shop_006',
+ shopName: '三九医药旗舰店',
name: '复方氨酚烷胺片',
specification: '10片/盒',
price: 12.8,
@@ -195,6 +228,8 @@ const mockProducts = {
stomach: [
{
id: 'stomach1',
+ shopId: 'shop_006',
+ shopName: '三九医药旗舰店',
name: '胃康灵胶囊',
specification: '0.4g*24粒',
price: 32.8,
@@ -206,6 +241,8 @@ const mockProducts = {
},
{
id: 'stomach2',
+ shopId: 'shop_007',
+ shopName: '阿斯利康医药',
name: '奥美拉唑肠溶胶囊',
specification: '20mg*14粒',
price: 28.5,
@@ -217,6 +254,8 @@ const mockProducts = {
},
{
id: 'stomach3',
+ shopId: 'shop_008',
+ shopName: '江中制药旗舰店',
name: '健胃消食片',
specification: '0.8g*32片',
price: 15.9,
@@ -228,6 +267,8 @@ const mockProducts = {
},
{
id: 'stomach4',
+ shopId: 'shop_009',
+ shopName: '益普生大药房',
name: '蒙脱石散',
specification: '3g*10袋',
price: 18.6,
@@ -239,6 +280,8 @@ const mockProducts = {
},
{
id: 'stomach5',
+ shopId: 'shop_010',
+ shopName: '西安杨森旗舰店',
name: '多潘立酮片',
specification: '10mg*30片',
price: 22.8,
@@ -250,6 +293,8 @@ const mockProducts = {
},
{
id: 'stomach6',
+ shopId: 'shop_011',
+ shopName: '拜耳医药自营店',
name: '铝碳酸镁咀嚼片',
specification: '0.5g*20片',
price: 25.9,
@@ -264,6 +309,8 @@ const mockProducts = {
pain: [
{
id: 'pain1',
+ shopId: 'shop_012',
+ shopName: '华北制药旗舰店',
name: '阿莫西林胶囊',
specification: '0.25g*24粒',
price: 28.5,
@@ -275,6 +322,8 @@ const mockProducts = {
},
{
id: 'pain2',
+ shopId: 'shop_013',
+ shopName: '诺华制药旗舰店',
name: '双氯芬酸钠缓释片',
specification: '75mg*10片',
price: 19.8,
@@ -286,6 +335,8 @@ const mockProducts = {
},
{
id: 'pain3',
+ shopId: 'shop_014',
+ shopName: '云南白药旗舰店',
name: '云南白药胶囊',
specification: '0.25g*32粒',
price: 35.9,
@@ -297,6 +348,8 @@ const mockProducts = {
},
{
id: 'pain4',
+ shopId: 'shop_015',
+ shopName: '辉瑞医药旗舰店',
name: '塞来昔布胶囊',
specification: '0.2g*10粒',
price: 48.6,
@@ -308,6 +361,8 @@ const mockProducts = {
},
{
id: 'pain5',
+ shopId: 'shop_016',
+ shopName: '中美史克大药房',
name: '布洛芬片',
specification: '0.1g*24片',
price: 12.5,
@@ -319,6 +374,8 @@ const mockProducts = {
},
{
id: 'pain6',
+ shopId: 'shop_002',
+ shopName: '白云山大药房',
name: '头孢克肟胶囊',
specification: '0.1g*6粒',
price: 32.8,
@@ -344,6 +401,8 @@ const generateDefaultProducts = (categoryId: string) => {
return baseProducts.map((product, index) => ({
id: `${categoryId}${index + 1}`,
+ shopId: `shop_default_${categoryId}_${index}`, // 确保不同分类店铺ID不同
+ shopName: '平台自营大药房',
...product,
specification: '规格待定',
originalPrice: product.price * 1.2,
@@ -419,8 +478,15 @@ onLoad((options: any) => {
}, 100)
}
} else {
- console.log('⚠️ onLoad中未找到分类参数')
- console.log('保持当前分类显示:', activePrimary.value)
+ console.log('⚠️ onLoad中未找到分类参数,使用默认分类')
+ // 默认选中第一个分类
+ const defaultCategory = 'cold'
+ console.log('默认分类:', defaultCategory)
+
+ // 无论如何都重新加载一次默认分类的数据
+ setTimeout(() => {
+ selectPrimaryCategory(defaultCategory)
+ }, 100)
}
console.log('=== category页面onLoad执行完成 ===')
@@ -505,6 +571,10 @@ const initPage = () => {
const systemInfo = uni.getSystemInfoSync()
statusBarHeight.value = systemInfo.statusBarHeight || 0
+ // 保持与主页一致的固定高度计算,不进行动态调整
+ // 这样在移动端会与主页的视觉体验保持一致(主页占位符固定为44px)
+ headerHeight.value = 10
+
// 获取页面参数
const pages = getCurrentPages()
if (pages.length > 0) {
@@ -585,6 +655,41 @@ const selectPrimaryCategory = (categoryId: string) => {
// 添加到购物车
const addToCart = (product: any) => {
+ // 获取现有购物车数据
+ const cartData = uni.getStorageSync('cart')
+ let cartItems: any[] = []
+
+ if (cartData) {
+ try {
+ cartItems = JSON.parse(cartData as string) as any[]
+ } catch (e) {
+ console.error('解析购物车数据失败', e)
+ }
+ }
+
+ // 检查商品是否已存在
+ const existingItem = cartItems.find((item: any) => item.id === product.id)
+
+ if (existingItem) {
+ existingItem.quantity++
+ } else {
+ // 添加新商品
+ cartItems.push({
+ id: product.id,
+ shopId: product.shopId || 'shop_default',
+ shopName: product.shopName || product.manufacturer || '自营店铺',
+ name: product.name,
+ price: product.price,
+ image: product.image,
+ spec: product.specification || '默认规格',
+ quantity: 1,
+ selected: true
+ })
+ }
+
+ // 保存回存储
+ uni.setStorageSync('cart', JSON.stringify(cartItems))
+
uni.showToast({
title: '已添加到购物车',
icon: 'success'
@@ -597,7 +702,48 @@ const navigateToSearch = () => uni.navigateTo({ url: '/pages/mall/consumer/searc
const navigateToCart = () => uni.navigateTo({ url: '/pages/medicine/cart' })
const navigateToProduct = (product: any) => {
uni.navigateTo({
- url: `/pages/medicine/detail?id=${product.id}`
+ url: `/pages/mall/consumer/product-detail?productId=${product.id}`
+ })
+}
+
+// 相机功能
+const onCamera = () => {
+ uni.chooseImage({
+ count: 1,
+ sourceType: ['camera'],
+ success: (res) => {
+ console.log('相机拍摄成功:', res.tempFilePaths[0])
+ uni.showToast({
+ title: '已拍摄,正在识别...',
+ icon: 'loading'
+ })
+ // 这里可以添加后续的识别逻辑
+ setTimeout(() => {
+ uni.showToast({
+ title: '识别成功',
+ icon: 'success'
+ })
+ }, 1000)
+ },
+ fail: (err) => {
+ console.error('相机调用失败:', err)
+ }
+ })
+}
+
+// 扫码功能
+const onScan = () => {
+ uni.scanCode({
+ success: (res) => {
+ console.log('扫码成功:', res)
+ uni.showToast({
+ title: '扫码成功: ' + res.result,
+ icon: 'none'
+ })
+ },
+ fail: (err) => {
+ console.error('扫码失败:', err)
+ }
})
}
@@ -611,7 +757,6 @@ const navigateToProduct = (product: any) => {
flex-direction: column;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
}
-
/* 搜索栏 */
.search-bar {
position: fixed;
@@ -623,8 +768,10 @@ const navigateToProduct = (product: any) => {
box-shadow: 0 2px 12px rgba(76, 175, 80, 0.15);
}
+/* 搜索栏 */
+/* 导航栏搜索框容器内边距调整 */
.search-container {
- height: 60px;
+ height: 44px; /* 调整为与消息页一致的高度 */
padding: 0 16px;
display: flex;
align-items: center;
@@ -634,44 +781,90 @@ const navigateToProduct = (product: any) => {
width: 100%;
}
+/* 搜索框 hover 效果 */
+.search-box:hover {
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
+}
+
+/* 导航栏搜索框容器内边距调整 */
.search-box {
flex: 1;
max-width: 600px;
- background: rgba(255, 255, 255, 0.95);
- border-radius: 25px;
- padding: 10px 20px;
+ background: #f0f0f0;
+ border-radius: 20px;
+ padding: 0 4px 0 12px;
display: flex;
+ flex-direction: row; /* UVUE 显式设置 row */
align-items: center;
cursor: pointer;
transition: all 0.3s ease;
- border: 2px solid transparent;
-}
-
-.search-box:hover {
- box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
- border-color: rgba(255, 255, 255, 0.3);
-}
-
-.search-icon {
- font-size: 18px;
- color: #4CAF50;
- margin-right: 12px;
+ width: 100%;
+ height: 32px; /* 减小高度,与顶部高度44px适配,略小于顶部高度 */
}
.search-placeholder {
- font-size: 15px;
- color: #666;
+ font-size: 14px;
+ color: #999;
flex: 1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
+.nav-inner-search-text {
+ font-size: 12px; /* 字体稍微变小 */
+ color: #ffffff;
+ font-weight: 500;
+}
+
.icon {
font-size: 22px;
color: white;
}
+.nav-icon-btn {
+ padding: 4px 8px 4px 4px;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: center;
+ border-right: 1px solid #ddd;
+ margin-right: 8px;
+}
+
+.nav-icon {
+ font-size: 18px;
+}
+
+.nav-camera-btn {
+ padding: 4px 8px 4px 4px;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: center;
+ border-right-width: 1px;
+ border-right-style: solid;
+ border-right-color: #ddd;
+ border-right: 1px solid #ddd; /* 修复UVUE样式 */
+ margin-right: 8px;
+}
+
+.nav-camera-icon {
+ font-size: 20px;
+}
+
+/* 搜索按钮高度微调 */
+.nav-inner-search-btn {
+ padding: 0 12px; /* 减小内边距 */
+ background-color: #87CEEB; /* 天空蓝 */
+ border-radius: 16px;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: center;
+ height: 24px; /* 随搜索框高度减小而减小 */
+}
+
.cart-badge {
position: absolute;
top: -5px;
@@ -693,14 +886,14 @@ const navigateToProduct = (product: any) => {
.category-content {
display: flex;
flex-direction: row; /* 强制水平排列 */
- margin-top: 60px;
+ /* margin-top: 44px; 已通过 style 动态绑定 */
padding: 0 16px;
max-width: 1400px;
margin-left: auto;
margin-right: auto;
width: 100%;
gap: 20px;
- height: calc(100vh - 60px); /* 设置固定高度,减去头部高度 */
+ /* height: calc(100vh - 44px); 已通过 style 动态绑定 */
overflow: hidden; /* 防止整体滚动 */
}
@@ -996,11 +1189,59 @@ const navigateToProduct = (product: any) => {
}
.product-grid {
- grid-template-columns: 1fr;
- gap: 12px;
+ grid-template-columns: repeat(2, 1fr); /* 改为双列显示 */
+ gap: 8px;
padding: 0 4px 20px 4px; /* 增加底部内边距 */
}
+ /* 手机端商品卡片极简模式 - 仿照主页样式 */
+ .product-spec,
+ .manufacturer,
+ .original-price,
+ .sales-info,
+ .product-badge { /* 分类页也隐藏角标,保持整洁 */
+ display: none;
+ }
+
+ .product-info {
+ padding: 6px;
+ }
+
+ .product-image {
+ height: 100px; /* 由于分类页右侧空间更窄,图片高度设得更小一点 */
+ }
+
+ .product-name {
+ font-size: 12px;
+ height: 32px;
+ line-height: 1.3;
+ margin-bottom: 2px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ }
+
+ .price-section {
+ margin-bottom: 0;
+ margin-top: 4px;
+ justify-content: space-between;
+ width: 100%;
+ }
+
+ .price-symbol {
+ font-size: 10px;
+ }
+
+ .price-value {
+ font-size: 14px;
+ }
+
+ .product-meta {
+ display: none; /* 隐藏整个元数据行 */
+ }
+
.search-container {
padding: 0 12px;
height: 55px;
@@ -1175,4 +1416,4 @@ const navigateToProduct = (product: any) => {
font-size: 24px;
}
}
-
+
\ No newline at end of file
diff --git a/pages/mall/consumer/coupons.uvue b/pages/mall/consumer/coupons.uvue
index 819cf548..9cc7db87 100644
--- a/pages/mall/consumer/coupons.uvue
+++ b/pages/mall/consumer/coupons.uvue
@@ -1,590 +1,149 @@
-
-
-
-
-
-
-
-
-
- 🎫
- {{ getEmptyText() }}
- {{ getEmptySubtext() }}
-
-
-
-
-
-
- {{ formatCouponValue(coupon) }}
- {{ formatCondition(coupon) }}
-
-
-
- {{ coupon.template?.name || coupon.name }}
- {{ coupon.template?.description || '' }}
- {{ formatTimeRange(coupon) }}
-
-
-
-
- {{ getStatusText(coupon) }}
-
-
-
-
-
+
+
+
+ 🎫
+ 暂无优惠券
+
+
+
+
+ {{ coupon.amount }}
+ 优惠券
+
+
+ {{ coupon.title }}
+ 有效期至: {{ coupon.expiry }}
+
+
+
+
+
-
\ No newline at end of file
diff --git a/pages/mall/consumer/favorites.uvue b/pages/mall/consumer/favorites.uvue
index ada359c9..1beb9a3f 100644
--- a/pages/mall/consumer/favorites.uvue
+++ b/pages/mall/consumer/favorites.uvue
@@ -1,694 +1,269 @@
-
-
-
-
-
-
-
-
- 商品
-
-
- 店铺
-
-
-
-
-
-
-
- ❤️
- {{ getEmptyText() }}
- {{ getEmptySubtext() }}
-
-
-
-
-
-
-
-
- ✓
-
-
-
-
-
- {{ item.product?.name || '商品已下架' }}
- ¥{{ item.product?.price || 0 }}
-
- 收藏时间: {{ formatTime(item.created_at) }}
-
-
-
-
-
-
-
-
-
-
-
- ✓
-
-
-
-
-
- {{ item.shop?.shop_name || '店铺已关闭' }}
-
- 评分: {{ item.shop?.rating?.toFixed(1) || '0.0' }}
- 销量: {{ item.shop?.total_sales || 0 }}
-
-
- 收藏时间: {{ formatTime(item.created_at) }}
-
-
-
-
-
-
-
-
- 加载中...
-
-
- 没有更多了
-
-
-
-
-
-
-
- ✓
-
- 全选
-
-
- 删除({{ selectedCount }})
-
-
-
+
+
+
+ ❤️
+ 暂无收藏商品
+
+
+
+
+
+
+ {{ product.name }}
+ ¥{{ product.price }}
+
+
+
+
+
-
\ No newline at end of file
diff --git a/pages/mall/consumer/footprint.uvue b/pages/mall/consumer/footprint.uvue
index 8e8d13b4..5b6245f6 100644
--- a/pages/mall/consumer/footprint.uvue
+++ b/pages/mall/consumer/footprint.uvue
@@ -39,17 +39,17 @@
-
+
- {{ item.product?.name || '商品已下架' }}
+ {{ item.name }}
- ¥{{ item.product?.price || 0 }}
- ¥{{ item.product.original_price }}
+ ¥{{ item.price }}
+ ¥{{ item.original_price }}
- 已售{{ item.product?.sales || 0 }}
- {{ formatTime(item.created_at) }}
+ 已售{{ item.sales }}
+ {{ formatTime(item.viewTime) }}
@@ -83,31 +83,24 @@
-
-
\ No newline at end of file
diff --git a/pages/mall/consumer/index松散.uvue b/pages/mall/consumer/index松散.uvue
deleted file mode 100644
index 5e053b49..00000000
--- a/pages/mall/consumer/index松散.uvue
+++ /dev/null
@@ -1,1612 +0,0 @@
-
-
-
-
-
-
-
-
- 💊
- 康乐医药商城
-
-
- 健康生活,品质保障
-
-
-
-
-
-
- 🔍
-
-
- 📋
- {{ pendingOrders }}
-
-
- 🛒
- {{ cartCount }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 💡
- 今日健康小贴士:按时服药,保持良好生活习惯
-
-
-
-
-
-
-
-
-
-
-
- {{ category.icon }}
-
- {{ category.name }}
-
-
-
-
-
-
-
-
-
- 🔍
- 搜索药品/症状/品牌
-
-
-
-
-
-
-
-
-
-
- {{ banner.title }}
- {{ banner.desc }}
-
-
-
-
-
-
-
-
-
- 👨⚕️
- 在线问诊
-
-
- 📝
- 处方购药
-
-
- 💊
- 非处方药
-
-
- 🩺
- 健康工具
-
-
-
-
-
-
-
-
-
-
-
-
- {{ medicine.tag }}
-
-
-
- {{ medicine.name }}
- {{ medicine.specification }}
-
-
- ¥{{ medicine.price }}
-
- ¥{{ medicine.originalPrice }}
-
-
-
-
- {{ medicine.manufacturer }}
-
- 已售{{ medicine.sales }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ medicine.icon }}
-
-
- {{ medicine.name }}
- {{ medicine.use }}
-
-
-
- 加入清单
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ medicine.specification }}
-
-
- {{ medicine.manufacturer }}
-
-
-
-
- ¥{{ medicine.price }}
-
- ¥{{ medicine.originalPrice }}
-
-
-
-
- 🛒
-
-
-
-
-
-
-
-
-
-
- 加载中...
-
-
-
- --- 已显示全部药品 ---
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/mall/consumer/index紧凑.uvue b/pages/mall/consumer/index紧凑.uvue
deleted file mode 100644
index a6d2b56b..00000000
--- a/pages/mall/consumer/index紧凑.uvue
+++ /dev/null
@@ -1,1793 +0,0 @@
-
-
-
-
-
-
-
-
- 💊
- 康乐医药商城
-
-
- 健康生活,品质保障
-
-
-
-
-
-
- 🔍
-
-
- 📋
- {{ pendingOrders }}
-
-
- 🛒
- {{ cartCount }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 💡
- 今日健康小贴士:按时服药,保持良好生活习惯
-
-
-
-
-
-
-
-
-
-
-
- {{ category.icon }}
-
- {{ category.name }}
-
-
-
-
-
-
-
- {{ category.icon }}
-
- {{ category.name }}
-
-
-
-
-
-
-
-
-
- 🔍
- 搜索药品/症状/品牌
-
-
-
-
-
-
-
-
-
-
- {{ banner.title }}
- {{ banner.desc }}
-
-
-
-
-
-
-
-
-
- 👨⚕️
- 在线问诊
-
-
- 📝
- 处方购药
-
-
- 💊
- 非处方药
-
-
- 🩺
- 健康工具
-
-
-
-
-
-
-
-
-
-
-
-
- {{ medicine.tag }}
-
-
-
- {{ medicine.name }}
- {{ medicine.specification }}
-
-
- ¥{{ medicine.price }}
-
- ¥{{ medicine.originalPrice }}
-
-
-
-
- {{ medicine.manufacturer }}
-
- 已售{{ medicine.sales }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ medicine.icon }}
-
-
- {{ medicine.name }}
- {{ medicine.use }}
-
-
-
- 加入清单
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ medicine.specification }}
-
-
- {{ medicine.manufacturer }}
-
-
-
-
- ¥{{ medicine.price }}
-
- ¥{{ medicine.originalPrice }}
-
-
-
-
- 🛒
-
-
-
-
-
-
-
-
-
-
- 加载中...
-
-
-
- --- 已显示全部药品 ---
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/mall/consumer/messages.uvue b/pages/mall/consumer/messages.uvue
index c747221a..78a44cc8 100644
--- a/pages/mall/consumer/messages.uvue
+++ b/pages/mall/consumer/messages.uvue
@@ -1,1159 +1,1330 @@
-
-
-
-
-
-
-
-
- {{ tab.name }}
- {{ tab.unread }}
-
-
-
-
-
-
-
-
-
-
- 专业医药顾问在线解答,服务时间 9:00-22:00
-
-
-
- 💊
- 用药咨询
-
-
- 📋
- 处方咨询
-
-
- ⚠️
- 副作用咨询
-
-
- 🚚
- 药品配送
-
-
-
-
-
-
-
-
-
- {{ message.icon }}
-
-
-
-
-
-
- {{ message.content }}
- {{ message.lastMessage }}
-
-
- {{ tag }}
-
-
-
-
-
-
- 💡
- 温馨提示:请勿相信任何要求转账、付款的信息,谨防诈骗
-
-
-
-
-
-
-
- 📢
-
-
-
- {{ message.content }}
- 重要
-
-
-
-
-
-
-
-
- 📦
-
-
-
- {{ message.content }}
- 订单号: {{ message.order_no }}
-
- {{ message.statusText }}
-
-
-
-
-
-
-
-
-
- 🎁
-
-
-
- {{ message.content }}
-
- {{ message.coupon }}优惠券
- 有效期至 {{ message.expiry }}
-
-
-
-
-
-
-
- 💬
- 暂无消息
- 暂时没有新消息
-
-
-
-
-
-
-
-
+
+
+
+
+ 消息中心
+
+
+ 🧹
+ 一键已读
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ tab.name }}
+ {{ tab.unread > 99 ? '99+' : tab.unread }}
+
+
+
+
+
+
+
+
+
+
+
+
+ 专业医药顾问在线解答,服务时间 9:00-22:00
+
+
+
+ 💊
+ 用药咨询
+
+
+ 📋
+ 处方咨询
+
+
+ ⚠️
+ 副作用咨询
+
+
+ 🚚
+ 药品配送
+
+
+
+
+
+
+
+
+
+ {{ message.icon }}
+
+
+
+
+
+
+ {{ message.content }}
+ {{ message.lastMessage }}
+
+
+ {{ tag }}
+
+
+
+
+
+
+ 💡
+ 温馨提示:请勿相信任何要求转账、付款的信息,谨防诈骗
+
+
+
+
+
+
+
+ 📢
+
+
+
+ {{ message.content }}
+ 重要
+
+
+
+
+
+
+
+
+ 📦
+
+
+
+ {{ message.content }}
+ 订单号: {{ message.order_no }}
+
+ {{ message.statusText }}
+
+
+
+
+
+
+
+
+
+ 🎁
+
+
+
+ {{ message.content }}
+
+ {{ message.coupon }}优惠券
+ 有效期至 {{ message.expiry }}
+ {{ message.claimed ? '已领取' : '点击领取' }}
+
+
+
+
+
+
+
+ 💬
+ 暂无消息
+ 暂时没有新消息
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
+
diff --git a/pages/mall/consumer/product-detail.uvue b/pages/mall/consumer/product-detail.uvue
index a65a7b6e..7b537794 100644
--- a/pages/mall/consumer/product-detail.uvue
+++ b/pages/mall/consumer/product-detail.uvue
@@ -25,13 +25,13 @@
- {{ merchant.shop_name }}
-
- 评分: {{ merchant.rating.toFixed(1) }}
- 销量: {{ merchant.total_sales }}
+ {{ merchant.shop_name }}
+
+ 评分: {{ merchant.rating.toFixed(1) }}
+ 销量: {{ merchant.total_sales }}
- 进店 >
+ 进店 >
@@ -50,6 +50,16 @@
+
+ 🛒
+ 购物车
+
+
+ {{ isFavorite ? '❤️' : '🤍' }}
+ {{ isFavorite ? '已收藏' : '收藏' }}
+
+
+
@@ -116,16 +126,55 @@ export default {
showSpec: false,
selectedSkuId: '',
selectedSpec: '',
- quantity: 1
+ quantity: 1,
+ isFavorite: false
}
},
onLoad(options: any) {
const productId = options.productId as string
if (productId) {
this.loadProductDetail(productId)
+ this.checkFavoriteStatus(productId)
+ this.saveFootprint(productId)
}
},
methods: {
+ saveFootprint(productId: string) {
+ const footprintData = uni.getStorageSync('footprints')
+ let footprints: any[] = []
+
+ if (footprintData) {
+ try {
+ footprints = JSON.parse(footprintData as string) as any[]
+ } catch (e) {
+ console.error('Failed to parse footprints', e)
+ }
+ }
+
+ // 移除已存在的相同商品(为了将其移到最新位置)
+ footprints = footprints.filter(item => item.id !== productId)
+
+ // 添加到头部
+ footprints.unshift({
+ id: this.product.id,
+ name: this.product.name,
+ price: this.product.price,
+ original_price: this.product.original_price, // 添加原价
+ image: this.product.images[0],
+ sales: this.product.sales,
+ shopId: this.merchant.id,
+ shopName: this.merchant.shop_name,
+ viewTime: Date.now()
+ })
+
+ // 限制数量,例如最近50条
+ if (footprints.length > 50) {
+ footprints = footprints.slice(0, 50)
+ }
+
+ uni.setStorageSync('footprints', JSON.stringify(footprints))
+ },
+
loadProductDetail(productId: string) {
// 模拟加载商品详情数据
this.product = {
@@ -222,6 +271,45 @@ export default {
return
}
+ // 获取现有购物车数据
+ const cartData = uni.getStorageSync('cart')
+ let cartItems: any[] = []
+
+ if (cartData) {
+ try {
+ cartItems = JSON.parse(cartData as string) as any[]
+ } catch (e) {
+ console.error('解析购物车数据失败', e)
+ }
+ }
+
+ // 检查商品是否已存在 (同一SKU)
+ const existingItem = cartItems.find((item: any) => item.id === this.selectedSkuId)
+
+ if (existingItem) {
+ existingItem.quantity += this.quantity
+ } else {
+ // 查找SKU信息
+ const sku = this.productSkus.find(s => s.id === this.selectedSkuId)
+
+ // 添加新商品
+ cartItems.push({
+ id: this.selectedSkuId, // 使用SKU ID作为购物车条目ID
+ productId: this.product.id,
+ shopId: this.merchant.id,
+ shopName: this.merchant.shop_name,
+ name: this.product.name,
+ price: sku ? sku.price : this.product.price,
+ image: (sku && sku.image_url) ? sku.image_url : this.product.images[0],
+ spec: this.selectedSpec,
+ quantity: this.quantity,
+ selected: true
+ })
+ }
+
+ // 保存回存储
+ uni.setStorageSync('cart', JSON.stringify(cartItems))
+
// 模拟添加到购物车
uni.showToast({
title: '已添加到购物车',
@@ -248,6 +336,70 @@ export default {
uni.navigateTo({
url: `/pages/mall/consumer/shop-detail?merchantId=${this.merchant.id}`
})
+ },
+
+ checkFavoriteStatus(id: string) {
+ const storedFavorites = uni.getStorageSync('favorites')
+ if (storedFavorites) {
+ try {
+ const favorites = JSON.parse(storedFavorites as string) as any[]
+ this.isFavorite = favorites.some(item => item.id === id)
+ } catch (e) {
+ console.error('Failed to parse favorites', e)
+ }
+ }
+ },
+
+ toggleFavorite() {
+ const storedFavorites = uni.getStorageSync('favorites')
+ let favorites: any[] = []
+
+ if (storedFavorites) {
+ try {
+ favorites = JSON.parse(storedFavorites as string) as any[]
+ } catch (e) {
+ console.error('Failed to parse favorites', e)
+ }
+ }
+
+ if (this.isFavorite) {
+ // 取消收藏
+ favorites = favorites.filter(item => item.id !== this.product.id)
+ uni.showToast({
+ title: '已取消收藏',
+ icon: 'none'
+ })
+ } else {
+ // 添加收藏
+ favorites.push({
+ id: this.product.id,
+ name: this.product.name,
+ price: this.product.price,
+ image: this.product.images[0],
+ sales: this.product.sales,
+ shopId: this.merchant.id,
+ shopName: this.merchant.shop_name
+ })
+ uni.showToast({
+ title: '收藏成功',
+ icon: 'success'
+ })
+ }
+
+ uni.setStorageSync('favorites', JSON.stringify(favorites))
+ this.isFavorite = !this.isFavorite
+ },
+
+ goToHome() {
+ uni.switchTab({
+ url: '/pages/mall/consumer/home'
+ })
+ },
+
+ goToCart() {
+ uni.switchTab({
+ url: '/pages/mall/consumer/cart'
+ })
}
}
}
@@ -328,6 +480,7 @@ export default {
padding: 30rpx;
margin-bottom: 20rpx;
display: flex;
+ flex-direction: row; /* 显式横向排列 */
align-items: center;
}
@@ -340,6 +493,9 @@ export default {
.shop-details {
flex: 1;
+ display: flex;
+ flex-direction: column; /* 内部信息保持纵向,或者根据需要改为横向 */
+ justify-content: center;
}
.shop-name {
@@ -349,8 +505,10 @@ export default {
margin-bottom: 10rpx;
}
-.shop-rating {
+.shop-stats-row {
display: flex;
+ flex-direction: row; /* 显式横向排列 */
+ align-items: center;
}
.rating-text, .sales-text {
@@ -414,21 +572,55 @@ export default {
left: 0;
right: 0;
background-color: #fff;
- padding: 20rpx 30rpx;
+ padding: 10rpx 20rpx;
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.1);
+ display: flex;
+ flex-direction: row; /* 显式设置横向排列 */
+ align-items: center;
+ justify-content: space-between;
}
.action-buttons {
display: flex;
- gap: 20rpx;
+ flex-direction: row; /* 显式设置横向排列 */
+ align-items: center;
+ margin-right: 20rpx;
+}
+
+.action-btn {
+ display: flex;
+ flex-direction: column; /* 图标文字保持纵向 */
+ align-items: center;
+ justify-content: center;
+ margin-right: 20rpx;
+ min-width: 80rpx;
+}
+
+.action-icon {
+ font-size: 40rpx;
+ margin-bottom: 4rpx;
+}
+
+.action-text {
+ font-size: 20rpx;
+ color: #666;
+}
+
+.btn-group {
+ flex: 1;
+ display: flex;
+ flex-direction: row; /* 显式设置横向排列 */
+ align-items: center;
}
.cart-btn, .buy-btn {
flex: 1;
- height: 80rpx;
- border-radius: 40rpx;
- font-size: 28rpx;
+ height: 72rpx;
+ line-height: 72rpx;
+ border-radius: 36rpx;
+ font-size: 26rpx;
border: none;
+ margin: 0 10rpx;
}
.cart-btn {
diff --git a/pages/mall/consumer/profile.uvue b/pages/mall/consumer/profile.uvue
index c5cb4297..80fa6aa3 100644
--- a/pages/mall/consumer/profile.uvue
+++ b/pages/mall/consumer/profile.uvue
@@ -1,40 +1,110 @@
-
-