diff --git a/pages.json b/pages.json
index 184c94d..a211a95 100644
--- a/pages.json
+++ b/pages.json
@@ -20,10 +20,11 @@
{
"path": "pages/home/home",
"style": {
- // "navigationBarTitleText": "custom"
- "navigationStyle": "default",
- "navigationBarBackgroundColor": "#298DFF",
- "navigationBarTextStyle": "white"
+ // "navigationBarTitleText": "custom",
+ "navigationStyle": "custom"
+// "navigationStyle": "default",
+// "navigationBarBackgroundColor": "#298DFF",
+// "navigationBarTextStyle": "white"
}
},
{
diff --git a/pages/home/home.vue b/pages/home/home.vue
index e671d58..ab0d282 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -1,239 +1,197 @@
-
-
-
-
- {{infoList.store['name'] || storeinfo[0].store['name'] || info.name || ''}}
-
-
+
+
-
-
-
-
- {{infoList.store['position'] || storeinfo[0].store.position || info.position || ''}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ zone.title }}
-
-
-
-
-
-
-
-
-
-
- 到店挂号
- 预约专家 不排队
-
-
-
-
-
-
-
-
- 预约购药
- 在线选药 极速达
-
-
-
-
-
-
-
-
-
-
-
-
- 预约购药
- 正品保障 · 种类齐全 · 快速配送
-
-
-
-
-
-
-
-
-
- 医生列表
-
- 更多
-
-
-
-
-
-
-
-
-
- {{item.name}}
- {{item.title}}
-
-
-
- {{item.depart}} | {{item.store}}
-
-
- 擅长:
- {{item.good_at}}
-
-
-
- {{item.inquiry_num}}
- 问诊量
-
-
- {{item.accept_percent}}
- 接诊率
-
-
-
- 咨询
-
+
+
+ {{infoList.store['name'] || storeinfo[0].store['name'] || info.name || '请选择门店'}}
+
+ 切换
-
-
- {{ topProductsTitle }}
-
- 更多
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
- {{ item.drug.drug_name }}
- OTC
-
- {{ item.drug.specification }}
+
+ {{ item.title }}
+
+
+
+
+
+
+
+
+
+ 到店挂号
+ 预约专家 不排队
+
+
+
+
+
+ 在线复诊
+ 在线选药 极速达
+
+
+
+
+
+
+
+
+
+ 预约购药
+ 正品保障 · 种类齐全 · 快速配送
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.name}}
+ {{item.title}}
-
+ {{item.depart}} | {{item.store}}
+
+ 擅长
+ {{item.good_at}}
+
+
+ 咨询
+
+
+
+ {{item.inquiry_num || '0'}}
+ 问诊量
+
+
+ {{item.accept_percent || '100%'}}
+ 接诊率
+
+
+ 10分钟
+ 平均响应
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.drug ? item.drug.drug_name : '' }}
+
+ {{item.drug && item.drug.is_otc ? 'OTC' : 'Rx'}}
+
+ {{ item.drug ? item.drug.specification : '' }}
+
+
- ¥
-
- {{ item.price || (item.drug.drugStoreDrug ? item.drug.drugStoreDrug.price : '0.00') }}
-
+ ¥
+ {{ item.price || (item.drug && item.drug.drugStoreDrug ? item.drug.drugStoreDrug.price : '0.00') }}
+
+
+
+
- 购买
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{item.drug.drug_name}}
-
- {{item.drug.is_otc ? 'OTC' : 'Rx'}}
-
-
- {{item.drug.specification}}
-
-
- {{item.drug.category}}
-
-
-
-
-
-
- ¥
- {{item.price}}
-
-
-
- 购买
-
-
-
-
-
-
-
-
-
- 平台资质
- 更多 >
-
-
-
-
- {{ item.name }}
-
-
-
-
-
+
-
+
-
@@ -258,11 +216,11 @@ export default {
storeType: 0,
storeinfo: [],
doctorList: [],
- productList: [], // 存储药品列表数据
- homeZones: [], // 首页专区入口
+ productList: [],
+ homeZones: [],
topProductsTitle: '热销商品',
- topProductsList: [], // 首页热销商品(OTC)
- qualifications: [], // 资质证明列表
+ topProductsList: [],
+ qualifications: [],
show: true,
showed: false,
shopList: {},
@@ -273,7 +231,18 @@ export default {
info: [],
bgShow: false,
isShow_envVersion: true,
- defaultDoctorId: '39' // 默认医生ID,从API获取
+ defaultDoctorId: '39',
+ statusBarHeight: 20,
+ isSticky: false,
+
+ // 控制金刚区布局模式: 'scroll' (滑动) 或 'wrap' (换行)
+ zoneLayoutMode: 'scroll'
+ }
+ },
+ computed: {
+ // 解决 template 中复杂表达式导致的渲染错误
+ displayProductList() {
+ return this.topProductsList.length > 0 ? this.topProductsList : this.productList;
}
},
onLoad() {
@@ -288,14 +257,12 @@ export default {
if (this.isShow_envVersion === false) {
this.getList();
}
- },
- created() {
- const token = uni.getStorageSync('token')
- const userInfo = uni.getStorageSync('userinfo')
- if (!token || !userInfo) {
- uni.navigateTo({
- url: '/pages/home/index'
- })
+
+ try {
+ const systemInfo = uni.getSystemInfoSync();
+ this.statusBarHeight = systemInfo.statusBarHeight || 20;
+ } catch (e) {
+ console.error(e);
}
},
onReady() {
@@ -304,15 +271,21 @@ export default {
} else {
this.goNewlist()
}
- uni.setNavigationBarTitle({
- title: this.headerTitle,
- success() {}
- });
- uni.setNavigationBarColor({
- frontColor: '#000000',
- })
+ },
+ onPageScroll(e) {
+ if (e.scrollTop > 50) {
+ this.isSticky = true;
+ } else {
+ this.isSticky = false;
+ }
},
methods: {
+ // 处理购物车按钮点击
+ handleAddToCart(item) {
+ if(item && item.drug) {
+ this.goProductDetail(item);
+ }
+ },
goYard(type) {
uni.navigateTo({
url: '/pages/Inquiries/Inquiries?type=' + type
@@ -320,7 +293,6 @@ export default {
},
async golist(type) {
if (type === 3) {
- // 检查药店在线复诊配置(委托诊所和医生)
try {
const storeId = uni.getStorageSync('store_id');
const res = await checkOnlineConsultationConfigApi({ store_id: storeId });
@@ -332,20 +304,14 @@ export default {
});
return;
}
- // 使用接口返回的医生ID
const doctorId = res.data.result.doctor_id || this.defaultDoctorId;
- // 获取委托诊所ID,如果有委托诊所则使用委托诊所ID,否则使用当前诊所ID
const delegateStoreId = res.data.result.delegate_store_id || storeId;
return uni.navigateTo({
url: '/subPackages/product/product?doctor_id=' + doctorId + '®ister_type=3&delegate_store_id=' + delegateStoreId
});
} catch (error) {
console.error('检查在线复诊配置失败:', error);
- uni.showToast({
- title: '网络异常,请稍后重试',
- icon: 'none',
- duration: 2000
- });
+ uni.showToast({ title: '网络异常,请稍后重试', icon: 'none' });
return;
}
}
@@ -369,74 +335,38 @@ export default {
if (res.data.errcode == 0) {
uni.setStorageSync('token_platform_id', res.data.data.token)
} else {
- this.$refs.uToast.show({
- title: res.data.msg,
- type: 'default',
- icon: false
- })
+ this.$refs.uToast.show({ title: res.data.msg, type: 'default', icon: false })
}
})
},
tosearch() {
- uni.navigateTo({
- url: '/subPackages/shop/search-home'
- })
+ uni.navigateTo({ url: '/subPackages/shop/search-home' })
},
toStore() {
- uni.navigateTo({
- url: '/subPackages/my/mystore'
- })
+ uni.navigateTo({ url: '/subPackages/my/mystore' })
},
goLookDoctor(id, sts_id) {
- if (!sts_id) {
- let sts_id = uni.getStorageSync('store_id')
- }
+ if (!sts_id) { let sts_id = uni.getStorageSync('store_id') }
setTimeout(() => {
uni.requestSubscribeMessage({
- tmplIds: ['JdSs08cMSiL17xwwHZ8fZ5UBUqeY0eKAuvyW7n4Fl20',
- 'OERMugiahk-aKRVH9GHmdJCRBE3yldzEKTzbMCJhY6U',
- 'p-Ix0uIuwPKxm-_yKDlI8mkI-niUgPtaMUZyAaa5vvA'
- ],
+ tmplIds: ['JdSs08cMSiL17xwwHZ8fZ5UBUqeY0eKAuvyW7n4Fl20', 'OERMugiahk-aKRVH9GHmdJCRBE3yldzEKTzbMCJhY6U', 'p-Ix0uIuwPKxm-_yKDlI8mkI-niUgPtaMUZyAaa5vvA'],
complete: (res) => {
- uni.navigateTo({
- url: '/subPackages/doctor/doctor-detail?store_id=' + sts_id + '&id=' + id
- })
+ uni.navigateTo({ url: '/subPackages/doctor/doctor-detail?store_id=' + sts_id + '&id=' + id })
}
})
}, 200)
},
- toSee() {
- uni.scanCode({
- success: function(res) {
- uni.showToast({
- title: '扫码成功',
- duration: 2000,
- icon: "success"
- });
- },
- });
- },
getStore() {
if (uni.getStorageSync('store_id')) {
this.show = false
storeInfo({
method: "post",
- data: {
- store_id: uni.getStorageSync('store_id') || '11001',
- }
+ data: { store_id: uni.getStorageSync('store_id') || '11001' }
}).then((res) => {
if (res.data.errcode == 0) {
this.storeType = res.data.data.store['type']
this.infoList = res.data.data
this.headerTitle = res.data.data.store['name']
- uni.setNavigationBarTitle({
- title: this.headerTitle,
- success() {},
- fail() { this.getStore() }
- });
- uni.setNavigationBarColor({
- frontColor: '#000000',
- })
this.getBannered();
}
})
@@ -447,9 +377,7 @@ export default {
goNewlist() {
storeList({
method: "post",
- data: {
- store_id: uni.getStorageSync('store_id') || '11001',
- }
+ data: { store_id: uni.getStorageSync('store_id') || '11001' }
}).then((res) => {
if (res.data.errcode == 0) {
this.show = res.data.data.open_issue
@@ -461,36 +389,18 @@ export default {
this.storeinfo = res.data.data.list.filter((item) => item.is_online == 1)
uni.setStorageSync('store_id', this.storeinfo[0].store.id)
this.headerTitle = this.storeinfo[0].store['name']
- uni.setNavigationBarTitle({
- title: this.headerTitle,
- success() {}
- });
- uni.setNavigationBarColor({
- frontColor: '#000000',
- })
this.getBannered();
}
} else {
- if (this.isShow_envVersion) {
- uni.navigateTo({ url: '/pages/home/index' })
- } else {
- uni.navigateTo({ url: '/pages/home/index' })
- }
+ uni.navigateTo({ url: '/pages/home/index' })
}
})
},
- goList(id) {
- uni.navigateTo({
- url: '/pages/home/index-list?type=' + 1 + '&id?=' + id
- })
- },
getList() {
this.doctorList = [];
doctorList({
method: "post",
- data: {
- store_id: uni.getStorageSync('store_id') || '11001',
- }
+ data: { store_id: uni.getStorageSync('store_id') || '11001' }
}).then((res) => {
if (res.data.errcode === 0) {
this.doctorList = (res.data.data.list).slice(0, 5)
@@ -498,10 +408,7 @@ export default {
})
},
toChang(e) {
- storeChange({
- method: "post",
- data: { store_id: e }
- }).then((res) => {
+ storeChange({ method: "post", data: { store_id: e } }).then((res) => {
if (res.data.errcode == 0) {
this.getStore()
this.getList();
@@ -511,47 +418,35 @@ export default {
getBannered() {
getBanner({
method: "post",
- data: {
- store_id: uni.getStorageSync('store_id') || '11001',
- }
+ data: { store_id: uni.getStorageSync('store_id') || '11001' }
}).then((res) => {
if (res.data.errcode == 0) {
this.info = res.data.data
this.urlInfo = res.data.data.nav
this.storeType = res.data.data.type
- this.list = (res.data.data.nav).map((item) => {
- return item.pic
- })
+ this.list = (res.data.data.nav).map((item) => { return item.pic })
}
})
},
toBanner(e) {
if (!this.urlInfo[e].external_link) return
if (this.urlInfo[e].link_type == 1 && this.isShow_envVersion == false) {
- uni.navigateTo({
- url: this.urlInfo[e].external_link,
- success() {}
- })
+ uni.navigateTo({ url: this.urlInfo[e].external_link })
} else {
- uni.navigateTo({
- url: '/pages/home/home-banner?id=' + this.urlInfo[e].external_link,
- success() {}
- })
+ uni.navigateTo({ url: '/pages/home/home-banner?id=' + this.urlInfo[e].external_link })
}
},
- // 获取药品列表
getProductList() {
getStoreDrugListBySalespersonApi({
store_id: uni.getStorageSync('store_id') || '11001',
page: 1,
- limit: 3 // 【优化点】首页只展示3个热门商品,保持版面简洁
+ limit: 3
}).then((res) => {
if (res.data.code == 0) {
this.productList = res.data.result.records;
}
})
},
- // 获取首页热销商品
getHomeTopProducts() {
getHomeTopProductsApi({
store_id: uni.getStorageSync('store_id') || '11001',
@@ -563,7 +458,6 @@ export default {
}
})
},
- // 获取首页专区入口
getHomeZones() {
getHomeZonesApi({
store_id: uni.getStorageSync('store_id') || '11001',
@@ -571,11 +465,8 @@ export default {
if (res.data.code == 0) {
this.homeZones = res.data.result || res.data.data || [];
}
- }).catch(() => {
- this.homeZones = [];
- })
+ }).catch(() => { this.homeZones = []; })
},
- // 获取平台资质证明
getPlatformQualifications() {
getPlatformQualificationsApi({
store_id: uni.getStorageSync('store_id') || '11001',
@@ -583,61 +474,8 @@ export default {
if (res.data.code == 0 || res.data.errcode == 0) {
this.qualifications = res.data.data || res.data.result || [];
}
- }).catch(() => {
- // 如果接口不存在,使用默认数据
- this.qualifications = [
- { name: '互联网药品经营许可证', image: '', type: 1 },
- { name: '营业执照', image: '', type: 2 },
- { name: '医疗器械经营许可证', image: '', type: 3 },
- { name: '食品经营许可证', image: '', type: 4 },
- { name: '药师资格证', image: '', type: 5 }
- ];
})
},
- // 跳转药品详情
- goProductDetail(item) {
- uni.navigateTo({
- 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}`,
- });
- },
- // 直接购买
- async buyProduct(item) {
- // 检查药店在线复诊配置(委托诊所和医生)
- try {
- const storeId = uni.getStorageSync('store_id');
- const res = await checkOnlineConsultationConfigApi({ store_id: storeId });
- if (!res.data?.result?.can_use) {
- uni.showToast({
- title: res.data?.result?.message || '该药店暂不支持在线复诊功能',
- icon: 'none',
- duration: 2000
- });
- return;
- }
- // 使用接口返回的医生ID
- const doctorId = res.data.result.doctor_id || this.defaultDoctorId;
- // 获取委托诊所ID,如果有委托诊所则使用委托诊所ID,否则使用当前诊所ID
- const delegateStoreId = res.data.result.delegate_store_id || storeId;
- uni.navigateTo({
- url: `/subPackages/product/product?doctor_id=${doctorId}®ister_type=3&delegate_store_id=${delegateStoreId}`
- });
- } catch (error) {
- console.error('检查在线复诊配置失败:', error);
- uni.showToast({
- title: '网络异常,请稍后重试',
- icon: 'none',
- duration: 2000
- });
- }
- },
- // 预览资质证明
previewQualification(item) {
if (item.image) {
uni.previewImage({
@@ -646,547 +484,255 @@ export default {
});
}
},
- // 跳转平台信息页面
- goPlatformInfo() {
+ goProductDetail(item) {
+ if(!item || !item.drug) return;
uni.navigateTo({
- url: '/pages/index/platform-info'
+ 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}`
});
},
- // 获取默认医生ID(根据门店配置)
+ goZoneList(zone) {
+ if (!zone || !zone.type) return;
+ uni.navigateTo({ url: `/subPackages/product/product?zone_type=${zone.type}` });
+ },
+ goPlatformInfo() {
+ uni.navigateTo({ url: '/pages/index/platform-info' });
+ },
async getDefaultDoctorId() {
try {
const storeId = uni.getStorageSync('store_id');
- if (!storeId) {
- console.warn('未找到store_id,无法获取默认医生');
- this.defaultDoctorId = null;
- return;
- }
+ if (!storeId) return;
const res = await request('/xkApi/online-consultation/get-default-doctor-id', {
method: 'GET',
data: { store_id: storeId }
}, 0);
if (res.data && res.data.result && res.data.result.doctor_id) {
this.defaultDoctorId = res.data.result.doctor_id;
- } else {
- // 门店未配置在线复诊负责人
- this.defaultDoctorId = null;
- console.warn('该门店未配置在线复诊负责人:', res.data?.result?.message);
}
} catch (error) {
console.error('获取默认医生ID失败:', error);
- this.defaultDoctorId = null;
}
}
},
- mounted() {
- const token = uni.getStorageSync('token')
- const id = uni.getStorageSync('store_id')
- const d_id = uni.getStorageSync('doctors_id')
- const d_store = uni.getStorageSync('st_id')
- if (token && id) {
- this.toChang(id)
- }
- if (d_id && token && d_store) {
- this.goLookDoctor(d_id, d_store)
- }
- },
onShow() {
this.storeId = uni.getStorageSync('store_id');
- this.infoList = ""
this.getStore();
this.getList();
- this.getProductList(); // 每次显示页面刷新商品列表
- this.getHomeTopProducts(); // 获取首页热销商品
- this.getPlatformQualifications(); // 获取平台资质证明
- this.getHomeZones(); // 获取首页专区入口
- this.getDefaultDoctorId(); // 获取默认医生ID
+ this.getProductList();
+ this.getHomeTopProducts();
+ this.getHomeZones();
+ this.getPlatformQualifications(); // 已补回
+ this.getDefaultDoctorId();
},
}
+
\ No newline at end of file
diff --git a/pages/index/platform-info.vue b/pages/index/platform-info.vue
index 4156628..52f1154 100644
--- a/pages/index/platform-info.vue
+++ b/pages/index/platform-info.vue
@@ -1,8 +1,8 @@
-
+
- 平台资质证明
+ {{ isPlatform ? '平台资质证明' : '店铺资质证明' }}
@@ -59,6 +59,8 @@ import { getPlatformQualificationsApi, getPlatformInfoApi } from '../../request/
export default {
data() {
return {
+ storeId: '', // 店铺ID,0表示平台
+ isPlatform: false, // 是否为平台资质
qualifications: [],
contactInfo: {
phone: '',
@@ -72,15 +74,28 @@ export default {
}
}
},
- onLoad() {
+ onLoad(options) {
+ // 接收store_id参数,如果传入0则显示平台资质,否则显示店铺资质
+ if (options.store_id !== undefined) {
+ this.storeId = options.store_id;
+ this.isPlatform = options.store_id === '0' || options.store_id === 0;
+ } else {
+ // 默认使用当前店铺ID
+ this.storeId = uni.getStorageSync('store_id') || '11001';
+ this.isPlatform = false;
+ }
+ // 动态设置页面标题
+ uni.setNavigationBarTitle({
+ title: this.isPlatform ? '平台资质' : '店铺资质'
+ });
this.getQualifications();
this.getPlatformInfoData();
},
methods: {
- // 获取平台资质证明
+ // 获取资质证明
getQualifications() {
getPlatformQualificationsApi({
- store_id: uni.getStorageSync('store_id') || '11001',
+ store_id: this.storeId,
}).then((res) => {
if (res.data.code == 0 || res.data.errcode == 0) {
this.qualifications = res.data.data || res.data.result || [];
@@ -99,7 +114,7 @@ export default {
// 获取平台信息
getPlatformInfoData() {
getPlatformInfoApi({
- store_id: uni.getStorageSync('store_id') || '11001',
+ store_id: this.storeId,
}).then((res) => {
if (res.data.code == 0 || res.data.errcode == 0) {
const data = res.data.data || res.data.result || {};
diff --git a/subPackages/product/symptoms.vue b/subPackages/product/symptoms.vue
index ff8e4c4..ee700e1 100644
--- a/subPackages/product/symptoms.vue
+++ b/subPackages/product/symptoms.vue
@@ -61,6 +61,12 @@
{{ productDetail.guozi_no }}
+
+
+
+ 查看平台资质
+
+
@@ -642,6 +648,12 @@ export default {
delta: 1
});
},
+ // 跳转平台资质页面
+ goPlatformQualification() {
+ uni.navigateTo({
+ url: '/pages/index/platform-info?store_id=0'
+ });
+ },
onIllnessConfirm(e) {
const index = e[0];
this.prescriptionFormData.illnessInfo = this.illnessOptions[index].value;
@@ -747,6 +759,18 @@ export default {
.val { color: #303133; font-weight: 500; }
}
}
+
+ .platform-qualification-entry {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ background: #F7F8FA;
+ padding: 24rpx;
+ border-radius: 12rpx;
+ margin-top: 20rpx;
+ font-size: 28rpx;
+ color: #606266;
+ }
}
/* 3. 物流提示 */