diff --git a/common/js/index.js b/common/js/index.js
index cf01543..6dfed37 100644
--- a/common/js/index.js
+++ b/common/js/index.js
@@ -41,8 +41,16 @@ const reqInterceptor = async (options) => {
...options.header
}
const isToken = (options.header || {}).isToken === false
- if (uni.getStorageSync('token') && !isToken) {
- options.header['authorization'] = `Bearer ${uni.getStorageSync('token')}`// 让每个请求携带自定义token 请根据实际情况自行修改
+ const isClinicAdminReq = (options.header || {})._clinicAdmin === '1'
+ || (options.url && String(options.url).indexOf('clinic-admin') !== -1)
+ const clinicToken = uni.getStorageSync('clinic_admin_token')
+ const doctorToken = uni.getStorageSync('token')
+ if (!isToken) {
+ if (isClinicAdminReq && clinicToken) {
+ options.header['authorization'] = `Bearer ${clinicToken}`
+ } else if (doctorToken) {
+ options.header['authorization'] = `Bearer ${doctorToken}`
+ }
}
return options;
}
@@ -86,14 +94,21 @@ const resInterceptor = (response, conf = {}) => {
} else if (statusCode === 401) {
uni.showToast({
icon: 'error',
- title: response['msg'] || errorCode[statusCode]
+ title: response['msg'] || response['message'] || errorCode[statusCode]
})
- uni.removeStorageSync()
- setTimeout(()=>{
- uni.navigateTo({
- url:'/pages/login/index'
- })
- },1000)
+ const isClinic = uni.getStorageSync('loginMode') === 'clinic_admin'
+ if (isClinic) {
+ uni.removeStorageSync('clinic_admin_token')
+ uni.removeStorageSync('clinic_admin_user')
+ uni.removeStorageSync('loginMode')
+ } else {
+ uni.removeStorageSync('token')
+ uni.removeStorageSync('loginInfo')
+ uni.removeStorageSync('identity')
+ }
+ setTimeout(() => {
+ uni.reLaunch({ url: '/pages/login/index' })
+ }, 1000)
_responseLog(response, conf, "response 401")
// 增加一个控制字段wakaryReqToReject 使 reject的内容更加可控
return {
diff --git a/components/d-upload/d-upload.vue b/components/d-upload/d-upload.vue
index a49269b..cd9a0d7 100644
--- a/components/d-upload/d-upload.vue
+++ b/components/d-upload/d-upload.vue
@@ -71,6 +71,8 @@
* @event {Function} on-choose-complete 每次选择图片后触发,只是让外部可以得知每次选择后,内部的文件列表
* @example
*/
+ import { prepareImagePath } from '@/common/js/image-compress.js';
+
export default {
name: 'd-upload',
props: {
@@ -296,52 +298,57 @@
const {
name = '', maxCount, multiple, maxSize, sizeType, lists, camera, compressed, maxDuration, sourceType
} = this;
- let chooseFile = null;
const newMaxCount = maxCount - lists.length;
- // 设置为只选择图片的时候使用 chooseImage 来实现
- chooseFile = new Promise((resolve, reject) => {
- uni.chooseImage({
- count: multiple ? (newMaxCount > 9 ? 9 : newMaxCount) : 1,
- sourceType: sourceType,
- sizeType,
- success: resolve,
- fail: reject
- });
- });
- chooseFile
- .then(res => {
- let file = null;
- let listOldLength = this.lists.length;
- res.tempFiles.map((val, index) => {
- // 检查文件后缀是否允许,如果不在this.limitType内,就会返回false
- if (!this.checkFileExt(val)) return;
-
- // 如果是非多选,index大于等于1或者超出最大限制数量时,不处理
- if (!multiple && index >= 1) return;
+ uni.chooseImage({
+ count: multiple ? (newMaxCount > 9 ? 9 : newMaxCount) : 1,
+ sourceType: sourceType,
+ sizeType,
+ success: async (res) => {
+ const listOldLength = this.lists.length;
+ for (let index = 0; index < res.tempFiles.length; index++) {
+ const val = res.tempFiles[index];
+ if (!this.checkFileExt(val)) continue;
+ if (!multiple && index >= 1) continue;
if (val.size > maxSize) {
this.$emit('on-oversize', val, this.lists, this.index);
this.showToast('超出允许的文件大小');
- } else {
- if (maxCount <= lists.length) {
- this.$emit('on-exceed', val, this.lists, this.index);
- this.showToast('超出最大允许的文件个数');
- return;
- }
+ continue;
+ }
+ if (maxCount <= lists.length) {
+ this.$emit('on-exceed', val, this.lists, this.index);
+ this.showToast('超出最大允许的文件个数');
+ break;
+ }
+
+ try {
+ const prepared = await prepareImagePath({
+ path: val.path,
+ size: val.size,
+ });
+ if (!prepared) continue;
+
lists.push({
- url: val.path,
+ url: prepared.path,
progress: 0,
error: false,
- file: val
+ file: {
+ ...val,
+ path: prepared.path,
+ size: prepared.size,
+ },
});
+ } catch (error) {
+ this.$emit('on-choose-fail', error);
+ this.showToast('图片处理失败');
}
- });
- // 每次图片选择完,抛出一个事件,并将当前内部选择的图片数组抛出去
+ }
this.$emit('on-choose-complete', this.lists, this.index);
if (this.autoUpload) this.uploadFile(listOldLength);
- })
- .catch(error => {
+ },
+ fail: (error) => {
this.$emit('on-choose-fail', error);
- });
+ }
+ });
},
// 提示用户消息
showToast(message, force = false) {
diff --git a/pages.json b/pages.json
index d39f755..2fadc11 100644
--- a/pages.json
+++ b/pages.json
@@ -391,6 +391,61 @@
}
]
+ }, {
+ "root": "subPackages/sub_clinic_admin",
+ "pages": [{
+ "path": "home/index",
+ "style": { "navigationBarTitleText": "工作台", "navigationStyle": "custom" }
+ },
+ {
+ "path": "my/index",
+ "style": { "navigationBarTitleText": "我的", "navigationStyle": "custom" }
+ },
+ {
+ "path": "withdrawal/index",
+ "style": { "navigationBarTitleText": "提现管理", "navigationStyle": "custom" }
+ },
+ {
+ "path": "withdrawal/settlement/index",
+ "style": { "navigationBarTitleText": "结算记录", "navigationStyle": "custom" }
+ },
+ {
+ "path": "withdrawal/settlement/detail",
+ "style": { "navigationBarTitleText": "结算明细", "navigationStyle": "custom" }
+ },
+ {
+ "path": "withdrawal/apply",
+ "style": { "navigationBarTitleText": "申请提现", "navigationStyle": "custom" }
+ },
+ {
+ "path": "withdrawal/card-edit",
+ "style": { "navigationBarTitleText": "编辑账户", "navigationStyle": "custom" }
+ },
+ {
+ "path": "withdrawal/record-detail",
+ "style": { "navigationBarTitleText": "提现详情", "navigationStyle": "custom" }
+ },
+ {
+ "path": "reconciliation/index",
+ "style": { "navigationBarTitleText": "对账单", "navigationStyle": "custom" }
+ },
+ {
+ "path": "order/index",
+ "style": { "navigationBarTitleText": "商品订单", "navigationStyle": "custom" }
+ },
+ {
+ "path": "order/detail",
+ "style": { "navigationBarTitleText": "订单详情", "navigationStyle": "custom" }
+ },
+ {
+ "path": "warehouse/index",
+ "style": { "navigationBarTitleText": "仓库管理", "navigationStyle": "custom" }
+ },
+ {
+ "path": "warehouse/detail",
+ "style": { "navigationBarTitleText": "药品详情", "navigationStyle": "custom" }
+ }
+ ]
}, {
"root": "subPackages/sub_agreement",
"pages": [{
@@ -423,10 +478,10 @@
}
],
"tabBar": {
- "color": "#fff",
- "selectedColor": "#fff",
- "backgroundColor": "#fff",
- "borderStyle": "white",
+ "color": "#666666",
+ "selectedColor": "#1575FC",
+ "backgroundColor": "#ffffff",
+ "borderStyle": "black",
"list": [{
"pagePath": "pages/workbench/index",
"text": "工作台"
diff --git a/pages/login/index.vue b/pages/login/index.vue
index ab75e3b..3d5c952 100644
--- a/pages/login/index.vue
+++ b/pages/login/index.vue
@@ -10,10 +10,16 @@
+
+
+
+
{{codeText}}
@@ -40,10 +46,13 @@
登录
-
-
-
+
+ {{ loginMode === 'clinic_admin' ? '返回医生/药师登录' : '我是诊所管理员' }}
+
+
+
+
@@ -60,9 +69,15 @@
getUserInfo,
loginOrRe
} from '../../api/all';
+ import {
+ sendClinicAdminCode,
+ clinicAdminLogin,
+ getClinicAdminMyInfo,
+ } from '../../api/clinicAdmin';
export default {
data() {
return {
+ loginMode: 'service_user',
loading: false,
form: {
check: false
@@ -74,6 +89,7 @@
mobile: '',
codeText: '',
smsCode: '',
+ clinicPassword: '',
code: ''
};
},
@@ -83,6 +99,13 @@
// console.log('appid', accountInfo.miniProgram.appId); // 小程序 appId
},
mounted() {
+ const clinicToken = uni.getStorageSync('clinic_admin_token')
+ if (clinicToken && uni.getStorageSync('loginMode') === 'clinic_admin') {
+ setTimeout(() => {
+ uni.reLaunch({ url: '/subPackages/sub_clinic_admin/home/index' })
+ }, 200)
+ return
+ }
const token = uni.getStorageSync('token')
const info = uni.getStorageSync('loginInfo')
if (token&&info) {
@@ -105,6 +128,11 @@
}
},
methods: {
+ switchClinicAdmin() {
+ this.loginMode = this.loginMode === 'clinic_admin' ? 'service_user' : 'clinic_admin'
+ this.clinicPassword = ''
+ this.smsCode = ''
+ },
toLogin() {
uni.login({
provider: 'weixin',
@@ -115,7 +143,6 @@
},
//登录或者注册接口
register() {
- //修改1
if (!uni.$u.test.mobile(this.form['mobile'])) {
this.$toast('请输入正确的手机号')
return
@@ -130,6 +157,15 @@
return
}
+ if (this.loginMode === 'clinic_admin') {
+ if (!this.clinicPassword) {
+ this.$toast('请输入后台登录密码')
+ return
+ }
+ this.clinicAdminLoginFlow()
+ return
+ }
+
const data = {
store_id: '11001',
mobile: this.form['mobile'],
@@ -257,16 +293,44 @@
codeChange(text) {
this.codeText = text;
},
+ clinicAdminLoginFlow() {
+ this.loading = true
+ clinicAdminLogin(this.form['mobile'], this.clinicPassword, this.smsCode).then(res => {
+ if (res.code !== 0 || !res.result || !res.result.token) {
+ this.$toast(res.message || res.msg || '登录失败')
+ return Promise.reject()
+ }
+ uni.setStorageSync('loginMode', 'clinic_admin')
+ uni.setStorageSync('clinic_admin_token', res.result.token)
+ return getClinicAdminMyInfo()
+ }).then((wrap) => {
+ if (!wrap || !wrap.ok) return
+ uni.setStorageSync('clinic_admin_user', wrap.data)
+ this.$toast('登录成功')
+ setTimeout(() => {
+ uni.reLaunch({ url: '/subPackages/sub_clinic_admin/home/index' })
+ }, 400)
+ }).catch(() => {}).finally(() => {
+ this.loading = false
+ })
+ },
getCode() {
if (this.$refs.uCode.canGetCode) {
- // 模拟向后端请求验证码
- uni.showLoading({
- title: '正在获取验证码'
- })
+ uni.showLoading({ title: '正在获取验证码' })
setTimeout(() => {
uni.hideLoading();
- // 通知验证码组件内部开始倒计时
- //发送验证码接口
+ if (this.loginMode === 'clinic_admin') {
+ if (!this.clinicPassword) {
+ this.$toast('请先输入后台登录密码')
+ return
+ }
+ sendClinicAdminCode(this.form['mobile']).then(res => {
+ if (res.code === 0 || res.errcode != -1) {
+ this.$refs.uCode.start();
+ }
+ })
+ return
+ }
const data = {
store_id: '11001',
mobile: this.form['mobile']
diff --git a/pages/my/prescriptionDetail.vue b/pages/my/prescriptionDetail.vue
index 89dcd80..5ecc1e4 100644
--- a/pages/my/prescriptionDetail.vue
+++ b/pages/my/prescriptionDetail.vue
@@ -135,13 +135,15 @@
-
-
+
+
- {{ it.content.drug_name}}
- {{ it.content.specification }}
+ {{ (it.content && it.content.drug_name) || '' }}
+ {{ it.content.specification }}
x{{ it.number}}
@@ -293,6 +295,25 @@
})
return num
},
+ normalizeRepice(list) {
+ return (list || []).map((it) => {
+ let content = it.content
+ if (typeof content === 'string') {
+ try {
+ content = JSON.parse(content || '{}')
+ } catch (e) {
+ content = {}
+ }
+ }
+ if (!content || typeof content !== 'object' || Array.isArray(content)) {
+ content = Array.isArray(content) ? content : {}
+ }
+ return {
+ ...it,
+ content,
+ }
+ })
+ },
getInfo() {
prescripDetail({
store_id: uni.getStorageSync('store_id') || '11001',
@@ -300,7 +321,9 @@
}).then((res) => {
// console.log(res, 'deta');
if (res.errcode == 0) {
- this.infoList = res.data.content
+ const content = res.data.content
+ content.repice = this.normalizeRepice(content.repice)
+ this.infoList = content
this.rpList = res.data.pharmacistInfo
this.lists = res.data
this.status = res.data.status
@@ -534,6 +557,12 @@
// justify-content: space-between;
flex-wrap: wrap;
+ .drug-spec {
+ font-size: 24rpx;
+ color: #999;
+ margin-left: 10rpx;
+ }
+
._name {
display: flex;
justify-content: space-between;
diff --git a/pages/workbench/prescriptionDetail.vue b/pages/workbench/prescriptionDetail.vue
index 3506a97..2e33290 100644
--- a/pages/workbench/prescriptionDetail.vue
+++ b/pages/workbench/prescriptionDetail.vue
@@ -132,13 +132,15 @@
-
-
+
+
- {{ it.content.drug_name}}
- {{ it.content.specification }}
+ {{ (it.content && it.content.drug_name) || '' }}
+ {{ it.content.specification }}
x{{ it.number}}
@@ -273,6 +275,25 @@
})
return num
},
+ normalizeRepice(list) {
+ return (list || []).map((it) => {
+ let content = it.content
+ if (typeof content === 'string') {
+ try {
+ content = JSON.parse(content || '{}')
+ } catch (e) {
+ content = {}
+ }
+ }
+ if (!content || typeof content !== 'object' || Array.isArray(content)) {
+ content = Array.isArray(content) ? content : {}
+ }
+ return {
+ ...it,
+ content,
+ }
+ })
+ },
getInfo() {
prescripDetail({
store_id: uni.getStorageSync('store_id') || '11001',
@@ -280,7 +301,9 @@
}).then((res) => {
// console.log(res, 'deta');
if (res.errcode == 0) {
- this.infoList = res.data.content
+ const content = res.data.content
+ content.repice = this.normalizeRepice(content.repice)
+ this.infoList = content
this.rpList = res.data.pharmacistInfo
this.lists = res.data
this.status = res.data.status
@@ -514,6 +537,12 @@
// justify-content: space-between;
flex-wrap: wrap;
+ .drug-spec {
+ font-size: 24rpx;
+ color: #999;
+ margin-left: 10rpx;
+ }
+
._name {
display: flex;
justify-content: space-between;
diff --git a/pages1.json b/pages1.json
index e44dc1a..133d360 100644
--- a/pages1.json
+++ b/pages1.json
@@ -101,10 +101,10 @@
}
],
"tabBar": {
- "color": "#fff",
- "selectedColor": "#fff",
- "backgroundColor": "#fff",
- "borderStyle": "white",
+ "color": "#666666",
+ "selectedColor": "#1575FC",
+ "backgroundColor": "#ffffff",
+ "borderStyle": "black",
"list": [{
"pagePath": "pages/workbench/index",
"text": "工作台"
diff --git a/subPackages/sub_my/my_setAct.vue b/subPackages/sub_my/my_setAct.vue
index da08191..18859d0 100644
--- a/subPackages/sub_my/my_setAct.vue
+++ b/subPackages/sub_my/my_setAct.vue
@@ -49,6 +49,7 @@
logout,
toUpload,
} from '@/api/all.js'
+ import { chooseAvatarImage } from '@/common/js/select-avatar-image.js';
export default {
data() {
return {
@@ -85,56 +86,24 @@
}
},
selectAct() {
- uni.chooseImage({
- count: 1, //默认9
- sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
- sourceType: ['album', 'camera'],
- success: (res) => {
- uni.showLoading({
- title: '请稍后...'
- })
- const tempFiles = res.tempFiles;
- let resSize = tempFiles[0].size;
- // 1M=1024KB=1048576B
- console.log(resSize)
- if (resSize > 1048576) {
- uni.showToast({
- title: "上传图片大小不能超过1MB",
- icon: 'error'
+ chooseAvatarImage({
+ formData: {
+ store_id: uni.getStorageSync('store_id') || '11001',
+ },
+ onSuccess: (res) => {
+ const req = this.$u.test.jsonString(res.data) ? JSON.parse(res.data) : res.data;
+ if (req.errcode == 0) {
+ toUpload({
+ store_id: uni.getStorageSync('store_id') || '11001',
+ avatar: req.data.url,
+ }).then(() => {
+ this.getDoctor();
+ this.$toast('编辑成功');
});
- return
+ } else {
+ this.$toast(res.msg);
}
- uni.uploadFile({
- url: 'https://api.xiaokang88.com/open-api/upload/old-admin-img',
- filePath: res.tempFiles[0]['path'],
- name: 'file',
- header: {
- authorization: `Bearer ${uni.getStorageSync('token')}`
- },
- formData: {
- store_id: uni.getStorageSync('store_id') || '11001'
- },
- success: res => {
- let req = this.$u.test.jsonString(res.data) ? JSON.parse(res
- .data) : res.data
- // console.log(req, 'req')
- if (req.errcode == 0) {
- toUpload({
- store_id: uni.getStorageSync('store_id') ||
- '11001',
- avatar: req.data.url
- }).then((res) => {
- this.getDoctor()
- this.$toast('编辑成功');
-
- })
- uni.hideLoading()
- } else {
- this.$toast(res.msg);
- }
- }
- });
- }
+ },
});
},
logout() {
diff --git a/subPackages/sub_online_reception/components/MessageBubble.vue b/subPackages/sub_online_reception/components/MessageBubble.vue
index b2fdf9b..36beee5 100644
--- a/subPackages/sub_online_reception/components/MessageBubble.vue
+++ b/subPackages/sub_online_reception/components/MessageBubble.vue
@@ -154,7 +154,7 @@
{{ parsedObj.question }}
-
+
{{ row.name || '药品' }}
×{{ row.quantity != null ? row.quantity : 1 }}
@@ -290,7 +290,7 @@
咨询问题
-
+
{{ qix + 1 }}. {{ qa.question }}
{{ qa.answer }}
@@ -318,6 +318,7 @@