fix: 首页的资质证明和详情的处方药、保健食品提醒

This commit is contained in:
2025-12-19 16:00:03 +08:00
parent cf0e974fa1
commit 29298af893
6 changed files with 267 additions and 115 deletions

1
.gitignore vendored
View File

@@ -116,3 +116,4 @@ dist
.pnp.*
/.hbuilderx/
/.idea/
/database/

View File

@@ -23,6 +23,33 @@
<u-swiper :list="list" :img-mode="aspectFill" :height="300" :interval="4000" @click="toBanner" border-radius="12"></u-swiper>
</view>
<!-- 首页专区入口 -->
<view v-if="storeType === '1' && homeZones.length" class="zone-entry-section">
<scroll-view class="zone-scroll" scroll-x="true" show-scrollbar="false">
<view class="zone-list">
<view
v-for="(zone, index) in homeZones"
:key="zone.type"
class="zone-item"
@click="goZoneList(zone)"
>
<view class="zone-image-wrapper">
<image
v-if="zone.icon"
:src="zone.icon"
mode="aspectFit"
class="zone-image"
/>
<view v-else class="zone-image-placeholder">
<text class="iconfont icon-shangpin"></text>
</view>
</view>
<view class="zone-label">{{ zone.title }}</view>
</view>
</view>
</scroll-view>
</view>
<!-- 导航栏区域诊所模式 (显示挂号和购药) -->
<!-- 优化点使用第一版的"左文右图+副标题"布局但背景保留原有的bg图片 -->
<view class="nav" v-if="storeType === '0'">
@@ -106,87 +133,42 @@
<!-- 药店模式热销药品标题 -->
<view v-if="storeType === '1'" class="doctor_list" @click="golist(3)">
热销商品
{{ topProductsTitle }}
<view class="info">
更多 <text class="iconfont icon-jiantou1"></text>
</view>
</view>
<!-- 药店模式分类热销商品展示 -->
<view v-if="storeType === '1'" class="top-products-container">
<!-- OTC热销 -->
<view v-if="topProducts.otc && topProducts.otc.length > 0" class="category-section">
<view class="category-title">OTC非处方药</view>
<view class="product-list-container">
<view class="product-card-simple" @click="goProductDetail(item)" v-for="(item,index) in topProducts.otc" :key="item.drug.id">
<image :src="item.drug.image || '/static/mine/avatar_1.png'" mode="aspectFill" class="product-img"></image>
<view class="product-info-simple">
<view class="product-main">
<view class="product-name-row">
<text class="product-name">{{item.drug.drug_name}}</text>
<text class="otc-tag otc-green">OTC</text>
</view>
<text class="product-spec">{{item.drug.specification}}</text>
</view>
<view class="product-bottom">
<view class="price-box">
<text class="currency">¥</text>
<text class="price">{{item.price || (item.drug.drugStoreDrug ? item.drug.drugStoreDrug.price : '0.00')}}</text>
</view>
<view class="buy-btn" @click.stop="goProductDetail(item)">购买</view>
<!-- 药店模式热销商品展示仅OTC -->
<view v-if="storeType === '1' && topProductsList.length > 0" class="top-products-container">
<view class="product-list-container">
<view
class="product-card-simple"
@click="goProductDetail(item)"
v-for="(item, index) in topProductsList"
:key="item.drug.id"
>
<image
:src="item.drug.image || '/static/mine/avatar_1.png'"
mode="aspectFill"
class="product-img"
></image>
<view class="product-info-simple">
<view class="product-main">
<view class="product-name-row">
<text class="product-name">{{ item.drug.drug_name }}</text>
<text class="otc-tag otc-green">OTC</text>
</view>
<text class="product-spec">{{ item.drug.specification }}</text>
</view>
</view>
</view>
</view>
<!-- 处方药热销 -->
<view v-if="topProducts.prescription && topProducts.prescription.length > 0" class="category-section">
<view class="category-title">处方药</view>
<view class="product-list-container">
<view class="product-card-simple" @click="goProductDetail(item)" v-for="(item,index) in topProducts.prescription" :key="item.drug.id">
<image :src="item.drug.image || '/static/mine/avatar_1.png'" mode="aspectFill" class="product-img prescription-blur"></image>
<view class="product-info-simple">
<view class="product-main">
<view class="product-name-row">
<text class="product-name">{{item.drug.drug_name}}</text>
<text class="otc-tag otc-red">Rx</text>
</view>
<text class="product-spec">{{item.drug.specification}}</text>
</view>
<view class="product-bottom">
<view class="price-box">
<text class="currency">¥</text>
<text class="price">{{item.price || (item.drug.drugStoreDrug ? item.drug.drugStoreDrug.price : '0.00')}}</text>
</view>
<view class="buy-btn" @click.stop="goProductDetail(item)">购买</view>
</view>
</view>
</view>
</view>
</view>
<!-- 保健食品热销 -->
<view v-if="topProducts.health_food && topProducts.health_food.length > 0" class="category-section">
<view class="category-title">保健食品</view>
<view class="product-list-container">
<view class="product-card-simple" @click="goProductDetail(item)" v-for="(item,index) in topProducts.health_food" :key="item.drug.id">
<image :src="item.drug.image || '/static/mine/avatar_1.png'" mode="aspectFill" class="product-img"></image>
<view class="product-info-simple">
<view class="product-main">
<view class="product-name-row">
<text class="product-name">{{item.drug.drug_name}}</text>
<text class="otc-tag" style="color: #FF9800; border-color: #FF9800;">保健</text>
</view>
<text class="product-spec">{{item.drug.specification}}</text>
</view>
<view class="product-bottom">
<view class="price-box">
<text class="currency">¥</text>
<text class="price">{{item.price || (item.drug.drugStoreDrug ? item.drug.drugStoreDrug.price : '0.00')}}</text>
</view>
<view class="buy-btn" @click.stop="goProductDetail(item)">购买</view>
<view class="product-bottom">
<view class="price-box">
<text class="currency">¥</text>
<text class="price">
{{ item.price || (item.drug.drugStoreDrug ? item.drug.drugStoreDrug.price : '0.00') }}
</text>
</view>
<view class="buy-btn" @click.stop="goProductDetail(item)">购买</view>
</view>
</view>
</view>
@@ -194,7 +176,7 @@
</view>
<!-- 药店模式药品列表容器保留原有逻辑作为备用 -->
<view v-if="storeType === '1' && (!topProducts.otc || topProducts.otc.length === 0)" class="product-list-container">
<view v-if="storeType === '1' && topProductsList.length === 0" class="product-list-container">
<!-- 药品卡片优化后的单卡片UI布局 -->
<view class="product-card-simple" @click="goProductDetail(item)" v-for="(item,index) in productList" :key="item.drug.id">
<!-- 左侧药品封面图 -->
@@ -266,7 +248,7 @@ import {
storeList
} from '../../request/api/api'
import { getPlatformQualificationsApi } from '../../request/api/platform'
import { getStoreDrugListBySalespersonApi, getHomeTopProductsApi } from "@/request/api/product";
import { getStoreDrugListBySalespersonApi, getHomeTopProductsApi, getHomeZonesApi } from "@/request/api/product";
export default {
data() {
@@ -276,11 +258,9 @@ export default {
storeinfo: [],
doctorList: [],
productList: [], // 存储药品列表数据
topProducts: {
otc: [],
prescription: [],
health_food: []
}, // 首页热销商品
homeZones: [], // 首页专区入口
topProductsTitle: '热销商品',
topProductsList: [], // 首页热销商品OTC
qualifications: [], // 资质证明列表
show: true,
showed: false,
@@ -549,11 +529,25 @@ export default {
getHomeTopProductsApi({
store_id: uni.getStorageSync('store_id') || '11001',
}).then((res) => {
if (res.data.code == 0) {
this.topProducts = res.data.result;
if (res.data.code == 0 && res.data.result) {
const result = res.data.result;
this.topProductsTitle = result.title || '热销商品';
this.topProductsList = result.list || [];
}
})
},
// 获取首页专区入口
getHomeZones() {
getHomeZonesApi({
store_id: uni.getStorageSync('store_id') || '11001',
}).then((res) => {
if (res.data.code == 0) {
this.homeZones = res.data.result || res.data.data || [];
}
}).catch(() => {
this.homeZones = [];
})
},
// 获取平台资质证明
getPlatformQualifications() {
getPlatformQualificationsApi({
@@ -565,7 +559,7 @@ export default {
}).catch(() => {
// 如果接口不存在,使用默认数据
this.qualifications = [
{ name: '药品经营许可证', image: '', type: 1 },
{ name: '互联网药品经营许可证', image: '', type: 1 },
{ name: '营业执照', image: '', type: 2 },
{ name: '医疗器械经营许可证', image: '', type: 3 },
{ name: '食品经营许可证', image: '', type: 4 },
@@ -579,6 +573,13 @@ export default {
url: `/subPackages/product/symptoms?id=${item.drug.id}&drug_name=${item.drug.drug_name}&is_otc=${item.drug.is_otc}&image=${item.drug.image}&price=${item.price}`
});
},
// 跳转专区商品列表
goZoneList(zone) {
if (!zone || !zone.type) return;
uni.navigateTo({
url: `/subPackages/product/product?zone_type=${zone.type}`,
});
},
// 直接购买
buyProduct(item) {
uni.navigateTo({
@@ -621,6 +622,7 @@ export default {
this.getProductList(); // 每次显示页面刷新商品列表
this.getHomeTopProducts(); // 获取首页热销商品
this.getPlatformQualifications(); // 获取平台资质证明
this.getHomeZones(); // 获取首页专区入口
},
}
</script>
@@ -689,6 +691,118 @@ export default {
height: 300rpx;
}
// 2.5 首页专区入口区域 - 水平滚动样式
.zone-entry-section {
width: 100%;
margin: 30rpx 0;
padding: 30rpx 0;
background: linear-gradient(180deg, #EEF4FF 0%, #F3F7FF 100%);
position: relative;
overflow: hidden;
.zone-scroll {
width: 100%;
white-space: nowrap;
.zone-list {
display: inline-flex;
padding: 0 30rpx;
gap: 30rpx;
}
.zone-item {
display: inline-flex;
flex-direction: column;
align-items: center;
position: relative;
flex-shrink: 0;
padding-bottom: 10rpx;
transition: transform 0.2s ease;
&:active {
transform: scale(0.95);
}
.zone-image-wrapper {
width: 140rpx;
height: 140rpx;
position: relative;
margin-bottom: 16rpx;
display: flex;
align-items: center;
justify-content: center;
padding: 8rpx;
// 不规则形状背景 - 使用border-radius创建云朵/气泡效果
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(255, 255, 255, 0.95);
// 使用不规则border-radius创建云朵形状
border-radius: 65% 35% 55% 45% / 45% 65% 35% 55%;
z-index: 0;
box-shadow: 0 4rpx 16rpx rgba(65, 117, 238, 0.12);
transition: box-shadow 0.3s ease;
}
// 添加第二个不规则层增加层次感
&::after {
content: '';
position: absolute;
top: -4rpx;
left: -4rpx;
right: -4rpx;
bottom: -4rpx;
background: rgba(227, 242, 253, 0.4);
border-radius: 60% 40% 65% 35% / 40% 60% 40% 60%;
z-index: -1;
filter: blur(8rpx);
}
.zone-image {
width: 100%;
height: 100%;
border-radius: 50%;
object-fit: cover;
position: relative;
z-index: 1;
background: #f5f5f5;
}
.zone-image-placeholder {
width: 100%;
height: 100%;
border-radius: 50%;
background: #E3F2FD;
display: flex;
align-items: center;
justify-content: center;
position: relative;
z-index: 1;
.iconfont {
font-size: 60rpx;
color: #4175EE;
}
}
}
.zone-label {
font-size: 28rpx;
color: #333;
font-weight: 500;
text-align: center;
white-space: nowrap;
line-height: 1.4;
}
}
}
}
// 3. 导航栏样式优化结合V1布局结构和原版背景图
.nav {
width: 710rpx;

View File

@@ -88,7 +88,7 @@ export default {
}).catch(() => {
// 如果接口不存在,使用默认数据
this.qualifications = [
{ name: '药品经营许可证', image: '', type: 1 },
{ name: '互联网药品经营许可证', image: '', type: 1 },
{ name: '营业执照', image: '', type: 2 },
{ name: '医疗器械经营许可证', image: '', type: 3 },
{ name: '食品经营许可证', image: '', type: 4 },

View File

@@ -1,28 +1,10 @@
import http from './request'
import {get, post, uploadFile} from './http'
import {post} from './http'
const prefix = '/order';
/**
* 获取扫码诊所的商品详情
* 查询订单的处方状态
* @param params
* @returns {Promise<*>}
*/
export async function genOrderApi(params) {
return await post(`${prefix}/gen-order`, params, 3)
}
/**
* 创建订单 - 购物车
* @param params
* @returns {Promise<*>}
*/
export async function genOrderByCartApi(params) {
return await post(`${prefix}/gen-order-by-cart`, params, 3)
}
/**
* 保存购药、复诊状态下的挂号信息
* @param params
* @returns {Promise<*>}
*/
export async function saveRegisterInfoApi(params) {
return await post(`${prefix}/save-register-info`, params, 3)
export async function getPrescriptionStatusApi(params) {
return await post('/order/prescription-status', params, 3)
}

View File

@@ -32,6 +32,14 @@ export async function getOrderTextApi(params) {
export async function getHomeTopProductsApi(params) {
return await get('/product/home-top-products', params, 3)
}
/**
* 获取首页专区入口配置
* @param params
* @returns {Promise<*>}
*/
export async function getHomeZonesApi(params) {
return await get('/product/home-zones', params, 3)
}
/**
* 更新商品介绍图
* @param params

View File

@@ -68,7 +68,7 @@
<view class="image-wrapper">
<image
class="item-image"
:class="{ 'prescription-blur': item.drug.is_otc === 0 || item.drug.is_otc === '0' }"
:class="{ 'prescription-blur': item.drug.is_otc === 0 && item.drug.type == 2 }"
:src="item.drug.image || '/static/mine/avatar_1.png'"
mode="aspectFill"
lazy-load
@@ -176,7 +176,7 @@
</template>
<script>
import { getStoreDrugListBySalespersonApi } from "@/request/api/product";
import { getStoreDrugListBySalespersonApi, getHomeZonesApi } from "@/request/api/product";
import { getCartCountsApi, saveCartApi } from "@/request/api/cart";
export default {
@@ -186,14 +186,9 @@ export default {
searchKeyword: "",
// 自定义下拉菜单相关
selectedCategory: 'all',
selectedCategory: 'otc',
showCategoryMenu: false, // 控制下拉菜单显示
categoryOptions: [
{ label: '全部', value: 'all' },
{ label: 'OTC', value: 'otc' },
{ label: '处方药', value: 'prescription' },
{ label: '保健品', value: 'health_food' }
],
categoryOptions: [], // 从后端获取分类选项
doctorId: 0,
r_type: 0,
@@ -224,8 +219,56 @@ export default {
onLoad(e) {
this.doctorId = e.doctor_id;
this.r_type = e.register_type;
// 根据首页传入的专区类型初始化分类默认OTC
if (e.zone_type) {
this.selectedCategory = e.zone_type;
} else {
this.selectedCategory = 'otc';
}
// 获取分类选项
this.getCategoryOptions();
this.getList();
},
methods: {
// 获取分类选项(从后端获取专区配置)
getCategoryOptions() {
getHomeZonesApi({
store_id: uni.getStorageSync('store_id') || '11001',
}).then((res) => {
if (res.data.code == 0) {
const zones = res.data.result || res.data.data || [];
// 将专区数据转换为分类选项格式
this.categoryOptions = zones.map(zone => ({
label: zone.title || this.getCategoryLabelByType(zone.type),
value: zone.type
}));
// 如果当前选中的分类不在选项中,重置为第一个选项
if (this.categoryOptions.length > 0) {
const hasCurrentCategory = this.categoryOptions.some(opt => opt.value === this.selectedCategory);
if (!hasCurrentCategory) {
this.selectedCategory = this.categoryOptions[0].value;
}
}
}
}).catch(() => {
// 如果接口失败,使用默认分类选项
this.categoryOptions = [
{ label: 'OTC', value: 'otc' },
{ label: '处方药', value: 'prescription' },
{ label: '保健食品', value: 'health_food' }
];
});
},
// 根据type获取分类标签备用
getCategoryLabelByType(type) {
const typeMap = {
'otc': 'OTC',
'prescription': '处方药',
'health_food': '保健食品',
'service_package': '产品服务包'
};
return typeMap[type] || type;
},
// 切换下拉菜单显示
toggleCategoryMenu() {
this.showCategoryMenu = !this.showCategoryMenu;
@@ -364,6 +407,10 @@ export default {
}
},
onShow() {
// 如果分类选项为空,重新获取
if (this.categoryOptions.length === 0) {
this.getCategoryOptions();
}
this.getList();
this.initCartPosition();
this.updateCartCount();