feat: 电子药箱小程序 - 4Tab药品管理

- 电子药箱: 药品库存管理 + 手动录入 + 今日用药打卡
- 药品百科: 搜索 + 分类筛选 + 20种药品静态数据
- 惠教中心: 4条药品使用指南课程
- 我的: 家庭成员信息管理
- 自定义TabBar + navigation-bar组件
- SVG药品分类插图
This commit is contained in:
陈誉午
2026-07-29 11:20:52 +08:00
commit 994b267f5c
683 changed files with 43849 additions and 0 deletions
@@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"popup": "/components/popup/popup",
"tag":"/components/tag/tag"
}
}
@@ -0,0 +1,159 @@
/* components/buy-record/buy-record.wxss */
@import "variables";
.order {
margin-top: $primary-gap;
border-radius: $primary-border-radius;
background-color: white;
overflow: hidden;
.order-header {
border-bottom: 2rpx solid rgba(0, 0, 0, 0.1);
line-height: $primary-gap;
height: $primary-gap;
padding: $primary-gap;
text-align: end;
}
.order-footer {
border-top: 2rpx solid rgba(0, 0, 0, 0.1);
// height: $primary-gap;
padding: $primary-gap;
display: flex;
flex-direction: column;
gap: $primary-gap/2;
.order-price {
display: flex;
justify-content: space-between;
}
.order-total-price {
font-size: 32rpx;
font-weight: 700;
}
.order-trade-amount {
color: $primary-color;
font-size: 38rpx;
font-weight: 700;
}
.orderNo {
// font-size: $large-font-size;
}
.payTime {
// font-size: $large-font-size;
}
}
.item+.item {
border-top: 2rpx solid rgba(0, 0, 0, 0.1);
}
.item {
width: 702rpx;
background-color: white;
height: 300rpx;
.info {
display: flex;
justify-content: space-between;
padding: $primary-gap;
padding-bottom: 0;
height: 200rpx;
.left {
border-radius: $primary-border-radius;
overflow: hidden;
min-width: 200rpx;
width: 200rpx;
height: 200rpx;
margin-right: $primary-gap;
image {
width: 100%;
height: 100%;
}
}
.right {
display: flex;
flex-direction: column;
justify-content: space-around;
width: 100%;
.spu {
display: flex;
justify-content: space-between;
width: 100%;
font-size: $large-font-size;
font-weight: 700;
.spuName {
max-width: 300rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.sku {
display: flex;
justify-content: space-between;
width: 100%;
color: $gray-color;
.skuName {
max-width: 300rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.history {
width: 100%;
border-radius: $primary-border-radius;
text-align: end;
color: $primary-color;
}
}
}
}
}
.order:first-child {
margin-top: 0rpx;
}
.footer {
display: flex;
flex-direction: row;
height: 40rpx;
justify-content: space-between;
.totalPrice {
font-size: $large-font-size;
font-weight: 700;
margin-right: $primary-gap;
margin-top: $primary-gap/2;
}
}
// .popup-header {
// display: flex;
// align-items: center;
// font-weight: 700;
// font-size: $large-font-size;
// margin-bottom: $primary-gap * 2;
// }
@@ -0,0 +1,82 @@
import { Orders } from '../../../pages/tab-bar/user/user.d'
export const OrderStateMap: Record<number, any> = {
10: { id: 10, name: "未付款", color: "#ff0056" },
20: { id: 20, name: "已驳回", color: "#ff0056" },
30: { id: 30, name: "待发货", color: "#FA6905" },
40: { id: 40, name: "待审核", color: "#ff7500" },
50: { id: 50, name: "发货中", color: "#1a64d3" },
60: { id: 60, name: "已签收", color: "#00bc12" },
70: { id: 70, name: "售后中", color: "#00b1dd" },
80: { id: 80, name: "全退款", color: "#ff0000" },
90: { id: 90, name: "部分退款", color: "#d90000" },
100: { id: 100, name: "已取消", color: "#ffba00" },
};
export const DeliveryStateMap: Record<number, any> = {
10: { id: 10, name: "待确认", color: "#ff4c3e" },
15: { id: 15, name: "定时发货", color: "#ff4c3e" },
20: { id: 20, name: "待发送ERP", color: "gold" },
30: { id: 30, name: "仓库待发货", color: "#ff7500" },
40: { id: 40, name: "仓库已发货", color: "#FABD14" },
50: { id: 50, name: "物流已揽收", color: "#057748" },
60: { id: 60, name: "客户签收", color: "#00bc12" },
70: { id: 70, name: "客户半签", color: "#52c41a" },
80: { id: 80, name: "客户拒收", color: "#ff0000" },
100: { id: 100, name: "已取消", color: "#ffba00" },
110: { id: 110, name: "售后中", color: "#00B4F4" },
120: { id: 120, name: "售后完成", color: "#156AA8" },
};
//不能查看物流信息
Component({
properties: {
order: {
type: Object,
value: {} as Orders,
},
isDetail: {
type: Boolean,
value: false
}
},
data: {
item: [] as any[],
state: {},
orderTime: "",
payTime: "",
showHistoryPopup: false,
deliveryState: null
},
observers: {
'order': function (order: Orders) {
if (order && order.good) {
// @ts-ignore
this.setData({
item: order.good,
state: OrderStateMap[order.state],
orderTime: order.orderTime.replace("T", " "),
payTime: order.payTime ? order.payTime.replace("T", " ") : ""
})
}
if (order && order.deliveryState) {
// @ts-ignore
this.setData({
deliveryState: DeliveryStateMap[order.deliveryState]
})
}
}
},
methods: {
// openPopup() {
// this.setData({ showHistoryPopup: true })
// },
// closePopup() {
// this.setData({ showHistoryPopup: false })
// }
handleDetail(this: WechatMiniprogram.Component.TrivialInstance) {
if (this.data.isDetail) return;
wx.navigateTo({ url: `/pages/common/order-detail/order-detail?id=${this.data.order.orderNo}` })
}
}
})
export { }
@@ -0,0 +1,68 @@
<!--components/buy-record/buy-record.wxml-->
<view class="order">
<view class="order-header">订单创建时间 {{orderTime}}</view>
<view class="item" wx:for="{{item}}" wx:key="skuName" bind:tap="handleDetail">
<view class="info">
<view class="left">
<image src="{{item.picUrl}}" mode="aspectFill" />
</view>
<view class="right">
<view class="spu">
<view class="spuName">{{item.spuName}}</view>
<view class="price">{{item.price?'¥'+item.price / 100:"暂无报价"}}</view>
</view>
<view class="sku">
<view class="skuName">{{item.skuName}}</view>
<view class="count">x{{item.count}}</view>
</view>
<tag class="history" color="{{state.color}}" propStyle="margin-right: 0rpx;">{{state.name}}</tag>
<view class="history" style="color:{{deliveryState.color}}">{{deliveryState.name}}</view>
<!-- <view class="history">
查看物流
</view> -->
<view>
</view>
</view>
</view>
<view class="footer">
<view></view>
<view class="totalPrice">
应付款:¥{{item.totalPrice / 100}}
</view>
</view>
</view>
<view class="order-footer">
<view class="order-price">
<view class="order-total-price">订单总金额 ¥{{order.totalAmount/100}}</view>
<view class="order-total-price">
优惠金额:¥{{order.discountAmount/100 || 0.00}}
</view>
</view>
<view class="order-price">
<view class="order-trade-amount">
实付金额 ¥{{order.advancePrice/100 || 0.00}}
</view>
<view class="order-trade-amount" >
{{state>=70?'退款金额':'支付金额'}}
¥{{order.tradeAmount/100}}
</view>
</view>
<view class="orderNo" wx:if="{{order.orderNo}}">订单号 {{order.orderNo}}</view>
<view class="orderNo" wx:if="{{order.transactionId}}">微信订单号 {{order.transactionId}}</view>
<view class="payTime" wx:if="{{order.payTime}}">订单支付时间 {{payTime||'未付款'}}</view>
<view class="payTime" wx:if="{{order.sendTime}}">订单发货时间 {{sendTime||'未付款'}}</view>
</view>
</view>
<!-- <popup visible="{{showHistoryPopup}}" bind:close="closePopup">
<view slot="header" class="popup-header">
<text>物流信息</text>
</view>
<view>
这里显示物流的信息
</view>
</popup> -->