1. 开方2.0优化重构,线下接诊已完成
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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: 实现另存常用方功能
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回
|
||||
*/
|
||||
|
||||
@@ -1,129 +1,143 @@
|
||||
<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="tag-item"
|
||||
:class="{ active: localConfig.ruleType === 1 }"
|
||||
@click="handleRuleTypeChange(1)"
|
||||
<view class="modern-pill-group">
|
||||
<view
|
||||
class="modern-pill"
|
||||
:class="{ active: localConfig.ruleType === 1 }"
|
||||
@click="handleRuleTypeChange(1)"
|
||||
>
|
||||
自制剂
|
||||
</view>
|
||||
<view
|
||||
class="tag-item"
|
||||
:class="{ active: localConfig.ruleType === 2 }"
|
||||
@click="handleRuleTypeChange(2)"
|
||||
<view
|
||||
class="modern-pill"
|
||||
:class="{ active: localConfig.ruleType === 2 }"
|
||||
@click="handleRuleTypeChange(2)"
|
||||
>
|
||||
委托调剂
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</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
|
||||
v-for="item in packageMethodList"
|
||||
:key="item.id"
|
||||
class="tag-item"
|
||||
:class="{ active: localConfig.packageMethodId === item.id }"
|
||||
@click="handlePackageMethodTagClick(item)"
|
||||
<view class="modern-pill-group">
|
||||
<view
|
||||
v-for="item in packageMethodList"
|
||||
:key="item.id"
|
||||
class="modern-pill outline"
|
||||
:class="{ active: localConfig.packageMethodId === item.id }"
|
||||
@click="handlePackageMethodTagClick(item)"
|
||||
>
|
||||
{{ item.name }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</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
|
||||
v-for="item in processRuleList"
|
||||
:key="item.id"
|
||||
class="tag-item"
|
||||
:class="{ active: localConfig.processRuleId === item.id }"
|
||||
@click="handleProcessRuleTagClick(item)"
|
||||
<view class="section-content m-b-24">
|
||||
<view class="modern-pill-group">
|
||||
<view
|
||||
v-for="item in processRuleList"
|
||||
:key="item.id"
|
||||
class="modern-pill outline"
|
||||
:class="{ active: localConfig.processRuleId === item.id }"
|
||||
@click="handleProcessRuleTagClick(item)"
|
||||
>
|
||||
{{ item.name }}
|
||||
</view>
|
||||
</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
|
||||
v-for="item in childProcessRuleList"
|
||||
:key="item.id"
|
||||
class="tag-item"
|
||||
:class="{ active: localConfig.childProcessRuleId === item.id }"
|
||||
@click="handleChildProcessRuleTagClick(item)"
|
||||
<view class="section-content m-b-24">
|
||||
<view class="modern-pill-group">
|
||||
<view
|
||||
v-for="item in childProcessRuleList"
|
||||
:key="item.id"
|
||||
class="modern-pill outline"
|
||||
:class="{ active: localConfig.childProcessRuleId === item.id }"
|
||||
@click="handleChildProcessRuleTagClick(item)"
|
||||
>
|
||||
{{ item.name }}
|
||||
</view>
|
||||
</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
|
||||
v-for="item in processRuleNoteList"
|
||||
:key="item.id"
|
||||
class="tag-item"
|
||||
:class="{ active: localConfig.processRuleNoteId === item.id }"
|
||||
@click="handleProcessRuleNoteTagClick(item)"
|
||||
<view class="section-content m-b-32">
|
||||
<view class="modern-pill-group">
|
||||
<view
|
||||
v-for="item in processRuleNoteList"
|
||||
:key="item.id"
|
||||
class="modern-pill outline"
|
||||
:class="{ active: localConfig.processRuleNoteId === item.id }"
|
||||
@click="handleProcessRuleNoteTagClick(item)"
|
||||
>
|
||||
{{ item.note || item.name }}
|
||||
</view>
|
||||
</view>
|
||||
</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="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="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>
|
||||
</view>
|
||||
|
||||
<view class="config-section">
|
||||
<view class="section-title">
|
||||
<d-text text="频次" className="fs-3 main-c"></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 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>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 保留原有逻辑
|
||||
export default {
|
||||
name: 'ChineseMedicineConfig',
|
||||
props: {
|
||||
@@ -211,7 +225,7 @@ export default {
|
||||
this.localConfig.packageMethodId = null;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 处理包法改变(标签点击)
|
||||
* @param {Object} item - 包法项
|
||||
@@ -220,7 +234,7 @@ export default {
|
||||
handlePackageMethodTagClick(item) {
|
||||
this.localConfig.packageMethodId = item.id;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 处理制剂改变(标签点击)
|
||||
* @param {Object} item - 制剂项
|
||||
@@ -233,7 +247,7 @@ export default {
|
||||
this.localConfig.processRuleNoteId = null;
|
||||
// localConfig 的变化会通过 watch 自动触发 @update:config
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 处理煎法改变(标签点击)
|
||||
* @param {Object} item - 煎法项
|
||||
@@ -245,7 +259,7 @@ export default {
|
||||
this.localConfig.processRuleNoteId = null;
|
||||
// localConfig 的变化会通过 watch 自动触发 @update:config
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 处理备注改变(标签点击)
|
||||
* @param {Object} item - 备注项
|
||||
@@ -254,7 +268,7 @@ export default {
|
||||
handleProcessRuleNoteTagClick(item) {
|
||||
this.localConfig.processRuleNoteId = item.id;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取包法名称
|
||||
* @returns {string} 包法名称
|
||||
@@ -263,7 +277,7 @@ export default {
|
||||
const item = this.packageMethodList.find(item => item.id === this.localConfig.packageMethodId);
|
||||
return item?.name || '';
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取制剂名称
|
||||
* @returns {string} 制剂名称
|
||||
@@ -272,7 +286,7 @@ export default {
|
||||
const item = this.processRuleList.find(item => item.id === this.localConfig.processRuleId);
|
||||
return item?.name || '';
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取煎法名称
|
||||
* @returns {string} 煎法名称
|
||||
@@ -281,7 +295,7 @@ export default {
|
||||
const item = this.childProcessRuleList.find(item => item.id === this.localConfig.childProcessRuleId);
|
||||
return item?.name || '';
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取备注名称
|
||||
* @returns {string} 备注名称
|
||||
@@ -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;
|
||||
color: #fff;
|
||||
border-color: #6ACDBB;
|
||||
}
|
||||
&.active {
|
||||
background-color: #00A88A;
|
||||
color: #fff;
|
||||
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>
|
||||
</style>
|
||||
@@ -1,138 +1,144 @@
|
||||
<template>
|
||||
<u-popup
|
||||
v-model="show"
|
||||
mode="bottom"
|
||||
:closeable="true"
|
||||
@close="handleClose"
|
||||
:safe-area-inset-bottom="true"
|
||||
:mask-close-able="false"
|
||||
z-index="10078"
|
||||
height="80%"
|
||||
<u-popup
|
||||
v-model="show"
|
||||
mode="bottom"
|
||||
:closeable="true"
|
||||
@close="handleClose"
|
||||
:safe-area-inset-bottom="true"
|
||||
:mask-close-able="false"
|
||||
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">
|
||||
<u-search
|
||||
v-model="searchKey"
|
||||
placeholder="请输入药品名称搜索"
|
||||
@input="handleSearch"
|
||||
@custom="searchKey = ''; handleSearch()"
|
||||
:show-action="false"
|
||||
<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>
|
||||
|
||||
|
||||
<!-- 药品列表(可滚动,支持触底加载) -->
|
||||
<scroll-view
|
||||
class="drug-list-scroll"
|
||||
scroll-y
|
||||
@scrolltolower="loadMore"
|
||||
:lower-threshold="100"
|
||||
<scroll-view
|
||||
class="drug-list-scroll"
|
||||
scroll-y
|
||||
@scrolltolower="loadMore"
|
||||
:lower-threshold="100"
|
||||
>
|
||||
<view class="drug-list" v-if="drugList.length > 0">
|
||||
<view
|
||||
class="drug-item white b-r-8 p-32 m-t-2"
|
||||
v-for="(item, index) in drugList"
|
||||
:key="item.id || index"
|
||||
:class="{ selected: isInSelected(item) }"
|
||||
<view
|
||||
class="medicine-card"
|
||||
v-for="(item, index) in drugList"
|
||||
:key="item.id || index"
|
||||
: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>
|
||||
<d-text :text="`¥${parseFloat(item.price || 0).toFixed(2)}/${getUnitName(item)}`" className="fs-32 font-bold color-price"></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>
|
||||
<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-16" v-if="commonQuantities.length > 0">
|
||||
<view
|
||||
class="quantity-tag"
|
||||
v-for="qty in commonQuantities"
|
||||
:key="qty"
|
||||
@click.stop="handleSelectCommonQuantity"
|
||||
:data-index="index"
|
||||
:data-quantity="qty"
|
||||
|
||||
<!-- 常用用量快捷标签 -->
|
||||
<view class="common-quantity-tags m-b-24" v-if="commonQuantities.length > 0">
|
||||
<view
|
||||
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>
|
||||
<input
|
||||
class="quantity-input"
|
||||
type="number"
|
||||
:value="getQuantity(item)"
|
||||
@input="handleQuantityInput"
|
||||
:data-index="index"
|
||||
placeholder="请输入"
|
||||
<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="stepper-input fs-28 font-bold"
|
||||
type="number"
|
||||
:value="getQuantity(item)"
|
||||
@input="handleQuantityInput"
|
||||
:data-index="index"
|
||||
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"
|
||||
@click.stop="handleRemoveDrug"
|
||||
:data-index="index"
|
||||
|
||||
<view
|
||||
v-if="isInSelected(item)"
|
||||
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"
|
||||
@click.stop="handleAddDrug"
|
||||
:data-index="index"
|
||||
<view
|
||||
v-else
|
||||
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>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 加载更多 -->
|
||||
<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>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view class="empty-state" v-else>
|
||||
<d-empty text="暂无药品"></d-empty>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<view class="modal-footer flex-jus-center flex-ali-center">
|
||||
<u-button
|
||||
:throttle-time="0"
|
||||
@click="handleClose"
|
||||
shape="circle"
|
||||
:custom-style="{
|
||||
backgroundColor: '#6ACDBB',
|
||||
<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: '#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 {
|
||||
@@ -223,7 +230,7 @@ export default {
|
||||
page: this.page,
|
||||
page_size: this.pageSize
|
||||
});
|
||||
|
||||
|
||||
if (res && (res.code === 0 || res.errcode === 0)) {
|
||||
const list = res.data || res.result || [];
|
||||
this.hasMore = list.length >= this.pageSize;
|
||||
@@ -269,7 +276,7 @@ export default {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 搜索药品
|
||||
* 职责:防抖搜索,调用加载药品列表
|
||||
@@ -289,7 +296,7 @@ export default {
|
||||
this.loadDrugList(this.searchKey);
|
||||
}, 300);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取药品数量
|
||||
* @param {Object} drug - 药品数据
|
||||
@@ -298,7 +305,7 @@ export default {
|
||||
getQuantity(drug) {
|
||||
return drug._quantity || 0;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取药品名称
|
||||
* @param {Object} drug - 药品数据
|
||||
@@ -316,7 +323,7 @@ export default {
|
||||
}
|
||||
return '';
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取单位名称
|
||||
* @param {Object} drug - 药品数据
|
||||
@@ -331,7 +338,7 @@ export default {
|
||||
}
|
||||
return 'g';
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取规格
|
||||
* @param {Object} drug - 药品数据
|
||||
@@ -346,7 +353,7 @@ export default {
|
||||
}
|
||||
return '--';
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 判断是否已选中该中药(基于父组件传入的 currentDrugs,初始展示用)
|
||||
* @param {Object} drug
|
||||
@@ -492,7 +499,7 @@ export default {
|
||||
}
|
||||
this.emitSelect();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 增加数量
|
||||
* @param {Event} event - 点击事件对象
|
||||
@@ -501,20 +508,20 @@ export default {
|
||||
handleIncreaseQuantity(event) {
|
||||
const index = event.currentTarget.dataset.index;
|
||||
console.log('handleIncreaseQuantity called', { index, drugListLength: this.drugList.length });
|
||||
|
||||
|
||||
if (index === undefined || index === null) {
|
||||
console.error('handleIncreaseQuantity: index is undefined');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const drug = this.drugList[index];
|
||||
console.log('drug found', drug);
|
||||
|
||||
|
||||
if (!drug) {
|
||||
console.error('handleIncreaseQuantity: drug not found at index', index);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 确保 _quantity 属性存在
|
||||
if (typeof drug._quantity === 'undefined') {
|
||||
this.$set(drug, '_quantity', 0);
|
||||
@@ -522,7 +529,7 @@ export default {
|
||||
this.$set(drug, '_quantity', (drug._quantity || 0) + 1);
|
||||
this.syncQuantityToSelected(drug);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 减少数量
|
||||
* @param {Event} event - 点击事件对象
|
||||
@@ -531,20 +538,20 @@ export default {
|
||||
handleDecreaseQuantity(event) {
|
||||
const index = event.currentTarget.dataset.index;
|
||||
console.log('handleDecreaseQuantity called', { index, drugListLength: this.drugList.length });
|
||||
|
||||
|
||||
if (index === undefined || index === null) {
|
||||
console.error('handleDecreaseQuantity: index is undefined');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const drug = this.drugList[index];
|
||||
console.log('drug found', drug);
|
||||
|
||||
|
||||
if (!drug) {
|
||||
console.error('handleDecreaseQuantity: drug not found at index', index);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 确保 _quantity 属性存在
|
||||
if (typeof drug._quantity === 'undefined') {
|
||||
this.$set(drug, '_quantity', 0);
|
||||
@@ -555,7 +562,7 @@ export default {
|
||||
this.syncQuantityToSelected(drug);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 处理数量输入
|
||||
* @param {Event} event - 输入事件对象
|
||||
@@ -564,33 +571,33 @@ export default {
|
||||
handleQuantityInput(event) {
|
||||
const index = event.currentTarget.dataset.index;
|
||||
console.log('handleQuantityInput called', { index, drugListLength: this.drugList.length });
|
||||
|
||||
|
||||
if (index === undefined || index === null) {
|
||||
console.error('handleQuantityInput: index is undefined');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const drug = this.drugList[index];
|
||||
console.log('drug found', drug);
|
||||
|
||||
|
||||
if (!drug) {
|
||||
console.error('handleQuantityInput: drug not found at index', index);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!event || !event.detail) {
|
||||
console.error('handleQuantityInput: event or event.detail is undefined');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const value = event.detail.value;
|
||||
const numValue = parseFloat(value);
|
||||
|
||||
|
||||
// 确保 _quantity 属性存在
|
||||
if (typeof drug._quantity === 'undefined') {
|
||||
this.$set(drug, '_quantity', 0);
|
||||
}
|
||||
|
||||
|
||||
if (!isNaN(numValue) && numValue >= 0) {
|
||||
this.$set(drug, '_quantity', numValue);
|
||||
this.syncQuantityToSelected(drug);
|
||||
@@ -599,7 +606,7 @@ export default {
|
||||
this.syncQuantityToSelected(drug);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 选择常用克数
|
||||
* @param {Event} event - 点击事件对象
|
||||
@@ -609,25 +616,25 @@ export default {
|
||||
const index = event.currentTarget.dataset.index;
|
||||
const quantity = parseFloat(event.currentTarget.dataset.quantity);
|
||||
console.log('handleSelectCommonQuantity called', { index, quantity, drugListLength: this.drugList.length });
|
||||
|
||||
|
||||
if (index === undefined || index === null) {
|
||||
console.error('handleSelectCommonQuantity: index is undefined');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (isNaN(quantity)) {
|
||||
console.error('handleSelectCommonQuantity: quantity is NaN', event.currentTarget.dataset.quantity);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const drug = this.drugList[index];
|
||||
console.log('drug found', drug);
|
||||
|
||||
|
||||
if (!drug) {
|
||||
console.error('handleSelectCommonQuantity: drug not found at index', index);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 确保 _quantity 属性存在
|
||||
if (typeof drug._quantity === 'undefined') {
|
||||
this.$set(drug, '_quantity', 0);
|
||||
@@ -636,7 +643,7 @@ export default {
|
||||
this.$set(drug, '_quantity', quantity);
|
||||
this.syncQuantityToSelected(drug);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 触底加载更多
|
||||
*/
|
||||
@@ -648,7 +655,7 @@ export default {
|
||||
this.page += 1;
|
||||
this.loadDrugList(this.searchKey);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 关闭弹窗
|
||||
* 职责:关闭弹窗,触发input事件
|
||||
@@ -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;
|
||||
font-size: 24rpx;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.quantity-tag:active {
|
||||
background-color: #6ACDBB;
|
||||
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;
|
||||
}
|
||||
|
||||
.action-icon {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.action-icon:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.quantity-label {
|
||||
font-size: 28rpx;
|
||||
.modern-tag {
|
||||
padding: 10rpx 24rpx;
|
||||
background-color: #F4F6F8;
|
||||
color: #6C7380;
|
||||
}
|
||||
|
||||
.quantity-input-wrapper {
|
||||
gap: 16rpx;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.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 {
|
||||
border-radius: 30rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-left: 8rpx;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
&:active {
|
||||
background-color: #00A88A;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
/* 现代精致步进器 */
|
||||
.modern-stepper {
|
||||
background: #F7F8FA;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
border: 1px solid #E2E8F0;
|
||||
|
||||
.stepper-btn {
|
||||
width: 60rpx;
|
||||
height: 56rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #6C7380;
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
background: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
|
||||
.action-btn-text {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
&.danger { color: #8A92A3; }
|
||||
}
|
||||
|
||||
.load-more {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 32rpx 0;
|
||||
.load-more-text {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.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>
|
||||
</style>
|
||||
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<u-popup
|
||||
v-model="show"
|
||||
mode="bottom"
|
||||
:closeable="true"
|
||||
<u-popup
|
||||
v-model="show"
|
||||
mode="bottom"
|
||||
:closeable="true"
|
||||
@close="handleClose"
|
||||
:safe-area-inset-bottom="true"
|
||||
:mask-close-able="false"
|
||||
:safe-area-inset-bottom="true"
|
||||
:mask-close-able="false"
|
||||
z-index="10078"
|
||||
height="80%"
|
||||
>
|
||||
@@ -13,13 +13,13 @@
|
||||
<view class="modal-header">
|
||||
<d-text text="常用方" className="fs-32 main-c"></d-text>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="modal-content">
|
||||
<!-- 常用方列表 -->
|
||||
<view class="prescription-list" v-if="prescriptionList.length > 0">
|
||||
<view
|
||||
class="prescription-item white b-r-8 m-t-2"
|
||||
v-for="(item, index) in prescriptionList"
|
||||
<view
|
||||
class="prescription-item white b-r-8 m-t-2"
|
||||
v-for="(item, index) in prescriptionList"
|
||||
:key="item.id"
|
||||
@click="handleSelectPrescription(item, index)"
|
||||
>
|
||||
@@ -35,8 +35,8 @@
|
||||
<view class="item-content m-t-16">
|
||||
<view class="label">药品:</view>
|
||||
<view class="drug-list">
|
||||
<text
|
||||
v-for="(drug, idx) in getDrugList(item, index)"
|
||||
<text
|
||||
v-for="(drug, idx) in getDrugList(item, index)"
|
||||
:key="idx"
|
||||
class="drug-item"
|
||||
>
|
||||
@@ -50,13 +50,13 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view class="empty-state" v-else>
|
||||
<d-empty text="暂无常用方"></d-empty>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<view class="modal-footer flex-jus-between flex-ali-center" v-if="!isSelectMode">
|
||||
<u-button
|
||||
@@ -87,7 +87,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCommonPrescriptionListApi } from '@/api/reception.js';
|
||||
import { getCommonPrescriptionListApi, deleteCommonPrescriptionApi } from '@/api/reception.js';
|
||||
|
||||
export default {
|
||||
name: 'CommonPrescriptionModal',
|
||||
@@ -137,7 +137,7 @@ export default {
|
||||
return 'tag-granular';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取标签文本(计算属性)
|
||||
* @returns {string} 标签文本
|
||||
@@ -176,7 +176,7 @@ export default {
|
||||
const storeId = uni.getStorageSync('store_id') || 11001;
|
||||
const type = this.getCommonPrescriptionType(this.prescriptionType);
|
||||
const res = await getCommonPrescriptionListApi(storeId);
|
||||
|
||||
|
||||
if (res && res.code === 0) {
|
||||
// 根据类型过滤常用方主表行 + 平行药品行
|
||||
const listKey = this.getListKey(type);
|
||||
@@ -196,7 +196,7 @@ export default {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取常用方类型字符串
|
||||
* @param {number} type - 处方类型
|
||||
@@ -211,7 +211,7 @@ export default {
|
||||
return 'granular';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取列表键名
|
||||
* @param {string} type - 常用方类型
|
||||
@@ -226,7 +226,7 @@ export default {
|
||||
return 'granular_prescription';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取某条常用方对应的药品列表
|
||||
* 与 PC 一致:list 接口返回的主表行与药品行按下标对齐,从 recipesByIndex[index] 取
|
||||
@@ -237,7 +237,7 @@ export default {
|
||||
getDrugList(_prescription, index) {
|
||||
return this.recipesByIndex[index] || [];
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 格式化药品名称
|
||||
* @param {Object} drug - 药品数据
|
||||
@@ -251,7 +251,7 @@ export default {
|
||||
return drug;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (this.prescriptionType === 1) {
|
||||
// 中药
|
||||
const name = drug.drug_name || drug.name || '';
|
||||
@@ -265,7 +265,7 @@ export default {
|
||||
return `${name} *${number}盒`;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取列表项的唯一key
|
||||
* @param {Object} item - 列表项
|
||||
@@ -275,7 +275,7 @@ export default {
|
||||
getItemKey(item, index) {
|
||||
return item.id || `item_${index}`;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 选择常用方
|
||||
* 直接 emit 整条主表行(已包含后端组装好的 apply_payload),
|
||||
@@ -287,7 +287,7 @@ export default {
|
||||
this.$emit('select', item);
|
||||
this.handleClose();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 删除常用方
|
||||
* @param {Object} prescription - 常用方数据
|
||||
@@ -302,10 +302,18 @@ export default {
|
||||
success: async ({ confirm }) => {
|
||||
if (confirm) {
|
||||
try {
|
||||
// TODO: 调用删除接口
|
||||
// await deleteCommonPrescriptionApi(prescription.id);
|
||||
this.$toast('删除成功');
|
||||
this.prescriptionList.splice(index, 1);
|
||||
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('删除失败');
|
||||
@@ -314,17 +322,21 @@ 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}`
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 关闭弹窗
|
||||
* 职责:关闭弹窗,触发input事件
|
||||
@@ -381,15 +393,15 @@ export default {
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
text-align: center;
|
||||
|
||||
|
||||
&.tag-chinese {
|
||||
background: rgba(15, 190, 22, 0.55);
|
||||
}
|
||||
|
||||
|
||||
&.tag-west {
|
||||
background: rgba(15, 163, 190, 0.55);
|
||||
}
|
||||
|
||||
|
||||
&.tag-granular {
|
||||
background: #6ACDBB;
|
||||
}
|
||||
@@ -431,19 +443,19 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border: 1rpx solid rgba(242, 242, 242, 1);
|
||||
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
height: 86rpx;
|
||||
line-height: 86rpx;
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
|
||||
|
||||
&.left {
|
||||
border-right: 1rpx solid rgba(242, 242, 242, 1);
|
||||
color: #FC3636;
|
||||
}
|
||||
|
||||
|
||||
&.right {
|
||||
color: #6ACDBB;
|
||||
}
|
||||
|
||||
@@ -1,125 +1,134 @@
|
||||
<template>
|
||||
<u-popup
|
||||
v-model="show"
|
||||
mode="bottom"
|
||||
:closeable="true"
|
||||
@close="handleClose"
|
||||
:safe-area-inset-bottom="true"
|
||||
:mask-close-able="false"
|
||||
z-index="10078"
|
||||
height="80%"
|
||||
<u-popup
|
||||
v-model="show"
|
||||
mode="bottom"
|
||||
:closeable="true"
|
||||
@close="handleClose"
|
||||
:safe-area-inset-bottom="true"
|
||||
:mask-close-able="false"
|
||||
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">
|
||||
<!-- 搜索框 -->
|
||||
<view class="search-box">
|
||||
<u-input
|
||||
v-model="searchKey"
|
||||
placeholder="请输入想要搜索的诊断名称..."
|
||||
:custom-style="searchStyle"
|
||||
@input="handleSearch"
|
||||
@clear="handleSearch"
|
||||
<u-input
|
||||
v-model="searchKey"
|
||||
placeholder="请输入想要搜索的诊断名称..."
|
||||
:custom-style="searchStyle"
|
||||
@input="handleSearch"
|
||||
@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="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>
|
||||
<view class="tag-container">
|
||||
<view
|
||||
v-for="item in doctorMyDiseaseList"
|
||||
:key="item.id"
|
||||
class="tag-item"
|
||||
:class="{ '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>
|
||||
</view>
|
||||
|
||||
<view class="scroll-container">
|
||||
<!-- 常用诊断列表 -->
|
||||
<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>
|
||||
</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>
|
||||
<scroll-view
|
||||
class="tag-container-scroll"
|
||||
scroll-y
|
||||
@scrolltolower="loadMore"
|
||||
:lower-threshold="100"
|
||||
>
|
||||
<view class="tag-container">
|
||||
<view
|
||||
v-for="item in allDiagnosisList"
|
||||
:key="item.id"
|
||||
class="tag-item"
|
||||
:class="{ 'selected': item.isSelect === 1 }"
|
||||
@click="selectDiagnosis(item)"
|
||||
<view class="modern-tag-container">
|
||||
<view
|
||||
v-for="item in doctorMyDiseaseList"
|
||||
:key="item.id"
|
||||
class="modern-tag-item"
|
||||
:class="{ 'is-selected': item.disease.isSelect === 1 }"
|
||||
@click="selectDiagnosis(item.disease)"
|
||||
>
|
||||
<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>
|
||||
</view>
|
||||
<view class="tag-action" v-else>
|
||||
<u-icon name="checkmark" size="14" color="#6ACDBB"></u-icon>
|
||||
<text class="tag-text">{{ item.disease.name }}</text>
|
||||
<view class="tag-action" @click.stop="removeFromMyDiagnosis(item)">
|
||||
<u-icon name="close" size="20"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多 -->
|
||||
<view class="load-more" v-if="loading">
|
||||
<text class="load-more-text">加载中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 搜索结果列表 -->
|
||||
<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>
|
||||
<view class="load-more" v-else-if="!hasMore && allDiagnosisList.length > 0">
|
||||
<text class="load-more-text">没有更多了</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view class="empty-state" v-if="allDiagnosisList.length === 0 && searchKey">
|
||||
<d-empty text="暂无相关诊断"></d-empty>
|
||||
<scroll-view
|
||||
class="tag-container-scroll"
|
||||
scroll-y
|
||||
@scrolltolower="loadMore"
|
||||
:lower-threshold="100"
|
||||
>
|
||||
<view class="modern-tag-container">
|
||||
<view
|
||||
v-for="item in allDiagnosisList"
|
||||
:key="item.id"
|
||||
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="20"></u-icon>
|
||||
</view>
|
||||
<view class="tag-action" v-else>
|
||||
<u-icon name="checkmark" size="20"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多 -->
|
||||
<view class="load-more" v-if="loading">
|
||||
<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>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view class="empty-state" v-if="allDiagnosisList.length === 0 && searchKey">
|
||||
<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'
|
||||
:throttle-time="0"
|
||||
@click="handleClose"
|
||||
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"
|
||||
shape="circle"
|
||||
:custom-style="{
|
||||
backgroundColor: '#6ACDBB',
|
||||
:throttle-time="0"
|
||||
@click="handleConfirm"
|
||||
shape="circle"
|
||||
:custom-style="{
|
||||
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)'
|
||||
}
|
||||
};
|
||||
},
|
||||
@@ -201,7 +212,7 @@ export default {
|
||||
const res = await getDiseaseList(searchKey, page, this.pageSize);
|
||||
let list = [];
|
||||
let hasMore = false;
|
||||
|
||||
|
||||
// 正确解析响应数据
|
||||
if (res && (res.code === 0 || res.errcode === 0)) {
|
||||
// 优先使用 data,然后是 result
|
||||
@@ -212,7 +223,7 @@ export default {
|
||||
} else if (Array.isArray(res)) {
|
||||
list = res;
|
||||
}
|
||||
|
||||
|
||||
// 从响应中获取分页信息
|
||||
if (res.pagination) {
|
||||
hasMore = res.pagination.has_more || false;
|
||||
@@ -223,11 +234,11 @@ export default {
|
||||
hasMore = list.length >= this.pageSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const processedList = list.map((item) => {
|
||||
item.isSelect = 0;
|
||||
item.isInMyList = this.doctorMyDiseaseList.some(
|
||||
(myItem) => myItem.disease && myItem.disease.id === item.id
|
||||
(myItem) => myItem.disease && myItem.disease.id === item.id
|
||||
);
|
||||
if (this.selectDiagnosisList) {
|
||||
const valuesArr = this.selectDiagnosisList.split(',');
|
||||
@@ -239,14 +250,14 @@ export default {
|
||||
}
|
||||
return item;
|
||||
});
|
||||
|
||||
|
||||
if (append) {
|
||||
this.allDiagnosisList = [...this.allDiagnosisList, ...processedList];
|
||||
} else {
|
||||
this.allDiagnosisList = processedList;
|
||||
this.currentPage = 1;
|
||||
}
|
||||
|
||||
|
||||
this.hasMore = hasMore;
|
||||
this.loading = false;
|
||||
} catch (error) {
|
||||
@@ -256,7 +267,7 @@ export default {
|
||||
this.hasMore = false;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 加载常用诊断列表
|
||||
* 职责:调用接口获取医生的常用诊断列表
|
||||
@@ -265,7 +276,7 @@ export default {
|
||||
try {
|
||||
const res = await getMyDiseaseList();
|
||||
let list = [];
|
||||
|
||||
|
||||
// 正确解析响应数据
|
||||
if (res && (res.code === 0 || res.errcode === 0)) {
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
@@ -276,12 +287,12 @@ export default {
|
||||
list = res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 确保 list 是数组,避免 map 报错
|
||||
if (!Array.isArray(list)) {
|
||||
list = [];
|
||||
}
|
||||
|
||||
|
||||
this.doctorMyDiseaseList = list.map((item) => {
|
||||
// 确保 item.disease 存在
|
||||
if (item.disease) {
|
||||
@@ -302,7 +313,7 @@ export default {
|
||||
this.doctorMyDiseaseList = [];
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 搜索诊断
|
||||
* 职责:防抖搜索,只在有输入时调用加载诊断列表
|
||||
@@ -323,7 +334,7 @@ export default {
|
||||
}
|
||||
}, 300);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 触底加载更多
|
||||
* 职责:加载下一页数据
|
||||
@@ -336,7 +347,7 @@ export default {
|
||||
this.currentPage++;
|
||||
this.loadDiagnosisList(this.searchKey.trim(), this.currentPage, true);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 选择诊断
|
||||
* @param {Object} item - 诊断项
|
||||
@@ -344,7 +355,7 @@ export default {
|
||||
*/
|
||||
selectDiagnosis(item) {
|
||||
let arr = this.selectDiagnosisList ? this.selectDiagnosisList.split(',').filter(Boolean) : [];
|
||||
|
||||
|
||||
if (item.isSelect === 1) {
|
||||
arr = arr.filter(name => name !== item.name);
|
||||
item.isSelect = 0;
|
||||
@@ -354,10 +365,10 @@ export default {
|
||||
}
|
||||
item.isSelect = 1;
|
||||
}
|
||||
|
||||
|
||||
this.selectDiagnosisList = arr.join(',');
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 添加到常用诊断
|
||||
* @param {Object} item - 诊断项
|
||||
@@ -378,7 +389,7 @@ export default {
|
||||
this.$toast('添加失败');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 从常用诊断中删除
|
||||
* @param {Object} item - 诊断项
|
||||
@@ -402,7 +413,7 @@ export default {
|
||||
this.$toast('删除失败');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 确认选择
|
||||
* 职责:触发确认事件,传递选中的诊断文本
|
||||
@@ -411,7 +422,7 @@ export default {
|
||||
this.$emit('confirm', this.selectDiagnosisList);
|
||||
this.handleClose();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 关闭弹窗
|
||||
* 职责:关闭弹窗,触发input事件
|
||||
@@ -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;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.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;
|
||||
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>
|
||||
</style>
|
||||
@@ -1,119 +1,124 @@
|
||||
<template>
|
||||
<u-popup
|
||||
v-model="show"
|
||||
mode="bottom"
|
||||
:closeable="true"
|
||||
@close="handleClose"
|
||||
:safe-area-inset-bottom="true"
|
||||
:mask-close-able="false"
|
||||
z-index="10078"
|
||||
height="80%"
|
||||
<u-popup
|
||||
v-model="show"
|
||||
mode="bottom"
|
||||
:closeable="true"
|
||||
@close="handleClose"
|
||||
:safe-area-inset-bottom="true"
|
||||
:mask-close-able="false"
|
||||
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
|
||||
v-for="item in doctorOrderMyList"
|
||||
:key="item.id"
|
||||
class="tag-item"
|
||||
:class="{ 'selected': item.isSelect === 1 }"
|
||||
@click="selectDoctorOrder(item, 1)"
|
||||
<view class="modern-tag-container">
|
||||
<view
|
||||
v-for="item in doctorOrderMyList"
|
||||
:key="item.id"
|
||||
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
|
||||
v-for="item in doctorOrderCommonList"
|
||||
:key="item.id"
|
||||
class="tag-item"
|
||||
:class="{ 'selected': item.isSelect === 1 }"
|
||||
@click="selectDoctorOrder(item, 2)"
|
||||
<view class="modern-tag-container">
|
||||
<view
|
||||
v-for="item in doctorOrderCommonList"
|
||||
:key="item.id"
|
||||
class="modern-tag-item"
|
||||
:class="{ 'is-selected': item.isSelect === 1 }"
|
||||
@click="selectDoctorOrder(item, 2)"
|
||||
>
|
||||
<text class="tag-text">{{ item.content }}</text>
|
||||
</view>
|
||||
</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'
|
||||
:throttle-time="0"
|
||||
@click="handleClose"
|
||||
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"
|
||||
shape="circle"
|
||||
:custom-style="{
|
||||
backgroundColor: '#6ACDBB',
|
||||
:throttle-time="0"
|
||||
@click="handleConfirm"
|
||||
shape="circle"
|
||||
:custom-style="{
|
||||
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: {
|
||||
@@ -191,7 +189,7 @@ export default {
|
||||
} else {
|
||||
this.doctorOrderMyList = [];
|
||||
}
|
||||
|
||||
|
||||
// 获取公共医嘱
|
||||
const commonRes = await getDoctorOrderCommonList({
|
||||
store_id: uni.getStorageSync('store_id') || 11001
|
||||
@@ -215,7 +213,7 @@ export default {
|
||||
this.$toast('获取医嘱列表失败');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 选择医嘱
|
||||
* @param {Object} item - 医嘱项
|
||||
@@ -224,7 +222,7 @@ export default {
|
||||
*/
|
||||
selectDoctorOrder(item, type = 1) {
|
||||
let arr = this.selectDoctorOrderList ? this.selectDoctorOrderList.split(',').filter(Boolean) : [];
|
||||
|
||||
|
||||
if (type === 1) {
|
||||
// 我的医嘱
|
||||
if (item.isSelect === 1) {
|
||||
@@ -248,10 +246,19 @@ export default {
|
||||
item.isSelect = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.selectDoctorOrderList = arr.join(',');
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 打开添加医嘱弹窗
|
||||
* 职责:清空旧内容,打开弹窗
|
||||
*/
|
||||
openAddModal() {
|
||||
this.newOrderContent = '';
|
||||
this.showAddModal = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* 添加自定义医嘱
|
||||
* 职责:调用接口添加我的医嘱
|
||||
@@ -261,13 +268,13 @@ export default {
|
||||
this.$toast('请输入医嘱内容');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
const res = await createDoctorOrder(this.newOrderContent.trim());
|
||||
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 || '添加失败');
|
||||
@@ -277,7 +284,7 @@ export default {
|
||||
this.$toast('添加失败');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 删除我的医嘱
|
||||
* @param {Object} item - 医嘱项
|
||||
@@ -297,16 +304,16 @@ export default {
|
||||
this.$toast('删除失败');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 取消添加
|
||||
* 职责:关闭添加输入框
|
||||
* 职责:关闭弹窗
|
||||
*/
|
||||
cancelAdd() {
|
||||
this.showAddModal = false;
|
||||
this.newOrderContent = '';
|
||||
this.showAddInput = false;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 确认选择
|
||||
* 职责:触发确认事件,传递选中的医嘱文本
|
||||
@@ -315,7 +322,7 @@ export default {
|
||||
this.$emit('confirm', this.selectDoctorOrderList);
|
||||
this.handleClose();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 关闭弹窗
|
||||
* 职责:关闭弹窗,触发input事件
|
||||
@@ -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;
|
||||
border-radius: 32rpx;
|
||||
|
||||
.add-text {
|
||||
font-size: 24rpx;
|
||||
color: #6ACDBB;
|
||||
}
|
||||
padding: 8rpx 20rpx;
|
||||
background: #E8F6F4;
|
||||
border-radius: 32rpx;
|
||||
cursor: pointer;
|
||||
|
||||
.add-text {
|
||||
font-size: 24rpx;
|
||||
font-weight: bold;
|
||||
color: #00A88A;
|
||||
}
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
|
||||
.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>
|
||||
</style>
|
||||
@@ -1,95 +1,100 @@
|
||||
<template>
|
||||
<u-popup
|
||||
v-model="show"
|
||||
mode="bottom"
|
||||
:closeable="true"
|
||||
@close="handleClose"
|
||||
:safe-area-inset-bottom="true"
|
||||
:mask-close-able="false"
|
||||
z-index="10078"
|
||||
height="80%"
|
||||
<u-popup
|
||||
v-model="show"
|
||||
mode="bottom"
|
||||
:closeable="true"
|
||||
@close="handleClose"
|
||||
:safe-area-inset-bottom="true"
|
||||
:mask-close-able="false"
|
||||
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">
|
||||
<u-search
|
||||
v-model="searchKey"
|
||||
placeholder="请输入产品名称搜索"
|
||||
@input="handleSearch"
|
||||
@custom="searchKey = ''; handleSearch()"
|
||||
:show-action="false"
|
||||
<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"
|
||||
v-for="item in productList"
|
||||
:key="item.id"
|
||||
<view
|
||||
class="medicine-card"
|
||||
v-for="item in productList"
|
||||
:key="item.id"
|
||||
>
|
||||
<view class="product-content flex-row">
|
||||
<image
|
||||
v-if="(item.drug && item.drug.image) || item.image"
|
||||
:src="(item.drug && item.drug.image) || item.image"
|
||||
class="product-image"
|
||||
mode="aspectFill"
|
||||
<view class="flex-row">
|
||||
<image
|
||||
v-if="(item.drug && item.drug.image) || item.image"
|
||||
:src="(item.drug && item.drug.image) || item.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-16">
|
||||
<u-button
|
||||
size="mini"
|
||||
:custom-style="{ backgroundColor: '#6ACDBB', color: '#fff' }"
|
||||
@click.stop="handleSelectProduct(item)"
|
||||
>
|
||||
选择
|
||||
</u-button>
|
||||
|
||||
<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>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view class="empty-state" v-else>
|
||||
<d-empty text="暂无产品"></d-empty>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<view class="modal-footer flex-jus-sp flex-ali-center">
|
||||
<u-button
|
||||
:throttle-time="0"
|
||||
@click="handleClose"
|
||||
shape="circle"
|
||||
:custom-style="{
|
||||
backgroundColor: '#f5f5f5',
|
||||
color: '#333',
|
||||
height: '86rpx',
|
||||
width: '320rpx'
|
||||
<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: '#F4F6F8',
|
||||
color: '#2A2E35',
|
||||
height: '88rpx',
|
||||
width: '320rpx',
|
||||
fontWeight: 'bold',
|
||||
fontSize: '30rpx',
|
||||
border: 'none'
|
||||
}"
|
||||
>取消</u-button>
|
||||
<u-button
|
||||
:throttle-time="0"
|
||||
@click="handleClose"
|
||||
shape="circle"
|
||||
:custom-style="{
|
||||
backgroundColor: '#6ACDBB',
|
||||
<u-button
|
||||
:throttle-time="0"
|
||||
@click="handleClose"
|
||||
shape="circle"
|
||||
:custom-style="{
|
||||
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 {
|
||||
@@ -161,7 +167,7 @@ export default {
|
||||
};
|
||||
return titles[this.productType] || '选择产品';
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 加载产品列表
|
||||
* @param {string} keyword - 搜索关键词
|
||||
@@ -176,9 +182,9 @@ export default {
|
||||
type: this.productType,
|
||||
name: keyword
|
||||
});
|
||||
|
||||
|
||||
if (res && (res.code === 0 || res.errcode === 0)) {
|
||||
this.productList = res.data || res.result || [];
|
||||
this.productList = res.result || [];
|
||||
} else {
|
||||
this.productList = [];
|
||||
}
|
||||
@@ -190,7 +196,7 @@ export default {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 搜索产品
|
||||
* 职责:防抖搜索,调用加载产品列表
|
||||
@@ -201,7 +207,7 @@ export default {
|
||||
this.loadProductList(this.searchKey);
|
||||
}, 300);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 选择产品
|
||||
* @param {Object} product - 产品数据
|
||||
@@ -211,7 +217,7 @@ export default {
|
||||
this.$emit('select', product);
|
||||
this.handleClose();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 关闭弹窗
|
||||
* 职责:关闭弹窗,触发input事件
|
||||
@@ -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>
|
||||
</style>
|
||||
@@ -1,107 +1,104 @@
|
||||
<template>
|
||||
<u-popup
|
||||
v-model="show"
|
||||
mode="bottom"
|
||||
:closeable="true"
|
||||
@close="handleClose"
|
||||
:safe-area-inset-bottom="true"
|
||||
:mask-close-able="false"
|
||||
z-index="10078"
|
||||
height="80%"
|
||||
<u-popup
|
||||
v-model="show"
|
||||
mode="bottom"
|
||||
:closeable="true"
|
||||
@close="handleClose"
|
||||
:safe-area-inset-bottom="true"
|
||||
:mask-close-able="false"
|
||||
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">
|
||||
<u-search
|
||||
v-model="searchKey"
|
||||
placeholder="请输入药品名称搜索"
|
||||
@input="handleSearch"
|
||||
@custom="searchKey = ''; handleSearch()"
|
||||
:show-action="false"
|
||||
<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"
|
||||
v-for="(item, index) in drugList"
|
||||
:key="index"
|
||||
:class="{ selected: isSelected(item) }"
|
||||
@click="!isSelected(item) && handleSelectDrug(item)"
|
||||
<view
|
||||
class="medicine-card"
|
||||
v-for="(item, index) in drugList"
|
||||
:key="index"
|
||||
:class="{ 'is-selected': isSelected(item) }"
|
||||
@click="!isSelected(item) && handleSelectDrug(item)"
|
||||
>
|
||||
<view class="drug-content flex-row">
|
||||
<image
|
||||
v-if="getDrugImage(item)"
|
||||
:src="getDrugImage(item)"
|
||||
class="drug-image"
|
||||
mode="aspectFill"
|
||||
<view class="flex-row">
|
||||
<image
|
||||
v-if="getDrugImage(item)"
|
||||
:src="getDrugImage(item)"
|
||||
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>
|
||||
<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>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view class="empty-state" v-else>
|
||||
<d-empty text="暂无药品"></d-empty>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<view class="modal-footer flex-jus-sp flex-ali-center">
|
||||
<u-button
|
||||
:throttle-time="0"
|
||||
@click="handleClose"
|
||||
shape="circle"
|
||||
:custom-style="{
|
||||
backgroundColor: '#f5f5f5',
|
||||
color: '#333',
|
||||
height: '86rpx',
|
||||
width: '320rpx'
|
||||
<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: '#F4F6F8',
|
||||
color: '#2A2E35',
|
||||
height: '88rpx',
|
||||
width: '320rpx',
|
||||
fontWeight: 'bold',
|
||||
fontSize: '30rpx',
|
||||
border: 'none'
|
||||
}"
|
||||
>取消</u-button>
|
||||
<u-button
|
||||
:throttle-time="0"
|
||||
@click="handleClose"
|
||||
shape="circle"
|
||||
:custom-style="{
|
||||
backgroundColor: '#6ACDBB',
|
||||
<u-button
|
||||
:throttle-time="0"
|
||||
@click="handleClose"
|
||||
shape="circle"
|
||||
:custom-style="{
|
||||
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: {
|
||||
@@ -176,7 +165,7 @@ export default {
|
||||
type: 2, // 西药
|
||||
name: keyword
|
||||
});
|
||||
|
||||
|
||||
if (res && (res.code === 0 || res.errcode === 0)) {
|
||||
this.drugList = res.data || res.result || [];
|
||||
} else {
|
||||
@@ -190,7 +179,7 @@ export default {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 搜索药品
|
||||
* 职责:防抖搜索,调用加载药品列表
|
||||
@@ -201,7 +190,7 @@ export default {
|
||||
this.loadDrugList(this.searchKey);
|
||||
}, 300);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取药品图片
|
||||
* @param {Object} item - 药品数据
|
||||
@@ -216,7 +205,7 @@ export default {
|
||||
}
|
||||
return '';
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 判断药品是否已在当前处方中
|
||||
* @param {Object} drug
|
||||
@@ -227,7 +216,7 @@ export default {
|
||||
const drugId = drug.drug_id || (drug.drug && drug.drug.id) || drug.id;
|
||||
return this.currentDrugs.some(item => (item.id || item.drug_id) === drugId);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 选择药品
|
||||
* @param {Object} drug - 药品数据
|
||||
@@ -240,7 +229,7 @@ export default {
|
||||
this.$emit('select', drug);
|
||||
this.handleClose();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 关闭弹窗
|
||||
* 职责:关闭弹窗,触发input事件
|
||||
@@ -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>
|
||||
</style>
|
||||
@@ -1,137 +1,175 @@
|
||||
<template>
|
||||
<u-popup
|
||||
v-model="show"
|
||||
mode="bottom"
|
||||
:closeable="true"
|
||||
@close="handleClose"
|
||||
:safe-area-inset-bottom="true"
|
||||
:mask-close-able="false"
|
||||
z-index="10078"
|
||||
height="80%"
|
||||
<u-popup
|
||||
v-model="show"
|
||||
mode="bottom"
|
||||
:closeable="true"
|
||||
@close="handleClose"
|
||||
:safe-area-inset-bottom="true"
|
||||
:mask-close-able="false"
|
||||
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>
|
||||
<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 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>
|
||||
</view>
|
||||
|
||||
<!-- 药品数量 -->
|
||||
<view class="usage-item white b-r-8 p-32 m-t-2">
|
||||
<view class="item-label">
|
||||
<d-text text="药品数量" className="fs-3 main-c"></d-text>
|
||||
|
||||
<!-- 表单区域:使用统一现代化表单卡片 -->
|
||||
<view class="form-card">
|
||||
<!-- 药品数量 -->
|
||||
<view class="form-item border-b">
|
||||
<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="usageData.select_number"
|
||||
:min="1"
|
||||
:max="(drug && drug.stock) || 999"
|
||||
: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="item-content">
|
||||
<u-number-box
|
||||
v-model="usageData.select_number"
|
||||
:min="1"
|
||||
:max="(drug && drug.stock) || 999"
|
||||
/>
|
||||
<d-text text="盒" className="fs-3 color9 m-l-16"></d-text>
|
||||
|
||||
<!-- 用法 -->
|
||||
<view class="form-item border-b">
|
||||
<view class="item-label">
|
||||
<d-text text="给药途径" className="fs-30 font-bold color-title"></d-text>
|
||||
</view>
|
||||
<view class="item-content">
|
||||
<picker
|
||||
mode="selector"
|
||||
:range="drugUseList.drug_use_type || []"
|
||||
range-key="name"
|
||||
:value="usageData.type_id && drugUseList.drug_use_type ? drugUseList.drug_use_type.findIndex(item => item.id === usageData.type_id) : 0"
|
||||
@change="handleChangeUsageType"
|
||||
>
|
||||
<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>
|
||||
|
||||
<!-- 用法 -->
|
||||
<view class="usage-item white b-r-8 p-32 m-t-2">
|
||||
<view class="item-label">
|
||||
<d-text text="用法" className="fs-3 main-c"></d-text>
|
||||
|
||||
<!-- 频次 -->
|
||||
<view class="form-item border-b">
|
||||
<view class="item-label">
|
||||
<d-text text="用药频次" className="fs-30 font-bold color-title"></d-text>
|
||||
</view>
|
||||
<view class="item-content">
|
||||
<picker
|
||||
mode="selector"
|
||||
:range="drugUseList.drug_use_frequency || []"
|
||||
range-key="name"
|
||||
:value="usageData.frequency_id && drugUseList.drug_use_frequency ? drugUseList.drug_use_frequency.findIndex(item => item.id === usageData.frequency_id) : 0"
|
||||
@change="handleChangeFrequency"
|
||||
>
|
||||
<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="item-content">
|
||||
<picker
|
||||
mode="selector"
|
||||
:range="drugUseList.drug_use_type || []"
|
||||
range-key="name"
|
||||
: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>
|
||||
</picker>
|
||||
|
||||
<!-- 时间 -->
|
||||
<view class="form-item border-b">
|
||||
<view class="item-label">
|
||||
<d-text text="用药时间" className="fs-30 font-bold color-title"></d-text>
|
||||
</view>
|
||||
<view class="item-content">
|
||||
<picker
|
||||
mode="selector"
|
||||
:range="drugUseList.drug_time || []"
|
||||
range-key="name"
|
||||
:value="usageData.time_id && drugUseList.drug_time ? drugUseList.drug_time.findIndex(item => item.id === usageData.time_id) : 0"
|
||||
@change="handleChangeTime"
|
||||
>
|
||||
<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>
|
||||
|
||||
<!-- 频次 -->
|
||||
<view class="usage-item white b-r-8 p-32 m-t-2">
|
||||
<view class="item-label">
|
||||
<d-text text="频次" className="fs-3 main-c"></d-text>
|
||||
</view>
|
||||
<view class="item-content">
|
||||
<picker
|
||||
mode="selector"
|
||||
:range="drugUseList.drug_use_frequency || []"
|
||||
range-key="name"
|
||||
: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>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 时间 -->
|
||||
<view class="usage-item white b-r-8 p-32 m-t-2">
|
||||
<view class="item-label">
|
||||
<d-text text="时间" className="fs-3 main-c"></d-text>
|
||||
</view>
|
||||
<view class="item-content">
|
||||
<picker
|
||||
mode="selector"
|
||||
:range="drugUseList.drug_time || []"
|
||||
range-key="name"
|
||||
: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>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 单位 -->
|
||||
<view class="usage-item white b-r-8 p-32 m-t-2">
|
||||
<view class="item-label">
|
||||
<d-text text="每次用量" className="fs-3 main-c"></d-text>
|
||||
</view>
|
||||
<view class="item-content">
|
||||
<u-number-box v-model="usageData.number" :min="1" />
|
||||
<picker
|
||||
mode="selector"
|
||||
:range="drugUseList.drug_unit || []"
|
||||
range-key="name"
|
||||
: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>
|
||||
</picker>
|
||||
|
||||
<!-- 单位与单次用量 -->
|
||||
<view class="form-item">
|
||||
<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 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 || []"
|
||||
range-key="name"
|
||||
:value="usageData.unit_id && drugUseList.drug_unit ? drugUseList.drug_unit.findIndex(item => item.id === usageData.unit_id) : 0"
|
||||
@change="handleChangeUnit"
|
||||
>
|
||||
<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">
|
||||
<u-button
|
||||
@click="handleClose"
|
||||
:custom-style="{ backgroundColor: '#f5f5f5', color: '#333' }"
|
||||
|
||||
<!-- 底部按钮:补充了 flex-row 以修复上下排列的问题 -->
|
||||
<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: '#F4F6F8',
|
||||
color: '#2A2E35',
|
||||
height: '88rpx',
|
||||
width: '320rpx',
|
||||
fontWeight: 'bold',
|
||||
fontSize: '30rpx',
|
||||
border: 'none'
|
||||
}"
|
||||
>取消</u-button>
|
||||
<u-button
|
||||
@click="handleConfirm"
|
||||
:custom-style="{ backgroundColor: '#6ACDBB', color: '#fff' }"
|
||||
<u-button
|
||||
:throttle-time="0"
|
||||
@click="handleConfirm"
|
||||
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 {
|
||||
@@ -217,7 +256,7 @@ export default {
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 加载药品使用方式列表
|
||||
* 职责:调用接口获取药品使用方式列表
|
||||
@@ -268,10 +307,10 @@ export default {
|
||||
}
|
||||
|
||||
const hasOptions =
|
||||
(lists.drug_use_type || []).length ||
|
||||
(lists.drug_use_frequency || []).length ||
|
||||
(lists.drug_time || []).length ||
|
||||
(lists.drug_unit || []).length;
|
||||
(lists.drug_use_type || []).length ||
|
||||
(lists.drug_use_frequency || []).length ||
|
||||
(lists.drug_time || []).length ||
|
||||
(lists.drug_unit || []).length;
|
||||
if (!hasOptions) {
|
||||
this.$toast('暂无用法用量配置,请联系管理员');
|
||||
}
|
||||
@@ -280,7 +319,7 @@ export default {
|
||||
this.$toast('获取用法用量失败');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 改变用法类型
|
||||
* @param {Object} e - 事件对象
|
||||
@@ -294,7 +333,7 @@ export default {
|
||||
this.usageData.use_type = item;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 改变频次
|
||||
* @param {Object} e - 事件对象
|
||||
@@ -308,7 +347,7 @@ export default {
|
||||
this.usageData.use_frequency = item;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 改变时间
|
||||
* @param {Object} e - 事件对象
|
||||
@@ -322,7 +361,7 @@ export default {
|
||||
this.usageData.use_num = item;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 改变单位
|
||||
* @param {Object} e - 事件对象
|
||||
@@ -336,7 +375,7 @@ export default {
|
||||
this.usageData.unit = item;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 确认
|
||||
* 职责:触发confirm事件,传递用法用量数据
|
||||
@@ -345,7 +384,7 @@ export default {
|
||||
this.$emit('confirm', { ...this.usageData });
|
||||
this.handleClose();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 关闭弹窗
|
||||
* 职责:关闭弹窗,触发input事件
|
||||
@@ -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;
|
||||
}
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 24rpx 32rpx calc(24rpx + env(safe-area-inset-bottom));
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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
@@ -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: []
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user