diff --git a/api/all.js b/api/all.js
index 282bf42..543d50e 100644
--- a/api/all.js
+++ b/api/all.js
@@ -102,7 +102,7 @@ export function toUpload(data) {
})
}
-// 药师 编辑资料
+// 药师 编辑资料
export function toUploaded(data) {
return req.request({
url: 'pharmacist/edit-info',
@@ -150,7 +150,7 @@ export function doctorIncome(data) {
// 医生 挂号收益统计
/**
* @param {Object} data
- * 参数名称 必须 参数类型 说明
+ * 参数名称 必须 参数类型 说明
*/
export function doctorRegister(data) {
return req.request({
@@ -456,7 +456,7 @@ export function doctorTypeList(data) {
})
}
-// 中药西药
+// 中药西药
/**
* @param {Object} data
* 参数名称 必须 参数类型 说明
@@ -1120,7 +1120,7 @@ export function deleteCommon(data) {
})
}
-// 开处方-常用方详情(西药)
+// 开处方-常用方详情(西药)
/**
* @param {Object} data
* 参数名称 必须 参数类型 说明
@@ -1155,7 +1155,7 @@ export function addOneGranular(data) {
})
}
-// 添加颗粒药药方
+// 添加颗粒药药方
export function addGranularRecipe(data) {
return req.request({
url: 'prescription/add-granular-recipe',
@@ -1172,8 +1172,6 @@ export function addGranularPrescription(data) {
})
}
-
-
// 颗粒药常用方
export function saveGranularCommon(data) {
return req.request({
diff --git a/common/js/index.js b/common/js/index.js
index 429481c..fe99b4b 100644
--- a/common/js/index.js
+++ b/common/js/index.js
@@ -9,7 +9,7 @@ export const config = {
}
/**
* 请求拦截器
- * @param {*} options
+ * @param {*} options
*/
const reqInterceptor = async (options) => {
options.header = {
@@ -109,5 +109,5 @@ function _responseLog(res, conf = {}, describe = null) {
/**
* 请求方法封装
*/
-
+
export const req = new Request(config, reqInterceptor, resInterceptor)
diff --git a/pages.json b/pages.json
index 50eee87..7e45003 100644
--- a/pages.json
+++ b/pages.json
@@ -169,6 +169,12 @@
"navigationBarTitleText": "添加商品"
}
},
+ {
+ "path": "workbench_recipe/addProductServicePackage",
+ "style": {
+ "navigationBarTitleText": "添加产品服务包"
+ }
+ },
{
"path": "workbench_recipe/common",
"style": {
@@ -423,4 +429,4 @@
"navigationBarTextStyle": "black",
"backgroundColor": "#f7f8fa"
}
-}
\ No newline at end of file
+}
diff --git a/pages/login/index.vue b/pages/login/index.vue
index f2bebc1..8258978 100644
--- a/pages/login/index.vue
+++ b/pages/login/index.vue
@@ -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) {
@@ -167,13 +167,13 @@
})
return
}
-
+
}).catch(() => {
this.loading = false
this.$toast(res.msg)
})
-
+
// 药师
if (res.data.ServiceUser.role == 2 && res.data.ServiceUser.status ==2 ) {
@@ -191,7 +191,7 @@
return
}
-
+
// 医生未通过审核
if (res.data.ServiceUser.role == 1 && res.data.ServiceUser.status == 3) {
// this.$toast(res.data.ServiceUser.reason)
@@ -200,16 +200,16 @@
}, 2000)
return
}
-
+
// 医生审核中
if (res.data.ServiceUser.role == 1 && res.data.ServiceUser.status == 1) {
- this.$toast('您的账号还在审核中')
+ this.$toast('您的账号还在审核中')
setTimeout(() => {
this.$go('/pages/workbench/examine')
}, 2000)
return
}
-
+
// 药师未通过审核
if (res.data.ServiceUser.role == 2 && res.data.ServiceUser.status == 3) {
// this.$toast(res.data.ServiceUser.reason)
@@ -218,10 +218,10 @@
}, 2000)
return
}
-
+
// 药师审核中
if (res.data.ServiceUser.role == 2 && res.data.ServiceUser.status == 1) {
- this.$toast('您的账号还在审核中')
+ this.$toast('您的账号还在审核中')
setTimeout(() => {
this.$go('/pages/workbench/examine')
}, 2000)
@@ -396,4 +396,4 @@
word-spacing: 3px;
}
}
-
\ No newline at end of file
+
diff --git a/subPackages/sub_my/my_diagnose_common.vue b/subPackages/sub_my/my_diagnose_common.vue
index 1d19751..fb1a5ec 100644
--- a/subPackages/sub_my/my_diagnose_common.vue
+++ b/subPackages/sub_my/my_diagnose_common.vue
@@ -59,7 +59,7 @@
};
},
onShow() {
- // this.templateLists();
+ this.templateLists();
},
methods: {
handleSelect(id) {
diff --git a/subPackages/sub_workbench/workbench_recipe/common.vue b/subPackages/sub_workbench/workbench_recipe/common.vue
index e8ca129..5cdacff 100644
--- a/subPackages/sub_workbench/workbench_recipe/common.vue
+++ b/subPackages/sub_workbench/workbench_recipe/common.vue
@@ -16,7 +16,7 @@
西药(中成)
-
@@ -84,10 +84,10 @@
- 非药品
+ 保健食品
-
@@ -156,7 +156,7 @@
item: [],
obj: {}
}])
-
+
this.type = op['type'] || 0;
console.log(this.type,'type')
this.commonUse()
diff --git a/subPackages/sub_workbench/workbench_recipe/components/add-setUsage.vue b/subPackages/sub_workbench/workbench_recipe/components/add-setUsage.vue
index f1839f2..6f6fa1c 100644
--- a/subPackages/sub_workbench/workbench_recipe/components/add-setUsage.vue
+++ b/subPackages/sub_workbench/workbench_recipe/components/add-setUsage.vue
@@ -120,8 +120,74 @@
+ 服务包
+
+
+
+ 名称:
+ {{obj.drug_name}}
+
+
+
+
+
+ 规格:
+ {{obj.specification}}
+
+
+ 库存:
+ 剩余{{obj.stock}}件
+
+
+
+
+ 毛利率:
+ {{getRate()}}%
+
+
+
+
+ 厂家:
+ {{obj.source}}
+
+
+
+
+ 功能主治:
+ {{obj.function}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -185,7 +251,7 @@
-
+
@@ -207,8 +273,8 @@
- {{(type==2||type==3)&&!is_next?'下一步':'添加到处方'}}
+ @click="(type==2||type==4)&&!is_next?next():add()" :loading="loading">
+ {{(type==2||type==4)&&!is_next?'下一步':'添加到处方'}}
@@ -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']
@@ -569,7 +636,32 @@
pId: addRecipe.pId
}, obj) : this.addDrug(data, obj, this.idx)
break;
- case 3:
+ 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
@@ -709,4 +801,4 @@
transform: translateY(-50%);
}
}
-
\ No newline at end of file
+
diff --git a/subPackages/sub_workbench/workbench_recipe/index.vue b/subPackages/sub_workbench/workbench_recipe/index.vue
index 203ee49..512c591 100644
--- a/subPackages/sub_workbench/workbench_recipe/index.vue
+++ b/subPackages/sub_workbench/workbench_recipe/index.vue
@@ -8,11 +8,12 @@
处方详情
-->
-
+
{{item.name}}
@@ -37,7 +38,7 @@
-
+
@@ -77,17 +78,7 @@
调整用量
删除
-
-
@@ -147,11 +138,6 @@
-
-
@@ -160,9 +146,52 @@
-
-
-
+
+
+
+
+
+
+
+ 添加产品服务包
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -206,7 +235,7 @@
-
+
@@ -221,7 +250,7 @@
-
+
诊疗费:
@@ -240,7 +269,7 @@
请确认患者已在实体医院就诊,并有明确诊断
-
+
@@ -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: [{
@@ -428,8 +458,11 @@
{
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']);
@@ -1059,7 +1104,7 @@
this.isOther = false
return
}
- uni.$emit('prescription', res.data)
+ uni.$emit('prescription', res.data)
!this.is_common && uni.setStorageSync('prescription', res.data)
uni.removeStorageSync('add');
this.$go(1, 4)
@@ -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)
- // },
}
}
@@ -1789,4 +1648,4 @@
}
}
}
-
\ No newline at end of file
+
diff --git a/subPackages/sub_workbench/workbench_recipe/mixin/mixin.js b/subPackages/sub_workbench/workbench_recipe/mixin/mixin.js
index b7ff5c7..5542a03 100644
--- a/subPackages/sub_workbench/workbench_recipe/mixin/mixin.js
+++ b/subPackages/sub_workbench/workbench_recipe/mixin/mixin.js
@@ -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
@@ -72,7 +75,7 @@ module.exports = {
}
uni.setStorageSync('wests', arr)
} else {
-
+
for (var i = 0; i < list.length; i++) {
console.log(list[i], 'JSON.parse(list[i].content)')
const cmIds = this.type == 2 ? list[i].cm_id.split(',') : list[i].gm_id.split(',')
@@ -134,15 +137,18 @@ 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) {
this.getDrug();
@@ -165,21 +171,32 @@ 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({
title: '请稍后...'
})
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,
@@ -190,8 +207,8 @@ module.exports = {
count: item.count || 1,
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: {
@@ -236,7 +265,7 @@ module.exports = {
...data,
recipe_id: data['pId'],store_id: uni.getStorageSync('store_id') || 11001,
})
- }
+ }
if (type == 2) {
index = this.chineses.findIndex((item => item['obj']['pId'] == data['pId']))
res = await changeChinese({
@@ -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'
@@ -305,25 +335,34 @@ module.exports = {
if(type==2){
key=uni.getStorageSync('add') ?'addChineses' : 'chineses'
}
-
+
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')
}
}
},