产品服务包模块

This commit is contained in:
2024-12-21 17:10:32 +08:00
parent 343d52c7f0
commit 9c8135b093
9 changed files with 292 additions and 297 deletions

View File

@@ -1172,8 +1172,6 @@ export function addGranularPrescription(data) {
})
}
// 颗粒药常用方
export function saveGranularCommon(data) {
return req.request({

View File

@@ -169,6 +169,12 @@
"navigationBarTitleText": "添加商品"
}
},
{
"path": "workbench_recipe/addProductServicePackage",
"style": {
"navigationBarTitleText": "添加产品服务包"
}
},
{
"path": "workbench_recipe/common",
"style": {

View File

@@ -149,7 +149,7 @@
uni.setStorageSync('store_id', res.data['StoreDoctor']['store_id'])
const data = {
store_id: uni.getStorageSync('store_id') || '11001',
store_id: uni.getStorageSync('store_id') || res.data['StoreDoctor']['store_id'] || '11001',
}
getUserInfo(data).then(res => {
if (res.errcode != -1) {

View File

@@ -59,7 +59,7 @@
};
},
onShow() {
// this.templateLists();
this.templateLists();
},
methods: {
handleSelect(id) {

View File

@@ -84,7 +84,7 @@
<d-text :text="'名 称:'" className="fs-3 color9"></d-text>
<d-text :text="item.name" className="fs-3 main-c"></d-text>
</view>
<view class="tag tag3">非药</view>
<view class="tag tag3">保健食</view>
<!-- <u-icon name="arrow-right" color="#A7ABB0" size="32"></u-icon> -->
</view>
<!-- <view class="m-t08 flex-row flex-jus-sp flex-ali-center"

View File

@@ -120,8 +120,74 @@
</view>
</view>
</view>
服务包
<view class="flex-col m-t-32 p-32" v-if="type==3">
<view class="flexBox">
<view class="item">
<view class="label">名称</view>
<view class="val">{{obj.drug_name}}</view>
</view>
</view>
<view class="flexBox">
<view class="item">
<view class="label">规格</view>
<view class="val">{{obj.specification}}</view>
</view>
<view class="item">
<view class="label">库存</view>
<view class="val">剩余{{obj.stock}}</view>
</view>
</view>
<view class="flexBox" v-if="see_rate==1">
<view class="item">
<view class="label">毛利率</view>
<view class="val">{{getRate()}}%</view>
</view>
</view>
<view class="flexBox">
<view class="item">
<view class="label">厂家</view>
<view class="val">{{obj.source}}</view>
</view>
</view>
<view class="flexBox">
<view class="item">
<view class="label">功能主治</view>
<view class="val">{{obj.function}}</view>
</view>
</view>
<view class="m-t-24 flex-col bg p-col-08 iBox">
<d-text text="用法用量(说明书)" className="fs-24 content-c m-l-16"></d-text>
<d-text :text="obj.usage" className="fs-24 tips-c m-l-16"></d-text>
<image src="../../../../static/image/i4.png" class="icon" mode="scaleToFill"
@click="previewImage(obj.instruction)" />
</view>
<view class="flex-col flex-jus-sp m-t-32">
<d-text text="用法用量" className="fs-3 main-c"></d-text>
<d-text text="初始默认值为说明书用量,请根据患者实际情况调整剂量" className="fs-24 error-c m-t08"></d-text>
</view>
<view class="flex-row flex-jus-sp m-t-32">
<d-text text="药品数量" className="fs-3 main-c"></d-text>
<d-number-box v-model="obj.number" :min="1" :max="obj.stock">
<view slot="minus" class="minus flex-row flex-jus-center flex-ali-center"
:style="{backgroundColor:`rgba(249, 250, 251,${obj.number>1?1:0.6})`}">
<u-icon name="minus" size="22" :color="obj.number>1?'#000':'#A7ABB0'"></u-icon>
</view>
<view slot="plus" class="plus flex-row flex-jus-center flex-ali-center"
:style="{backgroundColor:`rgba(41,121,255,${obj.number>=obj.stock?0.6:1})`}">
<u-icon name="plus" size="22" color="#fff"></u-icon>
</view>
</d-number-box>
</view>
<view class="bottom-border"></view>
<view class="flex-col">
</view>
</view>
<!-- 中药 -->
<view class="box flex-col white p-32" v-if="(type==2||type==3)&&is_next">
<view class="box flex-col white p-32" v-if="(type==2)&&is_next">
<view class="grid-tem-col-2 rp bg p-16">
<template v-for="item in obj">
<view class="flex-row flex-jus-sp flex-ali-center" :key="item.id" v-if="item.checked">
@@ -185,7 +251,7 @@
<!-- 颗粒 -->
<view class="p-row-52 flex-col" v-if="(type==2||type==3)&&!is_next">
<view class="p-row-52 flex-col" v-if="(type==2||type==4)&&!is_next">
<view class="bottom-border p-col-32 flex-row flex-jus-sp flex-ali-center"
v-for="(item,index) in obj" :key="index">
<d-text :text="item.drug_name" className="fs-32 content-c"></d-text>
@@ -207,8 +273,8 @@
</scroll-view>
<view class="add">
<u-button :throttle-time="0" :custom-style="{ backgroundColor:'#6ACDBB',color:'#fff' }" shape="circle"
@click="(type==2||type==3)&&!is_next?next():add()" :loading="loading">
{{(type==2||type==3)&&!is_next?'下一步':'添加到处方'}}
@click="(type==2||type==4)&&!is_next?next():add()" :loading="loading">
{{(type==2||type==4)&&!is_next?'下一步':'添加到处方'}}
</u-button>
</view>
</u-popup>
@@ -488,6 +554,7 @@
let obj = this.obj;
let addRecipe = this.addRecipe;
let data = {}
let instruction = '';
switch (this.type) {
case 1:
if (!obj['usages'] || (obj['usages'] && !obj['usages'][0] || !obj['usages'][1])) {
@@ -502,7 +569,7 @@
this.$toast('请设置频率');
return
}
let instruction = obj.usages['0']['name'] + obj.usages['1']['name'] + '' + obj['frequency'][
instruction = obj.usages['0']['name'] + obj.usages['1']['name'] + '' + obj['frequency'][
'name'
] + ',每次' + (obj['count'] || 1)
instruction += obj['describe']['name']
@@ -570,6 +637,31 @@
}, obj) : this.addDrug(data, obj, this.idx)
break;
case 3:
// instruction = obj.usages['0']['name'] + obj.usages['1']['name'] + '' + obj['frequency'][
// 'name'
// ] + ',每次' + (obj['count'] || 1)
// instruction += obj['describe']['name']
data = {
store_id: uni.getStorageSync('store_id') || 11001,
content: obj['id'],
number: obj['number'] || 1,
usage: instruction,
instruction,
time_id: obj.usages === undefined? '' : obj.usages['0']['id'],
type_id: obj.usages === undefined? '' : obj.usages['1']['id'],
grain_number: obj['count'] || 1,
count: obj['count'] || 1,
available_days: 5,
f_id: obj['frequency'] !== undefined? obj['frequency']['id']: '',
wu_id: obj['describe'] !== undefined? obj['describe']['id']: ''
}
// TODO 这里写加入逻辑
this.is_set ? this.setDrug({
...data,
pId: obj.pId
}, obj) : this.addDrug(data, obj)
break;
case 4:
if (!addRecipe.dosage) {
this.$toast('请设置剂数');
return

View File

@@ -8,11 +8,12 @@
处方详情
</view>
</view> -->
<view class="tabs flex p-32 flex-ali-center flex-jus-sp">
<view class="tabs flex p-32 flex-ali-center flex-jus-sp" style="overflow-x: auto">
<u-button :throttle-time="0" :plain="true" :type="tabsActive==index?'success':'default'"
v-for="(item,index) in tabs" :key="item.name" :custom-style="tabsBtnStyle" @click="swt(index)"
:hairline="true" :hoverStayTime="0" :style="{
display:(index==0&&identity==2)||(identity==1)?'block':'none'
display:(index==0&&identity==2)||(identity==1)?'block':'none',
marginLeft: '10rpx',
}">
{{item.name}}
</u-button>
@@ -37,7 +38,7 @@
</view>
<!-- :style="[scrollStyle]"-->
<scroll-view scroll-y="true" :style="[scrollStyle]">
<view :style="[scrollStyle]">
<!-- 西药 -->
<view class="m-t-2 b-r-8 white p-32 flex-col" v-if="tabsActive==0">
<view class="flex-row flex-jus-sp flex-ali-center">
@@ -77,17 +78,7 @@
<view @click="changeInfo(item)" class="btn left">调整用量</view>
<view class="btn right" @click="removeDrug(index)">删除</view>
</view>
<!-- <view class="m-t-32 flex-row flex-jus-sa">
<u-icon name="info-circle" size="24" color="#31353D" label-size="24" label-color="#31353D"
label="调整用量" @click="show=true;info=item;is_set=true;"></u-icon>
<u-icon name="close-circle" size="24" color="#F44336" label-size="24" label-color="#F44336"
label="删除" @click="removeDrug(index)"></u-icon>
</view> -->
</view>
<!-- <view class="m-t-32 flex-col" v-if="wests.length>0">
<d-text text="医嘱" color="#6C7380"></d-text>
<u-input v-model="entrust" placeholder="请输入" :custom-style="entrustStyle" />
</view> -->
<view class="m-t-32 flex-col" v-if="wests.length>0">
<view class="flex-jus-sp flex-row flex-ali-center">
<d-text text="医嘱" color="#6C7380"></d-text>
@@ -147,11 +138,6 @@
<d-empty @click="$go(`addType2?type=2&index=${i}`)"></d-empty>
</view>
</view>
<!-- <view class="flex-col b-r-8 white p-32">
<d-text text="医嘱" color="#6C7380"></d-text>
<u-input v-model="entrust" placeholder="请输入" :custom-style="entrustStyle" />
</view> -->
<view class="flex-col b-r-8 white p-32">
<view class="flex-jus-sp flex-row flex-ali-center">
<d-text text="医嘱" color="#6C7380"></d-text>
@@ -160,9 +146,52 @@
<u-input v-model="entrust" placeholder="请输入" :custom-style="entrustStyle" />
</view>
</block>
<!-- 颗粒 -->
<block v-if="tabsActive==2">
<view class="white b-r-8 p-32 m-t-2" v-for="(item,i) in granular" :key="item.id">
<!-- 产品服务包 -->
<view class="m-t-2 b-r-8 white p-32 flex-col" v-if="tabsActive==2">
<view class="flex-row flex-jus-sp flex-ali-center">
<d-text text="R" className="main-c fs-4" :bold="true"></d-text>
<view class="flex-row m-l-163" style="height: 50rpx;">
<view class="m-l-16">
<u-button :throttle-time="0" :custom-style="{ backgroundColor:'#6ACDBB',color:'#fff' }"
shape="circle" size="mini"
@click="$go(`addProductServicePackage?type=${parseInt(tabsActive)+1}}`)">
添加产品服务包
</u-button>
</view>
</view>
</view>
<view class="bottom-border p-col-32" v-for="(item,index) in servicePackage" :key="item.id">
<view class="flex-row flex-jus-sp flex-ali-center">
<d-text :text="`${index+1}、${item.drug_name}`" className="fs-3 content-c"></d-text>
<d-text :text="`¥${parseFloat(item.price).toFixed(2)}`" className="error-c fs-3"></d-text>
</view>
<view class="flex-row flex-ali-center flex-jus-sp m-t-16">
<view class="flex-row flex-ali-center m-t-16">
<d-text text="规格:" color="#6C7380"></d-text>
<d-text :text="item.specification" color="#6C7380"></d-text>
</view>
<view class="flex-row flex-ali-center m-t-16">
<d-text :text="item.number+'周期'" color="#6C7380"></d-text>
</view>
</view>
<view class="m-t-24 flex-row flex-jus-sa btnBox">
<view class="btn right" @click="removeDrug(index)">删除</view>
</view>
</view>
<view class="m-t-32 flex-col" v-if="servicePackage.length>0">
<view class="flex-jus-sp flex-row flex-ali-center">
<d-text text="医嘱" color="#6C7380"></d-text>
<d-text @click="showComment = true; selectComment = []" text="常用医嘱" color="#6ACDBB"></d-text>
</view>
<u-input v-model="entrust" placeholder="请输入" :custom-style="entrustStyle" />
</view>
<view class="flex-row flex-jus-center" v-if="servicePackage.length==0">
<d-empty @click="$go('addProductServicePackage?type=${parseInt(tabsActive)+1}&index=${i}&recipe=${JSON.stringify(item.obj)}')"></d-empty>
</view>
</view>
<view v-if="tabsActive==3">
<view class="white b-r-8 p-32 m-t-2 m-l-163" v-for="(item,i) in granular" :key="item.id">
<view class="flex-row flex-jus-sp flex-ali-center">
<view class="flex-row flex-ali-end ">
<d-text text="R" className="main-c fs-4" :bold="true"></d-text>
@@ -206,7 +235,7 @@
</view>
</view>
<view class="flex-row flex-jus-center" v-else>
<d-empty @click="$go(`addType3?type=2&index=${i}`)"></d-empty>
<d-empty @click="$go(`addProductServicePackage?type=2&index=${i}`)"></d-empty>
</view>
</view>
@@ -221,7 +250,7 @@
</view>
<u-input v-model="entrust" placeholder="请输入" :custom-style="entrustStyle" />
</view>
</block>
</view>
<view class="flex-row p-2 flex-jus-end">
<view class="flex-row flex-ali-center" style="margin-right: 20rpx">
<text>诊疗费</text>
@@ -240,7 +269,7 @@
</view>
<view class="ac">请确认患者已在实体医院就诊并有明确诊断</view>
</scroll-view>
</view>
<!-- 按钮 -->
<view class="bottom flex-jus-sp flex-ali-center">
@@ -357,6 +386,7 @@
getUseWay,
getDiagnoseCommonList
} from '@/api/all.js'
import {addServicePackagePrescription} from "../../../api/servicePackage";
export default {
components: {
diagnose,
@@ -419,7 +449,7 @@
// name: '中药饮片'
// },
// {
// name: '非药品'
// name: '保健食品'
// },
// ],
tabs: [{
@@ -429,7 +459,10 @@
name: '中药饮片'
},
{
name: '非药品'
name: '产品服务包'
},
{
name: '保健食品'
},
],
tabsActive: 0,
@@ -446,6 +479,7 @@
mInfo: [], // 中药 药方商品
mParms: {}, // 中药 药方信息
mInfoG: [], // 颗粒药方商品
servicePackage: [], // 颗粒药方商品
mParmsG: {}, // 颗粒药方信息
cr_ids: '', // 中药 颗粒药方id
isOther: false,
@@ -461,13 +495,14 @@
let buy_price = 0;
let arr = [];
let buy_total = 0;
this.tabsActive == 0 && (arr = this.wests)
this.tabsActive == 1 && (arr = this.mInfo)
this.tabsActive == 2 && (arr = this.mInfoG)
this.tabsActive === 0 && (arr = this.wests)
this.tabsActive === 1 && (arr = this.mInfo)
this.tabsActive === 2 && (arr = this.servicePackage)
this.tabsActive === 3 && (arr = this.mInfoG)
console.log(this.mParms, this.tabsActive, '22')
if (this.tabsActive == 1 || this.tabsActive == 2) {
const dosage = this.tabsActive == 1 ? (this.mParms ? this.mParms.dosage || 0 : 0) : (this.mParmsG ?
if (this.tabsActive === 1 || this.tabsActive === 2) {
const dosage = this.tabsActive === 1 ? (this.mParms ? this.mParms.dosage || 0 : 0) : (this.mParmsG ?
this.mParmsG.dosage || 0 : 0)
buy_price = arr.reduce((total, item) => {
buy_total += Number(item.buy_price * dosage * item.number)
@@ -476,7 +511,7 @@
buy_price > 0 ? buy_price.toFixed(4) : buy_price
} else {
buy_price = arr.reduce((total, item) => {
if (this.tabsActive == 0 && item.buy_price) {
if (this.tabsActive === 0 && item.buy_price) {
buy_total += Number((item.buy_price || item.buy_price) * item.number)
} else {
@@ -504,10 +539,10 @@
let arr = [];
this.tabsActive == 0 && (arr = this.wests)
this.tabsActive == 1 && (arr = this.mInfo)
this.tabsActive == 2 && (arr = this.mInfoG)
console.log(this.mParms, this.tabsActive, '22')
this.tabsActive == 2 && (arr = this.servicePackage)
this.tabsActive == 3 && (arr = this.mInfoG)
if (this.tabsActive == 1 || this.tabsActive == 2) {
if (this.tabsActive == 1 || this.tabsActive == 3) {
const dosage = this.tabsActive == 1 ? (this.mParms ? this.mParms.dosage || 0 : 0) : (this.mParmsG ?
this.mParmsG.dosage || 0 : 0)
price = arr.reduce((total, item) => {
@@ -518,11 +553,11 @@
// price = price.toFixed(3)
} else {
price = arr.reduce((total, item) => {
if (this.tabsActive == 0 && item.price) {
if ((this.tabsActive == 0 || this.tabsActive == 2) && item.price) {
total += Number((item.price || item.price) * item.number)
} else {
if (item.item.length > 0) {
if (item.item?.length > 0) {
let sum = item.item.reduce((to, item) => {
to = to ? Number(this.accAdd(this.Mul(Number(item.price), item
.grammage),
@@ -543,7 +578,10 @@
},
scrollStyle() {
let style = {}
style.height = `calc(100vh - env(safe-area-inset-bottom) - 450rpx - ${this.height}px)`
// style.height = `calc(95vh - env(safe-area-inset-bottom) - 450rpx - ${this.height}rpx)`
style.height = `100%`
style.minHeight = `80vh`
style.marginBottom = `200rpx`
return style
},
// 常用诊断
@@ -741,10 +779,13 @@
obj: {}
}]
let servicePackage = uni.getStorageSync(uni.getStorageSync('add') ? 'addServicePackage' : 'servicePackage') || []
// console.log(chineses,'chineses')
this.$set(this, 'wests', JSON.parse(JSON.stringify(wests)))
this.$set(this, 'chineses', chineses)
this.$set(this, 'granular', granular)
this.$set(this, 'servicePackage', JSON.parse(JSON.stringify(servicePackage)))
},
Mul(arg1, arg2) {
@@ -762,22 +803,22 @@
// 发送处方
async add(type) {
let that = this;
if (this.buttonLodging == true) {
if (this.buttonLodging === true) {
this.$toast('正在处理中,请勿重复提交');
return;
}
this.buttonLodging = true;
let res = {}
let list = this.tabsActive == 0 ? this.wests : this.tabsActive == 1 ? this.chineses : this.granular
let list = this.tabsActive == 0 ? this.wests : this.tabsActive == 1 ? this.chineses: this.tabsActive == 2? this.servicePackage : this.granular
let ids = list.reduce((total, item) => {
if (this.tabsActive == 0) {
if (this.tabsActive == 0 || this.tabsActive == 2) {
total.push(item['pId']);
} else {
item['obj'] && item['obj']['pId'] && total.push(item['obj']['pId']);
}
return total
}, []).join()
if (this.tabsActive != 0) {
if (this.tabsActive != 0 && this.tabsActive != 2) {
ids = this.cr_ids
}
const clinical_diagnose = this.diagnoses.reduce((total, item) => {
@@ -815,17 +856,17 @@
try {
let res = {}
let list = this.tabsActive == 0 ? this.wests : this.tabsActive == 1 ? this.chineses : this
let list = this.tabsActive == 0 ? this.wests : this.tabsActive == 1 ? this.chineses : this.tabsActive == 2? this.servicePackage : this
.granular
let ids = list.reduce((total, item) => {
if (this.tabsActive == 0) {
if (this.tabsActive == 0 || this.tabsActive === 2) {
total.push(item['pId']);
} else {
item['obj'] && item['obj']['pId'] && total.push(item['obj']['pId']);
}
return total
}, []).join()
if (this.tabsActive != 0) {
if (this.tabsActive != 0 && this.tabsActive != 2) {
ids = this.cr_ids
}
let checkRes = {
@@ -908,12 +949,13 @@
register_id: this.register_id,
treatement_price: this.treatement_price || 0
}
if (this.tabsActive == 2 || this.tabsActive == 3) {
if (this.tabsActive == 1 || this.tabsActive == 3) {
data['gr_ids'] = ids
} else {
data[`${this.tabsActive==0?'wr_ids':'cr_ids'}`] = ids
data[`${(this.tabsActive==0 || this.tabsActive==2)?'wr_ids':'cr_ids'}`] = ids
}
this.loading = true
// 西药添加
this.tabsActive == 0 && (res = await addPrescriptionWest(data))
// 中药添加
@@ -921,15 +963,18 @@
...data,
cr_ids: this.cr_ids
}))
// 服务包添加
this.tabsActive == 2 && (res = await addServicePackagePrescription({
...data,
cr_ids: this.cr_ids
}))
// 颗粒添加
this.tabsActive == 2 && (res = await addGranularPrescription({
this.tabsActive == 3 && (res = await addGranularPrescription({
...data,
cr_ids: this.cr_ids
}))
// this.loading = false
if (res.errcode == 0) {
uni.showToast({
title: '发送成功',
@@ -987,7 +1032,7 @@
// 保存常用方
async confirm() {
let res = {}
let list = this.tabsActive == 0 ? this.wests : this.tabsActive == 1 ? this.chineses : this.granular
let list = this.tabsActive == 0 ? this.wests : this.tabsActive == 1 ? this.chineses : this.tabsActive == 2? this.servicePackage : this.granular
let ids = list.reduce((total, item) => {
if (this.tabsActive == 0) {
total.push(item['pId']);
@@ -1242,192 +1287,6 @@
break;
}
},
// 修改
// async confirm() {
// this.isModal = true
// let res = {}
// let list = this.tabsActive == 0 ? this.wests : this.tabsActive == 1 ? this.chineses : this.granular
// const ids = list.reduce((total, item) => {
// if (this.tabsActive == 0) {
// total.push(item['pId']);
// } else {
// item['obj'] && item['obj']['pId'] && total.push(item['obj']['pId']);
// }
// return total
// }, []).join()
// const clinical_diagnose = this.diagnoses.reduce((total, item) => {
// total.push(item['name']);
// return total
// }, []).join()
// if (!clinical_diagnose) {
// this.$toast('请添加临床诊断')
// return
// }
// if (!ids) {
// this.$toast('请添加商品')
// return
// }
// if (!this.entrust) {
// this.$toast('请输入医嘱')
// return
// }
// if (!this.prescriptionName) {
// this.$toast('请输入处方名称')
// return
// }
// const data = {
// store_id: uni.getStorageSync('store_id') || 11001,
// name: this.prescriptionName,
// clinical_diagnose,
// up_id: this.upId,
// doctor_order: this.entrust,
// category: 1,
// }
// if (this.tabsActive == 2) {
// data['gr_ids'] = ids
// } else {
// data[`${this.tabsActive==0?'wr_ids':'cr_ids'}`] = ids
// }
// if (this.loading) {
// return
// }
// this.loading = true
// // 西药添加
// this.tabsActive == 0 && (res = await saveWestCommon(data))
// // 中药添加
// this.tabsActive == 1 && (res = await saveChinCommon(data))
// // 颗粒添加
// this.tabsActive == 2 && (res = await saveGranularCommon(data))
// this.loading = false
// if (res.errcode == 0) {
// uni.$emit('prescription', res.data)
// !this.is_common && uni.setStorageSync('prescription', res.data)
// uni.removeStorageSync('add');
// this.$toast('保存成功')
// setTimeout(() => {
// uni.switchTab({
// url: '/pages/workbench/index'
// })
// }, 2000)
// uni.hideLoading()
// } else {
// this.$toast(res.msg)
// }
// },
// async add() {
// let res = {}
// let list = this.tabsActive == 0 ? this.wests : this.tabsActive == 1 ? this.chineses : this.granular
// const ids = list.reduce((total, item) => {
// if (this.tabsActive == 0) {
// total.push(item['pId']);
// } else {
// item['obj'] && item['obj']['pId'] && total.push(item['obj']['pId']);
// }
// return total
// }, []).join()
// const clinical_diagnose = this.diagnoses.reduce((total, item) => {
// total.push(item['name']);
// return total
// }, []).join()
// if (!clinical_diagnose) {
// this.$toast('请添加临床诊断')
// return
// }
// if (!ids) {
// this.$toast('请添加商品')
// return
// }
// if (!this.entrust) {
// this.$toast('请输入医嘱')
// return
// }
// const data = {
// store_id: uni.getStorageSync('store_id') || 11001,
// name: this.prescriptionName,
// clinical_diagnose,
// up_id: this.upId,
// doctor_order: this.entrust,
// category: 1,
// }
// if (this.tabsActive == 2) {
// data['gr_ids'] = ids
// } else {
// data[`${this.tabsActive==0?'wr_ids':'cr_ids'}`] = ids
// }
// if (this.loading) {
// return
// }
// this.loading = true
// // 西药添加
// this.tabsActive == 0 && (res = await addPrescriptionWest(data))
// // 中药添加
// this.tabsActive == 1 && (res = await addPrescription(data))
// // 颗粒添加
// this.tabsActive == 2 && (res = await addGranularPrescription(data))
// this.loading = false
// if (res.errcode == 0) {
// uni.$emit('prescription', res.data)
// !this.is_common && uni.setStorageSync('prescription', res.data)
// uni.removeStorageSync('add');
// this.$toast('发送成功')
// setTimeout(() => {
// uni.switchTab({
// url: '/pages/workbench/index'
// })
// }, 2000)
// uni.hideLoading()
// } else {
// this.$toast(res.msg)
// }
// },
// async successed(e) {
// try {
// if (e.detail.status == 0) {
// this.loading = true
// const res = await prescriptionSend({
// prescription_id: this.prescription_id,
// store_id: uni.getStorageSync('store_id') || 11001,
// })
// if (res.errcode == 0) {
// uni.$emit('prescription', res.data)
// !this.is_common && uni.setStorageSync('prescription',
// res.data)
// uni.removeStorageSync('add');
// this.$toast('保存成功')
// setTimeout(() => {
// uni.switchTab({
// url: '/pages/workbench/index'
// })
// }, 2000)
// this.is_common = false
// uni.hideLoading()
// } else {
// this.$toast(res.msg)
// }
// } else {
// this.$toast(e.detail.message)
// }
// } finally {
// this.loading = false
// }
// },
// fail(e) {
// this.uniqueIdList = []
// this.$toast(e.detail.message)
// },
}
}
</script>

View File

@@ -6,12 +6,14 @@ import {
addGranularRecipe,
changeGranular
} from '@/api/all.js'
import {addServicePackageRecipe} from "../../../../api/servicePackage";
module.exports = {
data() {
return {
wests: [],
chineses: [],
granular:[]
granular:[],
servicePackage:[],
}
},
methods: {
@@ -33,6 +35,7 @@ module.exports = {
uni.removeStorageSync('addWests');
uni.removeStorageSync('addChineses');
uni.removeStorageSync('addGranular');
uni.removeStorageSync('addServicePackage');
let arr = []
let list = this.info || data
let it = this.item || item
@@ -134,14 +137,17 @@ module.exports = {
item: [],
obj: {}
}]
let servicePackage = uni.getStorageSync(uni.getStorageSync('add') ? 'addServicePackage' : 'servicePackage') || []
this.$set(this, 'wests', wests)
this.$set(this, 'chineses', chineses)
this.$set(this, 'granular', granular)
this.$set(this, 'servicePackage', servicePackage)
uni.setStorageSync(uni.getStorageSync('add') ? 'addWests' : 'wests', wests)
uni.setStorageSync(uni.getStorageSync('add') ? 'addChineses' : 'chineses', chineses)
uni.setStorageSync(uni.getStorageSync('add') ? 'addGranular' : 'granular', granular)
uni.setStorageSync(uni.getStorageSync('add') ? 'addServicePackage' : 'servicePackage', servicePackage)
},
async addDrug(data = {}, item = {}, idx = 0) {
@@ -165,6 +171,16 @@ module.exports = {
return
}
if (this.tabsActive === 3) {
this.servicePackage.push({
item: [],
obj: {}
})
uni.setStorageSync(uni.getStorageSync('add') ? 'addServicePackage' : 'servicePackage', this.servicePackage);
this.getDrug();
return
}
let type = this.tabsActive >= 0 ? this.tabsActive + 1 : this.type;
uni.showLoading({
@@ -172,14 +188,15 @@ module.exports = {
})
this.getDrug();
let res = {}
type == 1 && (res = await addWest(data))
type == 2 && (res = await addRecipe(data))
type == 3 && (res = await addGranularRecipe(data))
if (res.errcode == 0) {
type === 1 && (res = await addWest(data))
type === 2 && (res = await addRecipe(data))
type === 3 && (res = await addServicePackageRecipe(data))
type === 4 && (res = await addGranularRecipe(data))
if (res.errcode === 0) {
this.$toast('添加成功')
this.$nextTick(() => {
this.$toast('添加成功')
if (type == 1) {
if (type === 1) {
this.wests.push({
...item,
...data,
@@ -191,7 +208,7 @@ module.exports = {
nub: item.nub || 1
})
}
if(type==2) {
if(type===2) {
const obj = {
item,
obj: {
@@ -204,7 +221,19 @@ module.exports = {
.chineses)
this.$emit('add')
}
if(type==3) {
if(type===3) {
this.servicePackage.push({
...item,
...data,
pId: res.data[0]
})
uni.setStorageSync(uni.getStorageSync('add') ? 'addServicePackage' : 'servicePackage', this.servicePackage)
this.$emit('add', {
count: item.count || 1,
nub: item.nub || 1
})
}
if(type===4) {
const obj = {
item,
obj: {
@@ -297,7 +326,8 @@ module.exports = {
if (index >= 0) {
type == 1 && this.wests.splice(index, 1);
type == 2 && this.chineses.splice(index, 1);
type == 3 && this.granular.splice(index, 1);
type == 3 && this.servicePackage.splice(index, 1);
type == 4 && this.granular.splice(index, 1);
let key=null
if(type==1){
key=uni.getStorageSync('add') ? 'addWests' : 'wests'
@@ -307,23 +337,32 @@ module.exports = {
}
if(type==3){
key=uni.getStorageSync('add') ?'addServicePackage' : 'servicePackage'
}
if(type==4){
key=uni.getStorageSync('add') ?'addGranular' : 'granular'
}
uni.setStorageSync(key, type == 1 ? this.wests :type==2? this.chineses.length == 0 ? [{
item: [],
obj: {}
}] : this.chineses:this.granular.length == 0 ? [{
item: [],
obj: {}
}] : this.granular)
let data;
if (type === 1) {
data = this.wests;
} else if (type === 2) {
data = this.chineses && this.chineses.length > 0 ? this.chineses : [{ item: [], obj: {} }];
} else if (type === 3) {
data = this.servicePackage && this.servicePackage.length > 0 ? this.servicePackage : [];
} else {
data = this.granular && this.granular.length > 0 ? this.granular : [{ item: [], obj: {} }];
}
uni.setStorageSync(key, data);
this.getDrug()
} else {
this.wests = []
this.chineses = []
this.granular = []
this.servicePackage = []
uni.removeStorageSync(uni.getStorageSync('add') ? 'addWests' : 'wests')
console.log(1);
uni.setStorageSync(uni.getStorageSync('add') ? 'addChineses' : 'chineses', [{
item: [],
obj: {}
@@ -332,6 +371,7 @@ module.exports = {
item: [],
obj: {}
}])
uni.setStorageSync(uni.getStorageSync('add') ? 'addServicePackage' : 'servicePackage')
}
}
},