feat(home/chat): 列表骨架屏、聊天室己方头像与协议/医生详情优化

- 新增分包组件 ListSkeleton(doctor/message/product/article/category/zone)
- 首页/消息/资讯首次加载改用骨架屏,刷新不再清空旧数据避免闪空
  · 去掉 home getList、消息 onShow 中的数组清空
  · 三页 pages.json 增加 easycom 与 componentPlaceholder 主包异步引用
- 聊天室己方头像改为读取本地 userinfo.avatarurl(登录后微信头像),
  mycollection 上传头像成功后同步写回 storage
- 修复协议抽屉点不开:page-container 改为 v-if + :show;
  协议名单独可点节点,匹配放宽 name/desc 双向 includes
- 医生气泡头像可点击进入 doctor-detail?readonly=1 只读医生详情,
  隐藏预约挂号区
This commit is contained in:
李琦
2026-07-19 16:08:04 +08:00
parent 2c739324d6
commit 2d2a8abfd4
21 changed files with 1657 additions and 466 deletions

View File

@@ -2,7 +2,7 @@
<view class="container safe-area-inset-bottom">
<MessageNotification />
<!-- 收货地址 -->
<view class="head" v-if="logisticsList.express_name!=''">
<view class="head" v-if="logisticsList.express_name">
<image src="https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/mine/mr_tx.png" mode=""></image>
<view class="head_info">
<view class="name">{{logisticsList.express_name}} {{logisticsList.express_mobile_tm || logisticsList.express_mobile}}</view>
@@ -10,110 +10,250 @@
</view>
</view>
<!-- 订单信息 -->
<view class="infos" v-if="express!=''">
<view class="_info">
<text>快递单号</text>
<text class="info">{{express.express_no}}</text>
<text class="copy" @click="copy(express.express_no)">复制</text>
<!-- 多包裹 Tab:无 warehouse_name 时只显示包裹序号 -->
<scroll-view v-if="packages.length > 1" class="pkg-tabs" scroll-x>
<view
v-for="(pkg, idx) in packages"
:key="idx"
class="pkg-tab"
:class="{ active: activePkg === idx }"
@click="switchPkg(idx)"
>
包裹{{ pkg.package_no || idx + 1 }}
<text v-if="pkg.warehouse_name" class="pkg-sub">{{ pkg.warehouse_name }}</text>
</view>
<view class="_info">
<text>配送方式</text>
<text class="info">{{express.express_company_name}}</text>
</view>
</view>
</scroll-view>
<!-- 物流追踪 -->
<view class="card">
<view class="title">
物流追踪
</view>
<!-- <view class="empty" v-if="newArr.length==0">
<image src="https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/empty/orders.png" mode="aspectFit"></image>
<text>药房正在备药中,暂时还没有物流信息哦~</text>
</view> -->
<!-- 多包裹:左右滑动切换;单包直接展示 -->
<swiper
v-if="packages.length > 1"
class="pkg-swiper"
:current="activePkg"
:style="{ height: swiperHeight + 'px' }"
@change="onSwiperChange"
>
<swiper-item v-for="(pkg, idx) in packages" :key="idx">
<view class="pkg-panel" :id="'pkg-panel-' + idx">
<view class="infos" v-if="pkgExpress(pkg).express_no">
<view class="_info">
<text>快递单号</text>
<text class="info">{{ pkgExpress(pkg).express_no }}</text>
<text class="copy" @click="copy(pkgExpress(pkg).express_no)">复制</text>
</view>
<view class="_info">
<text>配送方式</text>
<text class="info">{{ pkgExpress(pkg).express_company_name }}</text>
</view>
</view>
<view class="infos" v-else>
<view class="_info">
<text>发货状态</text>
<text class="info">{{ Number(pkg.is_send) === 1 ? '已发货' : '待发货' }}</text>
</view>
</view>
<view class="card">
<view class="title">物流追踪</view>
<view class="line" v-if="pkgTracks(pkg).length > 0">
<u-time-line>
<u-time-line-item
v-for="(item, index) in pkgTracks(pkg)"
:key="index"
nodeTop="2"
>
<template v-slot:node>
<view class="track-node" :class="{ 'is-active': index === 0 }" />
</template>
<template v-slot:content>
<view class="track-content" :class="{ 'is-active': index === 0 }">
<view class="u-order-title">
{{ item.status }}
<text v-if="showOngoing(item, index)" class="ongoing">进行中</text>
</view>
<view class="u-order-desc">{{ item.detail }}</view>
<view class="u-order-time">{{ item.detail_at }}</view>
</view>
</template>
</u-time-line-item>
</u-time-line>
</view>
<view v-else class="empty-tip">暂无物流轨迹</view>
</view>
</view>
</swiper-item>
</swiper>
<view class="line" v-if="newArr.length>0">
<u-time-line v-for="(item,index) in newArr" :key="index">
<u-time-line-item nodeTop="2">
<template v-slot:content>
<view>
<view class="u-order-title">{{item.status}}</view>
<view class="u-order-desc">
{{item.detail}}
<template v-else>
<view class="infos" v-if="currentExpress && currentExpress.express_no">
<view class="_info">
<text>快递单号</text>
<text class="info">{{ currentExpress.express_no }}</text>
<text class="copy" @click="copy(currentExpress.express_no)">复制</text>
</view>
<view class="_info">
<text>配送方式</text>
<text class="info">{{ currentExpress.express_company_name }}</text>
</view>
</view>
<view class="infos" v-else-if="packages.length">
<view class="_info">
<text>发货状态</text>
<text class="info">{{ currentPkg && Number(currentPkg.is_send) === 1 ? '已发货' : '待发货' }}</text>
</view>
</view>
<view class="card">
<view class="title">物流追踪</view>
<view class="line" v-if="newArr.length > 0">
<u-time-line>
<u-time-line-item
v-for="(item, index) in newArr"
:key="index"
nodeTop="2"
>
<template v-slot:node>
<view class="track-node" :class="{ 'is-active': index === 0 }" />
</template>
<template v-slot:content>
<view class="track-content" :class="{ 'is-active': index === 0 }">
<view class="u-order-title">
{{ item.status }}
<text v-if="showOngoing(item, index)" class="ongoing">进行中</text>
</view>
<view class="u-order-desc">{{ item.detail }}</view>
<view class="u-order-time">{{ item.detail_at }}</view>
</view>
<view class="u-order-time">{{item.detail_at}}</view>
</view>
</template>
</u-time-line-item>
</u-time-line>
</template>
</u-time-line-item>
</u-time-line>
</view>
<view v-else class="empty-tip">暂无物流轨迹</view>
</view>
</view>
</template>
<!-- 底部 确认收货 -->
<view class="footer" v-if="newArr.length>0">
<!-- 底部确认收货 -->
<view class="footer" v-if="canConfirm">
<view class="to_pay" @click="toaffirm">确认收货</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
// getLogistics
import {
getLogistics,
confirmAccept
} from '../../request/api/api';
const FALLBACK_TRACKS = [{
detail: "药品已打包,等待快递揽件",
detail_at: "",
status: "已发货",
},
{
detail: "药房正在备药中",
detail_at: "",
status: "备药",
}
];
export default {
data() {
return {
isshow: true,
show: false,
content: '是否确认退款',
logisticsList: {},
order_no: '',
express: [],
express: {},
packages: [],
activePkg: 0,
order_id: '',
newArr: [{
detail: "药品已打包,等待快递揽件",
detail_at: "",
status: "已发货",
},
{
detail: "药房正在备药中",
detail_at: "",
status: "备药",
}
]
newArr: [],
canConfirm: false,
swiperHeight: 480,
}
},
computed: {
currentPkg() {
return this.packages[this.activePkg] || null
},
currentExpress() {
const pkg = this.currentPkg
if (pkg && pkg.express) return pkg.express
return this.express
}
},
onLoad(op) {
this.order_id = op.id || '45'
this.order_id = op.id || ''
this.getLogisticsList()
},
methods: {
// 支付
/** 最新一条非签收时才显示「进行中」 */
showOngoing(item, index) {
if (index !== 0) return false
const status = String((item && item.status) || '')
return status !== '签收'
},
pkgExpress(pkg) {
return (pkg && pkg.express) || {}
},
/** 按包裹组装轨迹(读 packages[i].express.detail) */
pkgTracks(pkg) {
const express = this.pkgExpress(pkg)
const detail = Array.isArray(express.detail) ? express.detail : []
if (detail.length) return detail
if (pkg && Number(pkg.is_send) === 1) return FALLBACK_TRACKS
return [{
detail: '药房正在备药中',
detail_at: '',
status: '备药',
}]
},
/** Tab 切换包裹,驱动 swiper */
switchPkg(idx) {
this.activePkg = idx
this.applyTracksFromPkg()
this.$nextTick(() => this.updateSwiperHeight())
},
/** swiper 左右滑同步 activePkg */
onSwiperChange(e) {
const idx = Number(e.detail.current || 0)
if (idx === this.activePkg) return
this.activePkg = idx
this.applyTracksFromPkg()
this.$nextTick(() => this.updateSwiperHeight())
},
/** 测量当前面板高度,避免 swiper 裁切时间轴 */
updateSwiperHeight() {
if (this.packages.length <= 1) return
const q = uni.createSelectorQuery().in(this)
q.select('#pkg-panel-' + this.activePkg).boundingClientRect((rect) => {
if (rect && rect.height) {
this.swiperHeight = Math.ceil(rect.height)
}
}).exec()
},
/**
* 根据当前包裹组装时间轴(单包模式用)
* 接口 detail 按时间倒序,第 0 条即最新
*/
applyTracksFromPkg() {
const pkg = this.currentPkg
this.newArr = this.pkgTracks(pkg)
const express = this.currentExpress
const hasTrack = Array.isArray(express.detail) && express.detail.length > 0
this.canConfirm = hasTrack || (pkg && Number(pkg.is_send) === 1)
},
toaffirm() {
this.postConfirm()
uni.switchTab({
url: '/pages/mine/mine'
})
},
// 点击复制
copy(value) {
//提示模板
uni.showModal({
content: value, //模板中提示的内容
content: value,
confirmText: '复制内容',
success: () => {
uni.setClipboardData({
data: value, //要被复制的内容
success: () => { //复制成功的回调函数
uni.showToast({ //提示
data: value,
success: () => {
uni.showToast({
title: '复制成功',
icon: 'success'
})
@@ -122,28 +262,31 @@
}
});
},
//物流详情请求
getLogisticsList() {
getLogistics({
method: "get",
method: "post",
data: {
store_id: uni.getStorageSync('store_id') || '11001',
order_id: this.order_id,
}
}).then((res) => {
// console.log(res, 'list');
if (res.data.errcode == 0) {
console.log(res.data.data);
this.logisticsList = res.data.data.address
this.express = res.data.data.express
let arr = this.express.detail.filter((item, index) => {
return index != 0
})
this.newArr = [...arr,...this.newArr ]
const data = res.data.data || {}
this.logisticsList = data.address || {}
this.express = data.express || {}
this.packages = Array.isArray(data.packages) ? data.packages : []
if (!this.packages.length && this.express && this.express.express_no) {
this.packages = [{
package_no: 1,
warehouse_name: '',
is_send: 1,
express: this.express,
}]
}
this.activePkg = 0
this.applyTracksFromPkg()
this.$nextTick(() => this.updateSwiperHeight())
}
})
},
postConfirm() {
@@ -154,11 +297,9 @@
order_id: this.order_id,
}
}).then((res) => {
// console.log(res, 'list');
if (res.data.errcode == 0) {
console.log(res.data.data);
}
})
},
}
@@ -166,25 +307,63 @@
</script>
<style lang="scss" scoped>
$primary: #4175EE;
$primary-soft: rgba(65, 117, 238, 0.12);
$primary-glow: rgba(65, 117, 238, 0.25);
.container {
width: 750rpx;
max-height: 100%;
min-height: 100vh;
padding-bottom: env(safe-area-inset-bottom);
padding-bottom: calc(120rpx + env(safe-area-inset-bottom));
background: #F5F5F5;
.empty {
width: 440rpx;
height: 393rpx;
margin: 200rpx auto;
.empty-tip {
text-align: center;
color: #999;
padding: 40rpx 0;
font-size: 26rpx;
}
image {
width: 100%;
height: 100%;
z-index: 10;
margin-bottom: 10rpx;
.pkg-tabs {
white-space: nowrap;
width: 710rpx;
margin: 0 auto 16rpx;
background: #fff;
padding: 16rpx 20rpx;
box-sizing: border-box;
}
.pkg-tab {
display: inline-flex;
flex-direction: column;
align-items: center;
padding: 12rpx 28rpx;
margin-right: 16rpx;
border-radius: 12rpx;
background: #f5f5f5;
font-size: 26rpx;
color: #666;
&.active {
background: $primary-soft;
color: $primary;
font-weight: 600;
}
.pkg-sub {
font-size: 20rpx;
margin-top: 4rpx;
opacity: 0.8;
}
}
.pkg-swiper {
width: 750rpx;
}
.pkg-panel {
padding-bottom: 20rpx;
}
.head {
@@ -217,157 +396,133 @@
.choose_area {
font-size: 24rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #232323;
}
}
}
.card {
width: 710rpx;
border-radius: 16rpx;
margin: 10rpx auto 180rpx;
padding: 30rpx;
background: #FFFFFF;
.title {
width: 640rpx;
padding-bottom: 22rpx;
font-size: 28rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #232323;
border-bottom: 2rpx solid #DDDDDD;
}
.line {
margin-top: 20rpx;
margin-bottom: 18rpx;
.u-time-line-item {
display: flex;
}
.u-node {
width: 44rpx;
height: 44rpx;
border-radius: 100rpx;
display: flex;
justify-content: center;
align-items: center;
background: #d0d0d0;
}
.u-order-title {
color: #333333;
font-weight: bold;
font-size: 32rpx;
}
.u-order-desc {
color: rgb(150, 150, 150);
font-size: 28rpx;
margin-bottom: 6rpx;
}
.u-order-time {
color: rgb(200, 200, 200);
font-size: 26rpx;
color: #666;
}
}
}
.infos {
width: 710rpx;
margin: 20rpx auto 20rpx;
padding: 20rpx 32rpx;
border-radius: 16rpx;
background: #FFFFFF;
margin: 0 auto 20rpx;
background: #fff;
padding: 10rpx 30rpx;
._info {
display: flex;
align-items: center;
margin: 20rpx 0;
text {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
}
padding: 20rpx 0;
font-size: 28rpx;
color: #666;
.info {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
flex: 1;
margin-left: 30rpx;
color: #232323;
margin-left: 60rpx;
}
.copy {
display: inline-block;
border: 2rpx solid #1777FF;
width: 88rpx;
height: 48rpx;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #1777FF;
line-height: 44rpx;
text-align: center;
margin-left: 60rpx;
color: $primary;
margin-left: 20rpx;
}
}
}
.card {
width: 710rpx;
margin: 0 auto 20rpx;
background: #fff;
padding: 30rpx;
.title {
font-size: 32rpx;
font-weight: bold;
color: #232323;
margin-bottom: 20rpx;
}
.line {
.track-node {
width: 16rpx;
height: 16rpx;
border-radius: 50%;
background: #d9d9d9;
margin-left: 6rpx;
&.is-active {
width: 20rpx;
height: 20rpx;
margin-left: 4rpx;
background: $primary;
box-shadow: 0 0 0 6rpx $primary-glow;
}
}
.track-content {
.u-order-title {
font-size: 28rpx;
font-weight: 500;
color: #999;
display: flex;
align-items: center;
gap: 12rpx;
}
.u-order-desc {
font-size: 26rpx;
color: #bbb;
margin: 10rpx 0;
}
.u-order-time {
font-size: 24rpx;
color: #ccc;
}
&.is-active {
.u-order-title {
font-weight: 700;
color: $primary;
}
.u-order-desc {
color: #666;
}
.u-order-time {
color: #999;
}
.ongoing {
font-size: 22rpx;
font-weight: 500;
color: #fff;
background: $primary;
padding: 2rpx 12rpx;
border-radius: 8rpx;
}
}
}
}
}
.footer {
width: 750rpx;
height: 100rpx;
background: #fff;
position: fixed;
bottom: 0;
left: 0;
bottom: env(safe-area-inset-bottom);
display: flex;
justify-content: flex-end;
align-items: center;
padding: 0 24rpx;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
.to_cancle {
width: 196rpx;
height: 64rpx;
text-align: center;
line-height: 64rpx;
color: #1777FF;
background: #E7F1FF;
border-radius: 50rpx 50rpx 50rpx 50rpx;
margin-right: 20rpx;
}
background: #fff;
padding: 20rpx 40rpx calc(20rpx + env(safe-area-inset-bottom));
box-sizing: border-box;
.to_pay {
width: 196rpx;
height: 64rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
line-height: 64rpx;
background: $primary;
color: #fff;
background: #1777FF;
border-radius: 50rpx 50rpx 50rpx 50rpx;
}
.to_agin {
width: 196rpx;
height: 64rpx;
text-align: center;
line-height: 64rpx;
border-radius: 50rpx 50rpx 50rpx 50rpx;
border: 2rpx solid #999999;
color: #999999;
margin-left: 20rpx;
border-radius: 40rpx;
font-size: 30rpx;
}
}
}
</style>
</style>