1. 开方2.0优化重构,线下接诊已完成

This commit is contained in:
李琦
2026-05-12 10:10:38 +08:00
parent 45996a26b6
commit e9966af14d
21 changed files with 3069 additions and 3208 deletions

View File

@@ -20,7 +20,7 @@ export function getAcceptingPatientList(data) {
})
}
// 获取患者详情
// 获取患者详情(挂号维度的就诊信息,不含处方列表)
export function getPatientItem(id) {
return req.request({
url: '/newApi/doctor-reception-wx/patient-item',
@@ -29,6 +29,33 @@ export function getPatientItem(id) {
})
}
/** 本次挂号处方分页 */
export function getRegisterPrescriptionList(data) {
return req.request({
url: '/newApi/doctor-reception-wx/register-prescription-list',
method: 'GET',
data
})
}
/** 患者历史处方分页(可排除某次挂号) */
export function getPatientPrescriptionHistory(data) {
return req.request({
url: '/newApi/doctor-reception-wx/patient-prescription-history',
method: 'GET',
data
})
}
/** 撤回处方(待支付) */
export function withdrawPrescriptionWx(data) {
return req.request({
url: '/newApi/doctor-reception-wx/withdraw-prescription',
method: 'POST',
data
})
}
/**
* 根据患者ID获取患者信息
* @param {number} patientId - 患者ID
@@ -210,10 +237,10 @@ export function switchStoreApi(data) {
})
}
// 获取处方详情
// 获取处方详情(医生小程序 doctor-reception-wx 路由,与接诊接口同鉴权)
export function getPrescriptionInfoApi(id) {
return req.request({
url: '/newApi/prescription/detail',
url: '/newApi/doctor-reception-wx/prescription-detail',
method: 'GET',
data: { id }
})
@@ -273,6 +300,24 @@ export function saveChineseCommonPrescriptionApi(data) {
})
}
// 保存颗粒药/保健食品常用方
export function saveGranularCommonPrescriptionApi(data) {
return req.request({
url: '/newApi/common-prescription/save-granular',
method: 'POST',
data
})
}
// 删除常用方
export function deleteCommonPrescriptionApi(data) {
return req.request({
url: '/newApi/common-prescription/delete',
method: 'POST',
data
})
}
// 获取公共医嘱列表
export function getDoctorOrderCommonList(data) {
return req.request({

View File

@@ -20,10 +20,13 @@ const arr = [
'password'
]
// 敏感数据
// 敏感数据(解密后做脱敏;需与下方 switch 分支一致)
const sensitiveData = [
'id_card',
'idcard'
'idcard',
'mobile',
'express_mobile',
'patient_mobile'
]
/**
* 请求拦截器
@@ -53,11 +56,17 @@ const resInterceptor = (response, conf = {}) => {
// 响应拦截器
if (statusCode >= 200 && statusCode < 300) {
_responseLog(response, conf, "response 200-299")
// 解密
// 解密Yii业务在 dataLaravel jok业务在 result
let res = response.data
if (res == null || typeof res !== 'object') {
return res
}
if (res.data != null) {
res.data = getRes(res.data)
}
if (res.result != null) {
res.result = getRes(res.result)
}
return res
} else if (statusCode === 500) {
uni.showToast({
@@ -133,11 +142,14 @@ function _responseLog(res, conf = {}, describe = null) {
}
function getRes(obj, isDecode = true) {
if (obj == null || typeof obj !== 'object') {
return obj
}
try {
for (const key in obj) {
if (Array.isArray(obj[key])) {
obj[key] = getRes(obj[key])
} else if (typeof obj[key] === 'object') {
} else if (typeof obj[key] === 'object' && obj[key] !== null) {
obj[key] = getRes(obj[key])
} else {
// 判断obj[key]是否在arr中

View File

@@ -21,6 +21,20 @@ if (!String.prototype.padStart) {
}
}
/**
* iOS含部分微信小程序环境下 new Date('yyyy-MM-dd HH:mm:ss') 无效,需转为 ISO 类似格式
*/
function normalizeDateInputForIOS(dateTime) {
if (dateTime == null || dateTime === '') return dateTime
if (typeof dateTime === 'number') return dateTime
const s = String(dateTime).trim()
// "2025-03-06 17:34:03" / "2025-03-06 17:34:03.000" -> T 分隔
if (/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}/.test(s)) {
return s.replace(' ', 'T')
}
return dateTime
}
// 其他更多是格式化有如下:
// yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合
function timeFormat(dateTime = null, fmt = 'yyyy-mm-dd') {
@@ -28,7 +42,11 @@ function timeFormat(dateTime = null, fmt = 'yyyy-mm-dd') {
if (!dateTime) dateTime = Number(new Date());
// 如果dateTime长度为10或者13则为秒和毫秒的时间戳如果超过13位则为其他的时间格式
if (dateTime.toString().length == 10) dateTime *= 1000;
dateTime = normalizeDateInputForIOS(dateTime);
let date = new Date(dateTime);
if (Number.isNaN(date.getTime())) {
return typeof dateTime === 'string' ? dateTime : ''
}
let ret;
let opt = {
"y+": date.getFullYear().toString(), // 年

View File

@@ -7,10 +7,16 @@ import {
} from '@/common/js/util.js'
// 引入uView主JS库
import uView from "uview-ui";
import timeFormatIOSFix from '@/common/js/timeFormat.js'
import store from './store';
import share from '@/common/share.js'
Vue.mixin(share)
Vue.use(uView);
// 覆盖 uView 的 timeFormat / date修复 iOS 下 `yyyy-MM-dd HH:mm:ss` 无法解析
if (uni && uni.$u) {
uni.$u.timeFormat = timeFormatIOSFix
uni.$u.date = timeFormatIOSFix
}
let systemInfo = uni.getSystemInfoSync();
const $d = {
addStyle,

View File

@@ -40,9 +40,9 @@
登录</u-button>
</view>
<view class="register">
<text @click="$go('../../subPackages/sub_workbench/workbench_identity')">手机号注册</text>
</view>
<!-- <view class="register">-->
<!-- <text @click="$go('../../subPackages/sub_workbench/workbench_identity')">手机号注册</text>-->
<!-- </view>-->
</view>
@@ -79,8 +79,8 @@
},
onLoad(e) {
const accountInfo = uni.getAccountInfoSync();
console.log(accountInfo.miniProgram.appId); // 小程序 appId
// const accountInfo = uni.getAccountInfoSync();
// console.log('appid', accountInfo.miniProgram.appId); // 小程序 appId
},
mounted() {
const token = uni.getStorageSync('token')

View File

@@ -521,21 +521,23 @@
},
// 跳转到小程序
toNext() {
uni.navigateToMiniProgram({
appId: 'wx8e8f04d0cf7831bf',
path: 'pages/login/index?id=',
envVersion: "release",
extraData: {
'data1': 'test'
},
success: res => {
// 打开成功
console.log("打开成功", res);
},
fail: err => {
console.log(err);
}
})
this.$toast('开发中~');
// uni.navigateToMiniProgram({
// appId: 'wx8e8f04d0cf7831bf',
// path: 'pages/login/index?id=',
// envVersion: "release",
// extraData: {
// 'data1': 'test'
// },
// success: res => {
// // 打开成功
// console.log("打开成功", res);
// },
// fail: err => {
// console.log(err);
// }
// })
},
// 获取正在接诊的患者列表
getAcceptingPatientList() {

View File

@@ -24,10 +24,10 @@
<view @click="isDel = true" class="btn btn1">删除医嘱</view>
<view @click="showAdd" class="btn btn2">添加医嘱</view>
</view>
<!-- <view v-else class="btnBox">-->
<!-- <view @click="isDel = false; selectId = []" class="btn btn1">暂不删除</view>-->
<!-- <view @click="templateDelete" class="btn btn2">删除医嘱</view>-->
<!-- </view>-->
<view v-else class="btnBox">
<view @click="isDel = false; selectId = []" class="btn btn1">暂不删除</view>
<view @click="templateDelete" class="btn btn2">删除医嘱</view>
</view>
<view class="modal" v-if="modalVisible">
<view class="mask"></view>
<view class="main">

View File

@@ -201,14 +201,13 @@
</view>
</scroll-view>
<!-- 底部按钮 -->
<!-- 底部按钮另存常用方未对接保存接口不展示 -->
<view class="bottom flex-jus-sp flex-ali-center safe-area-inset-bottom">
<view class="btnText" @click="saveAsCommonPrescription">另存常用方</view>
<u-button
:throttle-time="0"
@click="sendPrescription"
shape="circle"
:custom-style="{backgroundColor:buttonLodging?'#A5DCD2':'#6ACDBB',color:'#fff',height:'86rpx', width: '448rpx'}"
:custom-style="{backgroundColor:buttonLodging?'#A5DCD2':'#6ACDBB',color:'#fff',height:'86rpx', width: '686rpx'}"
:disabled="buttonLodging">
发送处方
</u-button>
@@ -708,18 +707,6 @@ export default {
}
},
/**
* 另存常用方
*/
async saveAsCommonPrescription() {
if (this.currentDrugs.length === 0) {
uni.showToast({ title: '请先添加药品后再保存为常用方', icon: 'none' });
return;
}
uni.showToast({ title: '另存常用方功能待实现', icon: 'none' });
// TODO: 实现另存常用方功能
},
/**
* 返回
*/

View File

@@ -1,20 +1,21 @@
<template>
<view class="chinese-medicine-config">
<view class="config-section">
<view class="section-title">
<d-text text="制剂方式" className="fs-3 main-c"></d-text>
<!-- 制剂方式 -->
<view class="config-section m-b-32">
<view class="section-title m-b-16">
<d-text text="制剂方式" className="fs-30 font-bold color-title"></d-text>
</view>
<view class="section-content">
<view class="tag-group">
<view class="modern-pill-group">
<view
class="tag-item"
class="modern-pill"
:class="{ active: localConfig.ruleType === 1 }"
@click="handleRuleTypeChange(1)"
>
自制剂
</view>
<view
class="tag-item"
class="modern-pill"
:class="{ active: localConfig.ruleType === 2 }"
@click="handleRuleTypeChange(2)"
>
@@ -25,16 +26,16 @@
</view>
<!-- 自制剂配置 -->
<view class="config-section" v-if="localConfig.ruleType === 1">
<view class="section-title">
<d-text text="包法" className="fs-3 main-c"></d-text>
<view class="config-section border-t-dashed pt-32 m-b-32" v-if="localConfig.ruleType === 1">
<view class="section-title m-b-16">
<d-text text="包法选择" className="fs-30 font-bold color-title"></d-text>
</view>
<view class="section-content">
<view class="tag-group">
<view class="modern-pill-group">
<view
v-for="item in packageMethodList"
:key="item.id"
class="tag-item"
class="modern-pill outline"
:class="{ active: localConfig.packageMethodId === item.id }"
@click="handlePackageMethodTagClick(item)"
>
@@ -45,16 +46,16 @@
</view>
<!-- 委托调剂配置 -->
<view class="config-section" v-if="localConfig.ruleType === 2">
<view class="section-title">
<d-text text="制剂" className="fs-3 main-c"></d-text>
<view class="config-section border-t-dashed pt-32" v-if="localConfig.ruleType === 2">
<view class="section-title m-b-16">
<d-text text="制剂要求" className="fs-30 font-bold color-title"></d-text>
</view>
<view class="section-content">
<view class="tag-group">
<view class="section-content m-b-24">
<view class="modern-pill-group">
<view
v-for="item in processRuleList"
:key="item.id"
class="tag-item"
class="modern-pill outline"
:class="{ active: localConfig.processRuleId === item.id }"
@click="handleProcessRuleTagClick(item)"
>
@@ -63,15 +64,15 @@
</view>
</view>
<view class="section-title m-t-16">
<d-text text="煎法" className="fs-3 main-c"></d-text>
<view class="section-title m-b-16 m-t-24">
<d-text text="煎法说明" className="fs-30 font-bold color-title"></d-text>
</view>
<view class="section-content">
<view class="tag-group">
<view class="section-content m-b-24">
<view class="modern-pill-group">
<view
v-for="item in childProcessRuleList"
:key="item.id"
class="tag-item"
class="modern-pill outline"
:class="{ active: localConfig.childProcessRuleId === item.id }"
@click="handleChildProcessRuleTagClick(item)"
>
@@ -80,15 +81,15 @@
</view>
</view>
<view class="section-title m-t-16">
<d-text text="备注" className="fs-3 main-c"></d-text>
<view class="section-title m-b-16 m-t-24">
<d-text text="附加备注" className="fs-30 font-bold color-title"></d-text>
</view>
<view class="section-content">
<view class="tag-group">
<view class="section-content m-b-32">
<view class="modern-pill-group">
<view
v-for="item in processRuleNoteList"
:key="item.id"
class="tag-item"
class="modern-pill outline"
:class="{ active: localConfig.processRuleNoteId === item.id }"
@click="handleProcessRuleNoteTagClick(item)"
>
@@ -98,32 +99,45 @@
</view>
</view>
<!-- 用量和频次 -->
<view class="config-section">
<view class="section-title">
<d-text text="用量" className="fs-3 main-c"></d-text>
<!-- 用量和频次 WesternUsageModal 保持一致的表单布局 -->
<view class="config-form border-t-dashed pt-20">
<view class="form-item flex-row flex-jus-sp flex-ali-center p-y-24">
<view class="item-label">
<d-text text="剂数" className="fs-30 font-bold color-title"></d-text>
</view>
<view class="section-content">
<u-number-box v-model="localConfig.dosage" :min="1" />
<d-text text="天" className="fs-3 color9 m-l-16"></d-text>
<u-input disabled class="input" placeholder="剂数" v-model="localConfig.dosage" :clearable="false" type="number" />
<d-text text="剂" className="fs-3 color9"></d-text>
<view class="item-content flex-row flex-ali-center">
<u-number-box
v-model="localConfig.dosage"
:min="1"
:input-width="80"
:input-height="60"
bg-color="#F7F8FA"
/>
<d-text text="剂(天)" className="fs-28 color-sub m-l-16"></d-text>
</view>
</view>
<view class="config-section">
<view class="section-title">
<d-text text="频次" className="fs-3 main-c"></d-text>
<view class="form-item flex-row flex-jus-sp flex-ali-center p-y-24">
<view class="item-label">
<d-text text="用药频次" className="fs-30 font-bold color-title"></d-text>
</view>
<view class="item-content flex-row flex-ali-center">
<u-number-box
v-model="localConfig.dayDosage"
:min="1"
:input-width="80"
:input-height="60"
bg-color="#F7F8FA"
/>
<d-text text="次/天" className="fs-28 color-sub m-l-16"></d-text>
</view>
<view class="section-content">
<u-number-box v-model="localConfig.dayDosage" :min="1" />
<d-text text="次/天" className="fs-3 color9 m-l-16"></d-text>
</view>
</view>
</view>
</template>
<script>
// 保留原有逻辑
export default {
name: 'ChineseMedicineConfig',
props: {
@@ -295,70 +309,64 @@ export default {
</script>
<style lang="scss" scoped>
/* 统一样式 */
.color-title { color: #2A2E35; }
.color-sub { color: #8A92A3; }
.fs-28 { font-size: 28rpx; }
.fs-30 { font-size: 30rpx; }
.font-bold { font-weight: bold; }
.m-b-16 { margin-bottom: 16rpx; }
.m-b-24 { margin-bottom: 24rpx; }
.m-b-32 { margin-bottom: 32rpx; }
.m-t-24 { margin-top: 24rpx; }
.m-l-16 { margin-left: 16rpx; }
.pt-20 { padding-top: 20rpx; }
.pt-32 { padding-top: 32rpx; }
.p-y-24 { padding: 24rpx 0; }
.border-t-dashed { border-top: 1px dashed #E2E8F0; }
.flex-row { display: flex; flex-direction: row; }
.flex-jus-sp { justify-content: space-between; }
.flex-ali-center { align-items: center; }
.chinese-medicine-config {
display: flex;
flex-direction: column;
}
.config-section {
margin-bottom: 32rpx;
}
.section-title {
margin-bottom: 16rpx;
}
.section-content {
display: flex;
align-items: center;
gap: 16rpx;
}
.tag-group {
.modern-pill-group {
display: flex;
gap: 16rpx;
flex-wrap: wrap;
}
.tag-item {
padding: 12rpx 32rpx;
background-color: #f5f5f5;
color: #666;
border-radius: 32rpx;
font-size: 28rpx;
.modern-pill {
padding: 12rpx 36rpx;
background-color: #F4F6F8;
color: #6C7380;
border-radius: 40rpx;
font-size: 26rpx;
text-align: center;
cursor: pointer;
border: 2rpx solid transparent;
transition: all 0.3s;
}
border: 1px solid transparent;
transition: all 0.2s;
.tag-item.active {
background-color: #6ACDBB;
&.active {
background-color: #00A88A;
color: #fff;
border-color: #6ACDBB;
border-color: #00A88A;
font-weight: bold;
}
.picker-view {
padding: 16rpx;
background: #f9f9f9;
border-radius: 8rpx;
min-width: 200rpx;
text-align: center;
}
&.outline {
background-color: #fff;
border: 1px solid #E2E8F0;
.input {
width: 200rpx;
&.active {
background-color: #E8F6F4;
color: #00A88A;
border-color: #00A88A;
}
.m-t-16 {
margin-top: 16rpx;
}
.m-l-16 {
margin-left: 16rpx;
}
.color9 {
color: #999;
}
</style>

View File

@@ -9,20 +9,21 @@
z-index="10078"
height="80%"
>
<view class="chinese-medicine-modal">
<view class="modal-header">
<d-text text="选择中药" className="fs-32 main-c"></d-text>
<view class="chinese-medicine-modal page-bg">
<view class="modal-header white">
<d-text text="选择中药" className="fs-32 font-bold color-title"></d-text>
</view>
<view class="modal-content">
<!-- 搜索框 -->
<view class="search-box">
<view class="search-box m-b-24">
<u-search
v-model="searchKey"
placeholder="请输入药品名称搜索"
@input="handleSearch"
@custom="searchKey = ''; handleSearch()"
:show-action="false"
bg-color="#fff"
/>
</view>
@@ -35,72 +36,73 @@
>
<view class="drug-list" v-if="drugList.length > 0">
<view
class="drug-item white b-r-8 p-32 m-t-2"
class="medicine-card"
v-for="(item, index) in drugList"
:key="item.id || index"
:class="{ selected: isInSelected(item) }"
:class="{ 'is-selected': isInSelected(item) }"
>
<view class="drug-header flex-row flex-jus-sp flex-ali-center">
<d-text :text="getDrugName(item)" className="fs-3 color0 bold"></d-text>
<d-text :text="`¥${parseFloat(item.price || 0).toFixed(2)}/${getUnitName(item)}`" className="fs-3 error-c"></d-text>
<view class="drug-header flex-row flex-jus-sp flex-ali-center m-b-16">
<view class="flex-row flex-ali-center">
<view class="selected-indicator" v-if="isInSelected(item)"></view>
<d-text :text="getDrugName(item)" className="fs-32 font-bold color-title"></d-text>
</view>
<view class="drug-info m-t-16">
<view class="specification-row flex-row flex-jus-sp flex-ali-center m-b-16">
<d-text :text="`规格:${getSpecification(item)}`" className="fs-24 color9"></d-text>
<view class="selected-tag" v-if="isInSelected(item)">已选</view>
<d-text :text="`¥${parseFloat(item.price || 0).toFixed(2)}/${getUnitName(item)}`" className="fs-32 font-bold color-price"></d-text>
</view>
<view class="common-quantity-tags m-b-16" v-if="commonQuantities.length > 0">
<view class="drug-info">
<view class="specification-row flex-row flex-jus-sp flex-ali-center m-b-24">
<d-text :text="`规格:${getSpecification(item)}`" className="fs-26 color-sub"></d-text>
<view class="usage-capsule" v-if="isInSelected(item)">已加处方</view>
</view>
<!-- 常用用量快捷标签 -->
<view class="common-quantity-tags m-b-24" v-if="commonQuantities.length > 0">
<view
class="quantity-tag"
class="modern-tag"
v-for="qty in commonQuantities"
:key="qty"
@click.stop="handleSelectCommonQuantity"
:data-index="index"
:data-quantity="qty"
>
{{ qty }}g
快捷 {{ qty }}g
</view>
</view>
<view class="quantity-input-row flex-row flex-ali-center flex-jus-sp">
<view class="quantity-input-row flex-row flex-ali-center flex-jus-sp pt-20 border-t-dashed">
<view class="quantity-input-left flex-row flex-ali-center">
<view class="quantity-label">用量</view>
<view class="quantity-input-wrapper flex-row flex-ali-center">
<view
class="quantity-btn"
@click.stop="handleDecreaseQuantity"
:data-index="index"
>-</view>
<d-text text="用量:" className="fs-28 color-title"></d-text>
<!-- 现代精致步进器 -->
<view class="modern-stepper flex-row flex-ali-center">
<view class="stepper-btn" @click.stop="handleDecreaseQuantity" :data-index="index">-</view>
<input
class="quantity-input"
class="stepper-input fs-28 font-bold"
type="number"
:value="getQuantity(item)"
@input="handleQuantityInput"
:data-index="index"
placeholder="请输入"
placeholder="0"
/>
<view
class="quantity-btn"
@click.stop="handleIncreaseQuantity"
:data-index="index"
>+</view>
<view class="stepper-btn" @click.stop="handleIncreaseQuantity" :data-index="index">+</view>
</view>
<text class="unit-text">{{ getUnitName(item) }}</text>
<text class="fs-26 color-sub m-l-12">{{ getUnitName(item) }}</text>
</view>
<view
v-if="isInSelected(item)"
class="action-icon delete-icon"
class="action-btn-text danger"
@click.stop="handleRemoveDrug"
:data-index="index"
>
<u-icon name="trash" size="44" color="#FC3636"></u-icon>
<u-icon name="trash" size="32" class="m-r-8"></u-icon> 移除
</view>
<view
v-else
class="action-icon add-icon"
class="action-btn-ghost primary"
@click.stop="handleAddDrug"
:data-index="index"
>
<u-icon name="plus-circle" size="44" color="#6ACDBB"></u-icon>
<u-icon name="plus" size="24" class="m-r-8"></u-icon> 添加
</view>
</view>
</view>
@@ -108,7 +110,7 @@
<!-- 加载更多 -->
<view class="load-more" v-if="loading">
<text class="load-more-text">加载中...</text>
<u-loading mode="circle" color="#6ACDBB"></u-loading> <text class="load-more-text m-l-16">加载中...</text>
</view>
<view class="load-more" v-else-if="!hasMore && drugList.length > 0">
<text class="load-more-text">没有更多了</text>
@@ -123,16 +125,20 @@
</view>
<!-- 底部按钮 -->
<view class="modal-footer flex-jus-center flex-ali-center">
<view class="modal-footer flex-jus-center flex-ali-center white shadow-up">
<u-button
:throttle-time="0"
@click="handleClose"
shape="circle"
:custom-style="{
backgroundColor: '#6ACDBB',
backgroundColor: '#00A88A',
color: '#fff',
height: '86rpx',
width: '670rpx'
height: '88rpx',
width: '670rpx',
fontWeight: 'bold',
fontSize: '32rpx',
boxShadow: '0 8rpx 20rpx rgba(0, 168, 138, 0.25)',
border: 'none'
}"
>关闭</u-button>
</view>
@@ -141,6 +147,7 @@
</template>
<script>
// 保留所有原有逻辑代码与注释
import { getProductListDoctorReception } from '@/api/reception.js';
export default {
@@ -663,18 +670,41 @@ export default {
</script>
<style lang="scss" scoped>
/* 使用与 index.vue 统一的设计风格与变量 */
.page-bg { background-color: #F4F6F8; }
.white { background: #fff; }
.color-title { color: #2A2E35; }
.color-sub { color: #8A92A3; }
.color-price { color: #F53F3F; }
.fs-26 { font-size: 26rpx; }
.fs-28 { font-size: 28rpx; }
.fs-32 { font-size: 32rpx; }
.font-bold { font-weight: bold; }
.m-b-16 { margin-bottom: 16rpx; }
.m-b-24 { margin-bottom: 24rpx; }
.m-r-8 { margin-right: 8rpx; }
.m-l-12 { margin-left: 12rpx; }
.m-l-16 { margin-left: 16rpx; }
.pt-20 { padding-top: 20rpx; }
.border-t-dashed { border-top: 1px dashed #E2E8F0; }
.shadow-up { box-shadow: 0 -4rpx 20rpx rgba(0,0,0,0.04); }
.flex-row { display: flex; flex-direction: row; }
.flex-jus-sp { justify-content: space-between; }
.flex-jus-center { justify-content: center; }
.flex-ali-center { align-items: center; }
.chinese-medicine-modal {
display: flex;
flex-direction: column;
height: 100%;
background-color: #fff;
overflow: hidden; // 防止整体溢出
overflow: hidden;
}
.modal-header {
padding: 32rpx;
text-align: center;
border-bottom: 1rpx solid #eee;
border-bottom: 1px solid #F0F2F5;
}
.modal-content {
@@ -682,209 +712,158 @@ export default {
padding: 32rpx;
display: flex;
flex-direction: column;
overflow: hidden; // 防止内容溢出
overflow: hidden;
}
.drug-list-scroll {
flex: 1;
overflow-y: auto; // 确保可以滚动
min-height: 0; // 重要:允许 flex 子元素缩小
}
.search-box {
margin-bottom: 32rpx;
overflow-y: auto;
min-height: 0;
display: flex;
flex-direction: column;
}
/* 底部防遮挡边距 */
.drug-list {
padding-bottom: 32rpx;
padding-bottom: 24rpx;
}
.drug-item {
margin-bottom: 16rpx;
/* 底部防遮挡边距 */
.drug-list {
padding-bottom: 120rpx;
}
.drug-item.selected {
border: 2rpx solid #6ACDBB;
/* 现代卡片样式 */
.medicine-card {
background: #fff;
border-radius: 16rpx;
padding: 24rpx;
margin-bottom: 24rpx;
box-shadow: 0 4rpx 16rpx rgba(42, 46, 53, 0.04);
position: relative;
overflow: hidden;
border: 2rpx solid transparent;
transition: all 0.2s;
&.is-selected {
border-color: #00A88A;
background-color: #F8FDFB;
}
}
.drug-header {
margin-bottom: 16rpx;
.selected-indicator {
width: 8rpx;
height: 32rpx;
background-color: #00A88A;
border-radius: 4rpx;
margin-right: 12rpx;
}
.drug-info {
margin-bottom: 16rpx;
}
.specification-row {
margin-bottom: 16rpx;
}
.selected-tag {
padding: 4rpx 16rpx;
border-radius: 32rpx;
border: 1rpx solid #6ACDBB;
color: #6ACDBB;
font-size: 22rpx;
}
.m-b-16 {
margin-bottom: 16rpx;
.usage-capsule {
display: inline-flex;
align-items: center;
background: #E8F6F4;
color: #00A88A;
padding: 6rpx 16rpx;
border-radius: 6rpx;
font-size: 24rpx;
font-weight: bold;
}
.common-quantity-tags {
display: flex;
flex-wrap: wrap;
gap: 16rpx;
margin-bottom: 16rpx;
}
.quantity-tag {
padding: 8rpx 24rpx;
background-color: #f0f5ff;
color: #6ACDBB;
border: 1rpx solid #6ACDBB;
border-radius: 32rpx;
.modern-tag {
padding: 10rpx 24rpx;
background-color: #F4F6F8;
color: #6C7380;
border-radius: 30rpx;
font-size: 24rpx;
text-align: center;
cursor: pointer;
}
.quantity-tag:active {
background-color: #6ACDBB;
transition: all 0.2s;
&:active {
background-color: #00A88A;
color: #fff;
}
.quantity-input-row {
gap: 16rpx;
align-items: center;
}
.quantity-input-left {
display: flex;
flex-direction: row;
align-items: center;
gap: 16rpx;
flex: 1;
min-width: 0;
}
/* 现代精致步进器 */
.modern-stepper {
background: #F7F8FA;
border-radius: 8rpx;
overflow: hidden;
border: 1px solid #E2E8F0;
.action-icon {
width: 64rpx;
height: 64rpx;
.stepper-btn {
width: 60rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.action-icon:active {
opacity: 0.7;
}
.quantity-label {
font-size: 28rpx;
color: #6C7380;
font-size: 36rpx;
font-weight: bold;
background: #fff;
cursor: pointer;
}
.quantity-input-wrapper {
gap: 16rpx;
.stepper-input {
width: 80rpx;
height: 56rpx;
text-align: center;
color: #2A2E35;
background: #F7F8FA;
border-left: 1px solid #E2E8F0;
border-right: 1px solid #E2E8F0;
}
}
.action-btn-ghost {
padding: 10rpx 28rpx;
border-radius: 30rpx;
font-size: 26rpx;
font-weight: bold;
display: flex;
align-items: center;
&.primary {
color: #00A88A;
background: #E8F6F4;
}
}
.quantity-btn {
width: 48rpx;
height: 48rpx;
line-height: 48rpx;
text-align: center;
border: 1rpx solid #6ACDBB;
color: #6ACDBB;
border-radius: 8rpx;
font-size: 32rpx;
flex-shrink: 0;
.action-btn-text {
display: flex;
align-items: center;
font-size: 26rpx;
font-weight: bold;
&.danger { color: #8A92A3; }
}
.quantity-input {
width: 120rpx;
height: 48rpx;
line-height: 48rpx;
text-align: center;
border: 1rpx solid #e0e0e0;
border-radius: 8rpx;
font-size: 28rpx;
padding: 0 16rpx;
background-color: #fff;
}
.unit-text {
.load-more {
display: flex;
justify-content: center;
align-items: center;
padding: 32rpx 0;
.load-more-text {
font-size: 24rpx;
color: #999;
margin-left: 8rpx;
}
}
.empty-state {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 100rpx 0;
text-align: center;
}
.modal-footer {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
padding: 32rpx;
border-top: 1rpx solid #eee;
padding: 24rpx 32rpx calc(24rpx + env(safe-area-inset-bottom));
background-color: #fff;
position: sticky;
bottom: 0;
z-index: 10;
}
.white {
background: #fff;
}
.b-r-8 {
border-radius: 8rpx;
}
.p-32 {
padding: 32rpx;
}
.m-t-2 {
margin-top: 16rpx;
}
.m-t-16 {
margin-top: 16rpx;
}
.flex-row {
display: flex;
flex-direction: row;
}
.flex-jus-sp {
justify-content: space-between;
}
.flex-jus-center {
justify-content: center;
}
.flex-ali-center {
align-items: center;
}
.color0 {
color: #000;
}
.color9 {
color: #999;
}
.bold {
font-weight: bold;
}
</style>

View File

@@ -87,7 +87,7 @@
</template>
<script>
import { getCommonPrescriptionListApi } from '@/api/reception.js';
import { getCommonPrescriptionListApi, deleteCommonPrescriptionApi } from '@/api/reception.js';
export default {
name: 'CommonPrescriptionModal',
@@ -302,10 +302,18 @@ export default {
success: async ({ confirm }) => {
if (confirm) {
try {
// TODO: 调用删除接口
// await deleteCommonPrescriptionApi(prescription.id);
this.$toast('删除成功');
const type = this.getCommonPrescriptionType(this.prescriptionType);
const res = await deleteCommonPrescriptionApi({
id: prescription.id,
type
});
if (res && res.code === 0) {
this.prescriptionList.splice(index, 1);
this.recipesByIndex.splice(index, 1);
this.$toast('删除成功');
} else {
this.$toast(res.msg || res.message || '删除失败');
}
} catch (error) {
console.error('删除常用方失败:', error);
this.$toast('删除失败');
@@ -320,9 +328,13 @@ export default {
* 职责:关闭弹窗,触发新建事件
*/
handleAddNew() {
const initialCategory =
this.prescriptionType === 1 ? 1 : this.prescriptionType === 2 ? 2 : 3;
uni.setStorageSync('add', true);
this.handleClose();
// 可以触发新建事件,让父组件处理
// this.$emit('add-new');
uni.navigateTo({
url: `/subPackages/sub_workbench/prescription_v2/index?save_common=1&initial_category=${initialCategory}`
});
},
/**

View File

@@ -9,9 +9,9 @@
z-index="10078"
height="80%"
>
<view class="diagnosis-modal">
<view class="modal-header">
<d-text text="常用诊断" className="fs-32 main-c"></d-text>
<view class="diagnosis-modal page-bg">
<view class="modal-header white">
<d-text text="常用诊断" className="fs-32 font-bold color-title"></d-text>
</view>
<view class="modal-content">
@@ -25,38 +25,39 @@
@clear="handleSearch"
>
<template slot="suffix">
<u-icon name="search" size="20" color="#999"></u-icon>
<u-icon name="search" size="32" color="#B0B6C2"></u-icon>
</template>
</u-input>
</view>
<view class="scroll-container">
<!-- 常用诊断列表 -->
<view class="section" v-if="doctorMyDiseaseList.length > 0">
<view class="section-header">
<d-text text="常用诊断" className="fs-28 content-c"></d-text>
<d-text :text="`${doctorMyDiseaseList.length}`" className="fs-24 tips-c"></d-text>
<view class="section white radius-16 p-32 m-b-24 shadow-sm" v-if="doctorMyDiseaseList.length > 0">
<view class="section-header flex-row flex-jus-sp flex-ali-center m-b-24">
<d-text text="常用诊断" className="fs-30 font-bold color-title"></d-text>
<d-text :text="`${doctorMyDiseaseList.length}`" className="fs-26 color-sub"></d-text>
</view>
<view class="tag-container">
<view class="modern-tag-container">
<view
v-for="item in doctorMyDiseaseList"
:key="item.id"
class="tag-item"
:class="{ 'selected': item.disease.isSelect === 1 }"
class="modern-tag-item"
:class="{ 'is-selected': item.disease.isSelect === 1 }"
@click="selectDiagnosis(item.disease)"
>
<text class="tag-text">{{ item.disease.name }}</text>
<view class="tag-action" @click.stop="removeFromMyDiagnosis(item)">
<u-icon name="close" size="14" color="#999"></u-icon>
<u-icon name="close" size="20"></u-icon>
</view>
</view>
</view>
</view>
<!-- 搜索结果列表 -->
<view class="section" v-if="allDiagnosisList.length > 0">
<view class="section-header">
<d-text text="搜索结果" className="fs-28 content-c"></d-text>
<d-text :text="`共 ${allDiagnosisList.length} 条`" className="fs-24 tips-c"></d-text>
<view class="section white radius-16 p-32 shadow-sm" v-if="allDiagnosisList.length > 0">
<view class="section-header flex-row flex-jus-sp flex-ali-center m-b-24">
<d-text text="搜索结果" className="fs-30 font-bold color-title"></d-text>
<d-text :text="`共 ${allDiagnosisList.length} 条`" className="fs-26 color-sub"></d-text>
</view>
<scroll-view
class="tag-container-scroll"
@@ -64,27 +65,27 @@
@scrolltolower="loadMore"
:lower-threshold="100"
>
<view class="tag-container">
<view class="modern-tag-container">
<view
v-for="item in allDiagnosisList"
:key="item.id"
class="tag-item"
:class="{ 'selected': item.isSelect === 1 }"
class="modern-tag-item"
:class="{ 'is-selected': item.isSelect === 1 }"
@click="selectDiagnosis(item)"
>
<text class="tag-text">{{ item.name }}</text>
<view class="tag-action" @click.stop="addToMyDiagnosis(item)" v-if="!item.isInMyList">
<u-icon name="plus" size="14" color="#6ACDBB"></u-icon>
<u-icon name="plus" size="20"></u-icon>
</view>
<view class="tag-action" v-else>
<u-icon name="checkmark" size="14" color="#6ACDBB"></u-icon>
<u-icon name="checkmark" size="20"></u-icon>
</view>
</view>
</view>
<!-- 加载更多 -->
<view class="load-more" v-if="loading">
<text class="load-more-text">加载中...</text>
<u-loading mode="circle" color="#00A88A"></u-loading> <text class="load-more-text m-l-12">加载中...</text>
</view>
<view class="load-more" v-else-if="!hasMore && allDiagnosisList.length > 0">
<text class="load-more-text">没有更多了</text>
@@ -97,18 +98,22 @@
<d-empty text="暂无相关诊断"></d-empty>
</view>
</view>
</view>
<!-- 底部按钮 -->
<view class="modal-footer flex-jus-between flex-ali-center">
<view class="modal-footer flex-row flex-jus-between flex-ali-center white shadow-up">
<u-button
:throttle-time="0"
@click="handleClose"
shape="circle"
:custom-style="{
backgroundColor: '#f5f5f5',
color: '#333',
height: '86rpx',
width: '320rpx'
backgroundColor: '#F4F6F8',
color: '#2A2E35',
height: '88rpx',
width: '320rpx',
fontWeight: 'bold',
fontSize: '30rpx',
border: 'none'
}"
>取消</u-button>
<u-button
@@ -116,10 +121,14 @@
@click="handleConfirm"
shape="circle"
:custom-style="{
backgroundColor: '#6ACDBB',
backgroundColor: '#00A88A',
color: '#fff',
height: '86rpx',
width: '320rpx'
height: '88rpx',
width: '320rpx',
fontWeight: 'bold',
fontSize: '30rpx',
boxShadow: '0 8rpx 20rpx rgba(0, 168, 138, 0.25)',
border: 'none'
}"
>确定</u-button>
</view>
@@ -128,6 +137,7 @@
</template>
<script>
// 保留所有原有逻辑代码与注释
import { getDiseaseList, getMyDiseaseList, addMyDisease, deleteMyDisease } from '@/api/reception.js';
export default {
@@ -162,10 +172,11 @@ export default {
searchTimer: null,
searchStyle: {
fontSize: '28rpx',
backgroundColor: '#F3F4F5',
borderRadius: '66rpx',
height: '66rpx',
padding: '8rpx 32rpx'
backgroundColor: '#fff',
borderRadius: '16rpx',
height: '80rpx',
padding: '0 32rpx',
boxShadow: '0 4rpx 16rpx rgba(0,0,0,0.02)'
}
};
},
@@ -425,104 +436,133 @@ export default {
</script>
<style lang="scss" scoped>
/* 使用与 index.vue 统一的设计风格与变量 */
.page-bg { background-color: #F4F6F8; }
.white { background: #fff; }
.color-title { color: #2A2E35; }
.color-sub { color: #8A92A3; }
.fs-26 { font-size: 26rpx; }
.fs-28 { font-size: 28rpx; }
.fs-30 { font-size: 30rpx; }
.fs-32 { font-size: 32rpx; }
.font-bold { font-weight: bold; }
.m-b-24 { margin-bottom: 24rpx; }
.m-l-12 { margin-left: 12rpx; }
.p-32 { padding: 32rpx; }
.radius-16 { border-radius: 16rpx; }
.shadow-sm { box-shadow: 0 4rpx 16rpx rgba(42, 46, 53, 0.04); }
.shadow-up { box-shadow: 0 -4rpx 20rpx rgba(0,0,0,0.04); }
.flex-row { display: flex; flex-direction: row; }
.flex-jus-sp { justify-content: space-between; }
.flex-jus-between { justify-content: space-between; }
.flex-ali-center { align-items: center; }
.diagnosis-modal {
display: flex;
flex-direction: column;
height: 100%;
background-color: #fff;
overflow: hidden;
}
.modal-header {
padding: 32rpx;
text-align: center;
border-bottom: 1rpx solid #eee;
border-bottom: 1px solid #F0F2F5;
}
.modal-content {
flex: 1;
overflow-y: auto;
display: flex;
flex-direction: column;
overflow: hidden;
padding: 32rpx;
}
.scroll-container {
flex: 1;
overflow-y: auto;
/* 底部防遮挡边距 */
padding-bottom: 24rpx;
display: flex;
flex-direction: column;
}
.search-box {
margin-bottom: 32rpx;
}
.section {
margin-bottom: 32rpx;
}
.section-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24rpx;
}
.tag-container-scroll {
max-height: 60vh;
max-height: 50vh;
}
.tag-container {
.modern-tag-container {
display: flex;
flex-wrap: wrap;
gap: 16rpx;
padding-bottom: 32rpx;
gap: 20rpx;
}
.modern-tag-item {
display: inline-flex;
align-items: center;
padding: 12rpx 24rpx;
background-color: #F7F8FA;
border: 1px solid #E2E8F0;
border-radius: 36rpx;
cursor: pointer;
transition: all 0.2s;
&.is-selected {
background-color: #E8F6F4;
border-color: #00A88A;
.tag-text {
color: #00A88A;
font-weight: bold;
}
.tag-action {
color: #00A88A;
}
}
.tag-text {
font-size: 26rpx;
color: #4b5563;
}
.tag-action {
margin-left: 12rpx;
display: flex;
align-items: center;
color: #8A92A3;
}
}
.load-more {
text-align: center;
display: flex;
align-items: center;
justify-content: center;
padding: 32rpx 0;
.load-more-text {
font-size: 24rpx;
color: #999;
}
}
.tag-item {
display: inline-flex;
align-items: center;
padding: 12rpx 24rpx;
background-color: #f9fafb;
border: 1rpx solid #e5e7eb;
border-radius: 9999rpx;
cursor: pointer;
transition: all 0.2s;
&.selected {
background-color: #eff6ff;
border-color: #6ACDBB;
.tag-text {
color: #6ACDBB;
font-weight: 500;
}
}
.tag-text {
font-size: 28rpx;
color: #4b5563;
}
.tag-action {
margin-left: 8rpx;
.empty-state {
flex: 1;
display: flex;
align-items: center;
}
}
.empty-state {
justify-content: center;
padding: 100rpx 0;
text-align: center;
}
.modal-footer {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 32rpx;
border-top: 1rpx solid #eee;
padding: 24rpx 32rpx calc(24rpx + env(safe-area-inset-bottom));
background-color: #fff;
}
</style>

View File

@@ -9,73 +9,50 @@
z-index="10078"
height="80%"
>
<view class="doctor-order-modal">
<view class="modal-header">
<d-text text="常用医嘱" className="fs-32 main-c"></d-text>
<view class="doctor-order-modal page-bg">
<view class="modal-header white">
<d-text text="常用医嘱" className="fs-32 font-bold color-title"></d-text>
</view>
<view class="modal-content">
<!-- 我的医嘱 -->
<view class="section">
<view class="section-header">
<d-text text="我的医嘱" className="fs-28 content-c"></d-text>
<view class="add-btn" @click="showAddInput = true" v-if="!showAddInput">
<u-icon name="plus" size="16" color="#6ACDBB"></u-icon>
<view class="section white radius-16 p-32 m-b-24 shadow-sm">
<view class="section-header flex-row flex-jus-sp flex-ali-center m-b-24">
<d-text text="我的医嘱" className="fs-30 font-bold color-title"></d-text>
<view class="add-btn-modern" @click="openAddModal">
<u-icon name="plus" size="24" color="#00A88A" class="m-r-8"></u-icon>
<text class="add-text">添加医嘱</text>
</view>
</view>
<!-- 添加输入框 -->
<view class="add-input-box" v-if="showAddInput">
<u-input
v-model="newOrderContent"
placeholder="输入内容后确认"
:custom-style="inputStyle"
@confirm="addMyDoctorOrder"
/>
<view class="input-actions">
<u-button
@click="cancelAdd"
size="mini"
plain
:custom-style="{ marginRight: '16rpx' }"
>取消</u-button>
<u-button
@click="addMyDoctorOrder"
size="mini"
:custom-style="{ backgroundColor: '#6ACDBB', color: '#fff' }"
>确认</u-button>
</view>
</view>
<!-- 我的医嘱列表 -->
<view class="tag-container">
<view class="modern-tag-container">
<view
v-for="item in doctorOrderMyList"
:key="item.id"
class="tag-item"
:class="{ 'selected': item.isSelect === 1 }"
class="modern-tag-item"
:class="{ 'is-selected': item.isSelect === 1 }"
@click="selectDoctorOrder(item, 1)"
>
<text class="tag-text">{{ item.content }}</text>
<view class="tag-action" @click.stop="deleteMyDoctorOrder(item)">
<u-icon name="close" size="14" color="#999"></u-icon>
<u-icon name="close" size="20"></u-icon>
</view>
</view>
</view>
</view>
<!-- 公共医嘱 -->
<view class="section" v-if="doctorOrderCommonList.length > 0">
<view class="section-header">
<d-text text="公共医嘱" className="fs-28 content-c"></d-text>
<view class="section white radius-16 p-32 shadow-sm" v-if="doctorOrderCommonList.length > 0">
<view class="section-header m-b-24">
<d-text text="系统公共医嘱" className="fs-30 font-bold color-title"></d-text>
</view>
<view class="tag-container">
<view class="modern-tag-container">
<view
v-for="item in doctorOrderCommonList"
:key="item.id"
class="tag-item"
:class="{ 'selected': item.isSelect === 1 }"
class="modern-tag-item"
:class="{ 'is-selected': item.isSelect === 1 }"
@click="selectDoctorOrder(item, 2)"
>
<text class="tag-text">{{ item.content }}</text>
@@ -85,16 +62,19 @@
</view>
<!-- 底部按钮 -->
<view class="modal-footer flex-jus-between flex-ali-center">
<view class="modal-footer flex-row flex-jus-between flex-ali-center white shadow-up">
<u-button
:throttle-time="0"
@click="handleClose"
shape="circle"
:custom-style="{
backgroundColor: '#f5f5f5',
color: '#333',
height: '86rpx',
width: '320rpx'
backgroundColor: '#F4F6F8',
color: '#2A2E35',
height: '88rpx',
width: '320rpx',
fontWeight: 'bold',
fontSize: '30rpx',
border: 'none'
}"
>取消</u-button>
<u-button
@@ -102,18 +82,43 @@
@click="handleConfirm"
shape="circle"
:custom-style="{
backgroundColor: '#6ACDBB',
backgroundColor: '#00A88A',
color: '#fff',
height: '86rpx',
width: '320rpx'
height: '88rpx',
width: '320rpx',
fontWeight: 'bold',
fontSize: '30rpx',
boxShadow: '0 8rpx 20rpx rgba(0, 168, 138, 0.25)',
border: 'none'
}"
>确定</u-button>
</view>
</view>
<!-- 添加自定义医嘱弹窗 -->
<u-modal
v-model="showAddModal"
:show-cancel-button="true"
title="添加医嘱"
z-index="10090"
@confirm="addMyDoctorOrder"
@cancel="cancelAdd"
>
<view class="slot-content" style="padding: 40rpx;">
<u-input
v-model="newOrderContent"
placeholder="请输入医嘱内容"
type="text"
:border="true"
border-color="#E2E8F0"
/>
</view>
</u-modal>
</u-popup>
</template>
<script>
// 保留所有原有逻辑代码与注释
import { getDoctorOrderList, getDoctorOrderCommonList, createDoctorOrder, deleteDoctorOrder } from '@/api/reception.js';
export default {
@@ -140,15 +145,8 @@ export default {
doctorOrderCommonList: [],
doctorOrderMyList: [],
selectDoctorOrderList: '',
showAddInput: false,
newOrderContent: '',
inputStyle: {
fontSize: '28rpx',
backgroundColor: '#F3F4F5',
borderRadius: '8rpx',
height: '66rpx',
padding: '8rpx 16rpx'
}
showAddModal: false,
newOrderContent: ''
};
},
watch: {
@@ -252,6 +250,15 @@ export default {
this.selectDoctorOrderList = arr.join('');
},
/**
* 打开添加医嘱弹窗
* 职责:清空旧内容,打开弹窗
*/
openAddModal() {
this.newOrderContent = '';
this.showAddModal = true;
},
/**
* 添加自定义医嘱
* 职责:调用接口添加我的医嘱
@@ -267,7 +274,7 @@ export default {
if (res && (res.code === 0 || res.errcode === 0)) {
this.$toast('添加成功');
this.newOrderContent = '';
this.showAddInput = false;
this.showAddModal = false;
await this.loadDoctorOrderListData();
} else {
this.$toast(res.msg || res.message || '添加失败');
@@ -300,11 +307,11 @@ export default {
/**
* 取消添加
* 职责:关闭添加输入框
* 职责:关闭弹窗
*/
cancelAdd() {
this.showAddModal = false;
this.newOrderContent = '';
this.showAddInput = false;
},
/**
@@ -329,106 +336,112 @@ export default {
</script>
<style lang="scss" scoped>
/* 使用与 index.vue 统一的设计风格与变量 */
.page-bg { background-color: #F4F6F8; }
.white { background: #fff; }
.color-title { color: #2A2E35; }
.fs-26 { font-size: 26rpx; }
.fs-30 { font-size: 30rpx; }
.fs-32 { font-size: 32rpx; }
.font-bold { font-weight: bold; }
.m-b-24 { margin-bottom: 24rpx; }
.m-t-16 { margin-top: 16rpx; }
.m-r-8 { margin-right: 8rpx; }
.m-l-16 { margin-left: 16rpx; }
.p-32 { padding: 32rpx; }
.radius-16 { border-radius: 16rpx; }
.shadow-sm { box-shadow: 0 4rpx 16rpx rgba(42, 46, 53, 0.04); }
.shadow-up { box-shadow: 0 -4rpx 20rpx rgba(0,0,0,0.04); }
.flex-row { display: flex; flex-direction: row; }
.flex-jus-sp { justify-content: space-between; }
.flex-jus-end { justify-content: flex-end; }
.flex-jus-between { justify-content: space-between; }
.flex-ali-center { align-items: center; }
.doctor-order-modal {
display: flex;
flex-direction: column;
height: 100%;
background-color: #fff;
overflow: hidden;
}
.modal-header {
padding: 32rpx;
text-align: center;
border-bottom: 1rpx solid #eee;
border-bottom: 1px solid #F0F2F5;
}
.modal-content {
flex: 1;
overflow-y: auto;
padding: 32rpx;
/* 底部防遮挡边距 */
padding-bottom: 24rpx;
}
.section {
margin-bottom: 32rpx;
}
.section-header {
.add-btn-modern {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24rpx;
.add-btn {
display: flex;
align-items: center;
gap: 8rpx;
padding: 8rpx 16rpx;
border: 1rpx dashed #6ACDBB;
padding: 8rpx 20rpx;
background: #E8F6F4;
border-radius: 32rpx;
cursor: pointer;
.add-text {
font-size: 24rpx;
color: #6ACDBB;
}
}
}
.add-input-box {
margin-bottom: 24rpx;
padding: 16rpx;
background-color: #f9fafb;
border-radius: 8rpx;
.input-actions {
display: flex;
justify-content: flex-end;
margin-top: 16rpx;
font-weight: bold;
color: #00A88A;
}
}
.tag-container {
.modern-tag-container {
display: flex;
flex-wrap: wrap;
gap: 16rpx;
gap: 20rpx;
}
.tag-item {
.modern-tag-item {
display: inline-flex;
align-items: center;
padding: 12rpx 24rpx;
background-color: #f9fafb;
border: 1rpx solid #e5e7eb;
border-radius: 9999rpx;
background-color: #F7F8FA;
border: 1px solid #E2E8F0;
border-radius: 36rpx;
cursor: pointer;
transition: all 0.2s;
&.selected {
background-color: #eff6ff;
border-color: #6ACDBB;
&.is-selected {
background-color: #E8F6F4;
border-color: #00A88A;
.tag-text {
color: #6ACDBB;
font-weight: 500;
color: #00A88A;
font-weight: bold;
}
.tag-action {
color: #00A88A;
}
}
.tag-text {
font-size: 28rpx;
font-size: 26rpx;
color: #4b5563;
}
.tag-action {
margin-left: 8rpx;
margin-left: 12rpx;
display: flex;
align-items: center;
color: #8A92A3;
}
}
.modal-footer {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 32rpx;
border-top: 1rpx solid #eee;
padding: 24rpx 32rpx calc(24rpx + env(safe-area-inset-bottom));
background-color: #fff;
}
</style>

View File

@@ -9,53 +9,51 @@
z-index="10078"
height="80%"
>
<view class="simple-product-modal">
<view class="modal-header">
<d-text :text="getModalTitle()" className="fs-32 main-c"></d-text>
<view class="simple-product-modal page-bg">
<view class="modal-header white">
<d-text :text="getModalTitle()" className="fs-32 font-bold color-title"></d-text>
</view>
<view class="modal-content">
<!-- 搜索框 -->
<view class="search-box">
<view class="search-box m-b-24">
<u-search
v-model="searchKey"
placeholder="请输入产品名称搜索"
@input="handleSearch"
@custom="searchKey = ''; handleSearch()"
:show-action="false"
bg-color="#fff"
/>
</view>
<!-- 产品列表 -->
<view class="product-list" v-if="productList.length > 0">
<view
class="product-item white b-r-8 p-32 m-t-2"
class="medicine-card"
v-for="item in productList"
:key="item.id"
>
<view class="product-content flex-row">
<view class="flex-row">
<image
v-if="(item.drug && item.drug.image) || item.image"
:src="(item.drug && item.drug.image) || item.image"
class="product-image"
class="drug-image-modern"
mode="aspectFill"
></image>
<view class="product-info-wrapper flex-1">
<view class="product-header flex-row flex-jus-sp flex-ali-center">
<d-text :text="item.drug.drug_name || item.drug.name" className="fs-3 color0 bold"></d-text>
<d-text :text="`¥${parseFloat(item.price || 0).toFixed(2)}`" className="fs-3 error-c"></d-text>
<view class="flex-1 m-l-24 flex-col">
<view class="flex-row flex-jus-sp flex-ali-start">
<text class="fs-30 font-bold color-title line-clamp-2 w-70">{{item.drug.drug_name || item.drug.name}}</text>
<text class="fs-32 font-bold color-price">{{parseFloat(item.price || 0).toFixed(2)}}</text>
</view>
<view class="product-info m-t-16">
<d-text :text="`规格:${item.drug.specification || '--'}`" className="fs-24 color9"></d-text>
<view class="flex-row flex-jus-sp flex-ali-center m-t-12">
<text class="fs-24 color-sub">规格{{item.drug.specification || '--'}}</text>
</view>
<view class="product-action m-t-24">
<view class="action-btn-ghost primary" @click.stop="handleSelectProduct(item)">
<u-icon name="plus" size="24" class="m-r-8"></u-icon> 选用此产品
</view>
<view class="product-action m-t-16">
<u-button
size="mini"
:custom-style="{ backgroundColor: '#6ACDBB', color: '#fff' }"
@click.stop="handleSelectProduct(item)"
>
选择
</u-button>
</view>
</view>
</view>
@@ -69,16 +67,19 @@
</view>
<!-- 底部按钮 -->
<view class="modal-footer flex-jus-sp flex-ali-center">
<view class="modal-footer flex-row flex-jus-between flex-ali-center white shadow-up">
<u-button
:throttle-time="0"
@click="handleClose"
shape="circle"
:custom-style="{
backgroundColor: '#f5f5f5',
color: '#333',
height: '86rpx',
width: '320rpx'
backgroundColor: '#F4F6F8',
color: '#2A2E35',
height: '88rpx',
width: '320rpx',
fontWeight: 'bold',
fontSize: '30rpx',
border: 'none'
}"
>取消</u-button>
<u-button
@@ -86,10 +87,14 @@
@click="handleClose"
shape="circle"
:custom-style="{
backgroundColor: '#6ACDBB',
backgroundColor: '#00A88A',
color: '#fff',
height: '86rpx',
width: '320rpx'
height: '88rpx',
width: '320rpx',
fontWeight: 'bold',
fontSize: '30rpx',
boxShadow: '0 8rpx 20rpx rgba(0, 168, 138, 0.25)',
border: 'none'
}"
>确定</u-button>
</view>
@@ -98,6 +103,7 @@
</template>
<script>
// 保留所有原有逻辑代码与注释
import { getProductListDoctorReception } from '@/api/reception.js';
export default {
@@ -178,7 +184,7 @@ export default {
});
if (res && (res.code === 0 || res.errcode === 0)) {
this.productList = res.data || res.result || [];
this.productList = res.result || [];
} else {
this.productList = [];
}
@@ -225,127 +231,123 @@ export default {
</script>
<style lang="scss" scoped>
/* 使用与 index.vue 统一的设计风格与变量 */
.page-bg { background-color: #F4F6F8; }
.white { background: #fff; }
.color-title { color: #2A2E35; }
.color-sub { color: #8A92A3; }
.color-price { color: #F53F3F; }
.fs-24 { font-size: 24rpx; }
.fs-30 { font-size: 30rpx; }
.fs-32 { font-size: 32rpx; }
.font-bold { font-weight: bold; }
.m-b-24 { margin-bottom: 24rpx; }
.m-t-12 { margin-top: 12rpx; }
.m-t-24 { margin-top: 24rpx; }
.m-l-24 { margin-left: 24rpx; }
.m-r-8 { margin-right: 8rpx; }
.shadow-up { box-shadow: 0 -4rpx 20rpx rgba(0,0,0,0.04); }
.flex-row { display: flex; flex-direction: row; }
.flex-col { display: flex; flex-direction: column; }
.flex-jus-sp { justify-content: space-between; }
.flex-jus-between { justify-content: space-between; }
.flex-ali-center { align-items: center; }
.flex-ali-start { align-items: flex-start; }
.flex-1 { flex: 1; }
.simple-product-modal {
display: flex;
flex-direction: column;
height: 100%;
background-color: #fff;
overflow: hidden;
}
.modal-header {
padding: 32rpx;
text-align: center;
border-bottom: 1rpx solid #eee;
border-bottom: 1px solid #F0F2F5;
}
.modal-content {
flex: 1;
overflow-y: auto;
padding: 32rpx;
display: flex;
flex-direction: column;
}
.search-box {
margin-bottom: 32rpx;
}
/* 底部防遮挡边距 */
.product-list {
padding-bottom: 32rpx;
padding-bottom: 24rpx;
}
.product-item {
margin-bottom: 16rpx;
/* 底部防遮挡边距 */
.product-list {
padding-bottom: 120rpx;
}
.product-content {
gap: 24rpx;
/* 现代卡片样式 */
.medicine-card {
background: #fff;
border-radius: 16rpx;
padding: 24rpx;
margin-bottom: 24rpx;
box-shadow: 0 4rpx 16rpx rgba(42, 46, 53, 0.04);
position: relative;
overflow: hidden;
}
.product-image {
width: 120rpx;
height: 120rpx;
border-radius: 8rpx;
.drug-image-modern {
width: 140rpx;
height: 140rpx;
border-radius: 12rpx;
background-color: #F7F8FA;
flex-shrink: 0;
background-color: #f5f5f5;
border: 1px solid #F0F2F5;
}
.product-info-wrapper {
min-width: 0;
flex: 1;
}
.product-header {
margin-bottom: 16rpx;
}
.product-info {
margin-bottom: 16rpx;
.line-clamp-2 {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.w-70 { width: 70%; }
.product-action {
display: flex;
justify-content: flex-end;
}
.empty-state {
//padding: 100rpx 0;
text-align: center;
}
.white {
background: #fff;
}
.b-r-8 {
border-radius: 8rpx;
}
.p-32 {
padding: 32rpx;
}
.m-t-2 {
margin-top: 16rpx;
}
.m-t-16 {
margin-top: 16rpx;
}
.flex-row {
display: flex;
flex-direction: row;
}
.flex-jus-sp {
justify-content: space-between;
}
.flex-ali-center {
align-items: center;
}
.color0 {
color: #000;
}
.color9 {
color: #999;
}
.bold {
.action-btn-ghost {
padding: 8rpx 24rpx;
border-radius: 30rpx;
font-size: 24rpx;
font-weight: bold;
display: flex;
align-items: center;
&.primary {
color: #00A88A;
background: #E8F6F4;
}
}
.empty-state {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 100rpx 0;
text-align: center;
}
.modal-footer {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 32rpx;
border-top: 1rpx solid #eee;
align-items: center;
padding: 24rpx 32rpx calc(24rpx + env(safe-area-inset-bottom));
background-color: #fff;
position: sticky;
bottom: 0;
z-index: 10;
}
</style>

View File

@@ -9,66 +9,56 @@
z-index="10078"
height="80%"
>
<view class="western-medicine-modal">
<view class="modal-header">
<d-text text="选择西药" className="fs-32 main-c"></d-text>
<view class="western-medicine-modal page-bg">
<view class="modal-header white">
<d-text text="选择西药" className="fs-32 font-bold color-title"></d-text>
</view>
<view class="modal-content">
<!-- 搜索框 -->
<view class="search-box">
<view class="search-box m-b-24">
<u-search
v-model="searchKey"
placeholder="请输入药品名称搜索"
@input="handleSearch"
@custom="searchKey = ''; handleSearch()"
:show-action="false"
bg-color="#fff"
/>
</view>
<!-- 药品列表 -->
<view class="drug-list" v-if="drugList.length > 0">
<view
class="drug-card white b-r-8 p-32 m-t-2"
class="medicine-card"
v-for="(item, index) in drugList"
:key="index"
:class="{ selected: isSelected(item) }"
:class="{ 'is-selected': isSelected(item) }"
@click="!isSelected(item) && handleSelectDrug(item)"
>
<view class="drug-content flex-row">
<view class="flex-row">
<image
v-if="getDrugImage(item)"
:src="getDrugImage(item)"
class="drug-image"
class="drug-image-modern"
mode="aspectFill"
></image>
<view class="drug-info-wrapper flex-1">
<view class="drug-header flex-row flex-jus-sp flex-ali-center">
<d-text
:text="`${index + 1}、${item.drug.drug_name || item.drug.name}`"
className="fs-3 color0 bold"
></d-text>
<d-text
:text="`¥${parseFloat(item.price || 0).toFixed(2)}`"
className="fs-3 error-c"
></d-text>
<view class="flex-1 m-l-24 flex-col">
<view class="flex-row flex-jus-sp flex-ali-start">
<text class="fs-30 font-bold color-title line-clamp-2 w-70">{{item.drug.drug_name || item.drug.name}}</text>
<text class="fs-32 font-bold color-price">{{parseFloat(item.price || 0).toFixed(2)}}</text>
</view>
<view class="drug-info m-t-16 flex-row flex-ali-center flex-jus-sp">
<d-text
:text="`规格:${item.drug.specification || '--'}`"
className="fs-24 color9"
></d-text>
<view class="flex-row flex-jus-sp flex-ali-center m-t-12">
<text class="fs-24 color-sub">规格{{item.drug.specification || '--'}}</text>
</view>
<view class="drug-status m-t-24">
<view v-if="isSelected(item)" class="action-btn-ghost disabled">
已添加处方
</view>
<view v-else class="action-btn-ghost primary">
<u-icon name="plus" size="24" class="m-r-8"></u-icon> 选用此药
</view>
</view>
<view class="drug-status">
<u-button
size="mini"
:disabled="isSelected(item)"
:custom-style="isSelected(item) ? selectedButtonStyle : addButtonStyle"
@click.stop="handleSelectDrug(item)"
>
{{ isSelected(item) ? '已选' : '添加' }}
</u-button>
</view>
</view>
</view>
@@ -81,16 +71,19 @@
</view>
<!-- 底部按钮 -->
<view class="modal-footer flex-jus-sp flex-ali-center">
<view class="modal-footer flex-row flex-jus-between flex-ali-center white shadow-up">
<u-button
:throttle-time="0"
@click="handleClose"
shape="circle"
:custom-style="{
backgroundColor: '#f5f5f5',
color: '#333',
height: '86rpx',
width: '320rpx'
backgroundColor: '#F4F6F8',
color: '#2A2E35',
height: '88rpx',
width: '320rpx',
fontWeight: 'bold',
fontSize: '30rpx',
border: 'none'
}"
>取消</u-button>
<u-button
@@ -98,10 +91,14 @@
@click="handleClose"
shape="circle"
:custom-style="{
backgroundColor: '#6ACDBB',
backgroundColor: '#00A88A',
color: '#fff',
height: '86rpx',
width: '320rpx'
height: '88rpx',
width: '320rpx',
fontWeight: 'bold',
fontSize: '30rpx',
boxShadow: '0 8rpx 20rpx rgba(0, 168, 138, 0.25)',
border: 'none'
}"
>确定</u-button>
</view>
@@ -110,6 +107,7 @@
</template>
<script>
// 保留所有原有逻辑代码与注释
import { getProductListDoctorReception } from '@/api/reception.js';
export default {
@@ -136,16 +134,7 @@ export default {
searchKey: '',
drugList: [],
loading: false,
searchTimer: null,
addButtonStyle: {
backgroundColor: '#6ACDBB',
color: '#fff'
},
selectedButtonStyle: {
backgroundColor: '#F5F7FA',
color: '#6ACDBB',
borderColor: '#6ACDBB'
}
searchTimer: null
};
},
watch: {
@@ -254,132 +243,137 @@ export default {
</script>
<style lang="scss" scoped>
/* 使用与 index.vue 统一的设计风格与变量 */
.page-bg { background-color: #F4F6F8; }
.white { background: #fff; }
.color-title { color: #2A2E35; }
.color-sub { color: #8A92A3; }
.color-price { color: #F53F3F; }
.fs-24 { font-size: 24rpx; }
.fs-30 { font-size: 30rpx; }
.fs-32 { font-size: 32rpx; }
.font-bold { font-weight: bold; }
.m-b-24 { margin-bottom: 24rpx; }
.m-t-12 { margin-top: 12rpx; }
.m-t-24 { margin-top: 24rpx; }
.m-l-24 { margin-left: 24rpx; }
.m-r-8 { margin-right: 8rpx; }
.shadow-up { box-shadow: 0 -4rpx 20rpx rgba(0,0,0,0.04); }
.flex-row { display: flex; flex-direction: row; }
.flex-col { display: flex; flex-direction: column; }
.flex-jus-sp { justify-content: space-between; }
.flex-jus-between { justify-content: space-between; }
.flex-ali-center { align-items: center; }
.flex-ali-start { align-items: flex-start; }
.flex-1 { flex: 1; }
.western-medicine-modal {
display: flex;
flex-direction: column;
height: 100%;
background-color: #fff;
overflow: hidden;
}
.modal-header {
padding: 32rpx;
text-align: center;
border-bottom: 1rpx solid #eee;
border-bottom: 1px solid #F0F2F5;
}
.modal-content {
flex: 1;
overflow-y: auto;
padding: 32rpx;
display: flex;
flex-direction: column;
}
.search-box {
margin-bottom: 32rpx;
}
/* 底部防遮挡边距 */
.drug-list {
padding-bottom: 32rpx;
padding-bottom: 24rpx;
}
.drug-item {
margin-bottom: 16rpx;
/* 底部防遮挡边距 */
.drug-list {
padding-bottom: 120rpx;
}
.drug-content {
gap: 24rpx;
/* 现代卡片样式 */
.medicine-card {
background: #fff;
border-radius: 16rpx;
padding: 24rpx;
margin-bottom: 24rpx;
box-shadow: 0 4rpx 16rpx rgba(42, 46, 53, 0.04);
position: relative;
overflow: hidden;
border: 2rpx solid transparent;
transition: all 0.2s;
&.is-selected {
border-color: #E2E8F0;
background-color: #F8FAFC;
opacity: 0.8;
}
}
.drug-image {
width: 120rpx;
height: 120rpx;
border-radius: 8rpx;
.drug-image-modern {
width: 140rpx;
height: 140rpx;
border-radius: 12rpx;
background-color: #F7F8FA;
flex-shrink: 0;
background-color: #f5f5f5;
border: 1px solid #F0F2F5;
}
.drug-info-wrapper {
min-width: 0;
}
.drug-header {
margin-bottom: 16rpx;
}
.drug-info {
margin-bottom: 16rpx;
.line-clamp-2 {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.w-70 { width: 70%; }
.drug-status {
display: flex;
align-items: center;
justify-content: flex-end;
}
.empty-state {
padding: 100rpx 0;
align-items: center;
text-align: center;
}
.white {
background: #fff;
}
.b-r-8 {
border-radius: 8rpx;
}
.p-32 {
padding: 32rpx;
}
.m-t-2 {
margin-top: 16rpx;
}
.m-t-16 {
margin-top: 16rpx;
}
.flex-row {
display: flex;
flex-direction: row;
}
.flex-jus-sp {
justify-content: space-between;
}
.flex-ali-center {
align-items: center;
}
.flex-1 {
flex: 1;
}
.color0 {
color: #000;
}
.color9 {
color: #999;
}
.bold {
.action-btn-ghost {
padding: 8rpx 24rpx;
border-radius: 30rpx;
font-size: 24rpx;
font-weight: bold;
display: flex;
align-items: center;
&.primary {
color: #00A88A;
background: #E8F6F4;
}
&.disabled {
color: #8A92A3;
background: #F4F6F8;
border: 1px solid #E2E8F0;
}
}
.empty-state {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 100rpx 0;
text-align: center;
}
.modal-footer {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 32rpx;
border-top: 1rpx solid #eee;
align-items: center;
padding: 24rpx 32rpx calc(24rpx + env(safe-area-inset-bottom));
background-color: #fff;
position: sticky;
bottom: 0;
z-index: 10;
}
</style>

View File

@@ -9,42 +9,48 @@
z-index="10078"
height="80%"
>
<view class="western-usage-modal">
<view class="modal-header">
<d-text text="用法用量" className="fs-32 main-c"></d-text>
<view class="western-usage-modal page-bg">
<view class="modal-header white">
<d-text text="用法用量" className="fs-32 font-bold color-title"></d-text>
</view>
<view class="modal-content">
<view class="drug-info white b-r-8 p-32 m-t-2" v-if="drug">
<view class="info-item">
<d-text text="名称:" className="fs-3 color9"></d-text>
<d-text :text="drug.drug_name" className="fs-3 color0"></d-text>
<view class="medicine-card m-b-24" v-if="drug">
<view class="flex-row flex-ali-start">
<view class="info-icon m-r-16">
<u-icon name="info-circle-fill" size="36" color="#00A88A"></u-icon>
</view>
<view class="flex-col">
<d-text :text="drug.drug_name" className="fs-32 font-bold color-title m-b-8"></d-text>
<d-text :text="`规格:${drug.specification || '--'}`" className="fs-26 color-sub"></d-text>
</view>
<view class="info-item m-t-16">
<d-text text="规格:" className="fs-3 color9"></d-text>
<d-text :text="drug.specification || '--'" className="fs-3 color0"></d-text>
</view>
</view>
<!-- 表单区域使用统一现代化表单卡片 -->
<view class="form-card">
<!-- 药品数量 -->
<view class="usage-item white b-r-8 p-32 m-t-2">
<view class="form-item border-b">
<view class="item-label">
<d-text text="药品数量" className="fs-3 main-c"></d-text>
<d-text text="药品数量" className="fs-30 font-bold color-title"></d-text>
</view>
<view class="item-content">
<view class="item-content flex-row flex-ali-center">
<u-number-box
v-model="usageData.select_number"
:min="1"
:max="(drug && drug.stock) || 999"
:input-width="80"
:input-height="60"
bg-color="#F7F8FA"
/>
<d-text text="盒" className="fs-3 color9 m-l-16"></d-text>
<d-text text="盒" className="fs-28 color-sub m-l-16"></d-text>
</view>
</view>
<!-- 用法 -->
<view class="usage-item white b-r-8 p-32 m-t-2">
<view class="form-item border-b">
<view class="item-label">
<d-text text="用法" className="fs-3 main-c"></d-text>
<d-text text="给药途径" className="fs-30 font-bold color-title"></d-text>
</view>
<view class="item-content">
<picker
@@ -54,17 +60,18 @@
:value="usageData.type_id && drugUseList.drug_use_type ? drugUseList.drug_use_type.findIndex(item => item.id === usageData.type_id) : 0"
@change="handleChangeUsageType"
>
<view class="picker-view">
{{ (usageData.use_type && usageData.use_type.name) || '请选择' }}
<view class="modern-picker-view">
<text class="fs-28 color-title">{{ (usageData.use_type && usageData.use_type.name) || '请选择用法' }}</text>
<u-icon name="arrow-right" size="24" color="#B0B6C2"></u-icon>
</view>
</picker>
</view>
</view>
<!-- 频次 -->
<view class="usage-item white b-r-8 p-32 m-t-2">
<view class="form-item border-b">
<view class="item-label">
<d-text text="频次" className="fs-3 main-c"></d-text>
<d-text text="用药频次" className="fs-30 font-bold color-title"></d-text>
</view>
<view class="item-content">
<picker
@@ -74,17 +81,18 @@
:value="usageData.frequency_id && drugUseList.drug_use_frequency ? drugUseList.drug_use_frequency.findIndex(item => item.id === usageData.frequency_id) : 0"
@change="handleChangeFrequency"
>
<view class="picker-view">
{{ (usageData.use_frequency && usageData.use_frequency.name) || '请选择' }}
<view class="modern-picker-view">
<text class="fs-28 color-title">{{ (usageData.use_frequency && usageData.use_frequency.name) || '请选择频次' }}</text>
<u-icon name="arrow-right" size="24" color="#B0B6C2"></u-icon>
</view>
</picker>
</view>
</view>
<!-- 时间 -->
<view class="usage-item white b-r-8 p-32 m-t-2">
<view class="form-item border-b">
<view class="item-label">
<d-text text="时间" className="fs-3 main-c"></d-text>
<d-text text="用药时间" className="fs-30 font-bold color-title"></d-text>
</view>
<view class="item-content">
<picker
@@ -94,20 +102,27 @@
:value="usageData.time_id && drugUseList.drug_time ? drugUseList.drug_time.findIndex(item => item.id === usageData.time_id) : 0"
@change="handleChangeTime"
>
<view class="picker-view">
{{ (usageData.use_num && usageData.use_num.name) || '请选择' }}
<view class="modern-picker-view">
<text class="fs-28 color-title">{{ (usageData.use_num && usageData.use_num.name) || '请选择时间' }}</text>
<u-icon name="arrow-right" size="24" color="#B0B6C2"></u-icon>
</view>
</picker>
</view>
</view>
<!-- 单位 -->
<view class="usage-item white b-r-8 p-32 m-t-2">
<!-- 单位与单次用量 -->
<view class="form-item">
<view class="item-label">
<d-text text="次用量" className="fs-3 main-c"></d-text>
<d-text text="次用量" className="fs-30 font-bold color-title"></d-text>
</view>
<view class="item-content">
<u-number-box v-model="usageData.number" :min="1" />
<view class="item-content flex-row flex-ali-center flex-jus-end">
<u-number-box
v-model="usageData.number"
:min="1"
:input-width="80"
:input-height="60"
bg-color="#F7F8FA"
/>
<picker
mode="selector"
:range="drugUseList.drug_unit || []"
@@ -115,23 +130,46 @@
:value="usageData.unit_id && drugUseList.drug_unit ? drugUseList.drug_unit.findIndex(item => item.id === usageData.unit_id) : 0"
@change="handleChangeUnit"
>
<view class="picker-view m-l-16">
{{ (usageData.unit && usageData.unit.name) || '请选择' }}
<view class="modern-picker-view m-l-16" style="min-width: 140rpx;">
<text class="fs-28 color-title">{{ (usageData.unit && usageData.unit.name) || '单位' }}</text>
<u-icon name="arrow-right" size="24" color="#B0B6C2"></u-icon>
</view>
</picker>
</view>
</view>
</view>
</view>
<!-- 底部按钮 -->
<view class="modal-footer">
<!-- 底部按钮补充了 flex-row 以修复上下排列的问题 -->
<view class="modal-footer flex-row flex-jus-between flex-ali-center white shadow-up">
<u-button
:throttle-time="0"
@click="handleClose"
:custom-style="{ backgroundColor: '#f5f5f5', color: '#333' }"
shape="circle"
:custom-style="{
backgroundColor: '#F4F6F8',
color: '#2A2E35',
height: '88rpx',
width: '320rpx',
fontWeight: 'bold',
fontSize: '30rpx',
border: 'none'
}"
>取消</u-button>
<u-button
:throttle-time="0"
@click="handleConfirm"
:custom-style="{ backgroundColor: '#6ACDBB', color: '#fff' }"
shape="circle"
:custom-style="{
backgroundColor: '#00A88A',
color: '#fff',
height: '88rpx',
width: '320rpx',
fontWeight: 'bold',
fontSize: '30rpx',
boxShadow: '0 8rpx 20rpx rgba(0, 168, 138, 0.25)',
border: 'none'
}"
>确定</u-button>
</view>
</view>
@@ -139,6 +177,7 @@
</template>
<script>
// 保留所有原有逻辑代码与注释
import { getDrugUseList, getDrugUseWithDefault } from '@/api/reception.js';
export default {
@@ -359,97 +398,95 @@ export default {
</script>
<style lang="scss" scoped>
/* 使用与 index.vue 统一的设计风格与变量 */
.page-bg { background-color: #F4F6F8; }
.white { background: #fff; }
.color-title { color: #2A2E35; }
.color-sub { color: #8A92A3; }
.fs-26 { font-size: 26rpx; }
.fs-28 { font-size: 28rpx; }
.fs-30 { font-size: 30rpx; }
.fs-32 { font-size: 32rpx; }
.font-bold { font-weight: bold; }
.m-b-8 { margin-bottom: 8rpx; }
.m-b-24 { margin-bottom: 24rpx; }
.m-r-16 { margin-right: 16rpx; }
.m-l-16 { margin-left: 16rpx; }
.border-b { border-bottom: 1px dashed #E2E8F0; }
.shadow-up { box-shadow: 0 -4rpx 20rpx rgba(0,0,0,0.04); }
.flex-row { display: flex; flex-direction: row; }
.flex-col { display: flex; flex-direction: column; }
.flex-jus-sp { justify-content: space-between; }
.flex-jus-end { justify-content: flex-end; }
.flex-jus-between { justify-content: space-between; }
.flex-ali-center { align-items: center; }
.flex-ali-start { align-items: flex-start; }
.western-usage-modal {
display: flex;
flex-direction: column;
height: 100%;
background-color: #fff;
overflow: hidden;
}
.modal-header {
padding: 32rpx;
text-align: center;
border-bottom: 1rpx solid #eee;
border-bottom: 1px solid #F0F2F5;
}
.modal-content {
flex: 1;
overflow-y: auto;
padding: 32rpx;
/* 底部防遮挡边距 */
padding-bottom: 24rpx;
}
.drug-info {
margin-bottom: 16rpx;
/* 顶部药品提示卡片 */
.medicine-card {
background: #E8F6F4;
border-radius: 16rpx;
padding: 24rpx;
border: 1px solid #BFE6DF;
}
.info-icon {
margin-top: 4rpx;
}
.info-item {
/* 统一表单卡片 */
.form-card {
background: #fff;
border-radius: 16rpx;
padding: 0 32rpx;
box-shadow: 0 4rpx 16rpx rgba(42, 46, 53, 0.04);
}
.form-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 32rpx 0;
}
.modern-picker-view {
display: flex;
align-items: center;
gap: 16rpx;
}
.usage-item {
margin-bottom: 16rpx;
}
.item-label {
margin-bottom: 16rpx;
}
.item-content {
display: flex;
align-items: center;
gap: 16rpx;
}
.picker-view {
padding: 16rpx;
background: #f9f9f9;
justify-content: space-between;
padding: 12rpx 24rpx;
background: #F7F8FA;
border-radius: 8rpx;
min-width: 200rpx;
text-align: center;
min-width: 240rpx;
}
/* 彻底解决底部按钮上下排列,显式开启 flex 布局 */
.modal-footer {
display: flex;
gap: 24rpx;
padding: 32rpx;
border-top: 1rpx solid #eee;
.u-button {
flex: 1;
}
}
.white {
background: #fff;
}
.b-r-8 {
border-radius: 8rpx;
}
.p-32 {
padding: 32rpx;
}
.m-t-2 {
margin-top: 16rpx;
}
.m-t-16 {
margin-top: 16rpx;
}
.m-l-16 {
margin-left: 16rpx;
}
.color0 {
color: #000;
}
.color9 {
color: #999;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 24rpx 32rpx calc(24rpx + env(safe-area-inset-bottom));
background-color: #fff;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -126,4 +126,20 @@ export class PrescriptionStorage {
return null;
}
}
/**
* 当前挂号草稿中是否已有任一分类的药品(用于复用前覆盖确认)
* @param {string|number} registerId
* @returns {boolean}
*/
static hasDraftWithDrugs(registerId) {
if (registerId === undefined || registerId === null || registerId === '') {
return false;
}
const categories = [1, 2, 3, 5, 6, 7];
return categories.some((category) => {
const data = this.loadPrescriptionData(category, registerId);
return data && Array.isArray(data.drugs) && data.drugs.length > 0;
});
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,7 @@
<view class="flex-1 m-t20">
<view v-for="(it,idx) in list.west[i]"
:key="it.id">
<d-text :text="`${JSON.parse(it.content).drug_name} *${it.number}盒`" className="fs-3 main-c"></d-text>
<d-text :text="formatWestDrugLine(it)" className="fs-3 main-c"></d-text>
</view>
</view>
</view>
@@ -62,7 +62,7 @@
<view class="flex-1 m-t20">
<view v-for="(it,idx) in list.chinese[i]"
:key="it.id">
<d-text :text="`${getName2(JSON.parse(it.content))}`" className=" fs-3 main-c"></d-text>
<d-text :text="formatChineseOrGranularDrugLine(it)" className=" fs-3 main-c"></d-text>
</view>
</view>
</view>
@@ -96,7 +96,7 @@
<view class="flex-1 m-t20">
<view v-for="(it,idx) in list.granular[i]"
:key="it.id">
<d-text :text="`${getName2(JSON.parse(it.content))}`" className=" fs-3 main-c"></d-text>
<d-text :text="formatChineseOrGranularDrugLine(it)" className=" fs-3 main-c"></d-text>
</view>
</view>
</view>
@@ -112,7 +112,7 @@
</block>
</view>
<view class="flex-row flex-jus-center"
v-if="!loading&&type==1&&list&&list.west_prescription&&list.west_prescription.length==0||type==2&&list&&list.chin_prescription&&list.chin_prescription.length==0">
v-if="!loading&&((type==1&&list&&list.west_prescription&&list.west_prescription.length==0)||(type==2&&list&&list.chin_prescription&&list.chin_prescription.length==0)||(type==3&&list&&list.granular_prescription&&list.granular_prescription.length==0))">
<d-empty @click="$go(1,4)"></d-empty>
</view>
<d-loading-page :loading="loading"></d-loading-page>
@@ -127,22 +127,24 @@
<script>
import mixin from './mixin/mixin.js';
import {
commonUse,
deleteCommon
} from '@/api/all.js'
getCommonPrescriptionListApi,
deleteCommonPrescriptionApi
} from '@/api/reception.js'
export default {
mixins: [mixin],
data() {
return {
loading: true,
list: '',
list: {
west_prescription: [],
west: [],
chin_prescription: [],
chinese: [],
granular_prescription: [],
granular: []
},
type: 0,
one:false,
typeName:{
1:'west',
2:'chinese',
3:'granular',
}
one:false
}
},
onLoad(op) {
@@ -159,33 +161,67 @@
this.type = op['type'] || 0;
console.log(this.type,'type')
this.commonUse()
this.loadCommonList()
},
onShow() {
this.one&&this.commonUse()
this.one&&this.loadCommonList()
},
onHide() {
this.one = true
},
methods: {
formatWestDrugLine(it) {
if (!it) return '';
let name = it.drug_name || '';
if (it.content) {
try {
const raw = typeof it.content === 'string' ? JSON.parse(it.content) : it.content;
name = raw.drug_name || raw.name || name;
} catch (e) {}
}
return `${name} *${it.number || 1}`;
},
formatChineseOrGranularDrugLine(it) {
if (!it) return '';
if (it.content) {
try {
const parsed = typeof it.content === 'string' ? JSON.parse(it.content) : it.content;
if (Array.isArray(parsed)) {
return this.getName2(parsed);
}
if (parsed && parsed.name) {
return `${parsed.name} ${parsed.number || 1}${parsed.unit && parsed.unit.name ? parsed.unit.name : 'g'} `;
}
} catch (e) {}
}
const u = it.unit && it.unit.name ? it.unit.name : 'g';
return `${it.drug_name || it.name || ''} ${it.number || 1}${u}`;
},
handleDel (i, type, type2) {
uni.showModal({
title: '提示信息',
content: '是否移除',
showCancel: true,
success: ({ confirm, cancel }) => {
if (confirm) {
deleteCommon({
success: async ({ confirm }) => {
if (!confirm) return;
try {
const res = await deleteCommonPrescriptionApi({
id: this.list[type][i].id,
type: type2,
store_id: uni.getStorageSync('store_id') || 11001,
})
uni.showToast({
title: '移除成功',
icon: 'success',
mask: true
})
this.list[type].splice(i, 1)
type: type2
});
if (res && res.code === 0) {
this.list[type].splice(i, 1);
const parallelKey = type2 === 'west' ? 'west' : type2 === 'chinese' ? 'chinese' : 'granular';
if (this.list[parallelKey] && this.list[parallelKey][i] !== undefined) {
this.list[parallelKey].splice(i, 1);
}
uni.showToast({ title: '移除成功', icon: 'success', mask: true });
} else {
this.$toast(res.msg || res.message || '移除失败');
}
} catch (e) {
console.error(e);
this.$toast('移除失败');
}
}
})
@@ -212,25 +248,43 @@
return len
},
add() {
uni.setStorageSync('add', true)
this.$go('index?type=' + (this.type?this.type-1:0))
uni.setStorageSync('add', true);
let initial = 2;
if (this.type === 2) initial = 1;
else if (this.type === 3) initial = 3;
uni.navigateTo({
url: `/subPackages/sub_workbench/prescription_v2/index?save_common=1&initial_category=${initial}`
});
},
commonUse() {
commonUse({
type:this.typeName[this.type],
store_id: uni.getStorageSync('store_id') || 11001,
}).then(res => {
if (res.errcode == 0) {
this.list = res.data
// console.log(this.list, '222')
this.$nextTick(() => {
this.loading = false
})
async loadCommonList() {
try {
const storeId = uni.getStorageSync('store_id') || 11001;
const res = await getCommonPrescriptionListApi(storeId);
if (res && res.code === 0 && res.result) {
this.list = res.result;
} else {
this.$toast(res.msg)
this.loading = false
this.$toast(res.msg || res.message || '加载失败');
this.list = this.emptyListShape();
}
})
} catch (e) {
console.error(e);
this.$toast('加载失败');
this.list = this.emptyListShape();
} finally {
this.$nextTick(() => {
this.loading = false;
});
}
},
emptyListShape() {
return {
west_prescription: [],
west: [],
chin_prescription: [],
chinese: [],
granular_prescription: [],
granular: []
};
}
}
}

View File

@@ -199,10 +199,6 @@
<d-text text="" className="main-c fs-4" :bold="true"></d-text>
</view>
<view class="flex-row" style="height: 50rpx;">
<u-button v-if="!is_common" :throttle-time="0" shape="circle" size="mini"
:custom-style="{backgroundColor: 'transparent !important',border:'1px solid #6ACDBB',color:'#6ACDBB'}"
plain @click="$go('common?type='+(parseInt(tabsActive)+1))" :ripple="true">常用方
</u-button>
<view class="m-l-16">
<u-button :throttle-time="0" :custom-style="{ backgroundColor:'#6ACDBB',color:'#fff' }"
shape="circle" size="mini"
@@ -273,10 +269,10 @@
<!-- 按钮 -->
<view class="bottom flex-jus-sp flex-ali-center">
<view v-if="!is_common" @click="add(1)" class="btnText">另存常用方</view>
<view v-if="!is_common && tabsActive !== 2 && tabsActive !== 3" @click="add(1)" class="btnText">另存常用方</view>
<!-- <d-text text="请确认患者已在实体医院就诊,并有明确诊断" className="tips-c fs-24"></d-text> -->
<u-button :throttle-time="0" @click="add(0)" shape="circle"
:custom-style="{backgroundColor:buttonLodging?'#A5DCD2':'#6ACDBB',color:'#fff',heigth:'86rpx', width: is_common ? '686rpx' : '448rpx'}"
:custom-style="{backgroundColor:buttonLodging?'#A5DCD2':'#6ACDBB',color:'#fff',heigth:'86rpx', width: (is_common || tabsActive === 2 || tabsActive === 3) ? '686rpx' : '448rpx'}"
:disabled="buttonLodging">{{is_common?'保存常用方':'发送处方'}}
</u-button>
</view>